diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 7c70660442452..b4bd74e278434 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -33,7 +33,7 @@ jobs: fi - uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '9.0.x' dotnet-quality: 'preview' - uses: actions/setup-node@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a6c6f805f1fd..2e4dfbbd74438 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: sudo mkdir -p /usr/share/dotnet - uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '9.0.x' dotnet-quality: 'preview' run: | sudo mkdir -p /usr/share/dotnet diff --git a/README.md b/README.md index 066078b8d88f2..fe928975f4c46 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CCXT – CryptoCurrency eXchange Trading Library -[![NPM Downloads](https://img.shields.io/npm/dy/ccxt.svg)](https://www.npmjs.com/package/ccxt) [![npm](https://img.shields.io/npm/v/ccxt.svg)](https://npmjs.com/package/ccxt) [![PyPI](https://img.shields.io/pypi/v/ccxt.svg)](https://pypi.python.org/pypi/ccxt) [![NuGet version](https://img.shields.io/nuget/v/ccxt)](https://www.nuget.org/packages/ccxt) [![GoDoc](https://pkg.go.dev/badge/github.com/ccxt/ccxt/go/v4?utm_source=godoc)](https://godoc.org/github.com/ccxt/ccxt/go/v4) [![Discord](https://img.shields.io/discord/690203284119617602?logo=discord&logoColor=white)](https://discord.gg/ccxt) [![Supported Exchanges](https://img.shields.io/badge/exchanges-106-blue.svg)](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [![Follow CCXT at x.com](https://img.shields.io/twitter/follow/ccxt_official.svg?style=social&label=CCXT)](https://x.com/ccxt_official) +[![NPM Downloads](https://img.shields.io/npm/dy/ccxt.svg)](https://www.npmjs.com/package/ccxt) [![npm](https://img.shields.io/npm/v/ccxt.svg)](https://npmjs.com/package/ccxt) [![PyPI](https://img.shields.io/pypi/v/ccxt.svg)](https://pypi.python.org/pypi/ccxt) [![NuGet version](https://img.shields.io/nuget/v/ccxt)](https://www.nuget.org/packages/ccxt) [![GoDoc](https://pkg.go.dev/badge/github.com/ccxt/ccxt/go/v4?utm_source=godoc)](https://godoc.org/github.com/ccxt/ccxt/go/v4) [![Discord](https://img.shields.io/discord/690203284119617602?logo=discord&logoColor=white)](https://discord.gg/ccxt) [![Supported Exchanges](https://img.shields.io/badge/exchanges-105-blue.svg)](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [![Follow CCXT at x.com](https://img.shields.io/twitter/follow/ccxt_official.svg?style=social&label=CCXT)](https://x.com/ccxt_official) A `JavaScript` / `Python` / `PHP` / `C#` / `Go` library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs. @@ -53,7 +53,7 @@ Current feature list: | [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOOFI PRO using CCXT's referral link for a 5% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d5%25&color=orange)](https://dex.woo.org/en/trade?ref=CCXT) | ## Supported Cryptocurrency Exchanges -The CCXT library currently supports the following 103 cryptocurrency exchange markets and trading APIs: +The CCXT library currently supports the following 102 cryptocurrency exchange markets and trading APIs: |logo |id |name |ver |type |certified |pro | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|----------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------| @@ -97,7 +97,6 @@ Current feature list: | [![coincatch](https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3)](https://partner.coincatch.cc/bg/92hy70391729607848548) | coincatch | [CoinCatch](https://partner.coincatch.cc/bg/92hy70391729607848548) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coincatch.github.io/github.io/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | | [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.coinex.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | -| [![coinlist](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg)](https://coinlist.co) | coinlist | [Coinlist](https://coinlist.co) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://trade-docs.coinlist.co) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | | [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | | [![coinmetro](https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539)](https://go.coinmetro.com/?ref=crypto24) | coinmetro | [Coinmetro](https://go.coinmetro.com/?ref=crypto24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://documenter.getpostman.com/view/3653795/SVfWN6KS) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | | [![coinone](https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg)](https://coinone.co.kr) | coinone | [CoinOne](https://coinone.co.kr) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.coinone.co.kr) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | @@ -221,13 +220,13 @@ console.log(version, Object.keys(exchanges)); All-in-one browser bundle (dependencies included), served from a CDN of your choice: -* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.89/dist/ccxt.browser.min.js -* unpkg: https://unpkg.com/ccxt@4.4.89/dist/ccxt.browser.min.js +* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.92/dist/ccxt.browser.min.js +* unpkg: https://unpkg.com/ccxt@4.4.92/dist/ccxt.browser.min.js CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers. ```HTML - + ``` Creates a global `ccxt` object: diff --git a/build/export-exchanges.js b/build/export-exchanges.js index 47ccf597ab0a8..b32228e4015f4 100644 --- a/build/export-exchanges.js +++ b/build/export-exchanges.js @@ -21,6 +21,8 @@ ansi.nice const unlimitedLog = log.unlimited; +let isPartiaBuild = false; + const capitalize = (s) => { return s.length ? (s.charAt (0).toUpperCase () + s.slice (1)) : s; }; @@ -44,12 +46,20 @@ function logExportExchanges (filename, regex, replacement) { function getIncludedExchangeIds (pathToDirectory) { + if (process.argv.length > 2) { + // allow a specific exchange to be specified via command line + isPartiaBuild = true; + return process.argv.slice (2); + } + const includedIds = fs.readFileSync ('exchanges.cfg') .toString () // Buffer → String .split ('\n') // String → Array .map (line => line.split ('#')[0].trim ()) // trim comments .filter (exchange => exchange); // filter empty lines + isPartiaBuild = includedIds.length > 0; + const isIncluded = (id) => ((includedIds.length === 0) || includedIds.includes (id)) const ids = fs.readdirSync (pathToDirectory) .filter (file => file.match (/[a-zA-Z0-9_-]+.ts$/)) @@ -709,6 +719,11 @@ async function exportEverything () { // strategically placed exactly here (we can require it AFTER the export) const exchanges = await createExchanges (ids) + if (isPartiaBuild) { + log.bright.cyan ('Using a partial build'.yellow, 'building only', ids) + return + } + const wikiPath = 'wiki' , gitWikiPath = 'build/ccxt.wiki' diff --git a/build/goTranspiler.ts b/build/goTranspiler.ts index 8e2a7dfb8769f..2e55c16b6eb3a 100644 --- a/build/goTranspiler.ts +++ b/build/goTranspiler.ts @@ -137,9 +137,11 @@ const VIRTUAL_BASE_METHODS: any = { "parsePosition": false, "parseTicker": false, "parseTrade": false, + "parseGreeks": false, "parseTransaction": false, "parseTransfer": false, "parseWithdrawal": false, + "parseLeverage": false, "parseWithdrawalStatus": false, "safeMarket": false, // try to remove custom implementations "market": false, @@ -212,7 +214,7 @@ class NewTranspiler { // c# custom method - customCSharpPropAssignment(node: any, identation: any) { + customgoPropAssignment(node: any, identation: any) { const stringValue = node.getFullText().trim(); if (Object.keys(errors).includes(stringValue)) { return `typeof(${stringValue})`; @@ -349,7 +351,7 @@ class NewTranspiler { if (!exchangeMethods) { exchangeMethods = {} } - // const transformedComment = this.transformTSCommentIntoCSharp(methodName, description, sees,params, returnType, returnDescription); + // const transformedComment = this.transformTSCommentIntogo(methodName, description, sees,params, returnType, returnDescription); exchangeMethods[methodName] = comment; goComments[exchangeName] = exchangeMethods return comment; @@ -382,7 +384,7 @@ class NewTranspiler { return values; } - getCsharpImports(file: any, ws = false) { + getgoImports(file: any, ws = false) { const namespace = ws ? 'namespace ccxt.pro;' : 'namespace ccxt;'; const values = [ // "using ccxt;", @@ -442,7 +444,7 @@ class NewTranspiler { return isPromise ? `<- chan ${type}` : type; } - const csharpReplacements: dict = { + const goReplacements: dict = { 'OrderType': 'string', 'OrderSide': 'string', // tmp } @@ -486,8 +488,8 @@ class NewTranspiler { if (wrappedType === 'Strings') { return addTaskIfNeeded('[]string') } - if (csharpReplacements[wrappedType] !== undefined) { - return addTaskIfNeeded(csharpReplacements[wrappedType]); + if (goReplacements[wrappedType] !== undefined) { + return addTaskIfNeeded(goReplacements[wrappedType]); } if (wrappedType.startsWith('Dictionary<')) { @@ -830,7 +832,7 @@ class NewTranspiler { } createExchangesWrappers(): string[] { - // in csharp classes should be Capitalized, so I'm creating a wrapper class for each exchange + // in go classes should be Capitalized, so I'm creating a wrapper class for each exchange const res: string[] = ['// class wrappers']; exchangeIds.forEach((exchange: string) => { const capitalizedExchange = exchange.charAt(0).toUpperCase() + exchange.slice(1); @@ -992,7 +994,7 @@ ${constStatements.join('\n')} return `<-this.DerivedExchange.${capitalizedMethod}(${p2})`; }); // create wrappers with specific types - // this.createCSharpWrappers('Exchange', GLOBAL_WRAPPER_FILE, baseFile.methodsTypes) + // this.creategoWrappers('Exchange', GLOBAL_WRAPPER_FILE, baseFile.methodsTypes) // custom transformations needed for go @@ -1076,7 +1078,7 @@ ${caseStatements.join('\n')} } - getCsharpExamplesWarning() { + getgoExamplesWarning() { return [ '', ' // !!Warning!! This example was automatically transpiled', @@ -1103,10 +1105,10 @@ ${caseStatements.join('\n')} if (tsContent.indexOf (transpileFlagPhrase) > -1) { const fileName = filenameWithExtenstion.replace ('.ts', '') log.magenta ('[C#] Transpiling example from', (tsFile as any).yellow) - const csharp = this.transpiler.transpileCSharp(tsContent); + const go = this.transpiler.transpileGo(tsContent); const transpiledFixed = this.regexAll( - csharp.content, + go.content, [ [/object exchange/, 'Exchange exchange'], [/async public Task example/gm, 'async public Task ' + this.camelize(fileName)], @@ -1119,7 +1121,7 @@ ${caseStatements.join('\n')} 'using ccxt;', 'using ccxt.pro;', 'namespace examples;', - // this.getCsharpExamplesWarning(), + // this.getgoExamplesWarning(), 'partial class Examples', '{', transpiledFixed, @@ -1139,26 +1141,26 @@ ${caseStatements.join('\n')} inputExchanges = exchanges.ws; } // @ts-expect-error - const options = { csharpFolder: EXCHANGES_WS_FOLDER, exchanges:inputExchanges } - // const options = { csharpFolder: EXCHANGES_WS_FOLDER, exchanges:['bitget'] } + const options = { goFolder: EXCHANGES_WS_FOLDER, exchanges:inputExchanges } + // const options = { goFolder: EXCHANGES_WS_FOLDER, exchanges:['bitget'] } await this.transpileDerivedExchangeFiles (tsFolder, options, '.ts', force, !!(inputExchanges), true ) } async transpileEverything (force = false, child = false, baseOnly = false, examplesOnly = false) { const exchanges = process.argv.slice (2).filter (x => !x.startsWith ('--')) - , csharpFolder = EXCHANGES_FOLDER + , goFolder = EXCHANGES_FOLDER , tsFolder = './ts/src/' , exchangeBase = './ts/src/base/Exchange.ts' if (!child) { - createFolderRecursively (csharpFolder) + createFolderRecursively (goFolder) } const transpilingSingleExchange = (exchanges.length === 1); // when transpiling single exchange, we can skip some steps because this is only used for testing/debugging if (transpilingSingleExchange) { force = true; // when transpiling single exchange, we always force } - const options = { csharpFolder, exchanges } + const options = { goFolder, exchanges } if (!baseOnly && !examplesOnly) { await this.transpileDerivedExchangeFiles (tsFolder, options, '.ts', force, !!(child || exchanges.length)) @@ -1277,7 +1279,7 @@ ${caseStatements.join('\n')} // const transpiled = transpiledFiles[i]; // const exchangeName = exchanges[i].replace('.ts',''); // const path = EXCHANGE_WS_WRAPPER_FOLDER + exchangeName + '.go'; - // this.createCSharpWrappers(exchangeName, path, transpiled.methodsTypes, true) + // this.creategoWrappers(exchangeName, path, transpiled.methodsTypes, true) } } exchanges.map ((file: string, idx: number) => this.transpileDerivedExchangeFile (jsFolder, file, options, transpiledFiles[idx], force, ws)) @@ -1328,7 +1330,7 @@ ${caseStatements.join('\n')} if (ws) { // const wsRegexes = this.getWsRegexes(); // content = this.regexAll (content, wsRegexes); - // content = this.replaceImportedRestClasses (content, csharpVersion.imports); + // content = this.replaceImportedRestClasses (content, goVersion.imports); // const classNameRegex = /public\spartial\sclass\s(\w+)\s:\s(\w+)/gm; // const classNameExec = classNameRegex.exec(content); // const className = classNameExec ? classNameExec[1] : ''; @@ -1374,35 +1376,35 @@ func (this *${className}) Init(userConfig map[string]interface{}) { return content; } - transpileDerivedExchangeFile (tsFolder: string, filename: string, options: any, csharpResult: any, force = false, ws = false) { + transpileDerivedExchangeFile (tsFolder: string, filename: string, options: any, goResult: any, force = false, ws = false) { const tsPath = tsFolder + filename - const { csharpFolder } = options + const { goFolder } = options const extensionlessName = filename.replace ('.ts', '') const goFilename = filename.replace ('.ts', '.go') const tsMtime = fs.statSync (tsPath).mtime.getTime () - const csharp = this.createGoExchange (extensionlessName, csharpResult, ws) + const go = this.createGoExchange (extensionlessName, goResult, ws) - if (csharpFolder) { - overwriteFileAndFolder (csharpFolder + goFilename, csharp) - // fs.utimesSync (csharpFolder + csharpFilename, new Date (), new Date (tsMtime)) + if (goFolder) { + overwriteFileAndFolder (goFolder + goFilename, go) + // fs.utimesSync (goFolder + goFilename, new Date (), new Date (tsMtime)) } } // --------------------------------------------------------------------------------------------- - transpileWsOrderbookTestsToCSharp (outDir: string) { + transpileWsOrderbookTestsToGo (outDir: string) { const jsFile = './ts/src/pro/test/base/test.OrderBook.ts'; - const csharpFile = `${outDir}/Orderbook.go`; + const goFile = `${outDir}/Orderbook.go`; log.magenta ('Transpiling from', (jsFile as any).yellow) - const csharp = this.transpiler.transpileCSharpByPath(jsFile); - let content = csharp.content; + const go = this.transpiler.transpileGoByPath(jsFile); + let content = go.content; const splitParts = content.split('// --------------------------------------------------------------------------------------------------------------------'); splitParts.shift(); content = splitParts.join('\n// --------------------------------------------------------------------------------------------------------------------\n'); @@ -1428,21 +1430,21 @@ func (this *${className}) Init(userConfig map[string]interface{}) { '}', ].join('\n') - log.magenta ('→', (csharpFile as any).yellow) + log.magenta ('→', (goFile as any).yellow) - overwriteFileAndFolder (csharpFile, file); + overwriteFileAndFolder (goFile, file); } // --------------------------------------------------------------------------------------------- - transpileWsCacheTestsToCSharp (outDir: string) { + transpileWsCacheTestsToGo (outDir: string) { const jsFile = './ts/src/pro/test/base/test.Cache.ts'; - const csharpFile = `${outDir}/Cache.go`; + const goFile = `${outDir}/Cache.go`; log.magenta ('Transpiling from', (jsFile as any).yellow) - const csharp = this.transpiler.transpileCSharpByPath(jsFile); - let content = csharp.content; + const go = this.transpiler.transpileGoByPath(jsFile); + let content = go.content; const splitParts = content.split('// ----------------------------------------------------------------------------'); splitParts.shift(); content = splitParts.join('\n// ----------------------------------------------------------------------------\n'); @@ -1468,9 +1470,9 @@ func (this *${className}) Init(userConfig map[string]interface{}) { '}', ].join('\n') - log.magenta ('→', (csharpFile as any).yellow) + log.magenta ('→', (goFile as any).yellow) - overwriteFileAndFolder (csharpFile, file); + overwriteFileAndFolder (goFile, file); } // --------------------------------------------------------------------------------------------- @@ -1482,8 +1484,8 @@ func (this *${className}) Init(userConfig map[string]interface{}) { log.magenta ('[go] Transpiling from', (jsFile as any).yellow) - const csharp = this.transpiler.transpileGoByPath(jsFile); - let content = csharp.content; + const go = this.transpiler.transpileGoByPath(jsFile); + let content = go.content; content = this.regexAll (content, [ [/new ccxt.Exchange.+\n.+\n.+/gm, 'ccxt.Exchange{}' ], [ /func Equals\(.+\n.*\n.*\n.*}/gm, '' ], // remove equals @@ -1504,8 +1506,8 @@ func (this *${className}) Init(userConfig map[string]interface{}) { } transpileExchangeTest(name: string, path: string): [string, string] { - const csharp = this.transpiler.transpileCSharpByPath(path); - let content = csharp.content; + const go = this.transpiler.transpileGoByPath(path); + let content = go.content; const parsedName = name.replace('.ts', ''); const parsedParts = parsedName.split('.'); @@ -1535,7 +1537,7 @@ func (this *${className}) Init(userConfig map[string]interface{}) { return [finalName, file]; } - async transpileExchangeTestsToCsharp() { + async transpileExchangeTestsToGo() { const inputDir = './ts/src/test/exchange/'; // @ts-expect-error const outDir = GENERATED_TESTS_FOLDER; @@ -1556,8 +1558,8 @@ func (this *${className}) Init(userConfig map[string]interface{}) { const outDir = BASE_TESTS_FOLDER; this.transpileBaseTests(outDir); this.transpileCryptoTestsToGo(outDir); - // this.transpileWsCacheTestsToCSharp(outDir); - // this.transpileWsOrderbookTestsToCSharp(outDir); + // this.transpileWsCacheTestsToGo(outDir); + // this.transpileWsOrderbookTestsToGo(outDir); } transpileBaseTests (outDir: string) { @@ -1700,7 +1702,7 @@ func (this *${className}) Init(userConfig map[string]interface{}) { // const baseFolders = { // ts: './ts/src/pro/test/Exchange/', - // csharp: EXCHANGE_GENERATED_FOLDER + 'Ws/', + // go: EXCHANGE_GENERATED_FOLDER + 'Ws/', // }; // const wsTests = fs.readdirSync (baseFolders.ts).filter(filename => filename.endsWith('.ts')).map(filename => filename.replace('.ts', '')); @@ -1711,7 +1713,7 @@ func (this *${className}) Init(userConfig map[string]interface{}) { // tests.push({ // name: test, // tsFile: baseFolders.ts + test + '.ts', - // csharpFile: baseFolders.goharp + test + '.go', + // goFile: baseFolders.goharp + test + '.go', // }); // }); diff --git a/build/single-js-build.sh b/build/single-js-build.sh new file mode 100755 index 0000000000000..c27009e8c7c05 --- /dev/null +++ b/build/single-js-build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Error: Missing required argument." + echo "Usage: $0 ExchangeName" + exit 1 +fi + +# export only the required exchange +npm run export-exchanges "$1" + +# build ts to js +npm run tsBuild + + +MATCH="$1" + +for DIR in js/src js/src/pro; do + find "$DIR" -maxdepth 1 -type f ! -name "*$MATCH*" -exec rm -v {} \; +done \ No newline at end of file diff --git a/cli/ts/cli.ts b/cli/ts/cli.ts index 735c5abb5fb1c..d24e2cb9caebc 100644 --- a/cli/ts/cli.ts +++ b/cli/ts/cli.ts @@ -69,7 +69,6 @@ interface CLIOptions { raw?: boolean; noKeys?: boolean; i?: boolean; - history?: boolean; name?: string; param?: any; config?: any; @@ -119,7 +118,6 @@ program .option ('--clipboard', 'Copies the result to clipboard automatically.') .option ('--signIn', 'calls the signIn() method if available') .option ('--cache-markets', 'forces markets caching') - .option ('--history', 'prints the history of executed commands') .option ('--no-load-markets', 'skips markets loading') .option ('--no-table', 'does not prettify the results') .option ('--spot', 'sets defaultType as spot') diff --git a/cs/ccxt/api/coinlist.cs b/cs/ccxt/api/coinlist.cs deleted file mode 100644 index ab3a888ffabe4..0000000000000 --- a/cs/ccxt/api/coinlist.cs +++ /dev/null @@ -1,279 +0,0 @@ -// ------------------------------------------------------------------------------- - -// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: -// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code - -// ------------------------------------------------------------------------------- - -namespace ccxt; - -public partial class coinlist : Exchange -{ - public coinlist (object args = null): base(args) {} - - public async Task publicGetV1Symbols (object parameters = null) - { - return await this.callAsync ("publicGetV1Symbols",parameters); - } - - public async Task publicGetV1SymbolsSummary (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSummary",parameters); - } - - public async Task publicGetV1SymbolsSymbol (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbol",parameters); - } - - public async Task publicGetV1SymbolsSymbolSummary (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolSummary",parameters); - } - - public async Task publicGetV1SymbolsSymbolBook (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolBook",parameters); - } - - public async Task publicGetV1SymbolsSymbolQuote (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolQuote",parameters); - } - - public async Task publicGetV1SymbolsSymbolCandles (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolCandles",parameters); - } - - public async Task publicGetV1SymbolsSymbolAuctions (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolAuctions",parameters); - } - - public async Task publicGetV1SymbolsSymbolAuctionsAuctionCode (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolAuctionsAuctionCode",parameters); - } - - public async Task publicGetV1Time (object parameters = null) - { - return await this.callAsync ("publicGetV1Time",parameters); - } - - public async Task publicGetV1Assets (object parameters = null) - { - return await this.callAsync ("publicGetV1Assets",parameters); - } - - public async Task publicGetV1Leaderboard (object parameters = null) - { - return await this.callAsync ("publicGetV1Leaderboard",parameters); - } - - public async Task publicGetV1AffiliateCompetitionCode (object parameters = null) - { - return await this.callAsync ("publicGetV1AffiliateCompetitionCode",parameters); - } - - public async Task publicGetV1CompetitionCompetitionId (object parameters = null) - { - return await this.callAsync ("publicGetV1CompetitionCompetitionId",parameters); - } - - public async Task publicGetV1SymbolsSymbolFunding (object parameters = null) - { - return await this.callAsync ("publicGetV1SymbolsSymbolFunding",parameters); - } - - public async Task privateGetV1Fees (object parameters = null) - { - return await this.callAsync ("privateGetV1Fees",parameters); - } - - public async Task privateGetV1Accounts (object parameters = null) - { - return await this.callAsync ("privateGetV1Accounts",parameters); - } - - public async Task privateGetV1AccountsTraderId (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderId",parameters); - } - - public async Task privateGetV1AccountsTraderIdAlias (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdAlias",parameters); - } - - public async Task privateGetV1AccountsTraderIdLedger (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdLedger",parameters); - } - - public async Task privateGetV1AccountsTraderIdWallets (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdWallets",parameters); - } - - public async Task privateGetV1AccountsTraderIdWalletLedger (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdWalletLedger",parameters); - } - - public async Task privateGetV1AccountsTraderIdLedgerSummary (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdLedgerSummary",parameters); - } - - public async Task privateGetV1Keys (object parameters = null) - { - return await this.callAsync ("privateGetV1Keys",parameters); - } - - public async Task privateGetV1Fills (object parameters = null) - { - return await this.callAsync ("privateGetV1Fills",parameters); - } - - public async Task privateGetV1Orders (object parameters = null) - { - return await this.callAsync ("privateGetV1Orders",parameters); - } - - public async Task privateGetV1OrdersOrderId (object parameters = null) - { - return await this.callAsync ("privateGetV1OrdersOrderId",parameters); - } - - public async Task privateGetV1Reports (object parameters = null) - { - return await this.callAsync ("privateGetV1Reports",parameters); - } - - public async Task privateGetV1Balances (object parameters = null) - { - return await this.callAsync ("privateGetV1Balances",parameters); - } - - public async Task privateGetV1Transfers (object parameters = null) - { - return await this.callAsync ("privateGetV1Transfers",parameters); - } - - public async Task privateGetV1User (object parameters = null) - { - return await this.callAsync ("privateGetV1User",parameters); - } - - public async Task privateGetV1Credits (object parameters = null) - { - return await this.callAsync ("privateGetV1Credits",parameters); - } - - public async Task privateGetV1Positions (object parameters = null) - { - return await this.callAsync ("privateGetV1Positions",parameters); - } - - public async Task privateGetV1AccountsTraderIdCompetitions (object parameters = null) - { - return await this.callAsync ("privateGetV1AccountsTraderIdCompetitions",parameters); - } - - public async Task privateGetV1ClosedPositions (object parameters = null) - { - return await this.callAsync ("privateGetV1ClosedPositions",parameters); - } - - public async Task privatePostV1Keys (object parameters = null) - { - return await this.callAsync ("privatePostV1Keys",parameters); - } - - public async Task privatePostV1Orders (object parameters = null) - { - return await this.callAsync ("privatePostV1Orders",parameters); - } - - public async Task privatePostV1OrdersCancelAllAfter (object parameters = null) - { - return await this.callAsync ("privatePostV1OrdersCancelAllAfter",parameters); - } - - public async Task privatePostV1Reports (object parameters = null) - { - return await this.callAsync ("privatePostV1Reports",parameters); - } - - public async Task privatePostV1TransfersToWallet (object parameters = null) - { - return await this.callAsync ("privatePostV1TransfersToWallet",parameters); - } - - public async Task privatePostV1TransfersFromWallet (object parameters = null) - { - return await this.callAsync ("privatePostV1TransfersFromWallet",parameters); - } - - public async Task privatePostV1TransfersInternalTransfer (object parameters = null) - { - return await this.callAsync ("privatePostV1TransfersInternalTransfer",parameters); - } - - public async Task privatePostV1TransfersWithdrawalRequest (object parameters = null) - { - return await this.callAsync ("privatePostV1TransfersWithdrawalRequest",parameters); - } - - public async Task privatePostV1OrdersBulk (object parameters = null) - { - return await this.callAsync ("privatePostV1OrdersBulk",parameters); - } - - public async Task privatePostV1AccountsTraderIdCompetitions (object parameters = null) - { - return await this.callAsync ("privatePostV1AccountsTraderIdCompetitions",parameters); - } - - public async Task privatePostV1AccountsTraderIdCreateCompetition (object parameters = null) - { - return await this.callAsync ("privatePostV1AccountsTraderIdCreateCompetition",parameters); - } - - public async Task privatePatchV1OrdersOrderId (object parameters = null) - { - return await this.callAsync ("privatePatchV1OrdersOrderId",parameters); - } - - public async Task privatePatchV1OrdersBulk (object parameters = null) - { - return await this.callAsync ("privatePatchV1OrdersBulk",parameters); - } - - public async Task privatePutV1AccountsTraderIdAlias (object parameters = null) - { - return await this.callAsync ("privatePutV1AccountsTraderIdAlias",parameters); - } - - public async Task privateDeleteV1KeysKey (object parameters = null) - { - return await this.callAsync ("privateDeleteV1KeysKey",parameters); - } - - public async Task privateDeleteV1Orders (object parameters = null) - { - return await this.callAsync ("privateDeleteV1Orders",parameters); - } - - public async Task privateDeleteV1OrdersOrderId (object parameters = null) - { - return await this.callAsync ("privateDeleteV1OrdersOrderId",parameters); - } - - public async Task privateDeleteV1OrdersBulk (object parameters = null) - { - return await this.callAsync ("privateDeleteV1OrdersBulk",parameters); - } - -} \ No newline at end of file diff --git a/cs/ccxt/api/lbank.cs b/cs/ccxt/api/lbank.cs index e81fbe3247000..e33ee1293b51f 100644 --- a/cs/ccxt/api/lbank.cs +++ b/cs/ccxt/api/lbank.cs @@ -26,6 +26,11 @@ public async Task spotPublicGetUsdToCny (object parameters = null) return await this.callAsync ("spotPublicGetUsdToCny",parameters); } + public async Task spotPublicGetAssetConfigs (object parameters = null) + { + return await this.callAsync ("spotPublicGetAssetConfigs",parameters); + } + public async Task spotPublicGetWithdrawConfigs (object parameters = null) { return await this.callAsync ("spotPublicGetWithdrawConfigs",parameters); diff --git a/cs/ccxt/base/Exchange.BaseMethods.cs b/cs/ccxt/base/Exchange.BaseMethods.cs index 20318258fef5d..cdec5bd8aacbf 100644 --- a/cs/ccxt/base/Exchange.BaseMethods.cs +++ b/cs/ccxt/base/Exchange.BaseMethods.cs @@ -926,6 +926,12 @@ public async virtual Task watchTrades(object symbol, object since = null throw new NotSupported ((string)add(this.id, " watchTrades() is not supported yet")) ; } + public async virtual Task unWatchOrders(object symbol = null, object parameters = null) + { + parameters ??= new Dictionary(); + throw new NotSupported ((string)add(this.id, " unWatchOrders() is not supported yet")) ; + } + public async virtual Task unWatchTrades(object symbol, object parameters = null) { parameters ??= new Dictionary(); @@ -1909,7 +1915,7 @@ public virtual object setMarkets(object markets, object currencies = null) } ((IList)values).Add(market); } - this.markets = ((object)this.indexBy(values, "symbol")); + this.markets = this.mapToSafeMap(((object)this.indexBy(values, "symbol"))); object marketsSortedBySymbol = this.keysort(this.markets); object marketsSortedById = this.keysort(this.markets_by_id); this.symbols = new List(((IDictionary)marketsSortedBySymbol).Keys); @@ -1917,7 +1923,7 @@ public virtual object setMarkets(object markets, object currencies = null) if (isTrue(!isEqual(currencies, null))) { // currencies is always undefined when called in constructor but not when called from loadMarkets - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); } else { object baseCurrencies = new List() {}; @@ -1950,8 +1956,8 @@ public virtual object setMarkets(object markets, object currencies = null) } baseCurrencies = this.sortBy(baseCurrencies, "code", false, ""); quoteCurrencies = this.sortBy(quoteCurrencies, "code", false, ""); - this.baseCurrencies = this.indexBy(baseCurrencies, "code"); - this.quoteCurrencies = this.indexBy(quoteCurrencies, "code"); + this.baseCurrencies = this.mapToSafeMap(this.indexBy(baseCurrencies, "code")); + this.quoteCurrencies = this.mapToSafeMap(this.indexBy(quoteCurrencies, "code")); object allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies); object groupedCurrencies = this.groupBy(allCurrencies, "code"); object codes = new List(((IDictionary)groupedCurrencies).Keys); @@ -1975,7 +1981,7 @@ public virtual object setMarkets(object markets, object currencies = null) ((IList)resultingCurrencies).Add(highestPrecisionCurrency); } object sortedCurrencies = this.sortBy(resultingCurrencies, "code"); - this.currencies = this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, "code")); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, "code"))); } this.currencies_by_id = this.indexBySafe(this.currencies, "id"); object currenciesSortedByCode = this.keysort(this.currencies); @@ -3396,7 +3402,7 @@ public virtual object parseOHLCVs(object ohlcvs, object market = null, object ti public virtual object parseLeverageTiers(object response, object symbols = null, object marketIdKey = null) { - // marketIdKey should only be undefined when response is a dictionary + // marketIdKey should only be undefined when response is a dictionary. symbols = this.marketSymbols(symbols); object tiers = new Dictionary() {}; object symbolsLength = 0; @@ -5387,6 +5393,12 @@ public async virtual Task fetchGreeks(object symbol, object parameters = throw new NotSupported ((string)add(this.id, " fetchGreeks() is not supported yet")) ; } + public async virtual Task fetchAllGreeks(object symbols = null, object parameters = null) + { + parameters ??= new Dictionary(); + throw new NotSupported ((string)add(this.id, " fetchAllGreeks() is not supported yet")) ; + } + public async virtual Task fetchOptionChain(object code, object parameters = null) { parameters ??= new Dictionary(); @@ -7365,6 +7377,37 @@ public virtual object parseGreeks(object greeks, object market = null) throw new NotSupported ((string)add(this.id, " parseGreeks () is not supported yet")) ; } + public virtual object parseAllGreeks(object greeks, object symbols = null, object parameters = null) + { + // + // the value of greeks is either a dict or a list + // + parameters ??= new Dictionary(); + object results = new List() {}; + if (isTrue(((greeks is IList) || (greeks.GetType().IsGenericType && greeks.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>)))))) + { + for (object i = 0; isLessThan(i, getArrayLength(greeks)); postFixIncrement(ref i)) + { + object parsedTicker = this.parseGreeks(getValue(greeks, i)); + object greek = this.extend(parsedTicker, parameters); + ((IList)results).Add(greek); + } + } else + { + object marketIds = new List(((IDictionary)greeks).Keys); + for (object i = 0; isLessThan(i, getArrayLength(marketIds)); postFixIncrement(ref i)) + { + object marketId = getValue(marketIds, i); + object market = this.safeMarket(marketId); + object parsed = this.parseGreeks(getValue(greeks, marketId), market); + object greek = this.extend(parsed, parameters); + ((IList)results).Add(greek); + } + } + symbols = this.marketSymbols(symbols); + return this.filterByArray(results, "symbol", symbols); + } + public virtual object parseOption(object chain, object currency = null, object market = null) { throw new NotSupported ((string)add(this.id, " parseOption () is not supported yet")) ; @@ -7540,7 +7583,7 @@ public virtual object convertExpireDateToMarketIdDate(object date) public virtual object convertMarketIdExpireDate(object date) { - // parse 03JAN24 to 240103 + // parse 03JAN24 to 240103. object monthMappping = new Dictionary() { { "JAN", "01" }, { "FEB", "02" }, @@ -7630,20 +7673,45 @@ public async virtual Task fetchTransfers(object code = null, object sinc throw new NotSupported ((string)add(this.id, " fetchTransfers () is not supported yet")) ; } - public virtual void cleanUnsubscription(WebSocketClient client, object subHash, object unsubHash) + public virtual void cleanUnsubscription(WebSocketClient client, object subHash, object unsubHash, object subHashIsPrefix = null) { + subHashIsPrefix ??= false; if (isTrue(inOp(client.subscriptions, unsubHash))) { ((IDictionary)client.subscriptions).Remove((string)unsubHash); } - if (isTrue(inOp(client.subscriptions, subHash))) + if (!isTrue(subHashIsPrefix)) { - ((IDictionary)client.subscriptions).Remove((string)subHash); - } - if (isTrue(inOp(client.futures, subHash))) + if (isTrue(inOp(client.subscriptions, subHash))) + { + ((IDictionary)client.subscriptions).Remove((string)subHash); + } + if (isTrue(inOp(client.futures, subHash))) + { + var error = new UnsubscribeError(add(add(this.id, " "), subHash)); + client.reject(error, subHash); + } + } else { - var error = new UnsubscribeError(add(add(this.id, " "), subHash)); - client.reject(error, subHash); + object clientSubscriptions = new List(((IDictionary)client.subscriptions).Keys); + for (object i = 0; isLessThan(i, getArrayLength(clientSubscriptions)); postFixIncrement(ref i)) + { + object sub = getValue(clientSubscriptions, i); + if (isTrue(((string)sub).StartsWith(((string)subHash)))) + { + ((IDictionary)client.subscriptions).Remove((string)sub); + } + } + object clientFutures = new List(((IDictionary)client.futures).Keys); + for (object i = 0; isLessThan(i, getArrayLength(clientFutures)); postFixIncrement(ref i)) + { + object future = getValue(clientFutures, i); + if (isTrue(((string)future).StartsWith(((string)subHash)))) + { + var error = new UnsubscribeError(add(add(this.id, " "), future)); + client.reject(error, future); + } + } } // client.resolve(true, unsubHash); } @@ -7661,7 +7729,7 @@ public virtual void cleanCache(object subscription) object symbolAndTimeFrame = getValue(symbolsAndTimeFrames, i); object symbol = this.safeString(symbolAndTimeFrame, 0); object timeframe = this.safeString(symbolAndTimeFrame, 1); - if (isTrue(inOp(this.ohlcvs, symbol))) + if (isTrue(isTrue((!isEqual(this.ohlcvs, null))) && isTrue((inOp(this.ohlcvs, symbol))))) { if (isTrue(inOp(getValue(this.ohlcvs, symbol), timeframe))) { @@ -7696,31 +7764,13 @@ public virtual void cleanCache(object subscription) } } else { - if (isTrue(isEqual(topic, "myTrades"))) + if (isTrue(isTrue(isEqual(topic, "myTrades")) && isTrue((!isEqual(this.myTrades, null))))) { - // don't reset this.myTrades directly here - // because in c# we need to use a different object (thread-safe dict) - object keys = new List(((IDictionary)this.myTrades).Keys); - for (object i = 0; isLessThan(i, getArrayLength(keys)); postFixIncrement(ref i)) - { - object key = getValue(keys, i); - if (isTrue(inOp(this.myTrades, key))) - { - ((IDictionary)this.myTrades).Remove((string)key); - } - } - } else if (isTrue(isEqual(topic, "orders"))) + this.myTrades = null; + } else if (isTrue(isTrue(isEqual(topic, "orders")) && isTrue((!isEqual(this.orders, null))))) { - object orderSymbols = new List(((IDictionary)this.orders).Keys); - for (object i = 0; isLessThan(i, getArrayLength(orderSymbols)); postFixIncrement(ref i)) - { - object orderSymbol = getValue(orderSymbols, i); - if (isTrue(inOp(this.orders, orderSymbol))) - { - ((IDictionary)this.orders).Remove((string)orderSymbol); - } - } - } else if (isTrue(isEqual(topic, "ticker"))) + this.orders = null; + } else if (isTrue(isTrue(isEqual(topic, "ticker")) && isTrue((!isEqual(this.tickers, null))))) { object tickerSymbols = new List(((IDictionary)this.tickers).Keys); for (object i = 0; isLessThan(i, getArrayLength(tickerSymbols)); postFixIncrement(ref i)) diff --git a/cs/ccxt/base/Exchange.MetaData.cs b/cs/ccxt/base/Exchange.MetaData.cs index aaf41a6bcba12..e3316349c5f64 100644 --- a/cs/ccxt/base/Exchange.MetaData.cs +++ b/cs/ccxt/base/Exchange.MetaData.cs @@ -3,7 +3,7 @@ namespace ccxt; // file updated automatically by vss and export-exchanges public partial class Exchange { - public static string ccxtVersion = "4.4.89"; + public static string ccxtVersion = "4.4.92"; - public static List exchanges = new List { "alpaca", "apex", "ascendex", "bequant", "bigone", "binance", "binancecoinm", "binanceus", "binanceusdm", "bingx", "bit2c", "bitbank", "bitbns", "bitfinex", "bitflyer", "bitget", "bithumb", "bitmart", "bitmex", "bitopro", "bitrue", "bitso", "bitstamp", "bitteam", "bittrade", "bitvavo", "blockchaincom", "blofin", "btcalpha", "btcbox", "btcmarkets", "btcturk", "bybit", "cex", "coinbase", "coinbaseadvanced", "coinbaseexchange", "coinbaseinternational", "coincatch", "coincheck", "coinex", "coinlist", "coinmate", "coinmetro", "coinone", "coinsph", "coinspot", "cryptocom", "cryptomus", "defx", "delta", "deribit", "derive", "digifinex", "ellipx", "exmo", "fmfwio", "gate", "gateio", "gemini", "hashkey", "hitbtc", "hollaex", "htx", "huobi", "hyperliquid", "independentreserve", "indodax", "kraken", "krakenfutures", "kucoin", "kucoinfutures", "latoken", "lbank", "luno", "mercado", "mexc", "modetrade", "myokx", "ndax", "novadax", "oceanex", "okcoin", "okx", "okxus", "onetrading", "oxfun", "p2b", "paradex", "paymium", "phemex", "poloniex", "probit", "timex", "tokocrypto", "tradeogre", "upbit", "vertex", "wavesexchange", "whitebit", "woo", "woofipro", "xt", "yobit", "zaif", "zonda" }; + public static List exchanges = new List { "alpaca", "apex", "ascendex", "bequant", "bigone", "binance", "binancecoinm", "binanceus", "binanceusdm", "bingx", "bit2c", "bitbank", "bitbns", "bitfinex", "bitflyer", "bitget", "bithumb", "bitmart", "bitmex", "bitopro", "bitrue", "bitso", "bitstamp", "bitteam", "bittrade", "bitvavo", "blockchaincom", "blofin", "btcalpha", "btcbox", "btcmarkets", "btcturk", "bybit", "cex", "coinbase", "coinbaseadvanced", "coinbaseexchange", "coinbaseinternational", "coincatch", "coincheck", "coinex", "coinmate", "coinmetro", "coinone", "coinsph", "coinspot", "cryptocom", "cryptomus", "defx", "delta", "deribit", "derive", "digifinex", "ellipx", "exmo", "fmfwio", "gate", "gateio", "gemini", "hashkey", "hitbtc", "hollaex", "htx", "huobi", "hyperliquid", "independentreserve", "indodax", "kraken", "krakenfutures", "kucoin", "kucoinfutures", "latoken", "lbank", "luno", "mercado", "mexc", "modetrade", "myokx", "ndax", "novadax", "oceanex", "okcoin", "okx", "okxus", "onetrading", "oxfun", "p2b", "paradex", "paymium", "phemex", "poloniex", "probit", "timex", "tokocrypto", "tradeogre", "upbit", "vertex", "wavesexchange", "whitebit", "woo", "woofipro", "xt", "yobit", "zaif", "zonda" }; } diff --git a/cs/ccxt/base/Exchange.Options.cs b/cs/ccxt/base/Exchange.Options.cs index e30e6317c0bb6..09cb8340fcf49 100644 --- a/cs/ccxt/base/Exchange.Options.cs +++ b/cs/ccxt/base/Exchange.Options.cs @@ -22,13 +22,13 @@ public partial class Exchange public string hostname { get; set; } = ""; - public dict baseCurrencies { get; set; } = new dict(); + public IDictionary baseCurrencies { get; set; } = new dict(); public bool reloadingMarkets { get; set; } = false; public Task marketsLoading { get; set; } = null; - public dict quoteCurrencies { get; set; } = new dict(); + public IDictionary quoteCurrencies { get; set; } = new dict(); public dict api { get; set; } = new dict(); diff --git a/cs/ccxt/base/Exchange.Wrappers.cs b/cs/ccxt/base/Exchange.Wrappers.cs index 5e0bba0494d7e..a5793ced5dfc5 100644 --- a/cs/ccxt/base/Exchange.Wrappers.cs +++ b/cs/ccxt/base/Exchange.Wrappers.cs @@ -881,6 +881,11 @@ public async Task FetchGreeks(string symbol, Dictionary var res = await this.fetchGreeks(symbol, parameters); return new Greeks(res); } + public async Task> FetchAllGreeks(List symbols = null, Dictionary parameters = null) + { + var res = await this.fetchAllGreeks(symbols, parameters); + return ((IList)res).Select(item => new Greeks(item)).ToList(); + } public async Task FetchOptionChain(string code, Dictionary parameters = null) { var res = await this.fetchOptionChain(code, parameters); @@ -1249,7 +1254,6 @@ public class Coinbaseinternational: coinbaseinternational { public Coinbaseinte public class Coincatch: coincatch { public Coincatch(object args = null) : base(args) { } } public class Coincheck: coincheck { public Coincheck(object args = null) : base(args) { } } public class Coinex: coinex { public Coinex(object args = null) : base(args) { } } -public class Coinlist: coinlist { public Coinlist(object args = null) : base(args) { } } public class Coinmate: coinmate { public Coinmate(object args = null) : base(args) { } } public class Coinmetro: coinmetro { public Coinmetro(object args = null) : base(args) { } } public class Coinone: coinone { public Coinone(object args = null) : base(args) { } } diff --git a/cs/ccxt/base/Exchange.cs b/cs/ccxt/base/Exchange.cs index 2d152c4b09369..99f265b279cac 100644 --- a/cs/ccxt/base/Exchange.cs +++ b/cs/ccxt/base/Exchange.cs @@ -164,10 +164,11 @@ public async virtual Task fetch(object url2, object method2 = null, obje var headers = this.extend(this.headers, headers3) as dict; var body = body2 as String; - var proxyUrl = this.checkProxyUrlSettings (url, method, headers, body); - if (proxyUrl != null) { + var proxyUrl = this.checkProxyUrlSettings(url, method, headers, body); + if (proxyUrl != null) + { proxyUrl = proxyUrl.ToString(); - url = proxyUrl + this.urlEncoderForProxyUrl (url).ToString(); + url = proxyUrl + this.urlEncoderForProxyUrl(url).ToString(); } if (this.verbose) @@ -1105,6 +1106,17 @@ public IDictionary createSafeDictionary() { return new System.Collections.Concurrent.ConcurrentDictionary(); } + + public IDictionary mapToSafeMap(object obj) + { + return (IDictionary)obj; + } + + public IDictionary safeMapToMap(object obj) + { + return (IDictionary)obj; + } + public class DynamicInvoker { public static object InvokeMethod(object action, object[] parameters) diff --git a/cs/ccxt/ccxt.csproj b/cs/ccxt/ccxt.csproj index cc9db0507af0c..df1eb3164f8c2 100644 --- a/cs/ccxt/ccxt.csproj +++ b/cs/ccxt/ccxt.csproj @@ -10,9 +10,9 @@ ccxt Carlos, Kroitor, Carlo - 4.4.89 - 4.4.89 - 4.4.89 + 4.4.92 + 4.4.92 + 4.4.92 README.md Cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges false @@ -25,8 +25,8 @@ en true - CS1998,CS0168, CS0108, CS8604, CS8600, CS8601, CS8602, CS8603, CS8625, CS8618, CS8981, CA2200, CS8974, CS043, CS0436, CA2200, CS8619 - + CS1998, CS0168, CS3021, CS0108, CS8604, CS8600, CS8601, CS8602, CS8603, CS8625, CS8618, CS8981, CA2200, CS8974, CS043, CS0436, CA2200, CS8619, CS4014, CS8625, CS8600 + diff --git a/cs/ccxt/exchanges/ascendex.cs b/cs/ccxt/exchanges/ascendex.cs index 34dbd9504f448..25d6f8b23d2a6 100644 --- a/cs/ccxt/exchanges/ascendex.cs +++ b/cs/ccxt/exchanges/ascendex.cs @@ -1501,6 +1501,8 @@ public override object parseOrder(object order, object market = null) // "timestamp": 1573576916201 // } // + // & linear (fetchClosedOrders) + // // { // "ac": "FUTURES", // "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn", @@ -1508,7 +1510,7 @@ public override object parseOrder(object order, object market = null) // "orderId": "a17e0874ecbdU0711043490bbtcpDU5X", // "seqNum": -1, // "orderType": "Limit", - // "execInst": "NULL_VAL", + // "execInst": "NULL_VAL", // NULL_VAL, ReduceOnly , ... // "side": "Buy", // "symbol": "BTC-PERP", // "price": "30000", @@ -1597,7 +1599,7 @@ public override object parseOrder(object order, object market = null) object status = this.parseOrderStatus(this.safeString(order, "status")); object marketId = this.safeString(order, "symbol"); object symbol = this.safeSymbol(marketId, market, "/"); - object timestamp = this.safeInteger2(order, "timestamp", "sendingTime"); + object timestamp = this.safeIntegerN(order, new List() {"timestamp", "sendingTime", "time"}); object lastTradeTimestamp = this.safeInteger(order, "lastExecTime"); if (isTrue(isEqual(timestamp, null))) { @@ -1605,7 +1607,7 @@ public override object parseOrder(object order, object market = null) } object price = this.safeString(order, "price"); object amount = this.safeString(order, "orderQty"); - object average = this.safeString(order, "avgPx"); + object average = this.safeString2(order, "avgPx", "avgFilledPx"); object filled = this.safeStringN(order, new List() {"cumFilledQty", "cumQty", "fillQty"}); object id = this.safeString(order, "orderId"); object clientOrderId = this.safeString(order, "id"); @@ -1643,13 +1645,13 @@ public override object parseOrder(object order, object market = null) } object triggerPrice = this.omitZero(this.safeString(order, "stopPrice")); object reduceOnly = null; - object execInst = this.safeString(order, "execInst"); - if (isTrue(isEqual(execInst, "reduceOnly"))) + object execInst = this.safeStringLower(order, "execInst"); + if (isTrue(isEqual(execInst, "reduceonly"))) { reduceOnly = true; } object postOnly = null; - if (isTrue(isEqual(execInst, "Post"))) + if (isTrue(isEqual(execInst, "post"))) { postOnly = true; } @@ -2464,8 +2466,7 @@ public async override Task fetchClosedOrders(object symbol = null, objec // } // object data = this.safeList(response, "data", new List() {}); - object isArray = ((data is IList) || (data.GetType().IsGenericType && data.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>)))); - if (!isTrue(isArray)) + if (!isTrue(((data is IList) || (data.GetType().IsGenericType && data.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>)))))) { data = this.safeList(data, "data", new List() {}); } diff --git a/cs/ccxt/exchanges/binance.cs b/cs/ccxt/exchanges/binance.cs index 3c306ff72fe13..eb016f60c0309 100644 --- a/cs/ccxt/exchanges/binance.cs +++ b/cs/ccxt/exchanges/binance.cs @@ -53,6 +53,7 @@ public override object describe() { "editOrder", true }, { "editOrders", true }, { "fetchAccounts", null }, + { "fetchAllGreeks", true }, { "fetchBalance", true }, { "fetchBidsAsks", true }, { "fetchBorrowInterest", true }, @@ -4031,7 +4032,7 @@ public override object parseTicker(object ticker, object market = null) // // { // "symbol": "BTCUSDT", - // "markPrice": "11793.63104562", // mark price + // "markPrice": "11793.63104561", // mark price // "indexPrice": "11781.80495970", // index price // "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts // "lastFundingRate": "0.00038246", // This is the lastest estimated funding rate @@ -10848,7 +10849,7 @@ public async virtual Task loadLeverageBrackets(object reload = null, obj { throw new NotSupported ((string)add(this.id, " loadLeverageBrackets() supports linear and inverse contracts only")) ; } - ((IDictionary)this.options)["leverageBrackets"] = new Dictionary() {}; + ((IDictionary)this.options)["leverageBrackets"] = this.createSafeDictionary(); for (object i = 0; isLessThan(i, getArrayLength(response)); postFixIncrement(ref i)) { object entry = getValue(response, i); @@ -13985,6 +13986,52 @@ public async override Task fetchGreeks(object symbol, object parameters return this.parseGreeks(getValue(response, 0), market); } + /** + * @method + * @name binance#fetchAllGreeks + * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + * @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price + * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} + */ + public async override Task fetchAllGreeks(object symbols = null, object parameters = null) + { + parameters ??= new Dictionary(); + await this.loadMarkets(); + symbols = this.marketSymbols(symbols, null, true, true, true); + object request = new Dictionary() {}; + object market = null; + if (isTrue(!isEqual(symbols, null))) + { + object symbolsLength = getArrayLength(symbols); + if (isTrue(isEqual(symbolsLength, 1))) + { + market = this.market(getValue(symbols, 0)); + ((IDictionary)request)["symbol"] = getValue(market, "id"); + } + } + object response = await this.eapiPublicGetMark(this.extend(request, parameters)); + // + // [ + // { + // "symbol": "BTC-231229-40000-C", + // "markPrice": "2012", + // "bidIV": "0.60236275", + // "askIV": "0.62267244", + // "markIV": "0.6125176", + // "delta": "0.39111646", + // "theta": "-32.13948531", + // "gamma": "0.00004656", + // "vega": "51.70062218", + // "highPriceLimit": "6474", + // "lowPriceLimit": "5" + // } + // ] + // + return this.parseAllGreeks(response, symbols); + } + public override object parseGreeks(object greeks, object market = null) { // diff --git a/cs/ccxt/exchanges/bitmart.cs b/cs/ccxt/exchanges/bitmart.cs index 92304b4b59540..748c1210c7f12 100644 --- a/cs/ccxt/exchanges/bitmart.cs +++ b/cs/ccxt/exchanges/bitmart.cs @@ -2078,6 +2078,7 @@ public async override Task fetchOHLCV(object symbol, object timeframe = * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] the latest time in ms to fetch trades for * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported) + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ public async override Task fetchMyTrades(object symbol = null, object since = null, object limit = null, object parameters = null) @@ -2209,6 +2210,7 @@ public async override Task fetchMyTrades(object symbol = null, object si * @param {int} [since] the earliest time in ms to fetch trades for * @param {int} [limit] the maximum number of trades to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ public async override Task fetchOrderTrades(object id, object symbol = null, object since = null, object limit = null, object parameters = null) @@ -2710,6 +2712,7 @@ public async override Task createMarketBuyOrderWithCost(object symbol, o * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1 + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ public async override Task createOrder(object symbol, object type, object side, object amount, object price = null, object parameters = null) @@ -2786,6 +2789,7 @@ public async override Task createOrder(object symbol, object type, objec * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ public async override Task createOrders(object orders, object parameters = null) @@ -3465,6 +3469,7 @@ public async virtual Task fetchOrdersByStatus(object status, object symb * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing' * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ public async override Task fetchOpenOrders(object symbol = null, object since = null, object limit = null, object parameters = null) @@ -3608,6 +3613,7 @@ public async override Task fetchOpenOrders(object symbol = null, object * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] timestamp in ms of the latest entry * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ public async override Task fetchClosedOrders(object symbol = null, object since = null, object limit = null, object parameters = null) @@ -3693,6 +3699,7 @@ public async virtual Task fetchCanceledOrders(object symbol = null, obje * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing' * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ public async override Task fetchOrder(object id, object symbol = null, object parameters = null) diff --git a/cs/ccxt/exchanges/bitmex.cs b/cs/ccxt/exchanges/bitmex.cs index ddb152af0b8e7..1ae7f2c1ee654 100644 --- a/cs/ccxt/exchanges/bitmex.cs +++ b/cs/ccxt/exchanges/bitmex.cs @@ -78,6 +78,7 @@ public override object describe() { "fetchTransactions", "emulated" }, { "fetchTransfer", false }, { "fetchTransfers", false }, + { "index", true }, { "reduceMargin", null }, { "sandbox", true }, { "setLeverage", true }, @@ -397,8 +398,8 @@ public async override Task fetchCurrencies(object parameters = null) // // "mediumPrecision": "8", // // "shorterPrecision": "4", // // "symbol": "₿", - // // "weight": "1", // // "tickLog": "0", + // // "weight": "1", // "enabled": true, // "isMarginCurrency": true, // "minDepositAmount": "10000", diff --git a/cs/ccxt/exchanges/bitvavo.cs b/cs/ccxt/exchanges/bitvavo.cs index 1d168bd398ce3..ef316590cd6b8 100644 --- a/cs/ccxt/exchanges/bitvavo.cs +++ b/cs/ccxt/exchanges/bitvavo.cs @@ -651,7 +651,7 @@ public virtual object parseCurrenciesCustom(object currencies) }); } // set currencies here to avoid calling publicGetAssets twice - this.currencies = this.deepExtend(this.currencies, result); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, result)); return result; } @@ -1281,6 +1281,9 @@ public virtual object createOrderRequest(object symbol, object type, object side if (isTrue(!isEqual(operatorId, null))) { ((IDictionary)request)["operatorId"] = this.parseToInt(operatorId); + } else + { + throw new ArgumentsRequired ((string)add(this.id, " createOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890")) ; } return this.extend(request, parameters); } @@ -1400,6 +1403,9 @@ public virtual object editOrderRequest(object id, object symbol, object type, ob if (isTrue(!isEqual(operatorId, null))) { ((IDictionary)request)["operatorId"] = this.parseToInt(operatorId); + } else + { + throw new ArgumentsRequired ((string)add(this.id, " editOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890")) ; } ((IDictionary)request)["market"] = getValue(market, "id"); return request; @@ -1452,6 +1458,9 @@ public virtual object cancelOrderRequest(object id, object symbol = null, object if (isTrue(!isEqual(operatorId, null))) { ((IDictionary)request)["operatorId"] = this.parseToInt(operatorId); + } else + { + throw new ArgumentsRequired ((string)add(this.id, " cancelOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890")) ; } return this.extend(request, parameters); } diff --git a/cs/ccxt/exchanges/btcturk.cs b/cs/ccxt/exchanges/btcturk.cs index f0fd1db7860a9..4d0780b60888c 100644 --- a/cs/ccxt/exchanges/btcturk.cs +++ b/cs/ccxt/exchanges/btcturk.cs @@ -21,35 +21,64 @@ public override object describe() { "future", false }, { "option", false }, { "addMargin", false }, + { "borrowCrossMargin", false }, + { "borrowIsolatedMargin", false }, + { "borrowMargin", false }, { "cancelOrder", true }, { "closeAllPositions", false }, { "closePosition", false }, { "createDepositAddress", false }, { "createOrder", true }, + { "createOrderWithTakeProfitAndStopLoss", false }, + { "createOrderWithTakeProfitAndStopLossWs", false }, + { "createPostOnlyOrder", false }, { "createReduceOnlyOrder", false }, { "fetchBalance", true }, + { "fetchBorrowInterest", false }, + { "fetchBorrowRate", false }, { "fetchBorrowRateHistories", false }, { "fetchBorrowRateHistory", false }, + { "fetchBorrowRates", false }, + { "fetchBorrowRatesPerSymbol", false }, { "fetchCrossBorrowRate", false }, { "fetchCrossBorrowRates", false }, { "fetchDepositAddress", false }, { "fetchDepositAddresses", false }, { "fetchDepositAddressesByNetwork", false }, { "fetchFundingHistory", false }, + { "fetchFundingInterval", false }, + { "fetchFundingIntervals", false }, { "fetchFundingRate", false }, { "fetchFundingRateHistory", false }, { "fetchFundingRates", false }, + { "fetchGreeks", false }, { "fetchIndexOHLCV", false }, { "fetchIsolatedBorrowRate", false }, { "fetchIsolatedBorrowRates", false }, + { "fetchIsolatedPositions", false }, { "fetchLeverage", false }, + { "fetchLeverages", false }, + { "fetchLeverageTiers", false }, + { "fetchLiquidations", false }, + { "fetchLongShortRatio", false }, + { "fetchLongShortRatioHistory", false }, + { "fetchMarginAdjustmentHistory", false }, { "fetchMarginMode", false }, + { "fetchMarginModes", false }, + { "fetchMarketLeverageTiers", false }, { "fetchMarkets", true }, { "fetchMarkOHLCV", false }, + { "fetchMarkPrices", false }, + { "fetchMyLiquidations", false }, + { "fetchMySettlementHistory", false }, { "fetchMyTrades", true }, { "fetchOHLCV", true }, + { "fetchOpenInterest", false }, { "fetchOpenInterestHistory", false }, + { "fetchOpenInterests", false }, { "fetchOpenOrders", true }, + { "fetchOption", false }, + { "fetchOptionChain", false }, { "fetchOrderBook", true }, { "fetchOrders", true }, { "fetchPosition", false }, @@ -60,11 +89,17 @@ public override object describe() { "fetchPositionsHistory", false }, { "fetchPositionsRisk", false }, { "fetchPremiumIndexOHLCV", false }, + { "fetchSettlementHistory", false }, { "fetchTicker", true }, { "fetchTickers", true }, { "fetchTrades", true }, + { "fetchVolatilityHistory", false }, { "reduceMargin", false }, + { "repayCrossMargin", false }, + { "repayIsolatedMargin", false }, + { "repayMargin", false }, { "setLeverage", false }, + { "setMargin", false }, { "setMarginMode", false }, { "setPositionMode", false }, { "ws", false }, diff --git a/cs/ccxt/exchanges/cex.cs b/cs/ccxt/exchanges/cex.cs index d1c52293d02ee..b7db21e0f95ae 100644 --- a/cs/ccxt/exchanges/cex.cs +++ b/cs/ccxt/exchanges/cex.cs @@ -20,34 +20,95 @@ public override object describe() { "swap", false }, { "future", false }, { "option", false }, + { "addMargin", false }, + { "borrowCrossMargin", false }, + { "borrowIsolatedMargin", false }, + { "borrowMargin", false }, { "cancelAllOrders", true }, { "cancelOrder", true }, + { "closeAllPositions", false }, + { "closePosition", false }, { "createOrder", true }, + { "createOrderWithTakeProfitAndStopLoss", false }, + { "createOrderWithTakeProfitAndStopLossWs", false }, + { "createPostOnlyOrder", false }, { "createReduceOnlyOrder", false }, { "createStopOrder", true }, { "createTriggerOrder", true }, { "fetchAccounts", true }, { "fetchBalance", true }, + { "fetchBorrowInterest", false }, + { "fetchBorrowRate", false }, + { "fetchBorrowRateHistories", false }, + { "fetchBorrowRateHistory", false }, + { "fetchBorrowRates", false }, + { "fetchBorrowRatesPerSymbol", false }, { "fetchClosedOrder", true }, { "fetchClosedOrders", true }, + { "fetchCrossBorrowRate", false }, + { "fetchCrossBorrowRates", false }, { "fetchCurrencies", true }, { "fetchDepositAddress", true }, { "fetchDepositsWithdrawals", true }, { "fetchFundingHistory", false }, + { "fetchFundingInterval", false }, + { "fetchFundingIntervals", false }, { "fetchFundingRate", false }, { "fetchFundingRateHistory", false }, { "fetchFundingRates", false }, + { "fetchGreeks", false }, + { "fetchIndexOHLCV", false }, + { "fetchIsolatedBorrowRate", false }, + { "fetchIsolatedBorrowRates", false }, + { "fetchIsolatedPositions", false }, { "fetchLedger", true }, + { "fetchLeverage", false }, + { "fetchLeverages", false }, + { "fetchLeverageTiers", false }, + { "fetchLiquidations", false }, + { "fetchLongShortRatio", false }, + { "fetchLongShortRatioHistory", false }, + { "fetchMarginAdjustmentHistory", false }, + { "fetchMarginMode", false }, + { "fetchMarginModes", false }, + { "fetchMarketLeverageTiers", false }, { "fetchMarkets", true }, + { "fetchMarkOHLCV", false }, + { "fetchMarkPrices", false }, + { "fetchMyLiquidations", false }, + { "fetchMySettlementHistory", false }, { "fetchOHLCV", true }, + { "fetchOpenInterest", false }, + { "fetchOpenInterestHistory", false }, + { "fetchOpenInterests", false }, { "fetchOpenOrder", true }, { "fetchOpenOrders", true }, + { "fetchOption", false }, + { "fetchOptionChain", false }, { "fetchOrderBook", true }, + { "fetchPosition", false }, + { "fetchPositionHistory", false }, + { "fetchPositionMode", false }, + { "fetchPositions", false }, + { "fetchPositionsForSymbol", false }, + { "fetchPositionsHistory", false }, + { "fetchPositionsRisk", false }, + { "fetchPremiumIndexOHLCV", false }, + { "fetchSettlementHistory", false }, { "fetchTicker", true }, { "fetchTickers", true }, { "fetchTime", true }, { "fetchTrades", true }, { "fetchTradingFees", true }, + { "fetchVolatilityHistory", false }, + { "reduceMargin", false }, + { "repayCrossMargin", false }, + { "repayIsolatedMargin", false }, + { "repayMargin", false }, + { "setLeverage", false }, + { "setMargin", false }, + { "setMarginMode", false }, + { "setPositionMode", false }, { "transfer", true }, } }, { "urls", new Dictionary() { diff --git a/cs/ccxt/exchanges/coinbase.cs b/cs/ccxt/exchanges/coinbase.cs index ec7ce021cc57d..8cc645eea566d 100644 --- a/cs/ccxt/exchanges/coinbase.cs +++ b/cs/ccxt/exchanges/coinbase.cs @@ -4938,7 +4938,7 @@ public override object parseConversion(object conversion, object fromCurrency = * @method * @name coinbase#closePosition * @description *futures only* closes open positions for a market - * @see https://coinbase-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions + * @see https://docs.cdp.coinbase.com/coinbase-app/trade/reference/retailbrokerageapi_closeposition * @param {string} symbol Unified CCXT market symbol * @param {string} [side] not used by coinbase * @param {object} [params] extra parameters specific to the coinbase api endpoint @@ -4951,10 +4951,6 @@ public async override Task closePosition(object symbol, object side = nu parameters ??= new Dictionary(); await this.loadMarkets(); object market = this.market(symbol); - if (!isTrue(getValue(market, "future"))) - { - throw new NotSupported ((string)add(this.id, " closePosition() only supported for futures markets")) ; - } object clientOrderId = this.safeString2(parameters, "client_order_id", "clientOrderId"); parameters = this.omit(parameters, "clientOrderId"); object request = new Dictionary() { diff --git a/cs/ccxt/exchanges/coinex.cs b/cs/ccxt/exchanges/coinex.cs index 93a39fbedb0e6..ada602b8dbb49 100644 --- a/cs/ccxt/exchanges/coinex.cs +++ b/cs/ccxt/exchanges/coinex.cs @@ -638,6 +638,7 @@ public override object describe() { "broad", new Dictionary() { { "ip not allow visit", typeof(PermissionDenied) }, { "service too busy", typeof(ExchangeNotAvailable) }, + { "Service is not available during funding fee settlement", typeof(OperationFailed) }, } }, } }, }); @@ -844,7 +845,7 @@ public async virtual Task fetchSpotMarkets(object parameters) { "settleId", null }, { "type", "spot" }, { "spot", true }, - { "margin", null }, + { "margin", this.safeBool(market, "is_margin_available") }, { "swap", false }, { "future", false }, { "option", false }, diff --git a/cs/ccxt/exchanges/coinlist.cs b/cs/ccxt/exchanges/coinlist.cs deleted file mode 100644 index 8bc2960844a7e..0000000000000 --- a/cs/ccxt/exchanges/coinlist.cs +++ /dev/null @@ -1,2769 +0,0 @@ -namespace ccxt; - -// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: -// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code - -public partial class coinlist : Exchange -{ - public override object describe() - { - return this.deepExtend(base.describe(), new Dictionary() { - { "id", "coinlist" }, - { "name", "Coinlist" }, - { "countries", new List() {"US"} }, - { "version", "v1" }, - { "rateLimit", 300 }, - { "certified", false }, - { "pro", false }, - { "has", new Dictionary() { - { "CORS", null }, - { "spot", true }, - { "margin", false }, - { "swap", false }, - { "future", false }, - { "option", false }, - { "addMargin", false }, - { "cancelAllOrders", true }, - { "cancelOrder", true }, - { "cancelOrders", true }, - { "closeAllPositions", false }, - { "closePosition", false }, - { "createDepositAddress", false }, - { "createOrder", true }, - { "createPostOnlyOrder", true }, - { "createReduceOnlyOrder", false }, - { "createStopLimitOrder", true }, - { "createStopMarketOrder", true }, - { "createStopOrder", true }, - { "deposit", false }, - { "editOrder", true }, - { "fetchAccounts", true }, - { "fetchBalance", true }, - { "fetchBidsAsks", false }, - { "fetchBorrowInterest", false }, - { "fetchBorrowRateHistories", false }, - { "fetchBorrowRateHistory", false }, - { "fetchCanceledOrders", true }, - { "fetchClosedOrder", false }, - { "fetchClosedOrders", true }, - { "fetchCrossBorrowRate", false }, - { "fetchCrossBorrowRates", false }, - { "fetchCurrencies", true }, - { "fetchDeposit", false }, - { "fetchDepositAddress", false }, - { "fetchDepositAddresses", false }, - { "fetchDepositAddressesByNetwork", false }, - { "fetchDeposits", false }, - { "fetchDepositsWithdrawals", true }, - { "fetchDepositWithdrawFee", false }, - { "fetchDepositWithdrawFees", false }, - { "fetchFundingHistory", false }, - { "fetchFundingRate", true }, - { "fetchFundingRateHistory", false }, - { "fetchFundingRates", false }, - { "fetchIndexOHLCV", false }, - { "fetchIsolatedBorrowRate", false }, - { "fetchIsolatedBorrowRates", false }, - { "fetchL3OrderBook", false }, - { "fetchLedger", true }, - { "fetchLeverage", false }, - { "fetchLeverageTiers", false }, - { "fetchMarketLeverageTiers", false }, - { "fetchMarkets", true }, - { "fetchMarkOHLCV", false }, - { "fetchMyTrades", true }, - { "fetchOHLCV", true }, - { "fetchOpenInterestHistory", false }, - { "fetchOpenOrder", false }, - { "fetchOpenOrders", true }, - { "fetchOrder", true }, - { "fetchOrderBook", true }, - { "fetchOrderBooks", false }, - { "fetchOrders", true }, - { "fetchOrderTrades", true }, - { "fetchPosition", false }, - { "fetchPositionHistory", false }, - { "fetchPositionMode", false }, - { "fetchPositions", false }, - { "fetchPositionsForSymbol", false }, - { "fetchPositionsHistory", false }, - { "fetchPositionsRisk", false }, - { "fetchPremiumIndexOHLCV", false }, - { "fetchStatus", false }, - { "fetchTicker", true }, - { "fetchTickers", true }, - { "fetchTime", true }, - { "fetchTrades", true }, - { "fetchTradingFee", false }, - { "fetchTradingFees", true }, - { "fetchTradingLimits", false }, - { "fetchTransactionFee", false }, - { "fetchTransactionFees", false }, - { "fetchTransactions", true }, - { "fetchTransfers", true }, - { "fetchWithdrawal", false }, - { "fetchWithdrawals", false }, - { "fetchWithdrawalWhitelist", false }, - { "reduceMargin", false }, - { "repayCrossMargin", false }, - { "repayIsolatedMargin", false }, - { "setLeverage", false }, - { "setMargin", false }, - { "setMarginMode", false }, - { "setPositionMode", false }, - { "signIn", false }, - { "transfer", true }, - { "withdraw", true }, - { "ws", false }, - } }, - { "timeframes", new Dictionary() { - { "1m", "1m" }, - { "5m", "5m" }, - { "30m", "30m" }, - } }, - { "urls", new Dictionary() { - { "logo", "https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg" }, - { "api", new Dictionary() { - { "public", "https://trade-api.coinlist.co" }, - { "private", "https://trade-api.coinlist.co" }, - } }, - { "www", "https://coinlist.co" }, - { "doc", new List() {"https://trade-docs.coinlist.co"} }, - { "fees", "https://coinlist.co/fees" }, - } }, - { "api", new Dictionary() { - { "public", new Dictionary() { - { "get", new Dictionary() { - { "v1/symbols", 1 }, - { "v1/symbols/summary", 1 }, - { "v1/symbols/{symbol}", 1 }, - { "v1/symbols/{symbol}/summary", 1 }, - { "v1/symbols/{symbol}/book", 1 }, - { "v1/symbols/{symbol}/quote", 1 }, - { "v1/symbols/{symbol}/candles", 1 }, - { "v1/symbols/{symbol}/auctions", 1 }, - { "v1/symbols/{symbol}/auctions/{auction_code}", 1 }, - { "v1/time", 1 }, - { "v1/assets", 1 }, - { "v1/leaderboard", 1 }, - { "v1/affiliate/{competition_code}", 1 }, - { "v1/competition/{competition_id}", 1 }, - { "v1/symbols/{symbol}/funding", 1 }, - } }, - } }, - { "private", new Dictionary() { - { "get", new Dictionary() { - { "v1/fees", 1 }, - { "v1/accounts", 1 }, - { "v1/accounts/{trader_id}", 1 }, - { "v1/accounts/{trader_id}/alias", 1 }, - { "v1/accounts/{trader_id}/ledger", 1 }, - { "v1/accounts/{trader_id}/wallets", 1 }, - { "v1/accounts/{trader_id}/wallet-ledger", 1 }, - { "v1/accounts/{trader_id}/ledger-summary", 1 }, - { "v1/keys", 1 }, - { "v1/fills", 1 }, - { "v1/orders", 1 }, - { "v1/orders/{order_id}", 1 }, - { "v1/reports", 1 }, - { "v1/balances", 1 }, - { "v1/transfers", 1 }, - { "v1/user", 1 }, - { "v1/credits", 1 }, - { "v1/positions", 1 }, - { "v1/accounts/{trader_id}/competitions", 1 }, - { "v1/closedPositions", 1 }, - } }, - { "post", new Dictionary() { - { "v1/keys", 1 }, - { "v1/orders", 1 }, - { "v1/orders/cancel-all-after", 1 }, - { "v1/reports", 1 }, - { "v1/transfers/to-wallet", 1 }, - { "v1/transfers/from-wallet", 1 }, - { "v1/transfers/internal-transfer", 1 }, - { "v1/transfers/withdrawal-request", 1 }, - { "v1/orders/bulk", 1 }, - { "v1/accounts/{trader_id}/competitions", 1 }, - { "v1/accounts/{trader_id}/create-competition", 1 }, - } }, - { "patch", new Dictionary() { - { "v1/orders/{order_id}", 1 }, - { "v1/orders/bulk", 1 }, - } }, - { "put", new Dictionary() { - { "v1/accounts/{trader_id}/alias", 1 }, - } }, - { "delete", new Dictionary() { - { "v1/keys/{key}", 1 }, - { "v1/orders", 1 }, - { "v1/orders/{order_id}", 1 }, - { "v1/orders/bulk", 1 }, - } }, - } }, - } }, - { "features", new Dictionary() { - { "default", new Dictionary() { - { "sandbox", false }, - { "createOrder", new Dictionary() { - { "marginMode", false }, - { "triggerPrice", true }, - { "triggerPriceType", new Dictionary() { - { "last", true }, - { "mark", true }, - { "index", true }, - } }, - { "triggerDirection", false }, - { "stopLossPrice", false }, - { "takeProfitPrice", false }, - { "attachedStopLossTakeProfit", null }, - { "timeInForce", new Dictionary() { - { "IOC", false }, - { "FOK", false }, - { "PO", true }, - { "GTD", false }, - } }, - { "hedged", false }, - { "trailing", true }, - { "leverage", false }, - { "marketBuyByCost", false }, - { "marketBuyRequiresPrice", false }, - { "selfTradePrevention", true }, - { "iceberg", false }, - } }, - { "createOrders", null }, - { "fetchMyTrades", new Dictionary() { - { "marginMode", false }, - { "limit", 500 }, - { "daysBack", 100000 }, - { "untilDays", 100000 }, - { "symbolRequired", false }, - } }, - { "fetchOrder", new Dictionary() { - { "marginMode", false }, - { "trigger", false }, - { "trailing", false }, - { "symbolRequired", false }, - } }, - { "fetchOpenOrders", new Dictionary() { - { "marginMode", false }, - { "limit", 500 }, - { "trigger", false }, - { "trailing", false }, - { "symbolRequired", false }, - } }, - { "fetchOrders", new Dictionary() { - { "marginMode", false }, - { "limit", 500 }, - { "daysBack", 100000 }, - { "untilDays", 100000 }, - { "trigger", false }, - { "trailing", false }, - { "symbolRequired", false }, - } }, - { "fetchClosedOrders", new Dictionary() { - { "marginMode", false }, - { "limit", 500 }, - { "daysBack", 100000 }, - { "daysBackCanceled", null }, - { "untilDays", 100000 }, - { "trigger", false }, - { "trailing", false }, - { "symbolRequired", false }, - } }, - { "fetchOHLCV", new Dictionary() { - { "limit", 300 }, - } }, - } }, - { "swap", new Dictionary() { - { "linear", null }, - { "inverse", null }, - } }, - { "future", new Dictionary() { - { "linear", null }, - { "inverse", null }, - } }, - } }, - { "fees", new Dictionary() { - { "trading", new Dictionary() { - { "feeSide", "get" }, - { "tierBased", true }, - { "percentage", true }, - { "taker", this.parseNumber("0.0045") }, - { "maker", this.parseNumber("0.0025") }, - { "tiers", new Dictionary() { - { "taker", new List() {new List {this.parseNumber("0"), this.parseNumber("0.0045")}, new List {this.parseNumber("20000"), this.parseNumber("0.003")}, new List {this.parseNumber("50000"), this.parseNumber("0.0025")}, new List {this.parseNumber("100000"), this.parseNumber("0.002")}, new List {this.parseNumber("500000"), this.parseNumber("0.0018")}, new List {this.parseNumber("750000"), this.parseNumber("0.0018")}, new List {this.parseNumber("1000000"), this.parseNumber("0.0016")}, new List {this.parseNumber("2500000"), this.parseNumber("0.0013")}, new List {this.parseNumber("5000000"), this.parseNumber("0.0012")}, new List {this.parseNumber("10000000"), this.parseNumber("0.001")}, new List {this.parseNumber("50000000"), this.parseNumber("0.0005")}, new List {this.parseNumber("100000000"), this.parseNumber("0.0005")}} }, - { "maker", new List() {new List {this.parseNumber("0"), this.parseNumber("0.0025")}, new List {this.parseNumber("20000"), this.parseNumber("0.0025")}, new List {this.parseNumber("50000"), this.parseNumber("0.0025")}, new List {this.parseNumber("100000"), this.parseNumber("0.002")}, new List {this.parseNumber("500000"), this.parseNumber("0.0015")}, new List {this.parseNumber("750000"), this.parseNumber("0.0012")}, new List {this.parseNumber("1000000"), this.parseNumber("0.001")}, new List {this.parseNumber("2500000"), this.parseNumber("0.0008")}, new List {this.parseNumber("5000000"), this.parseNumber("0.0007")}, new List {this.parseNumber("10000000"), this.parseNumber("0.0006")}, new List {this.parseNumber("50000000"), this.parseNumber("0.0000")}, new List {this.parseNumber("100000000"), this.parseNumber("0.00")}} }, - } }, - } }, - } }, - { "precisionMode", TICK_SIZE }, - { "options", new Dictionary() { - { "accountsByType", new Dictionary() { - { "CoinList Pro", "trading" }, - { "CoinList Pro trading account", "trading" }, - { "Pro", "trading" }, - { "pro", "trading" }, - { "trade", "trading" }, - { "trading", "trading" }, - { "CoinList", "funding" }, - { "CoinList wallet", "funding" }, - { "Wallet", "funding" }, - { "wallet", "funding" }, - { "fund", "funding" }, - { "funding", "funding" }, - } }, - } }, - { "exceptions", new Dictionary() { - { "exact", new Dictionary() { - { "AUTH_SIG_INVALID", typeof(AuthenticationError) }, - { "DENIED_MAINTENANCE", typeof(OnMaintenance) }, - { "ORDER_REJECT_BAD_STATUS", typeof(InvalidOrder) }, - { "ORDER_REJECT_INVALID_POST_ONLY", typeof(InvalidOrder) }, - { "ORDER_REJECT_INVALID_CLOSE_ONLY", typeof(InvalidOrder) }, - { "ORDER_REJECT_POST_ONLY_REQUIRED", typeof(InvalidOrder) }, - { "ORDER_REJECT_FROZEN_ORDER", typeof(InvalidOrder) }, - { "ORDER_REJECT_LIMIT_PRICE_PROTECTION_VIOLATION", typeof(InvalidOrder) }, - { "ORDER_REJECT_CLOSED", typeof(NotSupported) }, - { "ORDER_REJECT_MAX_ORDERS", typeof(BadRequest) }, - { "ORDER_REJECT_NOT_FOUND", typeof(OrderNotFound) }, - { "ORDER_REJECT_PARSE_ERROR", typeof(BadRequest) }, - { "ORDER_REJECT_PRICE_INVALID", typeof(InvalidOrder) }, - { "ORDER_REJECT_QUANTITY_ZERO", typeof(InvalidOrder) }, - { "ORDER_REJECT_TOKEN_LIMIT", typeof(InsufficientFunds) }, - { "ORDER_REJECT_TOKEN_LIMIT_OTHER", typeof(InvalidOrder) }, - { "ORDER_REJECT_SELF_TRADE", typeof(InvalidOrder) }, - { "ORDER_VALIDATE_BAD_SIZE_ALIGNMENT", typeof(InvalidOrder) }, - { "ORDER_VALIDATE_BAD_TICK_ALIGNMENT", typeof(InvalidOrder) }, - { "ORDER_VALIDATE_SYMBOL_NOT_FOUND", typeof(BadSymbol) }, - { "TRANSFERS_WITHDRAWAL_REQUEST_TOO_LARGE", typeof(InsufficientFunds) }, - { "WITHDRAWAL_REQUEST_NOT_ALLOWED", typeof(PermissionDenied) }, - } }, - { "broad", new Dictionary() { - { "A destinationAddress is required for non-USD withdrawals", typeof(InvalidAddress) }, - { "fails to match the JsonSchema date-time format pattern", typeof(BadRequest) }, - { "is required", typeof(ArgumentsRequired) }, - { "must be a string", typeof(BadRequest) }, - { "must be a valid GUID", typeof(BadRequest) }, - { "must be greater than or equal to", typeof(BadRequest) }, - { "must be less than or equal to", typeof(BadRequest) }, - { "must be one of", typeof(BadRequest) }, - { "Symbol not found", typeof(BadSymbol) }, - } }, - } }, - }); - } - - public override object calculateRateLimiterCost(object api, object method, object path, object parameters, object config = null) - { - config ??= new Dictionary(); - if (isTrue(((parameters is IList) || (parameters.GetType().IsGenericType && parameters.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>)))))) - { - object length = getArrayLength(parameters); - return Math.Ceiling(Convert.ToDouble(divide(length, 2))); - } - return 1; - } - - /** - * @method - * @name coinlist#fetchTime - * @description fetches the current integer timestamp in milliseconds from the exchange server - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-system-time - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {int} the current integer timestamp in milliseconds from the exchange server - */ - public async override Task fetchTime(object parameters = null) - { - parameters ??= new Dictionary(); - object response = await this.publicGetV1Time(parameters); - // - // { - // "epoch": 1698087996.039, - // "iso": "2023-10-23T19:06:36.039Z" - // } - // - object str = this.safeString(response, "iso"); - return this.parse8601(str); - } - - /** - * @method - * @name coinlist#fetchCurrencies - * @description fetches all available currencies on an exchange - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-supported-assets - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an associative dictionary of currencies - */ - public async override Task fetchCurrencies(object parameters = null) - { - parameters ??= new Dictionary(); - object response = await this.publicGetV1Assets(parameters); - // - // { - // "assets": [ - // { - // "asset": "AAVE", - // "index_code": ".AAVEUSD", - // "decimal_places": 18, - // "min_withdrawal": "1.0000", - // "is_transferable": true, - // "is_visible": true - // }, - // { - // "asset": "ALGO", - // "index_code": ".ALGOUSD", - // "decimal_places": 6, - // "min_withdrawal": "1.0000", - // "is_transferable": true, - // "is_visible": true - // } - // ] - // } - // - object currencies = this.safeValue(response, "assets", new List() {}); - object result = new Dictionary() {}; - for (object i = 0; isLessThan(i, getArrayLength(currencies)); postFixIncrement(ref i)) - { - object currency = getValue(currencies, i); - object id = this.safeString(currency, "asset"); - object code = this.safeCurrencyCode(id); - object isFiat = isEqual(code, "USD"); - object isTransferable = this.safeBool(currency, "is_transferable", false); - ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { - { "id", id }, - { "code", code }, - { "name", code }, - { "info", currency }, - { "active", null }, - { "deposit", isTransferable }, - { "withdraw", isTransferable }, - { "fee", null }, - { "precision", this.parseNumber(this.parsePrecision(this.safeString(currency, "decimal_places"))) }, - { "limits", new Dictionary() { - { "amount", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - { "withdraw", new Dictionary() { - { "min", this.safeNumber(currency, "min_withdrawal") }, - { "max", null }, - } }, - } }, - { "networks", new Dictionary() {} }, - { "type", ((bool) isTrue(isFiat)) ? "fiat" : "crypto" }, - }); - } - return result; - } - - /** - * @method - * @name coinlist#fetchMarkets - * @description retrieves data on all markets for coinlist - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-symbols - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} an array of objects representing market data - */ - public async override Task fetchMarkets(object parameters = null) - { - parameters ??= new Dictionary(); - object response = await this.publicGetV1Symbols(parameters); - // - // { - // "symbols": [ - // { - // "symbol": "CQT-USDT", // spot - // "base_currency": "CQT", - // "is_trader_geofenced": false, - // "list_time": "2021-06-15T00:00:00.000Z", - // "type": "spot", - // "series_code": "CQT-USDT-SPOT", - // "long_name": "Covalent", - // "asset_class": "CRYPTO", - // "minimum_price_increment": "0.0001", - // "minimum_size_increment": "0.0001", - // "quote_currency": "USDT", - // "index_code": null, - // "price_band_threshold_market": "0.05", - // "price_band_threshold_limit": "0.25", - // "last_price": "0.12160000", - // "fair_price": "0.12300000", - // "index_price": null - // }, - // ] - // } - // - object markets = this.safeValue(response, "symbols", new List() {}); - return this.parseMarkets(markets); - } - - public override object parseMarket(object market) - { - // perp - // { - // "symbol":"BTC-PERP", - // "base_currency":"BTC", - // "is_trader_geofenced":false, - // "expiry_name":null, - // "expiry_time":null, - // "list_time":"2024-09-16T00:00:00.000Z", - // "type":"perp-swap", - // "series_code":"BTC", - // "long_name":"Bitcoin", - // "asset_class":"CRYPTO", - // "minimum_price_increment":"0.01", - // "minimum_size_increment":"0.0001", - // "quote_currency":"USDT", - // "multiplier":"1", - // "contract_frequency":"FGHJKMNQUVXZ", - // "index_code":".BTC-USDT", - // "price_band_threshold_market":"0.05", - // "price_band_threshold_limit":"0.25", - // "maintenance_initial_ratio":"0.500000000000000000", - // "liquidation_initial_ratio":"0.500000000000000000", - // "last_price":"75881.36000000", - // "fair_price":"76256.00000000", - // "index_price":"77609.90000000", - // "mark_price":"76237.75000000", - // "mark_price_dollarizer":"0.99950000", - // "funding_interval":{ - // "hours":"8" - // }, - // "funding_rate_index_code":".BTC-USDT-FR8H", - // "initial_margin_base":"0.200000000000000000", - // "initial_margin_per_contract":"0.160000000000000000", - // "position_limit":"5.0000" - // } - // spot - // { - // "symbol": "CQT-USDT", // spot - // "base_currency": "CQT", - // "is_trader_geofenced": false, - // "list_time": "2021-06-15T00:00:00.000Z", - // "type": "spot", - // "series_code": "CQT-USDT-SPOT", - // "long_name": "Covalent", - // "asset_class": "CRYPTO", - // "minimum_price_increment": "0.0001", - // "minimum_size_increment": "0.0001", - // "quote_currency": "USDT", - // "index_code": null, - // "price_band_threshold_market": "0.05", - // "price_band_threshold_limit": "0.25", - // "last_price": "0.12160000", - // "fair_price": "0.12300000", - // "index_price": null - // } - object isSwap = isEqual(this.safeString(market, "type"), "perp-swap"); - object id = this.safeString(market, "symbol"); - object baseId = this.safeString(market, "base_currency"); - object quoteId = this.safeString(market, "quote_currency"); - object bs = this.safeCurrencyCode(baseId); - object quote = this.safeCurrencyCode(quoteId); - object amountPrecision = this.safeString(market, "minimum_size_increment"); - object pricePrecision = this.safeString(market, "minimum_price_increment"); - object created = this.safeString(market, "list_time"); - object settledId = null; - object settled = null; - object linear = null; - object inverse = null; - object contractSize = null; - object symbol = add(add(bs, "/"), quote); - if (isTrue(isSwap)) - { - contractSize = this.parseNumber("1"); - linear = true; - inverse = false; - settledId = quoteId; - settled = quote; - symbol = add(add(symbol, ":"), quote); - } - object type = ((bool) isTrue(isSwap)) ? "swap" : "spot"; - return new Dictionary() { - { "id", id }, - { "symbol", symbol }, - { "base", bs }, - { "quote", quote }, - { "settle", settled }, - { "baseId", baseId }, - { "quoteId", quoteId }, - { "settleId", settledId }, - { "type", type }, - { "spot", !isTrue(isSwap) }, - { "margin", false }, - { "swap", isSwap }, - { "future", false }, - { "option", false }, - { "active", true }, - { "contract", isSwap }, - { "linear", linear }, - { "inverse", inverse }, - { "contractSize", contractSize }, - { "expiry", null }, - { "expiryDatetime", null }, - { "strike", null }, - { "optionType", null }, - { "precision", new Dictionary() { - { "amount", this.parseNumber(amountPrecision) }, - { "price", this.parseNumber(pricePrecision) }, - } }, - { "limits", new Dictionary() { - { "leverage", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - { "amount", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - { "price", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - { "cost", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - } }, - { "created", this.parse8601(created) }, - { "info", market }, - }; - } - - /** - * @method - * @name coinlist#fetchTickers - * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-symbol-summaries - * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure} - */ - public async override Task fetchTickers(object symbols = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() {}; - object tickers = await this.publicGetV1SymbolsSummary(this.extend(request, parameters)); - // - // { - // "MATIC-USD": { - // "type":"spot", - // "last_price":"0.60990000", - // "lowest_ask":"0.61190000", - // "highest_bid":"0.60790000", - // "last_trade": { - // "price":"0.60000000", - // "volume":"2.0000", - // "imbalance":"198.0000", - // "logicalTime":"2023-10-22T23:02:25.000Z", - // "auctionCode":"MATIC-USD-2023-10-22T23:02:25.000Z" - // }, - // "volume_base_24h":"34.0555", - // "volume_quote_24h":"19.9282", - // "price_change_percent_24h":"7.50925436", - // "highest_price_24h":"0.68560000", - // "lowest_price_24h":"0.55500000" - // }, - // } - // - return this.parseTickers(tickers, symbols, parameters); - } - - /** - * @method - * @name coinlist#fetchTicker - * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-market-summary - * @param {string} symbol unified symbol of the market to fetch the ticker for - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} - */ - public async override Task fetchTicker(object symbol, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - }; - object ticker = await this.publicGetV1SymbolsSymbolSummary(this.extend(request, parameters)); - // - // { - // "type":"spot", - // "last_price":"31125.00000000", - // "lowest_ask":"31349.99000000", - // "highest_bid":"30900.00000000", - // "last_trade": { - // "price":"31000.00000000", - // "volume":"0.0003", - // "imbalance":"0.0000", - // "logicalTime":"2023-10-23T16:57:15.000Z", - // "auctionCode":"BTC-USDT-2023-10-23T16:57:15.000Z" - // }, - // "volume_base_24h":"0.3752", - // "volume_quote_24h":"11382.7181", - // "price_change_percent_24h":"3.66264694", - // "highest_price_24h":"31225.12000000", - // "lowest_price_24h":"29792.81000000" - // } - // - return this.parseTicker(ticker, market); - } - - public override object parseTicker(object ticker, object market = null) - { - // - // { - // "type":"spot", - // "last_price":"0.60990000", - // "lowest_ask":"0.61190000", - // "highest_bid":"0.60790000", - // "last_trade": { - // "price":"0.60000000", - // "volume":"2.0000", - // "imbalance":"198.0000", - // "logicalTime":"2023-10-22T23:02:25.000Z", - // "auctionCode":"MATIC-USD-2023-10-22T23:02:25.000Z" - // }, - // "volume_base_24h":"34.0555", - // "volume_quote_24h":"19.9282", - // "price_change_percent_24h":"7.50925436", - // "highest_price_24h":"0.68560000", - // "lowest_price_24h":"0.55500000" - // } - // - object lastTrade = this.safeValue(ticker, "last_trade", new Dictionary() {}); - object timestamp = this.parse8601(this.safeString(lastTrade, "logicalTime")); - object bid = this.safeString(ticker, "highest_bid"); - object ask = this.safeString(ticker, "lowest_ask"); - object baseVolume = this.safeString(ticker, "volume_base_24h"); - object quoteVolume = this.safeString(ticker, "volume_quote_24h"); - object high = this.safeString(ticker, "highest_price_24h"); - object low = this.safeString(ticker, "lowest_price_24h"); - object close = this.safeString(ticker, "last_price"); - object changePcnt = this.safeString(ticker, "price_change_percent_24h"); - return this.safeTicker(new Dictionary() { - { "symbol", getValue(market, "symbol") }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "open", null }, - { "high", high }, - { "low", low }, - { "close", close }, - { "bid", bid }, - { "bidVolume", null }, - { "ask", ask }, - { "askVolume", null }, - { "vwap", null }, - { "previousClose", null }, - { "change", null }, - { "percentage", changePcnt }, - { "average", null }, - { "baseVolume", baseVolume }, - { "quoteVolume", quoteVolume }, - { "info", ticker }, - }, market); - } - - /** - * @method - * @name coinlist#fetchOrderBook - * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-order-book-level-2 - * @param {string} symbol unified symbol of the market to fetch the order book for - * @param {int} [limit] the maximum amount of order book entries to return (default 100, max 200) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols - */ - public async override Task fetchOrderBook(object symbol, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - }; - object response = await this.publicGetV1SymbolsSymbolBook(this.extend(request, parameters)); - // - // { - // "bids": [ - // [ "30900.00000000", "0.0001" ], - // [ "30664.21000000", "0.0172" ], - // [ "30664.20000000", "0.0906" ], - // ], - // "asks": [ - // [ "31349.99000000", "0.0003" ], - // [ "31350.00000000", "0.0023" ], - // [ "31359.33000000", "0.0583" ], - // ], - // "after_auction_code": "BTC-USDT-2023-10-23T18:40:51.000Z", - // "call_time": "2023-10-23T18:40:51.068Z", - // "logical_time": "2023-10-23T18:40:51.000Z" - // } - // - object logical_time = this.parse8601(this.safeString(response, "logical_time")); - object orderbook = this.parseOrderBook(response, symbol, logical_time); - ((IDictionary)orderbook)["nonce"] = null; - return orderbook; - } - - /** - * @method - * @name coinlist#fetchOHLCV - * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-candles - * @param {string} symbol unified symbol of the market to fetch OHLCV data for - * @param {string} timeframe the length of time each candle represents - * @param {int} [since] timestamp in ms of the earliest candle to fetch - * @param {int} [limit] the maximum amount of candles to fetch - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume - */ - public async override Task fetchOHLCV(object symbol, object timeframe = null, object since = null, object limit = null, object parameters = null) - { - timeframe ??= "1m"; - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - object granularity = this.safeString(this.timeframes, timeframe); - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - { "granularity", granularity }, - }; - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - if (isTrue(!isEqual(limit, null))) - { - object duration = multiply(this.parseTimeframe(timeframe), 1000); - ((IDictionary)request)["end_time"] = this.iso8601(this.sum(since, multiply(duration, (limit)))); - } else - { - ((IDictionary)request)["end_time"] = this.iso8601(this.milliseconds()); - } - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - object response = await this.publicGetV1SymbolsSymbolCandles(this.extend(request, parameters)); - // - // { - // "candles": [ - // [ - // "2023-10-17T15:00:00.000Z", - // "28522.96000000", - // "28522.96000000", - // "28522.96000000", - // "28522.96000000", - // "0.1881", - // null - // ], - // [ - // "2023-10-17T15:30:00.000Z", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "0.0050", - // null - // ] - // ] - // } - // - object candles = this.safeList(response, "candles", new List() {}); - return this.parseOHLCVs(candles, market, timeframe, since, limit); - } - - public override object parseOHLCV(object ohlcv, object market = null) - { - // - // [ - // "2023-10-17T15:30:00.000Z", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "0.0050", - // null - // ] - // - return new List {this.parse8601(this.safeString(ohlcv, 0)), this.safeNumber(ohlcv, 1), this.safeNumber(ohlcv, 2), this.safeNumber(ohlcv, 3), this.safeNumber(ohlcv, 4), this.safeNumber(ohlcv, 5)}; - } - - /** - * @method - * @name coinlist#fetchTrades - * @description get the list of most recent trades for a particular symbol - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-auctions - * @param {string} symbol unified symbol of the market to fetch trades for - * @param {int} [since] timestamp in ms of the earliest trade to fetch - * @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades} - */ - public async override Task fetchTrades(object symbol, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - }; - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - } - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = mathMin(limit, 500); - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - object response = await this.publicGetV1SymbolsSymbolAuctions(this.extend(request, parameters)); - // - // { - // "auctions": [ - // { - // "symbol":"BTC-USDT", - // "auction_code":"BTC-USDT-2023-10-01T08:05:56.000Z", - // "price":"27241.53000000", - // "volume":"0.0052", - // "imbalance":"-1.0983", - // "logical_time":"2023-10-01T08:05:56.000Z", - // "call_time":"2023-10-01T08:05:56.068Z" - // }, - // { - // "symbol":"BTC-USDT", - // "auction_code":"BTC-USDT-2023-10-01T08:09:09.000Z", - // "price":"27236.83000000", - // "volume":"0.0283", - // "imbalance":"-1.0754", - // "logical_time":"2023-10-01T08:09:09.000Z", - // "call_time":"2023-10-01T08:09:09.078Z" - // } - // ] - // } - // - object auctions = this.safeList(response, "auctions", new List() {}); - return this.parseTrades(auctions, market, since, limit); - } - - public override object parseTrade(object trade, object market = null) - { - // - // fetchTrades - // { - // "symbol": "BTC-USDT", - // "auction_code": "BTC-USDT-2023-10-01T08:05:56.000Z", - // "price": "27241.53000000", - // "volume": "0.0052", - // "imbalance": "-1.0983", - // "logical_time": "2023-10-01T08:05:56.000Z", - // "call_time": "2023-10-01T08:05:56.068Z" - // } - // - // fetchMyTrades - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:22:14.000Z", - // "order_id": "83ed365f-497d-433b-96c1-9d08c1a12842", - // "quantity": "0.0008", - // "price": "1615.24000000", - // "fee": "0.005815", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:22:14.000Z" - // } - // - object marketId = this.safeString(trade, "symbol"); - market = this.safeMarket(marketId, market); - object symbol = getValue(market, "symbol"); - object id = this.safeString(trade, "auction_code"); - object timestamp = this.parse8601(this.safeString(trade, "logical_time")); - object priceString = this.safeString(trade, "price"); - object amountString = this.safeString2(trade, "volume", "quantity"); - object order = this.safeString(trade, "order_id"); - object fee = null; - object side = null; - object feeCost = this.safeString(trade, "fee"); - if (isTrue(!isEqual(feeCost, null))) - { - // only in fetchMyTrades - object amountIsNegative = Precise.stringLt(amountString, "0"); - if (isTrue(amountIsNegative)) - { - side = "sell"; - amountString = Precise.stringNeg(amountString); - } else - { - side = "buy"; - } - fee = new Dictionary() { - { "cost", feeCost }, - { "currency", this.safeString(trade, "fee_currency") }, - }; - } else - { - object imbalance = this.safeString(trade, "imbalance"); - if (isTrue(Precise.stringLt(imbalance, "0"))) - { - side = "buy"; - } else - { - side = "sell"; - } - } - object takerOrMaker = this.safeString(trade, "fee_type"); - return this.safeTrade(new Dictionary() { - { "id", id }, - { "order", order }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "symbol", symbol }, - { "type", null }, - { "side", side }, - { "takerOrMaker", takerOrMaker }, - { "price", priceString }, - { "amount", amountString }, - { "cost", null }, - { "fee", fee }, - { "info", trade }, - }, market); - } - - /** - * @method - * @name coinlist#fetchTradingFees - * @description fetch the trading fees for multiple markets - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols - */ - public async override Task fetchTradingFees(object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object response = await this.privateGetV1Fees(parameters); - // - // { - // fees_by_symbols: { - // 'BTC-USD,BTC-USDT,ETH-USD,ETH-USDT,ETH-BTC,AAVE-USD,AAVE-USDT,ALGO-USD,ALGO-USDT,AVAX-USD,AVAX-USDT,BICO-USD,BICO-USDT,BLD-USD,BLD-USDT,BTRST-USDT,BZZ-USDT,CELO-USD,CELO-BTC,CFG-USD,CFG-USDT,CLV-USDT,COMP-USD,COMP-USDT,CYBER-USDT,CQT-USDT,CSPR-USD,CSPR-USDT,CUSD-USD,CUSD-USDC,DOGE-USD,DOGE-USDT,DOT-USD,DOT-USDT,EFI-USDT,FIL-USD,FIL-USDT,FLOW-USD,FLOW-USDT,GAL-USD,GAL-USDT,GODS-USDT,GOG-USDT,HMT-USD,HMT-USDT,ICP-USD,ICP-USDT,IMX-USD,IMX-USDT,LINK-USD,LINK-USDT,MATIC-USD,MATIC-USDT,MINA-USD,MINA-USDT,MKR-USD,MKR-USDT,NEON-USDT,NYM-USD,NYM-USDT,OCEAN-USD,OXT-USD,ROSE-USD,ROSE-USDT,SKL-USD,SKL-USDT,SOL-USD,SOL-USDT,STX-USDT,SUI-USDT,T-USDT,UNI-USD,UNI-USDT,USDT-USD,VEGA-USDT,WAXL-USD,WAXL-USDT,WBTC-BTC,WCFG-USD,WCFG-USDT,XTZ-USD': { - // base: { - // fees: { maker: '0', taker: '0.0045', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_1: { - // fees: { maker: '0', taker: '0.003', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_2: { - // fees: { maker: '0', taker: '0.0025', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_3: { - // fees: { maker: '0', taker: '0.002', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_4: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_5: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_6: { - // fees: { maker: '0', taker: '0.0016', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_7: { - // fees: { maker: '0', taker: '0.0013', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_8: { - // fees: { maker: '0', taker: '0.0012', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_9: { - // fees: { maker: '0', taker: '0.001', liquidation: '0' }, - // floors: { maker: null, taker: null } - // } - // volume_tier_10: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_11: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // } - // } - // } - // - object fees = this.safeValue(response, "fees_by_symbols", new Dictionary() {}); - object result = new Dictionary() {}; - object groupsOfSymbols = new List(((IDictionary)fees).Keys); - for (object i = 0; isLessThan(i, getArrayLength(groupsOfSymbols)); postFixIncrement(ref i)) - { - object group = getValue(groupsOfSymbols, i); - object feeTiers = this.safeValue(fees, group, new Dictionary() {}); - object tiers = this.parseFeeTiers(feeTiers); - object firstTier = this.safeValue(feeTiers, "base", new Dictionary() {}); - object firstTierFees = this.safeValue(firstTier, "fees", new Dictionary() {}); - object ids = ((string)group).Split(new [] {((string)",")}, StringSplitOptions.None).ToList(); - for (object j = 0; isLessThan(j, getArrayLength(ids)); postFixIncrement(ref j)) - { - object id = getValue(ids, j); - object market = this.safeMarket(id); - object symbol = getValue(market, "symbol"); - object info = new Dictionary() {}; - ((IDictionary)info)[(string)group] = feeTiers; - ((IDictionary)result)[(string)symbol] = new Dictionary() { - { "info", info }, - { "symbol", symbol }, - { "maker", this.safeNumber(firstTierFees, "maker") }, - { "taker", this.safeNumber(firstTierFees, "taker") }, - { "percentage", true }, - { "tierBased", true }, - { "tiers", tiers }, - }; - } - } - return result; - } - - public virtual object parseFeeTiers(object feeTiers, object market = null) - { - // - // base: { - // fees: { maker: '0', taker: '0.0045', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_1: { - // fees: { maker: '0', taker: '0.003', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_2: { - // fees: { maker: '0', taker: '0.0025', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_3: { - // fees: { maker: '0', taker: '0.002', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_4: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_5: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_6: { - // fees: { maker: '0', taker: '0.0016', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_7: { - // fees: { maker: '0', taker: '0.0013', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_8: { - // fees: { maker: '0', taker: '0.0012', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_9: { - // fees: { maker: '0', taker: '0.001', liquidation: '0' }, - // floors: { maker: null, taker: null } - // } - // volume_tier_10: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_11: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // - object takerFees = new List() {}; - object makerFees = new List() {}; - object keys = new List(((IDictionary)feeTiers).Keys); - object keysLength = getArrayLength(keys); - if (isTrue(isGreaterThan(keysLength, 0))) - { - for (object i = 0; isLessThan(i, keysLength); postFixIncrement(ref i)) - { - object key = getValue(keys, i); - object tier = this.safeValue(feeTiers, key, new Dictionary() {}); - object tierFees = this.safeValue(tier, "fees", new Dictionary() {}); - object taker = this.safeString(tierFees, "taker"); - object maker = this.safeString(tierFees, "maker"); - ((IList)makerFees).Add(new List() {null, this.parseNumber(maker)}); - ((IList)takerFees).Add(new List() {null, this.parseNumber(taker)}); - } - takerFees = this.sortBy(takerFees, 1, true); - makerFees = this.sortBy(makerFees, 1, true); - object firstTier = this.safeDict(takerFees, 0, new List() {}); - object exchangeFees = this.safeDict(this, "fees", new Dictionary() {}); - object exchangeFeesTrading = this.safeDict(exchangeFees, "trading", new Dictionary() {}); - object exchangeFeesTradingTiers = this.safeDict(exchangeFeesTrading, "tiers", new Dictionary() {}); - object exchangeFeesTradingTiersTaker = this.safeList(exchangeFeesTradingTiers, "taker", new List() {}); - object exchangeFeesTradingTiersMaker = this.safeList(exchangeFeesTradingTiers, "maker", new List() {}); - object exchangeFeesTradingTiersTakerLength = getArrayLength(exchangeFeesTradingTiersTaker); - object firstTierLength = getArrayLength(firstTier); - if (isTrue(isTrue((isEqual(keysLength, exchangeFeesTradingTiersTakerLength))) && isTrue((isGreaterThan(firstTierLength, 0))))) - { - for (object i = 0; isLessThan(i, keysLength); postFixIncrement(ref i)) - { - ((List)getValue(takerFees, i))[Convert.ToInt32(0)] = getValue(getValue(exchangeFeesTradingTiersTaker, i), 0); - ((List)getValue(makerFees, i))[Convert.ToInt32(0)] = getValue(getValue(exchangeFeesTradingTiersMaker, i), 0); - } - } - } - return new Dictionary() { - { "maker", makerFees }, - { "taker", takerFees }, - }; - } - - /** - * @method - * @name coinlist#fetchAccounts - * @description fetch all the accounts associated with a profile - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-accounts - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type - */ - public async override Task fetchAccounts(object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object response = await this.privateGetV1Accounts(parameters); - // - // { - // "accounts": [ - // { - // "trader_id": "b18507ce-7d55-4bf1-b12a-0ccca5b90936", - // "name": "string" - // } - // ] - // } - // - object accounts = this.safeValue(response, "accounts", new List() {}); - return this.parseAccounts(accounts, parameters); - } - - public override object parseAccount(object account) - { - // - // { - // "trader_id": "b18507ce-7d55-4bf1-b12a-0ccca5b90936", - // "name": "string" - // } - // - return new Dictionary() { - { "id", this.safeString(account, "trader_id") }, - { "type", "trading" }, - { "code", null }, - { "info", account }, - }; - } - - /** - * @method - * @name coinlist#fetchBalance - * @description query for balance and get the amount of funds available for trading or funds locked in orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-balances - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure} - */ - public async override Task fetchBalance(object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object response = await this.privateGetV1Balances(parameters); - return this.parseBalance(response); - } - - public override object parseBalance(object response) - { - // - // { - // "asset_balances": { - // "BTC": "0.00308696", - // "ETH": "20.000000000000000000" - // }, - // "asset_holds": { - // "BTC": "0.00000000", - // "ETH": "1.000000000000000000" - // }, - // "net_liquidation_value_usd": "string" - // } - // - object result = new Dictionary() { - { "info", response }, - { "timestamp", null }, - { "datetime", null }, - }; - object totalBalances = this.safeValue(response, "asset_balances", new Dictionary() {}); - object usedBalances = this.safeValue(response, "asset_holds", new Dictionary() {}); - object currencyIds = new List(((IDictionary)totalBalances).Keys); - for (object i = 0; isLessThan(i, getArrayLength(currencyIds)); postFixIncrement(ref i)) - { - object currencyId = getValue(currencyIds, i); - object code = this.safeCurrencyCode(currencyId); - object account = this.account(); - ((IDictionary)account)["total"] = this.safeString(totalBalances, currencyId); - ((IDictionary)account)["used"] = this.safeString(usedBalances, currencyId, "0"); - ((IDictionary)result)[(string)code] = account; - } - return this.safeBalance(result); - } - - /** - * @method - * @name coinlist#fetchMyTrades - * @description fetch all trades made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fills - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch trades for - * @param {int} [limit] the maximum number of trades structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} - */ - public async override Task fetchMyTrades(object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() {}; - object market = null; - if (isTrue(!isEqual(symbol, null))) - { - market = this.market(symbol); - ((IDictionary)request)["symbol"] = getValue(market, "id"); - } - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - } - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = limit; - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - object response = await this.privateGetV1Fills(this.extend(request, parameters)); - // - // { - // "fills": [ - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:16:30.000Z", - // "order_id": "39911d5f-c789-4a7d-ad34-820a804d1da6", - // "quantity": "-0.0009", - // "price": "1608.83000000", - // "fee": "0.006516", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:16:30.000Z" - // }, - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:22:14.000Z", - // "order_id": "83ed365f-497d-433b-96c1-9d08c1a12842", - // "quantity": "0.0008", - // "price": "1615.24000000", - // "fee": "0.005815", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:22:14.000Z" - // }, - // ] - // } - // - object fills = this.safeList(response, "fills", new List() {}); - return this.parseTrades(fills, market, since, limit); - } - - /** - * @method - * @name coinlist#fetchOrderTrades - * @description fetch all the trades made from a single order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fills - * @param {string} id order id - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch trades for - * @param {int} [limit] the maximum number of trades to retrieve - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} - */ - public async override Task fetchOrderTrades(object id, object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - object request = new Dictionary() { - { "order_id", id }, - }; - return await this.fetchMyTrades(symbol, since, limit, this.extend(request, parameters)); - } - - /** - * @method - * @name coinlist#fetchOrders - * @description fetches information on multiple orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @param {string|string[]} [params.status] the status of the order - 'accepted', 'done', 'canceled', 'rejected', 'pending' (default [ 'accepted', 'done', 'canceled', 'rejected', 'pending' ]) - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task fetchOrders(object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object status = ((object)this.safeString(parameters, "status")); - if (isTrue(isEqual(status, null))) - { - status = new List() {"accepted", "done", "canceled", "rejected", "pending"}; - } - object request = new Dictionary() { - { "status", status }, - }; - object market = null; - if (isTrue(!isEqual(symbol, null))) - { - market = this.market(symbol); - ((IDictionary)request)["symbol"] = getValue(market, "id"); - } - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - } - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = limit; - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - object response = await this.privateGetV1Orders(this.extend(request, parameters)); - // - // { - // "orders":[ - // { - // "order_id":"913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price":"35800.00000000", - // "stop_price":null, - // "cost":"0.00000000", - // "fill_fees":"0.00000000", - // "trader_id":"9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status":"accepted", - // "epoch_timestamp":"2023-10-26T08:20:56.307Z", - // "origin":"web", - // "self_trade_prevention":null, - // "client_id":null, - // "created_at":"2023-10-26T08:20:56.307Z", - // "symbol":"BTC-USDT", - // "size":"0.0003", - // "side":"sell", - // "type":"limit", - // "post_only":false, - // "size_filled":"0.0000" - // } - // ] - // } - // - object orders = this.safeList(response, "orders", new List() {}); - return this.parseOrders(orders, market, since, limit); - } - - /** - * @method - * @name coinlist#fetchOrder - * @description fetches information on an order made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-specific-order-by-id - * @param {int|string} id order id - * @param {string} symbol not used by coinlist fetchOrder () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task fetchOrder(object id, object symbol = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() { - { "order_id", id }, - }; - object response = await this.privateGetV1OrdersOrderId(this.extend(request, parameters)); - // - // { - // "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe", - // "client_id": "string", - // "symbol": "string", - // "type": "market", - // "side": "buy", - // "size": "string", - // "price": "string", - // "stop_price": "string", - // "stop_trigger": "last", - // "self_trade_prevention": "keep-newest", - // "average_fill_price": "string", - // "fill_fees": "string", - // "size_filled": "string", - // "created_at": "2019-08-24T14:15:22Z", - // "epoch_timestamp": "2019-08-24T14:15:22Z", - // "post_only": true, - // "peg_price_type": "trailing-stop", - // "peg_offset_value": "string", - // "origin": "web", - // "status": "pending" - // } - // - return this.parseOrder(response); - } - - /** - * @method - * @name coinlist#fetchOpenOrders - * @description fetch all unfilled currently open orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch open orders for - * @param {int} [limit] the maximum number of open order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task fetchOpenOrders(object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() { - { "status", "accepted" }, - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, parameters)); - } - - /** - * @method - * @name coinlist#fetchClosedOrders - * @description fetches information on multiple closed orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of closed order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task fetchClosedOrders(object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() { - { "status", "done" }, - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, parameters)); - } - - /** - * @method - * @name coinlist#fetchCanceledOrders - * @description fetches information on multiple canceled orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of canceled order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async virtual Task fetchCanceledOrders(object symbol = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() { - { "status", "canceled" }, - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, parameters)); - } - - /** - * @method - * @name coinlist#cancelAllOrders - * @description cancel open orders of market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-all-orders - * @param {string} symbol unified market symbol - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task cancelAllOrders(object symbol = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = null; - object request = new Dictionary() {}; - if (isTrue(!isEqual(symbol, null))) - { - market = this.market(symbol); - ((IDictionary)request)["symbol"] = getValue(market, "id"); - } - object response = await this.privateDeleteV1Orders(this.extend(request, parameters)); - // - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - object orders = new List() {response}; - return this.parseOrders(orders, market); - } - - /** - * @method - * @name coinlist#cancelOrder - * @description cancels an open order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-specific-order-by-id - * @param {string} id order id - * @param {string} symbol not used by coinlist cancelOrder () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task cancelOrder(object id, object symbol = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object request = new Dictionary() { - { "order_id", id }, - }; - object response = await this.privateDeleteV1OrdersOrderId(this.extend(request, parameters)); - // - // { - // "message": "Cancel order request received.", - // "order_id": "d36e7588-6525-485c-b768-8ad8b3f745f9", - // "timestamp": "2023-10-26T14:36:37.559Z" - // } - // - return this.parseOrder(response); - } - - /** - * @method - * @name coinlist#cancelOrders - * @description cancel multiple orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-specific-orders - * @param {string[]} ids order ids - * @param {string} symbol not used by coinlist cancelOrders () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async virtual Task cancelOrders(object ids, object symbol = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - parameters = ids; - object response = await this.privateDeleteV1OrdersBulk(parameters); - // - // { - // "message": "Cancel order requests received.", - // "order_ids": [ - // "ff132955-43bc-4fe5-9d9c-5ba226cc89a0" - // ], - // "timestamp": "2024-06-01T02:32:30.305Z" - // } - // - object orderIds = this.safeList(response, "order_ids", new List() {}); - object orders = new List() {}; - object datetime = this.safeString(response, "timestamp"); - for (object i = 0; isLessThan(i, getArrayLength(orderIds)); postFixIncrement(ref i)) - { - ((IList)orders).Add(this.safeOrder(new Dictionary() { - { "info", getValue(orderIds, i) }, - { "id", getValue(orderIds, i) }, - { "lastUpdateTimestamp", this.parse8601(datetime) }, - })); - } - return orders; - } - - /** - * @method - * @name coinlist#createOrder - * @description create a trade order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#create-new-order - * @param {string} symbol unified symbol of the market to create an order in - * @param {string} type 'market' or 'limit' or 'stop_market' or 'stop_limit' or 'take_market' or 'take_limit' - * @param {string} side 'buy' or 'sell' - * @param {float} amount how much of currency you want to trade in units of base currency - * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately (default false) - * @param {float} [params.triggerPrice] only for the 'stop_market', 'stop_limit', 'take_market' or 'take_limit' orders (the price at which an order is triggered) - * @param {string} [params.clientOrderId] client order id (default undefined) - * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task createOrder(object symbol, object type, object side, object amount, object price = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - { "type", type }, - { "side", side }, - { "size", this.amountToPrecision(symbol, amount) }, - }; - object isMarket = false; - if (isTrue(isTrue(isTrue((isEqual(type, "limit"))) || isTrue((isEqual(type, "stop_limit")))) || isTrue((isEqual(type, "take_limit"))))) - { - if (isTrue(isEqual(price, null))) - { - throw new ArgumentsRequired ((string)add(add(add(this.id, " createOrder() requires a price argument for a "), type), " order")) ; - } - ((IDictionary)request)["price"] = this.priceToPrecision(symbol, price); - } else - { - isMarket = true; - } - object postOnly = null; - var postOnlyparametersVariable = this.handlePostOnly(isMarket, false, parameters); - postOnly = ((IList)postOnlyparametersVariable)[0]; - parameters = ((IList)postOnlyparametersVariable)[1]; - if (isTrue(postOnly)) - { - ((IDictionary)request)["post_only"] = true; - } - object triggerPrice = this.safeNumberN(parameters, new List() {"triggerPrice", "trigger_price", "stopPrice", "stop_price"}); - if (isTrue(!isEqual(triggerPrice, null))) - { - parameters = this.omit(parameters, new List() {"triggerPrice", "trigger_price", "stopPrice"}); - ((IDictionary)request)["stop_price"] = this.priceToPrecision(symbol, triggerPrice); - if (isTrue(isEqual(type, "market"))) - { - ((IDictionary)request)["type"] = "stop_market"; - } else if (isTrue(isEqual(type, "limit"))) - { - ((IDictionary)request)["type"] = "stop_limit"; - } - } else if (isTrue(isTrue(isTrue(isTrue((isEqual(type, "stop_market"))) || isTrue((isEqual(type, "stop_limit")))) || isTrue((isEqual(type, "take_market")))) || isTrue((isEqual(type, "take_limit"))))) - { - throw new ArgumentsRequired ((string)add(this.id, " createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders")) ; - } - object clientOrderId = this.safeString2(parameters, "clientOrderId", "client_id"); - if (isTrue(!isEqual(clientOrderId, null))) - { - ((IDictionary)request)["client_id"] = clientOrderId; - parameters = this.omit(parameters, new List() {"clientOrderId", "client_id"}); - } - object response = await this.privatePostV1Orders(this.extend(request, parameters)); - // - // { - // "message": "New order request received.", - // "order": { - // "symbol": "BTC-USDT", - // "type": "market", - // "side": "sell", - // "size": "0.0003", - // "order_id": "cad67c0f-9aec-4ac8-ac03-aaf5db299ff7", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b" - // }, - // "timestamp": "2023-10-26T11:30:55.376Z" - // } - // - object order = this.safeDict(response, "order", new Dictionary() {}); - return this.parseOrder(order, market); - } - - /** - * @method - * @name coinlist#editOrder - * @description create a trade order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#modify-existing-order - * @param {string} id order id - * @param {string} symbol unified symbol of the market to create an order in - * @param {string} type 'market' or 'limit' or 'stop_market' or 'stop_limit' or 'take_market' or 'take_limit' - * @param {string} side 'buy' or 'sell' - * @param {float} amount how much of currency you want to trade in units of base currency - * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - public async override Task editOrder(object id, object symbol, object type, object side, object amount = null, object price = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - if (isTrue(isEqual(amount, null))) - { - throw new ArgumentsRequired ((string)add(this.id, " editOrder() requires an amount argument")) ; - } - object market = this.market(symbol); - object request = new Dictionary() { - { "order_id", id }, - { "type", type }, - { "side", side }, - { "size", this.amountToPrecision(symbol, amount) }, - }; - if (isTrue(!isEqual(price, null))) - { - ((IDictionary)request)["price"] = this.priceToPrecision(symbol, price); - } - object response = await this.privatePatchV1OrdersOrderId(this.extend(request, parameters)); - return this.parseOrder(response, market); - } - - public override object parseOrder(object order, object market = null) - { - // - // fetchOrder - // { - // "order_id": "913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price": "35800.00000000", - // "stop_price":null, - // "cost": "0.00000000", - // "fill_fees": "0.00000000", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status": "canceled", - // "epoch_timestamp": "2023-10-26T08:20:56.307Z", - // "origin": "web", - // "self_trade_prevention":null, - // "client_id":null, - // "symbol": "BTC-USDT", - // "size": "0.0003", - // "side": "sell", - // "type": "limit", - // "post_only":false, - // "size_filled": "0.0000" - // } - // - // fetchOrders - // { - // "order_id":"913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price":"35800.00000000", - // "stop_price":null, - // "cost":"0.00000000", - // "fill_fees":"0.00000000", - // "trader_id":"9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status":"accepted", - // "epoch_timestamp":"2023-10-26T08:20:56.307Z", - // "origin":"web", - // "self_trade_prevention":null, - // "client_id":null, - // "created_at":"2023-10-26T08:20:56.307Z", - // "symbol":"BTC-USDT", - // "size":"0.0003", - // "side":"sell", - // "type":"limit", - // "post_only":false, - // "size_filled":"0.0000" - // } - // - // createOrder - // { - // "symbol": "BTC-USDT", - // "type": "market", - // "side": "sell", - // "size": "0.0003", - // "order_id": "cad67c0f-9aec-4ac8-ac03-aaf5db299ff7", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b" - // }, - // - // cancelOrder - // { - // "message": "Cancel order request received.", - // "order_id": "d36e7588-6525-485c-b768-8ad8b3f745f9", - // "timestamp": "2023-10-26T14:36:37.559Z" - // } - // - // cancelOrders - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - // cancelAllOrders - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - object id = this.safeString(order, "order_id"); - object marketId = this.safeString(order, "symbol"); - market = this.safeMarket(marketId, market); - object clientOrderId = this.safeString(order, "client_id"); - object timestampString = this.safeString2(order, "created_at", "epoch_timestamp"); - if (isTrue(isEqual(timestampString, null))) - { - timestampString = this.safeString(order, "timestamp"); - } - object timestamp = this.parse8601(timestampString); - object status = this.parseOrderStatus(this.safeString(order, "status")); - object type = this.parseOrderType(this.safeString(order, "type")); - object side = this.safeString(order, "side"); - object price = this.safeString(order, "price"); - object triggerPrice = this.safeString(order, "stop_price"); - object average = this.safeString(order, "average_fill_price"); // from documentation - object amount = this.safeString(order, "size"); - object filled = this.safeString(order, "size_filled"); - object feeCost = this.safeString(order, "fill_fees"); - object postOnly = this.safeValue(order, "post_only"); - object fee = null; - if (isTrue(!isEqual(feeCost, null))) - { - fee = new Dictionary() { - { "currency", getValue(market, "quote") }, - { "cost", feeCost }, - { "rate", null }, - }; - } - return this.safeOrder(new Dictionary() { - { "id", id }, - { "clientOrderId", clientOrderId }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "lastTradeTimestamp", null }, - { "status", status }, - { "symbol", getValue(market, "symbol") }, - { "type", type }, - { "timeInForce", "GTC" }, - { "side", side }, - { "price", price }, - { "triggerPrice", triggerPrice }, - { "average", average }, - { "amount", amount }, - { "cost", null }, - { "filled", filled }, - { "remaining", null }, - { "fee", fee }, - { "trades", null }, - { "info", order }, - { "postOnly", postOnly }, - }, market); - } - - public virtual object parseOrderStatus(object status) - { - object statuses = new Dictionary() { - { "pending", "open" }, - { "accepted", "open" }, - { "rejected", "rejected" }, - { "done", "closed" }, - { "canceled", "canceled" }, - }; - return this.safeString(statuses, status, status); - } - - public virtual object parseOrderType(object status) - { - object statuses = new Dictionary() { - { "market", "market" }, - { "limit", "limit" }, - { "stop_market", "market" }, - { "stop_limit", "limit" }, - { "take_market", "market" }, - { "take_limit", "limit" }, - }; - return this.safeString(statuses, status, status); - } - - /** - * @method - * @name coinlist#transfer - * @description transfer currency internally between wallets on the same account - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-between-entities - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-from-wallet-to-pro - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-from-pro-to-wallet - * @param {string} code unified currency code - * @param {float} amount amount to transfer - * @param {string} fromAccount account to transfer from - * @param {string} toAccount account to transfer to - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure} - */ - public async override Task transfer(object code, object amount, object fromAccount, object toAccount, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object currency = this.currency(code); - object request = new Dictionary() { - { "asset", getValue(currency, "id") }, - { "amount", this.currencyToPrecision(code, amount) }, - }; - object accountsByType = this.safeValue(this.options, "accountsByType", new Dictionary() {}); - object fromAcc = this.safeString(accountsByType, fromAccount, fromAccount); - object toAcc = this.safeString(accountsByType, toAccount, toAccount); - object response = null; - if (isTrue(isTrue((isEqual(fromAcc, "funding"))) && isTrue((isEqual(toAcc, "trading"))))) - { - response = await this.privatePostV1TransfersFromWallet(this.extend(request, parameters)); - } else if (isTrue(isTrue((isEqual(fromAcc, "trading"))) && isTrue((isEqual(toAcc, "funding"))))) - { - response = await this.privatePostV1TransfersToWallet(this.extend(request, parameters)); - } else - { - ((IDictionary)request)["from_trader_id"] = fromAcc; - ((IDictionary)request)["to_trader_id"] = toAcc; - response = await this.privatePostV1TransfersInternalTransfer(this.extend(request, parameters)); - } - // - // privatePostV1TransfersInternalTransfer - // { - // "from_trader_id": "1f494ace-b3ed-4324-b202-55526ed06381", - // "to_trader_id": "d32c7a40-cc24-44b0-8597-f9edb3da989f", - // "asset": "string", - // "amount": "string" - // } - // - // privatePostV1TransfersFromWallet, privatePostV1TransfersToWallet - // { - // "transfer_id": "bb34f528-d9b0-47c6-b11f-4d4840b86ee3" - // } - // - object transfer = this.parseTransfer(response, currency); - return transfer; - } - - /** - * @method - * @name coinlist#fetchTransfers - * @description fetch a history of internal transfers between CoinList.co and CoinList Pro. It does not return external deposits or withdrawals - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-transfers - * @param {string} code unified currency code - * @param {int} [since] the earliest time in ms to fetch transfers for - * @param {int} [limit] the maximum number of transfer structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure} - */ - public async override Task fetchTransfers(object code = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object currency = null; - if (isTrue(!isEqual(code, null))) - { - currency = this.currency(code); - } - object request = new Dictionary() {}; - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - } - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = limit; - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - object response = await this.privateGetV1Transfers(this.extend(request, parameters)); - // - // { - // "transfers": [ - // { - // "transfer_id": "2c02db25-e8f2-4271-8222-e110bfd0aa2a", - // "created_at": "2023-10-20T13:15:37.000Z", - // "confirmed_at": "2023-10-20T13:15:37.000Z", - // "asset": "ETH", - // "amount": "0.010000000000000000", - // "status": "confirmed" - // }, - // { - // "transfer_id": "890694db-156c-4e93-a3ef-4db61685aca7", - // "created_at": "2023-10-26T14:32:22.000Z", - // "confirmed_at": "2023-10-26T14:32:22.000Z", - // "asset": "USD", - // "amount": "-3.00", - // "status": "confirmed" - // } - // ] - // } - // - object transfers = this.safeList(response, "transfers", new List() {}); - return this.parseTransfers(transfers, currency, since, limit); - } - - public override object parseTransfer(object transfer, object currency = null) - { - // - // fetchTransfers - // { - // "transfer_id": "890694db-156c-4e93-a3ef-4db61685aca7", - // "created_at": "2023-10-26T14:32:22.000Z", - // "confirmed_at": "2023-10-26T14:32:22.000Z", - // "asset": "USD", - // "amount": "-3.00", - // "status": "confirmed" - // } - // - // transfer - privatePostV1TransfersInternalTransfer - // { - // "from_trader_id": "1f494ace-b3ed-4324-b202-55526ed06381", - // "to_trader_id": "d32c7a40-cc24-44b0-8597-f9edb3da989f", - // "asset": "string", - // "amount": "string" - // } - // - // transfer - privatePostV1TransfersFromWallet, privatePostV1TransfersToWallet - // { - // "transfer_id": "bb34f528-d9b0-47c6-b11f-4d4840b86ee3" - // } - // - object currencyId = this.safeString(transfer, "asset"); - object confirmedAt = this.safeString(transfer, "confirmed_at"); - object timetstamp = this.parse8601(confirmedAt); - object status = this.safeString(transfer, "status"); - object amountString = this.safeString(transfer, "amount"); - object fromAccount = null; - object toAccount = null; - object amount = null; - if (isTrue(!isEqual(amountString, null))) - { - object amountIsNegative = Precise.stringLt(amountString, "0"); - if (isTrue(amountIsNegative)) - { - fromAccount = "trading"; - toAccount = "funding"; - amountString = Precise.stringNeg(amountString); - } else - { - fromAccount = "funding"; - toAccount = "trading"; - } - amount = this.parseNumber(amountString); - } - return new Dictionary() { - { "info", transfer }, - { "id", this.safeString(transfer, "transfer_id") }, - { "timestamp", timetstamp }, - { "datetime", this.iso8601(timetstamp) }, - { "currency", this.safeCurrencyCode(currencyId, currency) }, - { "amount", amount }, - { "fromAccount", fromAccount }, - { "toAccount", toAccount }, - { "status", this.parseTransferStatus(status) }, - }; - } - - public virtual object parseTransferStatus(object status) - { - object statuses = new Dictionary() { - { "confirmed", "ok" }, - }; - return this.safeString(statuses, status, status); - } - - /** - * @method - * @name coinlist#fetchDepositsWithdrawals - * @description fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-coinlist-wallet-ledger - * @param {string} [code] unified currency code for the currency of the deposit/withdrawals - * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal - * @param {int} [limit] max number of deposit/withdrawals to return (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure} - */ - public async override Task fetchDepositsWithdrawals(object code = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - if (isTrue(isEqual(code, null))) - { - throw new ArgumentsRequired ((string)add(this.id, " fetchDepositsWithdrawals() requires a code argument")) ; - } - object traderId = this.safeString2(parameters, "trader_id", "traderId"); - if (isTrue(isEqual(traderId, null))) - { - throw new ArgumentsRequired ((string)add(this.id, " fetchDepositsWithdrawals() requires a traderId argument in the params")) ; - } - await this.loadMarkets(); - object currency = this.currency(code); - object request = new Dictionary() { - { "asset", getValue(currency, "id") }, - { "trader_id", traderId }, - }; - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = limit; - } - parameters = this.omit(parameters, new List() {"trader_id", "traderId"}); - object response = await this.privateGetV1AccountsTraderIdWalletLedger(this.extend(request, parameters)); - // - // [ - // { - // "id": "2c02db25-e8f2-4271-8222-e110bfd0aa2a", - // "asset": "ETH", - // "amount": "0.01", - // "created_at": "2023-10-20T13:15:37.000Z", - // "description": "Transfer to CoinList Pro", - // "type": "PRO_TRANSFER", - // "delta": "-0.010000000000000000" - // }, - // { - // "id": "7139384d-6cec-479e-a19c-d498647ccb47", - // "asset": "ETH", - // "amount": "0.01", - // "created_at": "2023-10-20T13:10:55.000Z", - // "description": "CRYPTO_DEPOSIT", - // "type": "CRYPTO_DEPOSIT", - // "delta": "0.010000000000000000" - // }, - // - // ... - // - // { - // "id": "91bbbb22-5ede-4e9a-81ef-3f9318aa83d2", - // "asset": "USDT", - // "amount": "4.169654", - // "withdrawal_fee_amount": "8.830346000000000000", - // "created_at": "2023-10-27T16:14:11.000Z", - // "description": "CRYPTO_WITHDRAWAL", - // "type": "CRYPTO_WITHDRAWAL", - // "delta": "-4.169654000000000000" - // }, - // { - // "id": "830261bd-cda9-401f-b6df-105f4da3b37c", - // "asset": "USDT", - // "amount": "13", - // "created_at": "2023-10-27T14:52:05.000Z", - // "description": "Transfer from CoinList Pro", - // "type": "PRO_TRANSFER", - // "delta": "13.000000000000000000" - // } - // ] - // - // coinlist returns both internal transfers and blockchain transactions - return this.parseTransactions(response, currency, since, limit); - } - - /** - * @method - * @name coinlist#withdraw - * @description request a withdrawal from CoinList wallet. (Disabled by default. Contact CoinList to apply for an exception.) - * @see https://trade-docs.coinlist.co/?javascript--nodejs#request-withdrawal-from-wallet - * @param {string} code unified currency code - * @param {float} amount the amount to withdraw - * @param {string} address the address to withdraw to - * @param {string} tag - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure} - */ - public async override Task withdraw(object code, object amount, object address, object tag = null, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object currency = this.currency(code); - object request = new Dictionary() { - { "asset", getValue(currency, "id") }, - { "amount", this.currencyToPrecision(code, amount) }, - { "destination_address", address }, - }; - object response = await this.privatePostV1TransfersWithdrawalRequest(this.extend(request, parameters)); - // - // { - // "transfer_id": "d4a2d8dd-7def-4545-a062-761683b9aa05" - // } - // - object data = this.safeDict(response, "data", new Dictionary() {}); - return this.parseTransaction(data, currency); - } - - public override object parseTransaction(object transaction, object currency = null) - { - // withdraw - // - // { - // "transfer_id": "d4a2d8dd-7def-4545-a062-761683b9aa05" - // } - // - // fetchDepositsWithdrawals - // { - // "id": "91bbbb22-5ede-4e9a-81ef-3f9318aa83d2", - // "asset": "USDT", - // "amount": "4.169654", - // "withdrawal_fee_amount": "8.830346000000000000", - // "created_at": "2023-10-27T16:14:11.000Z", - // "description": "CRYPTO_WITHDRAWAL", - // "type": "CRYPTO_WITHDRAWAL", - // "delta": "-4.169654000000000000" - // }, - // - object currencyId = this.safeString(transaction, "asset"); - object code = this.safeCurrencyCode(currencyId, currency); - object id = this.safeString2(transaction, "id", "transfer_id"); - object amount = this.safeNumber(transaction, "amount"); - object timestamp = this.parse8601(this.safeString(transaction, "created_at")); - object type = this.safeString(transaction, "type", null); - if (isTrue(isEqual(type, null))) - { - type = "withdrawal"; // undefined only in withdraw() method - } else - { - type = this.parseTransactionType(type); - } - object fee = null; - object feeCost = this.safeString(transaction, "withdrawal_fee_amount"); - if (isTrue(!isEqual(feeCost, null))) - { - fee = new Dictionary() { - { "cost", feeCost }, - { "currency", code }, - }; - } - return new Dictionary() { - { "info", transaction }, - { "id", id }, - { "txid", null }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "network", null }, - { "addressFrom", null }, - { "address", null }, - { "addressTo", null }, - { "tagFrom", null }, - { "tag", null }, - { "tagTo", null }, - { "type", type }, - { "amount", amount }, - { "currency", code }, - { "status", null }, - { "updated", null }, - { "fee", fee }, - { "comment", this.safeString(transaction, "description") }, - { "internal", null }, - }; - } - - public virtual object parseTransactionType(object type) - { - object types = new Dictionary() { - { "CRYPTO_DEPOSIT", "deposit" }, - { "CRYPTO_WITHDRAWAL", "withdrawal" }, - { "PRO_TRANSFER", "transfer" }, - }; - return this.safeString(types, type, type); - } - - /** - * @method - * @name coinlist#fetchLedger - * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history - * @param {string} [code] unified currency code, default is undefined - * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined - * @param {int} [limit] max number of ledger entries to return (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger} - */ - public async override Task fetchLedger(object code = null, object since = null, object limit = null, object parameters = null) - { - parameters ??= new Dictionary(); - object traderId = this.safeString2(parameters, "trader_id", "traderId"); - if (isTrue(isEqual(traderId, null))) - { - throw new ArgumentsRequired ((string)add(this.id, " fetchLedger() requires a traderId argument in the params")) ; - } - await this.loadMarkets(); - object request = new Dictionary() { - { "trader_id", traderId }, - }; - object currency = null; - if (isTrue(!isEqual(code, null))) - { - currency = this.currency(code); - } - if (isTrue(!isEqual(since, null))) - { - ((IDictionary)request)["start_time"] = this.iso8601(since); - } - if (isTrue(!isEqual(limit, null))) - { - ((IDictionary)request)["count"] = limit; - } - object until = this.safeInteger(parameters, "until"); - if (isTrue(!isEqual(until, null))) - { - parameters = this.omit(parameters, new List() {"until"}); - ((IDictionary)request)["end_time"] = this.iso8601(until); - } - parameters = this.omit(parameters, new List() {"trader_id", "traderId"}); - object response = await this.privateGetV1AccountsTraderIdLedger(this.extend(request, parameters)); - // - // { - // "transactions": [ - // { - // "transaction_id": "0288634e-49bd-494d-b04a-18fd1832d394", - // "transaction_type": "XFER", - // "type": "deposit", - // "asset": "ETH", - // "symbol": null, - // "amount": "0.010000000000000000", - // "details": null, - // "created_at": "2023-10-20T13:15:39.443Z" - // }, - // { - // "transaction_id": "47a45928-abcd-4c12-8bd6-587c3028025f", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "1.447947", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "1ffe3a54-916e-41f0-b957-3a01309eb009", - // "transaction_type": "FEE", - // "type": "fee", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "-0.006516", - // "details": { - // "fee_details": [ - // { - // "insurance_fee": "0", - // "order_id": "39911d5f-c789-4a7d-ad34-820a804d1da6", - // "fee_type": "taker", - // "fee_currency": "USDT" - // } - // ] - // }, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "3930e8a3-2218-481f-8c3c-2219287e205e", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "ETH", - // "symbol": "ETH-USDT", - // "amount": "-0.000900000000000000", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "a6c65cb3-95d0-44e2-8202-f70581d6e55c", - // "transaction_type": "XFER", - // "type": "withdrawal", - // "asset": "USD", - // "symbol": null, - // "amount": "-3.00", - // "details": null, - // "created_at": "2023-10-26T14:32:24.887Z" - // } - // ] - // } - // - object ledger = this.safeValue(response, "transactions", new List() {}); - return this.parseLedger(ledger, currency, since, limit); - } - - public override object parseLedgerEntry(object item, object currency = null) - { - // - // deposit transaction from wallet (funding) to pro (trading) - // { - // "transaction_id": "0288634e-49bd-494d-b04a-18fd1832d394", - // "transaction_type": "XFER", - // "type": "deposit", - // "asset": "ETH", - // "symbol": null, - // "amount": "0.010000000000000000", - // "details": null, - // "created_at": "2023-10-20T13:15:39.443Z" - // } - // - // withdrawal transaction from pro (trading) to wallet (funding) - // { - // "transaction_id": "a6c65cb3-95d0-44e2-8202-f70581d6e55c", - // "transaction_type": "XFER", - // "type": "withdrawal", - // "asset": "USD", - // "symbol": null, - // "amount": "-3.00", - // "details": null, - // "created_at": "2023-10-26T14:32:24.887Z" - // } - // - // sell trade - // { - // "transaction_id": "47a45928-abcd-4c12-8bd6-587c3028025f", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "1.447947", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // } - // - // buy trade - // { - // "transaction_id": "46d20a93-45c4-4441-a238-f89602eb8c8c", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "ETH", - // "symbol": "ETH-USDT", - // "amount": "0.000800000000000000", - // "details": null, - // "created_at": "2023-10-20T13:22:14.256Z" - // }, - // - // fee - // { - // "transaction_id": "57fd526c-36b1-4721-83ce-42aadcb1e953", - // "transaction_type": "FEE", - // "type": "fee", - // "asset": "USDT", - // "symbol": "BTC-USDT", - // "amount": "-0.047176", - // "details": { - // "fee_details": [ - // { - // "insurance_fee": "0", - // "order_id": "c0bc33cd-eeb9-40a0-ab5f-2d99f323ef58", - // "fee_type": "taker", - // "fee_currency": "USDT" - // } - // ] - // }, - // "created_at": "2023-10-25T16:46:24.294Z" - // } - // - object id = this.safeString(item, "transaction_id"); - object createdAt = this.safeString(item, "created_at"); - object timestamp = this.parse8601(createdAt); - object amount = this.safeString(item, "amount"); - object amountIsNegative = Precise.stringLt(amount, "0"); - object direction = null; - if (isTrue(amountIsNegative)) - { - direction = "out"; - amount = Precise.stringNeg(amount); - } else - { - direction = "in"; - } - object currencyId = this.safeString(item, "asset"); - object code = this.safeCurrencyCode(currencyId, currency); - currency = this.safeCurrency(currencyId, currency); - object type = this.parseLedgerEntryType(this.safeString(item, "type")); - return this.safeLedgerEntry(new Dictionary() { - { "info", item }, - { "id", id }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "direction", direction }, - { "account", "trading" }, - { "referenceId", null }, - { "referenceAccount", null }, - { "type", type }, - { "currency", code }, - { "amount", this.parseNumber(amount) }, - { "before", null }, - { "after", null }, - { "status", "ok" }, - { "fee", null }, - }, currency); - } - - public virtual object parseLedgerEntryType(object type) - { - object types = new Dictionary() { - { "atomic token swap", "trade" }, - { "fee", "fee" }, - { "deposit", "transfer" }, - { "withdrawal", "transfer" }, - }; - return this.safeString(types, type, type); - } - - /** - * @method - * @name coinlist#fetchFundingRate - * @description fetch the current funding rate - * @see https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates - * @param {string} symbol unified market symbol - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure} - */ - public async override Task fetchFundingRate(object symbol, object parameters = null) - { - parameters ??= new Dictionary(); - await this.loadMarkets(); - object market = this.market(symbol); - if (!isTrue(getValue(market, "swap"))) - { - throw new BadSymbol ((string)add(this.id, " fetchFundingRate() supports swap contracts only")) ; - } - object request = new Dictionary() { - { "symbol", getValue(market, "id") }, - }; - object response = await this.publicGetV1SymbolsSymbolFunding(this.extend(request, parameters)); - // - // { - // "last": { - // "funding_rate": "-0.00043841", - // "funding_time": "2025-04-15T04:00:00.000Z" - // }, - // "next": { - // "funding_rate": "-0.00046952", - // "funding_time": "2025-04-15T12:00:00.000Z" - // }, - // "indicative": { - // "funding_rate": "-0.00042517", - // "funding_time": "2025-04-15T20:00:00.000Z" - // }, - // "timestamp": "2025-04-15T07:01:15.219Z" - // } - // - return this.parseFundingRate(response, market); - } - - public override object parseFundingRate(object contract, object market = null) - { - // - // { - // "last": { - // "funding_rate": "-0.00043841", - // "funding_time": "2025-04-15T04:00:00.000Z" - // }, - // "next": { - // "funding_rate": "-0.00046952", - // "funding_time": "2025-04-15T12:00:00.000Z" - // }, - // "indicative": { - // "funding_rate": "-0.00042517", - // "funding_time": "2025-04-15T20:00:00.000Z" - // }, - // "timestamp": "2025-04-15T07:01:15.219Z" - // } - // - object previous = this.safeDict(contract, "last", new Dictionary() {}); - object current = this.safeDict(contract, "next", new Dictionary() {}); - object next = this.safeDict(contract, "indicative", new Dictionary() {}); - object previousDatetime = this.safeString(previous, "funding_time"); - object currentDatetime = this.safeString(current, "funding_time"); - object nextDatetime = this.safeString(next, "funding_time"); - object datetime = this.safeString(contract, "timestamp"); - return new Dictionary() { - { "info", contract }, - { "symbol", this.safeSymbol(null, market) }, - { "markPrice", null }, - { "indexPrice", null }, - { "interestRate", null }, - { "estimatedSettlePrice", null }, - { "timestamp", this.parse8601(datetime) }, - { "datetime", datetime }, - { "fundingRate", this.safeNumber(current, "funding_rate") }, - { "fundingTimestamp", this.parse8601(currentDatetime) }, - { "fundingDatetime", currentDatetime }, - { "nextFundingRate", this.safeNumber(next, "funding_rate") }, - { "nextFundingTimestamp", this.parse8601(nextDatetime) }, - { "nextFundingDatetime", nextDatetime }, - { "previousFundingRate", this.safeNumber(previous, "funding_rate") }, - { "previousFundingTimestamp", this.parse8601(previousDatetime) }, - { "previousFundingDatetime", previousDatetime }, - { "interval", "8h" }, - }; - } - - public override object sign(object path, object api = null, object method = null, object parameters = null, object headers = null, object body = null) - { - api ??= "public"; - method ??= "GET"; - parameters ??= new Dictionary(); - object request = this.omit(parameters, this.extractParams(path)); - object endpoint = add("/", this.implodeParams(path, parameters)); - object url = add(getValue(getValue(this.urls, "api"), api), endpoint); - object isBulk = ((parameters is IList) || (parameters.GetType().IsGenericType && parameters.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>)))); - object query = null; - if (!isTrue(isBulk)) - { - query = this.urlencode(request); - } - if (isTrue(isEqual(api, "private"))) - { - this.checkRequiredCredentials(); - object timestamp = ((object)this.seconds()).ToString(); - object auth = add(add(timestamp, method), endpoint); - if (isTrue(isTrue(isTrue((isEqual(method, "POST"))) || isTrue((isEqual(method, "PATCH")))) || isTrue(isBulk))) - { - body = this.json(request); - auth = add(auth, body); - } else if (isTrue(isTrue(!isEqual(query, null)) && isTrue(!isEqual(((string)query).Length, 0)))) - { - auth = add(auth, add("?", query)); - url = add(url, add("?", query)); - } - object signature = this.hmac(this.encode(auth), this.base64ToBinary(this.secret), sha256, "base64"); - headers = new Dictionary() { - { "CL-ACCESS-KEY", this.apiKey }, - { "CL-ACCESS-SIG", signature }, - { "CL-ACCESS-TIMESTAMP", timestamp }, - { "Content-Type", "application/json" }, - }; - } else if (isTrue(isTrue(!isEqual(query, null)) && isTrue(!isEqual(((string)query).Length, 0)))) - { - url = add(url, add("?", query)); - } - return new Dictionary() { - { "url", url }, - { "method", method }, - { "body", body }, - { "headers", headers }, - }; - } - - public override object handleErrors(object code, object reason, object url, object method, object headers, object body, object response, object requestHeaders, object requestBody) - { - if (isTrue(isEqual(response, null))) - { - // In some cases the exchange returns 202 Accepted for bad orders. - // The body of that response contains order_id of the order. - // Some bad orders will get status 'rejected' and could be fetched later (by using fetchOrders() or fetchOrder(order_id)). - // While others don't get any status, they simply disappear, but the response is still 202 Accepted and contains their order_id. - // When using fechOrder(order_id) for such disappeared orders, the exchange returns an empty response with code 404. - if (isTrue(isTrue(isTrue((isEqual(code, 404))) && isTrue((isGreaterThanOrEqual(getIndexOf(url, "/orders/"), 0)))) && isTrue((isEqual(method, "GET"))))) - { - object parts = ((string)url).Split(new [] {((string)"/orders/")}, StringSplitOptions.None).ToList(); - object orderId = this.safeString(parts, 1); - throw new OrderNotFound ((string)add(add(add(this.id, " order "), orderId), " not found (or rejected on the exchange side)")) ; - } - return null; - } - object responseCode = this.safeString(response, "status"); - object messageCode = this.safeString(response, "message_code"); - if (isTrue(isTrue((!isEqual(messageCode, null))) || isTrue((isTrue(isTrue(isTrue(isTrue((!isEqual(responseCode, null))) && isTrue((!isEqual(code, 200)))) && isTrue((!isEqual(code, 202)))) && isTrue((!isEqual(responseCode, "200")))) && isTrue((!isEqual(responseCode, "202"))))))) - { - object feedback = add(add(this.id, " "), body); - object message = this.safeString(response, "message"); - this.throwBroadlyMatchedException(getValue(this.exceptions, "broad"), message, feedback); - this.throwExactlyMatchedException(getValue(this.exceptions, "exact"), messageCode, feedback); - throw new ExchangeError ((string)feedback) ; - } - return null; - } -} diff --git a/cs/ccxt/exchanges/cryptocom.cs b/cs/ccxt/exchanges/cryptocom.cs index 4cafd8912cba8..024b3302b5ad9 100644 --- a/cs/ccxt/exchanges/cryptocom.cs +++ b/cs/ccxt/exchanges/cryptocom.cs @@ -503,7 +503,29 @@ public async override Task fetchCurrencies(object parameters = null) { return null; } - object response = await this.v1PrivatePostPrivateGetCurrencyNetworks(parameters); + object skipFetchCurrencies = false; + var skipFetchCurrenciesparametersVariable = this.handleOptionAndParams(parameters, "fetchCurrencies", "skipFetchCurrencies", false); + skipFetchCurrencies = ((IList)skipFetchCurrenciesparametersVariable)[0]; + parameters = ((IList)skipFetchCurrenciesparametersVariable)[1]; + if (isTrue(skipFetchCurrencies)) + { + // sub-accounts can't access this endpoint + return null; + } + object response = new Dictionary() {}; + try + { + response = await this.v1PrivatePostPrivateGetCurrencyNetworks(parameters); + } catch(Exception e) + { + if (isTrue(e is ExchangeError)) + { + // sub-accounts can't access this endpoint + // {"code":"10001","msg":"SYS_ERROR"} + return null; + } + throw e; + } // // { // "id": "1747502328559", @@ -528,7 +550,7 @@ public async override Task fetchCurrencies(object parameters = null) // "network_id": "CRONOS", // "withdrawal_fee": "0.18000000", // "withdraw_enabled": true, - // "min_withdrawal_amount": "0.36", + // "min_withdrawal_amount": "0.35", // "deposit_enabled": true, // "confirmation_required": "15" // }, diff --git a/cs/ccxt/exchanges/cryptomus.cs b/cs/ccxt/exchanges/cryptomus.cs index 3f14648dc23f4..7025da52bfecd 100644 --- a/cs/ccxt/exchanges/cryptomus.cs +++ b/cs/ccxt/exchanges/cryptomus.cs @@ -361,71 +361,47 @@ public async override Task fetchCurrencies(object parameters = null) // } // object coins = this.safeList(response, "result"); + object groupedById = this.groupBy(coins, "currency_code"); + object keys = new List(((IDictionary)groupedById).Keys); object result = new Dictionary() {}; - for (object i = 0; isLessThan(i, getArrayLength(coins)); postFixIncrement(ref i)) + for (object i = 0; isLessThan(i, getArrayLength(keys)); postFixIncrement(ref i)) { - object networkEntry = getValue(coins, i); - object currencyId = this.safeString(networkEntry, "currency_code"); - object code = this.safeCurrencyCode(currencyId); - if (!isTrue((inOp(result, code)))) + object id = getValue(keys, i); + object code = this.safeCurrencyCode(id); + object networks = new Dictionary() {}; + object networkEntries = getValue(groupedById, id); + for (object j = 0; isLessThan(j, getArrayLength(networkEntries)); postFixIncrement(ref j)) { - ((IDictionary)result)[(string)code] = new Dictionary() { - { "id", currencyId }, - { "code", code }, - { "precision", null }, - { "type", null }, - { "name", null }, - { "active", null }, - { "deposit", null }, - { "withdraw", null }, - { "fee", null }, + object networkEntry = getValue(networkEntries, j); + object networkId = this.safeString(networkEntry, "network_code"); + object networkCode = this.networkIdToCode(networkId); + ((IDictionary)networks)[(string)networkCode] = new Dictionary() { + { "id", networkId }, + { "network", networkCode }, { "limits", new Dictionary() { { "withdraw", new Dictionary() { - { "min", null }, - { "max", null }, + { "min", this.safeNumber(networkEntry, "min_withdraw") }, + { "max", this.safeNumber(networkEntry, "max_withdraw") }, } }, { "deposit", new Dictionary() { - { "min", null }, - { "max", null }, + { "min", this.safeNumber(networkEntry, "min_deposit") }, + { "max", this.safeNumber(networkEntry, "max_deposit") }, } }, } }, - { "networks", new Dictionary() {} }, - { "info", new Dictionary() {} }, + { "active", null }, + { "deposit", this.safeBool(networkEntry, "can_withdraw") }, + { "withdraw", this.safeBool(networkEntry, "can_deposit") }, + { "fee", null }, + { "precision", null }, + { "info", networkEntry }, }; } - object networkId = this.safeString(networkEntry, "network_code"); - object networkCode = this.networkIdToCode(networkId); - ((IDictionary)getValue(getValue(result, code), "networks"))[(string)networkCode] = new Dictionary() { - { "id", networkId }, - { "network", networkCode }, - { "limits", new Dictionary() { - { "withdraw", new Dictionary() { - { "min", this.safeNumber(networkEntry, "min_withdraw") }, - { "max", this.safeNumber(networkEntry, "max_withdraw") }, - } }, - { "deposit", new Dictionary() { - { "min", this.safeNumber(networkEntry, "min_deposit") }, - { "max", this.safeNumber(networkEntry, "max_deposit") }, - } }, - } }, - { "active", null }, - { "deposit", this.safeBool(networkEntry, "can_withdraw") }, - { "withdraw", this.safeBool(networkEntry, "can_deposit") }, - { "fee", null }, - { "precision", null }, - { "info", networkEntry }, - }; - // add entry in info - object info = this.safeList(getValue(result, code), "info", new List() {}); - ((IList)info).Add(networkEntry); - ((IDictionary)getValue(result, code))["info"] = info; - } - // only after all entries are formed in currencies, restructure each entry - object allKeys = new List(((IDictionary)result).Keys); - for (object i = 0; isLessThan(i, getArrayLength(allKeys)); postFixIncrement(ref i)) - { - object code = getValue(allKeys, i); - ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(getValue(result, code)); // this is needed after adding network entry + ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { + { "id", id }, + { "code", code }, + { "networks", networks }, + { "info", networkEntries }, + }); } return result; } @@ -466,7 +442,7 @@ public override object parseTicker(object ticker, object market = null) // // { // "currency_pair": "XMR_USDT", - // "last_price": "158.04829771", + // "last_price": "158.04829772", // "base_volume": "0.35185785", // "quote_volume": "55.523761128544" // } diff --git a/cs/ccxt/exchanges/delta.cs b/cs/ccxt/exchanges/delta.cs index 209acaf2ed192..319a883fa6387 100644 --- a/cs/ccxt/exchanges/delta.cs +++ b/cs/ccxt/exchanges/delta.cs @@ -882,9 +882,9 @@ public async override Task fetchMarkets(object parameters = null) { "inverse", ((bool) isTrue(spot)) ? null : !isTrue(linear) }, { "taker", this.safeNumber(market, "taker_commission_rate") }, { "maker", this.safeNumber(market, "maker_commission_rate") }, - { "contractSize", contractSize }, + { "contractSize", ((bool) isTrue(spot)) ? null : contractSize }, { "expiry", expiry }, - { "expiryDatetime", expiryDatetime }, + { "expiryDatetime", this.iso8601(expiry) }, { "strike", this.parseNumber(strike) }, { "optionType", optionType }, { "precision", new Dictionary() { diff --git a/cs/ccxt/exchanges/exmo.cs b/cs/ccxt/exchanges/exmo.cs index 57b0b12a5caee..a1e82d0b9e9f6 100644 --- a/cs/ccxt/exchanges/exmo.cs +++ b/cs/ccxt/exchanges/exmo.cs @@ -653,9 +653,10 @@ public override object parseDepositWithdrawFee(object fee, object currency = nul */ public async override Task fetchCurrencies(object parameters = null) { - // parameters ??= new Dictionary(); - object currencyList = await this.publicGetCurrencyListExtended(parameters); + object promises = new List() {}; + // + ((IList)promises).Add(this.publicGetCurrencyListExtended(parameters)); // // [ // {"name":"VLX","description":"Velas"}, @@ -664,7 +665,7 @@ public async override Task fetchCurrencies(object parameters = null) // {"name":"USD","description":"US Dollar"} // ] // - object cryptoList = await this.publicGetPaymentsProvidersCryptoList(parameters); + ((IList)promises).Add(this.publicGetPaymentsProvidersCryptoList(parameters)); // // { // "BTC":[ @@ -689,96 +690,103 @@ public async override Task fetchCurrencies(object parameters = null) // ], // } // + object responses = await promiseAll(promises); + object currencyList = getValue(responses, 0); + object cryptoList = getValue(responses, 1); object result = new Dictionary() {}; for (object i = 0; isLessThan(i, getArrayLength(currencyList)); postFixIncrement(ref i)) { object currency = getValue(currencyList, i); object currencyId = this.safeString(currency, "name"); - object name = this.safeString(currency, "description"); - object providers = this.safeValue(cryptoList, currencyId); - object active = false; + object code = this.safeCurrencyCode(currencyId); object type = "crypto"; - object limits = new Dictionary() { - { "deposit", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - { "withdraw", new Dictionary() { - { "min", null }, - { "max", null }, - } }, - }; - object fee = null; - object depositEnabled = null; - object withdrawEnabled = null; + object networks = new Dictionary() {}; + object providers = this.safeList(cryptoList, currencyId); if (isTrue(isEqual(providers, null))) { - active = true; type = "fiat"; } else { for (object j = 0; isLessThan(j, getArrayLength(providers)); postFixIncrement(ref j)) { object provider = getValue(providers, j); + object name = this.safeString(provider, "name"); + // get network-id by removing extra things + object networkId = ((string)name).Replace((string)add(currencyId, " "), (string)""); + networkId = ((string)networkId).Replace((string)"(", (string)""); + object replaceChar = ")"; // transpiler trick + networkId = ((string)networkId).Replace((string)replaceChar, (string)""); + object networkCode = this.networkIdToCode(networkId); + if (!isTrue((inOp(networks, networkCode)))) + { + ((IDictionary)networks)[(string)networkCode] = new Dictionary() { + { "id", networkId }, + { "network", networkCode }, + { "active", null }, + { "deposit", null }, + { "withdraw", null }, + { "fee", null }, + { "limits", new Dictionary() { + { "withdraw", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + { "deposit", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + } }, + { "info", new List() {} }, + }; + } object typeInner = this.safeString(provider, "type"); object minValue = this.safeString(provider, "min"); object maxValue = this.safeString(provider, "max"); - if (isTrue(Precise.stringEq(maxValue, "0.0"))) - { - maxValue = null; - } - object activeProvider = this.safeValue(provider, "enabled"); + object activeProvider = this.safeBool(provider, "enabled"); + object networkEntry = getValue(networks, networkCode); if (isTrue(isEqual(typeInner, "deposit"))) { - if (isTrue(isTrue(activeProvider) && !isTrue(depositEnabled))) - { - depositEnabled = true; - } else if (!isTrue(activeProvider)) - { - depositEnabled = false; - } + ((IDictionary)networkEntry)["deposit"] = activeProvider; + ((IDictionary)getValue(getValue(networkEntry, "limits"), "deposit"))["min"] = minValue; + ((IDictionary)getValue(getValue(networkEntry, "limits"), "deposit"))["max"] = maxValue; } else if (isTrue(isEqual(typeInner, "withdraw"))) { - if (isTrue(isTrue(activeProvider) && !isTrue(withdrawEnabled))) - { - withdrawEnabled = true; - } else if (!isTrue(activeProvider)) - { - withdrawEnabled = false; - } - } - if (isTrue(activeProvider)) - { - active = true; - object limitMin = this.numberToString(getValue(getValue(limits, typeInner), "min")); - if (isTrue(isTrue((isEqual(getValue(getValue(limits, typeInner), "min"), null))) || isTrue((Precise.stringLt(minValue, limitMin))))) - { - ((IDictionary)getValue(limits, typeInner))["min"] = minValue; - ((IDictionary)getValue(limits, typeInner))["max"] = maxValue; - if (isTrue(isEqual(typeInner, "withdraw"))) - { - object commissionDesc = this.safeString(provider, "commission_desc"); - fee = this.parseFixedFloatValue(commissionDesc); - } - } + ((IDictionary)networkEntry)["withdraw"] = activeProvider; + ((IDictionary)getValue(getValue(networkEntry, "limits"), "withdraw"))["min"] = minValue; + ((IDictionary)getValue(getValue(networkEntry, "limits"), "withdraw"))["max"] = maxValue; } + object info = this.safeList(networkEntry, "info"); + ((IList)info).Add(provider); + ((IDictionary)networkEntry)["info"] = info; + ((IDictionary)networks)[(string)networkCode] = networkEntry; } } - object code = this.safeCurrencyCode(currencyId); - ((IDictionary)result)[(string)code] = new Dictionary() { + ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { { "id", currencyId }, { "code", code }, - { "name", name }, + { "name", this.safeString(currency, "description") }, { "type", type }, - { "active", active }, - { "deposit", depositEnabled }, - { "withdraw", withdrawEnabled }, - { "fee", fee }, + { "active", null }, + { "deposit", null }, + { "withdraw", null }, + { "fee", null }, { "precision", this.parseNumber("1e-8") }, - { "limits", limits }, - { "info", providers }, - { "networks", new Dictionary() {} }, - }; + { "limits", new Dictionary() { + { "withdraw", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + { "deposit", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + } }, + { "info", new Dictionary() { + { "currency", currency }, + { "providers", providers }, + } }, + { "networks", networks }, + }); } return result; } @@ -794,7 +802,8 @@ public async override Task fetchCurrencies(object parameters = null) public async override Task fetchMarkets(object parameters = null) { parameters ??= new Dictionary(); - object response = await this.publicGetPairSettings(parameters); + object promises = new List() {}; + ((IList)promises).Add(this.publicGetPairSettings(parameters)); // // { // "BTC_USD":{ @@ -811,48 +820,26 @@ public async override Task fetchMarkets(object parameters = null) // } // object marginPairsDict = new Dictionary() {}; - if (isTrue(this.checkRequiredCredentials(false))) + object fetchMargin = this.checkRequiredCredentials(false); + if (isTrue(fetchMargin)) { - object marginPairs = await this.privatePostMarginPairList(parameters); - // - // { - // "pairs": [ - // { - // "buy_price": "55978.85", - // "default_leverage": "3", - // "is_fair_price": true, - // "last_trade_price": "55999.23", - // "liquidation_fee": "2", - // "liquidation_level": "10", - // "margin_call_level": "15", - // "max_leverage": "3", - // "max_order_price": "150000", - // "max_order_quantity": "1", - // "max_position_quantity": "1", - // "max_price_precision": 2, - // "min_order_price": "1", - // "min_order_quantity": "0.00002", - // "name": "BTC_USD", - // "position": 1, - // "sell_price": "55985.51", - // "ticker_updated": "1619019818936107989", - // "trade_maker_fee": "0", - // "trade_taker_fee": "0.05", - // "updated": "1619008608955599013" - // } - // ] - // } - // - object pairs = this.safeValue(marginPairs, "pairs"); + ((IList)promises).Add(this.privatePostMarginPairList(parameters)); + } + object responses = await promiseAll(promises); + object spotResponse = getValue(responses, 0); + if (isTrue(fetchMargin)) + { + object marginPairs = getValue(responses, 1); + object pairs = this.safeList(marginPairs, "pairs"); marginPairsDict = this.indexBy(pairs, "name"); } - object keys = new List(((IDictionary)response).Keys); + object keys = new List(((IDictionary)spotResponse).Keys); object result = new List() {}; for (object i = 0; isLessThan(i, getArrayLength(keys)); postFixIncrement(ref i)) { object id = getValue(keys, i); - object market = getValue(response, id); - object marginMarket = this.safeValue(marginPairsDict, id); + object market = getValue(spotResponse, id); + object marginMarket = this.safeDict(marginPairsDict, id); object symbol = ((string)id).Replace((string)"_", (string)"/"); var baseIdquoteIdVariable = ((string)symbol).Split(new [] {((string)"/")}, StringSplitOptions.None).ToList(); var baseId = ((IList) baseIdquoteIdVariable)[0]; diff --git a/cs/ccxt/exchanges/gate.cs b/cs/ccxt/exchanges/gate.cs index bf846944a0c4a..8844148a3cd65 100644 --- a/cs/ccxt/exchanges/gate.cs +++ b/cs/ccxt/exchanges/gate.cs @@ -1162,7 +1162,7 @@ public async override Task fetchMarkets(object parameters = null) object rawPromises = new List {this.fetchContractMarkets(parameters), this.fetchOptionMarkets(parameters)}; if (!isTrue(sandboxMode)) { - // gate does not have a sandbox for spot markets + // gate doesn't have a sandbox for spot markets object mainnetOnly = new List {this.fetchSpotMarkets(parameters)}; rawPromises = this.arrayConcat(rawPromises, mainnetOnly); } @@ -1605,7 +1605,7 @@ public async virtual Task fetchOptionMarkets(object parameters = null) { "contractSize", this.parseNumber("1") }, { "expiry", expiry }, { "expiryDatetime", this.iso8601(expiry) }, - { "strike", strike }, + { "strike", this.parseNumber(strike) }, { "optionType", optionType }, { "precision", new Dictionary() { { "amount", this.parseNumber("1") }, diff --git a/cs/ccxt/exchanges/hollaex.cs b/cs/ccxt/exchanges/hollaex.cs index 1e4888ed55113..d1f9071911ffa 100644 --- a/cs/ccxt/exchanges/hollaex.cs +++ b/cs/ccxt/exchanges/hollaex.cs @@ -245,6 +245,7 @@ public override object describe() } }, { "exceptions", new Dictionary() { { "broad", new Dictionary() { + { "API request is expired", typeof(InvalidNonce) }, { "Invalid token", typeof(AuthenticationError) }, { "Order not found", typeof(OrderNotFound) }, { "Insufficient balance", typeof(InsufficientFunds) }, @@ -816,7 +817,8 @@ public override object parseTrade(object trade, object market = null) // "price":0.147411, // "timestamp":"2022-01-26T17:53:34.650Z", // "order_id":"cba78ecb-4187-4da2-9d2f-c259aa693b5a", - // "fee":0.01031877,"fee_coin":"usdt" + // "fee":0.01031877, + // "fee_coin":"usdt" // } // object marketId = this.safeString(trade, "symbol"); @@ -829,12 +831,13 @@ public override object parseTrade(object trade, object market = null) object priceString = this.safeString(trade, "price"); object amountString = this.safeString(trade, "size"); object feeCostString = this.safeString(trade, "fee"); + object feeCoin = this.safeString(trade, "fee_coin"); object fee = null; if (isTrue(!isEqual(feeCostString, null))) { fee = new Dictionary() { { "cost", feeCostString }, - { "currency", getValue(market, "quote") }, + { "currency", this.safeCurrencyCode(feeCoin) }, }; } return this.safeTrade(new Dictionary() { @@ -926,7 +929,7 @@ public async override Task fetchTradingFees(object parameters = null) * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch - * @param {int} [limit] the maximum amount of candles to fetch + * @param {int} [limit] the maximum amount of candles to fetch (max 500) * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] timestamp in ms of the latest candle to fetch * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume @@ -941,21 +944,32 @@ public async override Task fetchOHLCV(object symbol, object timeframe = { "symbol", getValue(market, "id") }, { "resolution", this.safeString(this.timeframes, timeframe, timeframe) }, }; - object until = this.safeInteger(parameters, "until"); - object end = this.seconds(); - if (isTrue(!isEqual(until, null))) + object paginate = false; + object maxLimit = 500; + var paginateparametersVariable = this.handleOptionAndParams(parameters, "fetchOHLCV", "paginate", paginate); + paginate = ((IList)paginateparametersVariable)[0]; + parameters = ((IList)paginateparametersVariable)[1]; + if (isTrue(paginate)) { - end = this.parseToInt(divide(until, 1000)); + return await this.fetchPaginatedCallDeterministic("fetchOHLCV", symbol, since, limit, timeframe, parameters, maxLimit); } - object defaultSpan = 2592000; // 30 days - if (isTrue(!isEqual(since, null))) + object until = this.safeInteger(parameters, "until"); + object timeDelta = multiply(multiply(this.parseTimeframe(timeframe), maxLimit), 1000); + object start = since; + object now = this.milliseconds(); + if (isTrue(isTrue(isEqual(until, null)) && isTrue(isEqual(start, null)))) { - ((IDictionary)request)["from"] = this.parseToInt(divide(since, 1000)); - } else + until = now; + start = subtract(until, timeDelta); + } else if (isTrue(isEqual(until, null))) + { + until = now; // the exchange has not a lot of trades, so if we count until by limit and limit is small, it may return empty result + } else if (isTrue(isEqual(start, null))) { - ((IDictionary)request)["from"] = subtract(end, defaultSpan); + start = subtract(until, timeDelta); } - ((IDictionary)request)["to"] = end; + ((IDictionary)request)["from"] = this.parseToInt(divide(start, 1000)); // convert to seconds + ((IDictionary)request)["to"] = this.parseToInt(divide(until, 1000)); // convert to seconds parameters = this.omit(parameters, "until"); object response = await this.publicGetChart(this.extend(request, parameters)); // @@ -1334,11 +1348,10 @@ public async override Task createOrder(object symbol, object type, objec parameters ??= new Dictionary(); await this.loadMarkets(); object market = this.market(symbol); - object convertedAmount = parseFloat(this.amountToPrecision(symbol, amount)); object request = new Dictionary() { { "symbol", getValue(market, "id") }, { "side", side }, - { "size", this.normalizeNumberIfNeeded(convertedAmount) }, + { "size", this.amountToPrecision(symbol, amount) }, { "type", type }, }; object triggerPrice = this.safeNumberN(parameters, new List() {"triggerPrice", "stopPrice", "stop"}); @@ -1348,12 +1361,11 @@ public async override Task createOrder(object symbol, object type, objec object postOnly = this.isPostOnly(isMarketOrder, exchangeSpecificParam, parameters); if (!isTrue(isMarketOrder)) { - object convertedPrice = parseFloat(this.priceToPrecision(symbol, price)); - ((IDictionary)request)["price"] = this.normalizeNumberIfNeeded(convertedPrice); + ((IDictionary)request)["price"] = this.priceToPrecision(symbol, price); } if (isTrue(!isEqual(triggerPrice, null))) { - ((IDictionary)request)["stop"] = this.normalizeNumberIfNeeded(parseFloat(this.priceToPrecision(symbol, triggerPrice))); + ((IDictionary)request)["stop"] = this.priceToPrecision(symbol, triggerPrice); } if (isTrue(postOnly)) { @@ -2064,15 +2076,6 @@ public async override Task fetchDepositWithdrawFees(object codes = null, return this.parseDepositWithdrawFees(coins, codes, "symbol"); } - public virtual object normalizeNumberIfNeeded(object number) - { - if (isTrue(this.isRoundNumber(number))) - { - number = parseInt(number); - } - return number; - } - public override object sign(object path, object api = null, object method = null, object parameters = null, object headers = null, object body = null) { api ??= "public"; diff --git a/cs/ccxt/exchanges/htx.cs b/cs/ccxt/exchanges/htx.cs index 8f3a737863ca7..9bae65cb85f7f 100644 --- a/cs/ccxt/exchanges/htx.cs +++ b/cs/ccxt/exchanges/htx.cs @@ -7122,7 +7122,7 @@ public async override Task withdraw(object code, object amount, object a if (isTrue(isEqual(fee, null))) { object currencies = await this.fetchCurrencies(); - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); object targetNetwork = this.safeValue(getValue(currency, "networks"), networkCode, new Dictionary() {}); fee = this.safeNumber(targetNetwork, "fee"); if (isTrue(isEqual(fee, null))) diff --git a/cs/ccxt/exchanges/hyperliquid.cs b/cs/ccxt/exchanges/hyperliquid.cs index 6a81e1b1ce8b1..1effea3fd2304 100644 --- a/cs/ccxt/exchanges/hyperliquid.cs +++ b/cs/ccxt/exchanges/hyperliquid.cs @@ -38,6 +38,7 @@ public override object describe() { "createMarketSellOrderWithCost", false }, { "createOrder", true }, { "createOrders", true }, + { "createOrderWithTakeProfitAndStopLoss", true }, { "createReduceOnlyOrder", true }, { "createStopOrder", true }, { "createTriggerOrder", true }, @@ -219,7 +220,16 @@ public override object describe() { "triggerDirection", false }, { "stopLossPrice", false }, { "takeProfitPrice", false }, - { "attachedStopLossTakeProfit", null }, + { "attachedStopLossTakeProfit", new Dictionary() { + { "triggerPriceType", new Dictionary() { + { "last", false }, + { "mark", false }, + { "index", false }, + } }, + { "triggerPrice", true }, + { "type", true }, + { "price", true }, + } }, { "timeInForce", new Dictionary() { { "IOC", true }, { "FOK", false }, @@ -695,7 +705,8 @@ public override object parseMarket(object market) // } // object quoteId = "USDC"; - object bs = this.safeString(market, "name"); + object baseName = this.safeString(market, "name"); + object bs = this.safeCurrencyCode(baseName); object quote = this.safeCurrencyCode(quoteId); object baseId = this.safeString(market, "baseId"); object settleId = "USDC"; @@ -1532,6 +1543,82 @@ public async override Task createOrders(object orders, object parameters return this.parseOrders(statuses, null); } + public virtual object createOrderRequest(object symbol, object type, object side, object amount, object price = null, object parameters = null) + { + parameters ??= new Dictionary(); + object market = this.market(symbol); + type = ((string)type).ToUpper(); + side = ((string)side).ToUpper(); + object isMarket = (isEqual(type, "MARKET")); + object isBuy = (isEqual(side, "BUY")); + object clientOrderId = this.safeString2(parameters, "clientOrderId", "client_id"); + object slippage = this.safeString(parameters, "slippage"); + object defaultTimeInForce = ((bool) isTrue((isMarket))) ? "ioc" : "gtc"; + object postOnly = this.safeBool(parameters, "postOnly", false); + if (isTrue(postOnly)) + { + defaultTimeInForce = "alo"; + } + object timeInForce = this.safeStringLower(parameters, "timeInForce", defaultTimeInForce); + timeInForce = this.capitalize(timeInForce); + object triggerPrice = this.safeString2(parameters, "triggerPrice", "stopPrice"); + object stopLossPrice = this.safeString(parameters, "stopLossPrice", triggerPrice); + object takeProfitPrice = this.safeString(parameters, "takeProfitPrice"); + object isTrigger = (isTrue(stopLossPrice) || isTrue(takeProfitPrice)); + object px = null; + if (isTrue(isMarket)) + { + if (isTrue(isEqual(price, null))) + { + throw new ArgumentsRequired ((string)add(this.id, " market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).")) ; + } + px = ((bool) isTrue((isBuy))) ? Precise.stringMul(price, Precise.stringAdd("1", slippage)) : Precise.stringMul(price, Precise.stringSub("1", slippage)); + px = this.priceToPrecision(symbol, px); // round after adding slippage + } else + { + px = this.priceToPrecision(symbol, price); + } + object sz = this.amountToPrecision(symbol, amount); + object reduceOnly = this.safeBool(parameters, "reduceOnly", false); + object orderType = new Dictionary() {}; + if (isTrue(isTrigger)) + { + object isTp = false; + if (isTrue(!isEqual(takeProfitPrice, null))) + { + triggerPrice = this.priceToPrecision(symbol, takeProfitPrice); + isTp = true; + } else + { + triggerPrice = this.priceToPrecision(symbol, stopLossPrice); + } + ((IDictionary)orderType)["trigger"] = new Dictionary() { + { "isMarket", isMarket }, + { "triggerPx", triggerPrice }, + { "tpsl", ((bool) isTrue((isTp))) ? "tp" : "sl" }, + }; + } else + { + ((IDictionary)orderType)["limit"] = new Dictionary() { + { "tif", timeInForce }, + }; + } + parameters = this.omit(parameters, new List() {"clientOrderId", "slippage", "triggerPrice", "stopPrice", "stopLossPrice", "takeProfitPrice", "timeInForce", "client_id", "reduceOnly", "postOnly"}); + object orderObj = new Dictionary() { + { "a", this.parseToInt(getValue(market, "baseId")) }, + { "b", isBuy }, + { "p", px }, + { "s", sz }, + { "r", reduceOnly }, + { "t", orderType }, + }; + if (isTrue(!isEqual(clientOrderId, null))) + { + ((IDictionary)orderObj)["c"] = clientOrderId; + } + return orderObj; + } + public virtual object createOrdersRequest(object orders, object parameters = null) { /** @@ -1573,6 +1660,7 @@ public virtual object createOrdersRequest(object orders, object parameters = nul parameters = this.omit(parameters, new List() {"slippage", "clientOrderId", "client_id", "slippage", "triggerPrice", "stopPrice", "stopLossPrice", "takeProfitPrice", "timeInForce"}); object nonce = this.milliseconds(); object orderReq = new List() {}; + object grouping = "na"; for (object i = 0; isLessThan(i, getArrayLength(orders)); postFixIncrement(ref i)) { object rawOrder = getValue(orders, i); @@ -1580,78 +1668,54 @@ public virtual object createOrdersRequest(object orders, object parameters = nul object market = this.market(marketId); object symbol = getValue(market, "symbol"); object type = this.safeStringUpper(rawOrder, "type"); - object isMarket = (isEqual(type, "MARKET")); object side = this.safeStringUpper(rawOrder, "side"); - object isBuy = (isEqual(side, "BUY")); object amount = this.safeString(rawOrder, "amount"); object price = this.safeString(rawOrder, "price"); object orderParams = this.safeDict(rawOrder, "params", new Dictionary() {}); - object clientOrderId = this.safeString2(orderParams, "clientOrderId", "client_id"); object slippage = this.safeString(orderParams, "slippage", defaultSlippage); - object defaultTimeInForce = ((bool) isTrue((isMarket))) ? "ioc" : "gtc"; - object postOnly = this.safeBool(orderParams, "postOnly", false); - if (isTrue(postOnly)) - { - defaultTimeInForce = "alo"; - } - object timeInForce = this.safeStringLower(orderParams, "timeInForce", defaultTimeInForce); - timeInForce = this.capitalize(timeInForce); - object triggerPrice = this.safeString2(orderParams, "triggerPrice", "stopPrice"); - object stopLossPrice = this.safeString(orderParams, "stopLossPrice", triggerPrice); - object takeProfitPrice = this.safeString(orderParams, "takeProfitPrice"); - object isTrigger = (isTrue(stopLossPrice) || isTrue(takeProfitPrice)); - object px = null; - if (isTrue(isMarket)) - { - if (isTrue(isEqual(price, null))) - { - throw new ArgumentsRequired ((string)add(this.id, " market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).")) ; - } - px = ((bool) isTrue((isBuy))) ? Precise.stringMul(price, Precise.stringAdd("1", slippage)) : Precise.stringMul(price, Precise.stringSub("1", slippage)); - px = this.priceToPrecision(symbol, px); // round after adding slippage - } else - { - px = this.priceToPrecision(symbol, price); - } - object sz = this.amountToPrecision(symbol, amount); - object reduceOnly = this.safeBool(orderParams, "reduceOnly", false); - object orderType = new Dictionary() {}; + ((IDictionary)orderParams)["slippage"] = slippage; + object stopLoss = this.safeValue(orderParams, "stopLoss"); + object takeProfit = this.safeValue(orderParams, "takeProfit"); + object isTrigger = (isTrue(stopLoss) || isTrue(takeProfit)); + orderParams = this.omit(orderParams, new List() {"stopLoss", "takeProfit"}); + object mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams); + ((IList)orderReq).Add(mainOrderObj); if (isTrue(isTrigger)) { - object isTp = false; - if (isTrue(!isEqual(takeProfitPrice, null))) + // grouping opposed orders for sl/tp + object stopLossOrderTriggerPrice = this.safeStringN(stopLoss, new List() {"triggerPrice", "stopPrice"}); + object stopLossOrderType = this.safeString(stopLoss, "type"); + object stopLossOrderLimitPrice = this.safeStringN(stopLoss, new List() {"price", "stopLossPrice"}, stopLossOrderTriggerPrice); + object takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, new List() {"triggerPrice", "stopPrice"}); + object takeProfitOrderType = this.safeString(takeProfit, "type"); + object takeProfitOrderLimitPrice = this.safeStringN(takeProfit, new List() {"price", "takeProfitPrice"}, takeProfitOrderTriggerPrice); + grouping = "normalTpsl"; + orderParams = this.omit(orderParams, new List() {"stopLoss", "takeProfit"}); + object triggerOrderSide = ""; + if (isTrue(isEqual(side, "BUY"))) { - triggerPrice = this.priceToPrecision(symbol, takeProfitPrice); - isTp = true; + triggerOrderSide = "sell"; } else { - triggerPrice = this.priceToPrecision(symbol, stopLossPrice); + triggerOrderSide = "buy"; + } + if (isTrue(!isEqual(takeProfit, null))) + { + object orderObj = this.createOrderRequest(symbol, takeProfitOrderType, triggerOrderSide, amount, takeProfitOrderLimitPrice, this.extend(orderParams, new Dictionary() { + { "takeProfitPrice", takeProfitOrderTriggerPrice }, + { "reduceOnly", true }, + })); + ((IList)orderReq).Add(orderObj); + } + if (isTrue(!isEqual(stopLoss, null))) + { + object orderObj = this.createOrderRequest(symbol, stopLossOrderType, triggerOrderSide, amount, stopLossOrderLimitPrice, this.extend(orderParams, new Dictionary() { + { "stopLossPrice", stopLossOrderTriggerPrice }, + { "reduceOnly", true }, + })); + ((IList)orderReq).Add(orderObj); } - ((IDictionary)orderType)["trigger"] = new Dictionary() { - { "isMarket", isMarket }, - { "triggerPx", triggerPrice }, - { "tpsl", ((bool) isTrue((isTp))) ? "tp" : "sl" }, - }; - } else - { - ((IDictionary)orderType)["limit"] = new Dictionary() { - { "tif", timeInForce }, - }; - } - orderParams = this.omit(orderParams, new List() {"clientOrderId", "slippage", "triggerPrice", "stopPrice", "stopLossPrice", "takeProfitPrice", "timeInForce", "client_id", "reduceOnly", "postOnly"}); - object orderObj = new Dictionary() { - { "a", this.parseToInt(getValue(market, "baseId")) }, - { "b", isBuy }, - { "p", px }, - { "s", sz }, - { "r", reduceOnly }, - { "t", orderType }, - }; - if (isTrue(!isEqual(clientOrderId, null))) - { - ((IDictionary)orderObj)["c"] = clientOrderId; } - ((IList)orderReq).Add(orderObj); } object vaultAddress = null; var vaultAddressparametersVariable = this.handleOptionAndParams(parameters, "createOrder", "vaultAddress"); @@ -1661,7 +1725,7 @@ public virtual object createOrdersRequest(object orders, object parameters = nul object orderAction = new Dictionary() { { "type", "order" }, { "orders", orderReq }, - { "grouping", "na" }, + { "grouping", grouping }, }; if (isTrue(isEqual(vaultAddress, null))) { diff --git a/cs/ccxt/exchanges/kraken.cs b/cs/ccxt/exchanges/kraken.cs index c8eaceb57ca8b..9e3869dd572bd 100644 --- a/cs/ccxt/exchanges/kraken.cs +++ b/cs/ccxt/exchanges/kraken.cs @@ -1420,7 +1420,20 @@ public override object parseTrade(object trade, object market = null) // "maker": false // } // + // watchTrades + // + // { + // "symbol": "BTC/USD", + // "side": "buy", + // "price": 109601.2, + // "qty": 0.04561994, + // "ord_type": "market", + // "trade_id": 83449369, + // "timestamp": "2025-05-27T11:24:03.847761Z" + // } + // object timestamp = null; + object datetime = null; object side = null; object type = null; object price = null; @@ -1475,6 +1488,15 @@ public override object parseTrade(object trade, object market = null) { "currency", currency }, }; } + } else + { + symbol = this.safeString(trade, "symbol"); + datetime = this.safeString(trade, "timestamp"); + id = this.safeString(trade, "trade_id"); + side = this.safeString(trade, "side"); + type = this.safeString(trade, "ord_type"); + price = this.safeString(trade, "price"); + amount = this.safeString(trade, "qty"); } if (isTrue(!isEqual(market, null))) { @@ -1487,12 +1509,19 @@ public override object parseTrade(object trade, object market = null) { takerOrMaker = ((bool) isTrue(maker)) ? "maker" : "taker"; } + if (isTrue(isEqual(datetime, null))) + { + datetime = this.iso8601(timestamp); + } else + { + timestamp = this.parse8601(datetime); + } return this.safeTrade(new Dictionary() { { "id", id }, { "order", orderId }, { "info", trade }, { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, + { "datetime", datetime }, { "symbol", symbol }, { "type", type }, { "side", side }, diff --git a/cs/ccxt/exchanges/krakenfutures.cs b/cs/ccxt/exchanges/krakenfutures.cs index 3092487fc789f..36c033dc4540c 100644 --- a/cs/ccxt/exchanges/krakenfutures.cs +++ b/cs/ccxt/exchanges/krakenfutures.cs @@ -468,7 +468,7 @@ public async override Task fetchMarkets(object parameters = null) { "precision", null }, }); } - this.currencies = this.deepExtend(currencies, this.currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(currencies, this.currencies)); return result; } diff --git a/cs/ccxt/exchanges/kucoin.cs b/cs/ccxt/exchanges/kucoin.cs index b8fb9fefcb60c..4348eede74910 100644 --- a/cs/ccxt/exchanges/kucoin.cs +++ b/cs/ccxt/exchanges/kucoin.cs @@ -1214,38 +1214,35 @@ public async override Task fetchCurrencies(object parameters = null) // } // object currenciesData = this.safeList(response, "data", new List() {}); + object brokenCurrencies = this.safeList(this.options, "brokenCurrencies", new List() {"00", "OPEN_ERROR", "HUF", "BDT"}); + object otherFiats = this.safeList(this.options, "fiats", new List() {"KWD", "IRR", "PKR"}); object result = new Dictionary() {}; for (object i = 0; isLessThan(i, getArrayLength(currenciesData)); postFixIncrement(ref i)) { object entry = getValue(currenciesData, i); object id = this.safeString(entry, "currency"); - object name = this.safeString(entry, "fullName"); + if (isTrue(this.inArray(id, brokenCurrencies))) + { + continue; + } object code = this.safeCurrencyCode(id); object networks = new Dictionary() {}; object chains = this.safeList(entry, "chains", new List() {}); - object rawPrecision = this.safeString(entry, "precision"); - object precision = this.parseNumber(this.parsePrecision(rawPrecision)); object chainsLength = getArrayLength(chains); - if (!isTrue(chainsLength)) - { - continue; - } for (object j = 0; isLessThan(j, chainsLength); postFixIncrement(ref j)) { object chain = getValue(chains, j); object chainId = this.safeString(chain, "chainId"); object networkCode = this.networkIdToCode(chainId, code); - object chainWithdrawEnabled = this.safeBool(chain, "isWithdrawEnabled", false); - object chainDepositEnabled = this.safeBool(chain, "isDepositEnabled", false); ((IDictionary)networks)[(string)networkCode] = new Dictionary() { { "info", chain }, { "id", chainId }, { "name", this.safeString(chain, "chainName") }, { "code", networkCode }, - { "active", isTrue(chainWithdrawEnabled) && isTrue(chainDepositEnabled) }, + { "active", null }, { "fee", this.safeNumber(chain, "withdrawalMinFee") }, - { "deposit", chainDepositEnabled }, - { "withdraw", chainWithdrawEnabled }, + { "deposit", this.safeBool(chain, "isDepositEnabled") }, + { "withdraw", this.safeBool(chain, "isWithdrawEnabled") }, { "precision", this.parseNumber(this.parsePrecision(this.safeString(chain, "withdrawPrecision"))) }, { "limits", new Dictionary() { { "withdraw", new Dictionary() { @@ -1260,10 +1257,12 @@ public async override Task fetchCurrencies(object parameters = null) }; } // kucoin has determined 'fiat' currencies with below logic - object isFiat = isTrue((isEqual(rawPrecision, "2"))) && isTrue((isEqual(chainsLength, 0))); + object rawPrecision = this.safeString(entry, "precision"); + object precision = this.parseNumber(this.parsePrecision(rawPrecision)); + object isFiat = isTrue(this.inArray(id, otherFiats)) || isTrue((isTrue((isEqual(rawPrecision, "2"))) && isTrue((isEqual(chainsLength, 0))))); ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { { "id", id }, - { "name", name }, + { "name", this.safeString(entry, "fullName") }, { "code", code }, { "type", ((bool) isTrue(isFiat)) ? "fiat" : "crypto" }, { "precision", precision }, diff --git a/cs/ccxt/exchanges/latoken.cs b/cs/ccxt/exchanges/latoken.cs index 2427923375bba..703071b5abea3 100644 --- a/cs/ccxt/exchanges/latoken.cs +++ b/cs/ccxt/exchanges/latoken.cs @@ -225,6 +225,8 @@ public override object describe() { "fetchTradingFee", new Dictionary() { { "method", "fetchPrivateTradingFee" }, } }, + { "timeDifference", 0 }, + { "adjustForTimeDifference", true }, } }, { "features", new Dictionary() { { "spot", new Dictionary() { @@ -333,39 +335,6 @@ public async override Task fetchTime(object parameters = null) public async override Task fetchMarkets(object parameters = null) { parameters ??= new Dictionary(); - object currencies = await this.fetchCurrenciesFromCache(parameters); - // - // [ - // { - // "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d", - // "status":"CURRENCY_STATUS_ACTIVE", - // "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO - // "name":"MyCryptoBank", - // "tag":"MCB", - // "description":"", - // "logo":"", - // "decimals":18, - // "created":1572912000000, - // "tier":1, - // "assetClass":"ASSET_CLASS_UNKNOWN", - // "minTransferAmount":0 - // }, - // { - // "id":"db02758e-2507-46a5-a805-7bc60355b3eb", - // "status":"CURRENCY_STATUS_ACTIVE", - // "type":"CURRENCY_TYPE_FUTURES_CONTRACT", - // "name":"BTC USDT Futures Contract", - // "tag":"BTCUSDT", - // "description":"", - // "logo":"", - // "decimals":8, - // "created":1589459984395, - // "tier":1, - // "assetClass":"ASSET_CLASS_UNKNOWN", - // "minTransferAmount":0 - // }, - // ] - // object response = await this.publicGetPair(parameters); // // [ @@ -387,10 +356,11 @@ public async override Task fetchMarkets(object parameters = null) // } // ] // - if (isTrue(this.safeValue(this.options, "adjustForTimeDifference", true))) + if (isTrue(this.safeBool(this.options, "adjustForTimeDifference", false))) { await this.loadTimeDifference(); } + object currencies = this.safeDict(this.options, "cachedCurrencies", new Dictionary() {}); object currenciesById = this.indexBy(currencies, "id"); object result = new List() {}; for (object i = 0; isLessThan(i, getArrayLength(response)); postFixIncrement(ref i)) @@ -400,12 +370,14 @@ public async override Task fetchMarkets(object parameters = null) // the exchange shows them inverted object baseId = this.safeString(market, "baseCurrency"); object quoteId = this.safeString(market, "quoteCurrency"); - object baseCurrency = this.safeValue(currenciesById, baseId); - object quoteCurrency = this.safeValue(currenciesById, quoteId); - if (isTrue(isTrue(!isEqual(baseCurrency, null)) && isTrue(!isEqual(quoteCurrency, null)))) + object baseCurrency = this.safeDict(currenciesById, baseId); + object quoteCurrency = this.safeDict(currenciesById, quoteId); + object baseCurrencyInfo = this.safeDict(baseCurrency, "info"); + object quoteCurrencyInfo = this.safeDict(quoteCurrency, "info"); + if (isTrue(isTrue(!isEqual(baseCurrencyInfo, null)) && isTrue(!isEqual(quoteCurrencyInfo, null)))) { - object bs = this.safeCurrencyCode(this.safeString(baseCurrency, "tag")); - object quote = this.safeCurrencyCode(this.safeString(quoteCurrency, "tag")); + object bs = this.safeCurrencyCode(this.safeString(baseCurrencyInfo, "tag")); + object quote = this.safeCurrencyCode(this.safeString(quoteCurrencyInfo, "tag")); object lowercaseQuote = ((string)quote).ToLower(); object capitalizedQuote = this.capitalize(lowercaseQuote); object status = this.safeString(market, "status"); @@ -463,26 +435,6 @@ public async override Task fetchMarkets(object parameters = null) return result; } - public async virtual Task fetchCurrenciesFromCache(object parameters = null) - { - // this method is now redundant - // currencies are now fetched before markets - parameters ??= new Dictionary(); - object options = this.safeValue(this.options, "fetchCurrencies", new Dictionary() {}); - object timestamp = this.safeInteger(options, "timestamp"); - object expires = this.safeInteger(options, "expires", 1000); - object now = this.milliseconds(); - if (isTrue(isTrue((isEqual(timestamp, null))) || isTrue((isGreaterThan((subtract(now, timestamp)), expires))))) - { - object response = await this.publicGetCurrency(parameters); - ((IDictionary)this.options)["fetchCurrencies"] = this.extend(options, new Dictionary() { - { "response", response }, - { "timestamp", now }, - }); - } - return this.safeValue(getValue(this.options, "fetchCurrencies"), "response"); - } - /** * @method * @name latoken#fetchCurrencies @@ -493,7 +445,7 @@ public async virtual Task fetchCurrenciesFromCache(object parameters = n public async override Task fetchCurrencies(object parameters = null) { parameters ??= new Dictionary(); - object response = await this.fetchCurrenciesFromCache(parameters); + object response = await this.publicGetCurrency(parameters); // // [ // { @@ -533,30 +485,18 @@ public async override Task fetchCurrencies(object parameters = null) object id = this.safeString(currency, "id"); object tag = this.safeString(currency, "tag"); object code = this.safeCurrencyCode(tag); - object fee = this.safeNumber(currency, "fee"); object currencyType = this.safeString(currency, "type"); - object type = null; - if (isTrue(isEqual(currencyType, "CURRENCY_TYPE_ALTERNATIVE"))) - { - type = "other"; - } else - { - // CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos - type = "crypto"; - } - object status = this.safeString(currency, "status"); - object active = (isEqual(status, "CURRENCY_STATUS_ACTIVE")); - object name = this.safeString(currency, "name"); - ((IDictionary)result)[(string)code] = new Dictionary() { + object isCrypto = (isTrue(isEqual(currencyType, "CURRENCY_TYPE_CRYPTO")) || isTrue(isEqual(currencyType, "CURRENCY_TYPE_IEO"))); + ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { { "id", id }, { "code", code }, { "info", currency }, - { "name", name }, - { "type", type }, - { "active", active }, + { "name", this.safeString(currency, "name") }, + { "type", ((bool) isTrue(isCrypto)) ? "crypto" : "other" }, + { "active", isEqual(this.safeString(currency, "status"), "CURRENCY_STATUS_ACTIVE") }, { "deposit", null }, { "withdraw", null }, - { "fee", fee }, + { "fee", this.safeNumber(currency, "fee") }, { "precision", this.parseNumber(this.parsePrecision(this.safeString(currency, "decimals"))) }, { "limits", new Dictionary() { { "amount", new Dictionary() { @@ -569,7 +509,7 @@ public async override Task fetchCurrencies(object parameters = null) } }, } }, { "networks", new Dictionary() {} }, - }; + }); } return result; } diff --git a/cs/ccxt/exchanges/lbank.cs b/cs/ccxt/exchanges/lbank.cs index ecd31cd12498a..8a021347255e0 100644 --- a/cs/ccxt/exchanges/lbank.cs +++ b/cs/ccxt/exchanges/lbank.cs @@ -38,6 +38,7 @@ public override object describe() { "fetchClosedOrders", false }, { "fetchCrossBorrowRate", false }, { "fetchCrossBorrowRates", false }, + { "fetchCurrencies", true }, { "fetchDepositAddress", true }, { "fetchDepositAddresses", false }, { "fetchDepositAddressesByNetwork", false }, @@ -112,7 +113,8 @@ public override object describe() { "currencyPairs", 2.5 }, { "accuracy", 2.5 }, { "usdToCny", 2.5 }, - { "withdrawConfigs", 2.5 }, + { "assetConfigs", 2.5 }, + { "withdrawConfigs", multiply(2.5, 1.5) }, { "timestamp", 2.5 }, { "ticker/24hr", 2.5 }, { "ticker", 2.5 }, @@ -192,6 +194,7 @@ public override object describe() } }, } }, { "commonCurrencies", new Dictionary() { + { "XBT", "XBT" }, { "HIT", "Hiver" }, { "VET_ERC20", "VEN" }, { "PNT", "Penta" }, @@ -240,21 +243,12 @@ public override object describe() { "BTCTRON", "btctron" }, { "XRP", "xrp" }, } }, - { "inverse-networks", new Dictionary() { + { "networksById", new Dictionary() { { "erc20", "ERC20" }, { "trc20", "TRC20" }, - { "omni", "OMNI" }, - { "asa", "ASA" }, - { "bep20(bsc)", "BSC" }, - { "bep20", "BSC" }, - { "heco", "HT" }, - { "bep2", "BNB" }, - { "btc", "BTC" }, - { "dogecoin", "DOGE" }, - { "matic", "MATIC" }, - { "oec", "OEC" }, - { "btctron", "BTCTRON" }, - { "xrp", "XRP" }, + { "TRX", "TRC20" }, + { "bep20(bsc)", "BEP20" }, + { "bep20", "BEP20" }, } }, { "defaultNetworks", new Dictionary() { { "USDT", "TRC20" }, @@ -384,6 +378,113 @@ public async override Task fetchTime(object parameters = null) return this.safeInteger(response, "data"); } + /** + * @method + * @name lbank#fetchCurrencies + * @description fetches all available currencies on an exchange + * @param {dict} [params] extra parameters specific to the exchange API endpoint + * @returns {dict} an associative dictionary of currencies + */ + public async override Task fetchCurrencies(object parameters = null) + { + parameters ??= new Dictionary(); + object response = await this.spotPublicGetWithdrawConfigs(parameters); + // + // { + // "msg": "Success", + // "result": "true", + // "data": [ + // { + // "amountScale": "4", + // "chain": "bep20(bsc)", + // "assetCode": "usdt", + // "min": "10", + // "transferAmtScale": "4", + // "canWithDraw": true, + // "fee": "0.0000", + // "minTransfer": "0.0001", + // "type": "1" + // }, + // { + // "amountScale": "4", + // "chain": "trc20", + // "assetCode": "usdt", + // "min": "1", + // "transferAmtScale": "4", + // "canWithDraw": true, + // "fee": "1.0000", + // "minTransfer": "0.0001", + // "type": "1" + // }, + // ... + // ], + // "error_code": "0", + // "ts": "1747973911431" + // } + // + object currenciesData = this.safeList(response, "data", new List() {}); + object grouped = this.groupBy(currenciesData, "assetCode"); + object groupedKeys = new List(((IDictionary)grouped).Keys); + object result = new Dictionary() {}; + for (object i = 0; isLessThan(i, getArrayLength(groupedKeys)); postFixIncrement(ref i)) + { + object id = ((object)(getValue(groupedKeys, i))).ToString(); // some currencies are numeric + object code = this.safeCurrencyCode(id); + object networksRaw = getValue(grouped, id); + object networks = new Dictionary() {}; + for (object j = 0; isLessThan(j, getArrayLength(networksRaw)); postFixIncrement(ref j)) + { + object networkEntry = getValue(networksRaw, j); + object networkId = this.safeString(networkEntry, "chain"); + object networkCode = this.networkIdToCode(networkId); + ((IDictionary)networks)[(string)networkCode] = new Dictionary() { + { "id", networkId }, + { "network", networkCode }, + { "limits", new Dictionary() { + { "withdraw", new Dictionary() { + { "min", this.safeNumber(networkEntry, "min") }, + { "max", null }, + } }, + { "deposit", new Dictionary() { + { "min", this.safeNumber(networkEntry, "minTransfer") }, + { "max", null }, + } }, + } }, + { "active", null }, + { "deposit", null }, + { "withdraw", this.safeBool(networkEntry, "canWithDraw") }, + { "fee", this.safeNumber(networkEntry, "fee") }, + { "precision", this.parseNumber(this.parsePrecision(this.safeString(networkEntry, "transferAmtScale"))) }, + { "info", networkEntry }, + }; + } + ((IDictionary)result)[(string)code] = this.safeCurrencyStructure(new Dictionary() { + { "id", id }, + { "code", code }, + { "precision", null }, + { "type", null }, + { "name", null }, + { "active", null }, + { "deposit", null }, + { "withdraw", null }, + { "fee", null }, + { "limits", new Dictionary() { + { "withdraw", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + { "deposit", new Dictionary() { + { "min", null }, + { "max", null }, + } }, + } }, + { "networks", networks }, + { "info", networksRaw }, + }); + } + return result; + } + /** * @method * @name lbank#fetchMarkets @@ -2280,13 +2381,10 @@ public async virtual Task fetchDepositAddressDefault(object code, object object result = this.safeValue(response, "data"); object address = this.safeString(result, "address"); object tag = this.safeString(result, "memo"); - object networkId = this.safeString(result, "netWork"); - object inverseNetworks = this.safeValue(this.options, "inverse-networks", new Dictionary() {}); - object networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId); return new Dictionary() { { "info", response }, { "currency", code }, - { "network", networkCode }, + { "network", this.networkIdToCode(this.safeString(result, "netWork")) }, { "address", address }, { "tag", tag }, }; @@ -2325,12 +2423,10 @@ public async virtual Task fetchDepositAddressSupplement(object code, obj object result = this.safeValue(response, "data"); object address = this.safeString(result, "address"); object tag = this.safeString(result, "memo"); - object inverseNetworks = this.safeValue(this.options, "inverse-networks", new Dictionary() {}); - object networkCode = this.safeStringUpper(inverseNetworks, network, network); return new Dictionary() { { "info", response }, { "currency", code }, - { "network", networkCode }, + { "network", null }, { "address", address }, { "tag", tag }, }; @@ -2460,9 +2556,6 @@ public override object parseTransaction(object transaction, object currency = nu } object txid = this.safeString(transaction, "txId"); object timestamp = this.safeInteger2(transaction, "insertTime", "applyTime"); - object networks = this.safeValue(this.options, "inverse-networks", new Dictionary() {}); - object networkId = this.safeString(transaction, "networkName"); - object network = this.safeString(networks, networkId, networkId); object address = this.safeString(transaction, "address"); object addressFrom = null; object addressTo = null; @@ -2492,7 +2585,7 @@ public override object parseTransaction(object transaction, object currency = nu { "txid", txid }, { "timestamp", timestamp }, { "datetime", this.iso8601(timestamp) }, - { "network", network }, + { "network", this.networkIdToCode(this.safeString(transaction, "networkName")) }, { "address", address }, { "addressTo", addressTo }, { "addressFrom", addressFrom }, @@ -2708,11 +2801,10 @@ public async virtual Task fetchPrivateTransactionFees(object parameters for (object j = 0; isLessThan(j, getArrayLength(networkList)); postFixIncrement(ref j)) { object networkEntry = getValue(networkList, j); - object networkId = this.safeString(networkEntry, "name"); - object networkCode = this.safeString(getValue(this.options, "inverse-networks"), networkId, networkId); object fee = this.safeNumber(networkEntry, "withdrawFee"); if (isTrue(!isEqual(fee, null))) { + object networkCode = this.networkIdToCode(this.safeString(networkEntry, "name")); ((IDictionary)getValue(withdrawFees, code))[(string)networkCode] = fee; } } @@ -2770,8 +2862,7 @@ public async virtual Task fetchPublicTransactionFees(object parameters = { object currencyId = this.safeString(item, "assetCode"); object codeInner = this.safeCurrencyCode(currencyId); - object chain = this.safeString(item, "chain"); - object network = this.safeString(getValue(this.options, "inverse-networks"), chain, chain); + object network = this.networkIdToCode(this.safeString(item, "chain")); if (isTrue(isEqual(network, null))) { network = codeInner; @@ -2942,8 +3033,7 @@ public virtual object parsePublicDepositWithdrawFees(object response, object cod object resultCodeInfo = getValue(getValue(result, code), "info"); ((IList)resultCodeInfo).Add(fee); } - object chain = this.safeString(fee, "chain"); - object networkCode = this.safeString(getValue(this.options, "inverse-networks"), chain, chain); + object networkCode = this.networkIdToCode(this.safeString(fee, "chain")); if (isTrue(!isEqual(networkCode, null))) { ((IDictionary)getValue(getValue(result, code), "networks"))[(string)networkCode] = new Dictionary() { @@ -3003,8 +3093,7 @@ public override object parseDepositWithdrawFee(object fee, object currency = nul for (object j = 0; isLessThan(j, getArrayLength(networkList)); postFixIncrement(ref j)) { object networkEntry = getValue(networkList, j); - object networkId = this.safeString(networkEntry, "name"); - object networkCode = this.safeStringUpper(getValue(this.options, "inverse-networks"), networkId, networkId); + object networkCode = this.networkIdToCode(this.safeString(networkEntry, "name")); object withdrawFee = this.safeNumber(networkEntry, "withdrawFee"); object isDefault = this.safeValue(networkEntry, "isDefault"); if (isTrue(!isEqual(withdrawFee, null))) diff --git a/cs/ccxt/exchanges/mexc.cs b/cs/ccxt/exchanges/mexc.cs index 43bc4798986ee..e23c3d744440a 100644 --- a/cs/ccxt/exchanges/mexc.cs +++ b/cs/ccxt/exchanges/mexc.cs @@ -649,6 +649,7 @@ public override object describe() { "PROS", "PROSFINANCE" }, { "SIN", "SINCITYTOKEN" }, { "SOUL", "SOULSWAP" }, + { "XBT", "XBT" }, } }, { "exceptions", new Dictionary() { { "exact", new Dictionary() { diff --git a/cs/ccxt/exchanges/modetrade.cs b/cs/ccxt/exchanges/modetrade.cs index 24db4176f9080..3efa977accd39 100644 --- a/cs/ccxt/exchanges/modetrade.cs +++ b/cs/ccxt/exchanges/modetrade.cs @@ -1776,7 +1776,7 @@ public async override Task cancelOrder(object id, object symbol = null, // // { // "success": true, - // "timestamp": 1702989203989, + // "timestamp": 1702989203988, // "data": { // "status": "CANCEL_SENT" // } @@ -1784,7 +1784,7 @@ public async override Task cancelOrder(object id, object symbol = null, // // { // "success": true, - // "timestamp": 1702989203989, + // "timestamp": 1702989203988, // "status": "CANCEL_SENT" // } // diff --git a/cs/ccxt/exchanges/okx.cs b/cs/ccxt/exchanges/okx.cs index fc538e4af78c3..b4eacb0ccfebc 100644 --- a/cs/ccxt/exchanges/okx.cs +++ b/cs/ccxt/exchanges/okx.cs @@ -5346,7 +5346,7 @@ public async override Task withdraw(object code, object amount, object a if (isTrue(isEqual(fee, null))) { object currencies = await this.fetchCurrencies(); - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); object targetNetwork = this.safeDict(getValue(currency, "networks"), this.networkIdToCode(network), new Dictionary() {}); fee = this.safeString(targetNetwork, "fee"); if (isTrue(isEqual(fee, null))) @@ -7513,7 +7513,7 @@ public override object parseMarketLeverageTiers(object info, object market = nul /** * @method * @name okx#fetchBorrowInterest - * @description fetch the interest owed by the user for borrowing currency for margin trading + * @description fetch the interest owed b the user for borrowing currency for margin trading * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data * @param {string} code the unified currency code for the currency of the interest * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned diff --git a/cs/ccxt/exchanges/paradex.cs b/cs/ccxt/exchanges/paradex.cs index 86ae7f7b87bb4..95f10ac91c420 100644 --- a/cs/ccxt/exchanges/paradex.cs +++ b/cs/ccxt/exchanges/paradex.cs @@ -62,6 +62,7 @@ public override object describe() { "fetchFundingRateHistory", false }, { "fetchFundingRates", false }, { "fetchGreeks", true }, + { "fetchAllGreeks", true }, { "fetchIndexOHLCV", false }, { "fetchIsolatedBorrowRate", false }, { "fetchIsolatedBorrowRates", false }, @@ -800,7 +801,7 @@ public override object parseTicker(object ticker, object market = null) // "ask": "69578.2", // "volume_24h": "5815541.397939004", // "total_volume": "584031465.525259686", - // "created_at": 1718170156580, + // "created_at": 1718170156581, // "underlying_price": "67367.37268422", // "open_interest": "162.272", // "funding_rate": "0.01629574927887", @@ -2639,6 +2640,62 @@ public async override Task fetchGreeks(object symbol, object parameters return this.parseGreeks(greeks, market); } + /** + * @method + * @name paradex#fetchAllGreeks + * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary + * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} + */ + public async override Task fetchAllGreeks(object symbols = null, object parameters = null) + { + parameters ??= new Dictionary(); + await this.loadMarkets(); + symbols = this.marketSymbols(symbols, null, true, true, true); + object request = new Dictionary() { + { "market", "ALL" }, + }; + object response = await this.publicGetMarketsSummary(this.extend(request, parameters)); + // + // { + // "results": [ + // { + // "symbol": "BTC-USD-114000-P", + // "mark_price": "10835.66892602", + // "mark_iv": "0.71781855", + // "delta": "-0.98726024", + // "greeks": { + // "delta": "-0.9872602390817709", + // "gamma": "0.000004560958862297231", + // "vega": "227.11344863639806", + // "rho": "-302.0617972461581", + // "vanna": "0.06609830491614832", + // "volga": "925.9501532805552" + // }, + // "last_traded_price": "10551.5", + // "bid": "10794.9", + // "bid_iv": "0.05", + // "ask": "10887.3", + // "ask_iv": "0.8783283", + // "last_iv": "0.05", + // "volume_24h": "0", + // "total_volume": "195240.72672261014", + // "created_at": 1747644009995, + // "underlying_price": "103164.79162649", + // "open_interest": "0", + // "funding_rate": "0.000004464241170536191", + // "price_change_rate_24h": "0.074915", + // "future_funding_rate": "0.0001" + // } + // ] + // } + // + object results = this.safeList(response, "results", new List() {}); + return this.parseAllGreeks(results, symbols); + } + public override object parseGreeks(object greeks, object market = null) { // diff --git a/cs/ccxt/exchanges/pro/bitstamp.cs b/cs/ccxt/exchanges/pro/bitstamp.cs index 1c604abeb7ca9..e0c22d4a3748f 100644 --- a/cs/ccxt/exchanges/pro/bitstamp.cs +++ b/cs/ccxt/exchanges/pro/bitstamp.cs @@ -578,7 +578,7 @@ public async virtual Task authenticate(object parameters = null) object sessionToken = this.safeString(response, "token"); if (isTrue(!isEqual(sessionToken, null))) { - object userId = this.safeNumber(response, "user_id"); + object userId = this.safeString(response, "user_id"); object validity = this.safeIntegerProduct(response, "valid_sec", 1000); ((IDictionary)this.options)["expiresIn"] = this.sum(time, validity); ((IDictionary)this.options)["userId"] = userId; diff --git a/cs/ccxt/exchanges/pro/bybit.cs b/cs/ccxt/exchanges/pro/bybit.cs index e466caaeb4a66..b20fa3490a80a 100644 --- a/cs/ccxt/exchanges/pro/bybit.cs +++ b/cs/ccxt/exchanges/pro/bybit.cs @@ -1412,8 +1412,7 @@ public async virtual Task unWatchMyTrades(object symbol = null, object p await this.loadMarkets(); if (isTrue(!isEqual(symbol, null))) { - symbol = this.symbol(symbol); - subHash = add(subHash, add(":", symbol)); + throw new NotSupported ((string)add(this.id, " unWatchMyTrades() does not support a symbol parameter, you must unwatch all my trades")) ; } object url = await this.getUrlByMarketType(symbol, true, method, parameters); await this.authenticate(url); @@ -1907,7 +1906,7 @@ public async override Task watchOrders(object symbol = null, object sinc * @param {boolean} [params.unifiedMargin] use unified margin account * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ - public async virtual Task unWatchOrders(object symbol = null, object parameters = null) + public async override Task unWatchOrders(object symbol = null, object parameters = null) { parameters ??= new Dictionary(); await this.loadMarkets(); @@ -1916,8 +1915,7 @@ public async virtual Task unWatchOrders(object symbol = null, object par object subHash = "orders"; if (isTrue(!isEqual(symbol, null))) { - symbol = this.symbol(symbol); - subHash = add(subHash, add(":", symbol)); + throw new NotSupported ((string)add(this.id, " unWatchOrders() does not support a symbol parameter, you must unwatch all orders")) ; } object url = await this.getUrlByMarketType(symbol, true, method, parameters); await this.authenticate(url); @@ -2060,14 +2058,12 @@ public virtual void handleOrder(WebSocketClient client, object message) object symbols = new Dictionary() {}; for (object i = 0; isLessThan(i, getArrayLength(rawOrders)); postFixIncrement(ref i)) { - object parsed = null; - if (isTrue(isSpot)) - { - parsed = this.parseWsSpotOrder(getValue(rawOrders, i)); - } else - { - parsed = this.parseOrder(getValue(rawOrders, i)); - } + object parsed = this.parseOrder(getValue(rawOrders, i)); + // if (isSpot) { + // parsed = this.parseWsSpotOrder (rawOrders[i]); + // } else { + // parsed = this.parseOrder (rawOrders[i]); + // } object symbol = getValue(parsed, "symbol"); ((IDictionary)symbols)[(string)symbol] = true; callDynamically(orders, "append", new object[] {parsed}); @@ -2082,148 +2078,6 @@ public virtual void handleOrder(WebSocketClient client, object message) callDynamically(client as WebSocketClient, "resolve", new object[] {orders, messageHash}); } - public virtual object parseWsSpotOrder(object order, object market = null) - { - // - // { - // "e": "executionReport", - // "E": "1653297251061", // timestamp - // "s": "LTCUSDT", // symbol - // "c": "1653297250740", // user id - // "S": "SELL", // side - // "o": "MARKET_OF_BASE", // order type - // "f": "GTC", // time in force - // "q": "0.16233", // quantity - // "p": "0", // price - // "X": "NEW", // status - // "i": "1162336018974750208", // order id - // "M": "0", - // "l": "0", // last filled - // "z": "0", // total filled - // "L": "0", // last traded price - // "n": "0", // trading fee - // "N": '', // fee asset - // "u": true, - // "w": true, - // "m": false, // is limit_maker - // "O": "1653297251042", // order creation - // "Z": "0", // total filled - // "A": "0", // account id - // "C": false, // is close - // "v": "0", // leverage - // "d": "NO_LIQ" - // } - // v5 - // { - // "category":"spot", - // "symbol":"LTCUSDT", - // "orderId":"1474764674982492160", - // "orderLinkId":"1690541649154749", - // "blockTradeId":"", - // "side":"Buy", - // "positionIdx":0, - // "orderStatus":"Cancelled", - // "cancelType":"UNKNOWN", - // "rejectReason":"EC_NoError", - // "timeInForce":"GTC", - // "isLeverage":"0", - // "price":"0", - // "qty":"5.00000", - // "avgPrice":"0", - // "leavesQty":"0.00000", - // "leavesValue":"5.0000000", - // "cumExecQty":"0.00000", - // "cumExecValue":"0.0000000", - // "cumExecFee":"", - // "orderType":"Market", - // "stopOrderType":"", - // "orderIv":"", - // "triggerPrice":"0.000", - // "takeProfit":"", - // "stopLoss":"", - // "triggerBy":"", - // "tpTriggerBy":"", - // "slTriggerBy":"", - // "triggerDirection":0, - // "placeType":"", - // "lastPriceOnCreated":"0.000", - // "closeOnTrigger":false, - // "reduceOnly":false, - // "smpGroup":0, - // "smpType":"None", - // "smpOrderId":"", - // "createdTime":"1690541649160", - // "updatedTime":"1690541649168" - // } - // - object id = this.safeString2(order, "i", "orderId"); - object marketId = this.safeString2(order, "s", "symbol"); - object symbol = this.safeSymbol(marketId, market, null, "spot"); - object timestamp = this.safeInteger2(order, "O", "createdTime"); - object price = this.safeString2(order, "p", "price"); - if (isTrue(isEqual(price, "0"))) - { - price = null; // market orders - } - object filled = this.safeString2(order, "z", "cumExecQty"); - object status = this.parseOrderStatus(this.safeString2(order, "X", "orderStatus")); - object side = this.safeStringLower2(order, "S", "side"); - object lastTradeTimestamp = this.safeString2(order, "E", "updatedTime"); - object timeInForce = this.safeString2(order, "f", "timeInForce"); - object amount = null; - object cost = this.safeString2(order, "Z", "cumExecValue"); - object type = this.safeStringLower2(order, "o", "orderType"); - if (isTrue(isTrue((!isEqual(type, null))) && isTrue((isGreaterThanOrEqual(getIndexOf(type, "market"), 0))))) - { - type = "market"; - } - if (isTrue(isTrue(isEqual(type, "market")) && isTrue(isEqual(side, "buy")))) - { - amount = filled; - } else - { - amount = this.safeString2(order, "orderQty", "qty"); - } - object fee = null; - object feeCost = this.safeString2(order, "n", "cumExecFee"); - if (isTrue(isTrue(!isEqual(feeCost, null)) && isTrue(!isEqual(feeCost, "0")))) - { - object feeCurrencyId = this.safeString(order, "N"); - object feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId); - fee = new Dictionary() { - { "cost", feeCost }, - { "currency", feeCurrencyCode }, - }; - } - object triggerPrice = this.omitZero(this.safeString(order, "triggerPrice")); - return this.safeOrder(new Dictionary() { - { "info", order }, - { "id", id }, - { "clientOrderId", this.safeString2(order, "c", "orderLinkId") }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "lastTradeTimestamp", lastTradeTimestamp }, - { "symbol", symbol }, - { "type", type }, - { "timeInForce", timeInForce }, - { "postOnly", null }, - { "side", side }, - { "price", price }, - { "stopPrice", triggerPrice }, - { "triggerPrice", triggerPrice }, - { "takeProfitPrice", this.safeString(order, "takeProfit") }, - { "stopLossPrice", this.safeString(order, "stopLoss") }, - { "reduceOnly", this.safeValue(order, "reduceOnly") }, - { "amount", amount }, - { "cost", cost }, - { "average", this.safeString(order, "avgPrice") }, - { "filled", filled }, - { "remaining", null }, - { "status", status }, - { "fee", fee }, - }, market); - } - /** * @method * @name bybit#watchBalance diff --git a/cs/ccxt/exchanges/pro/kraken.cs b/cs/ccxt/exchanges/pro/kraken.cs index 50bdbeffd7abe..46940f3a0c343 100644 --- a/cs/ccxt/exchanges/pro/kraken.cs +++ b/cs/ccxt/exchanges/pro/kraken.cs @@ -35,6 +35,7 @@ public override object describe() { "public", "wss://ws.kraken.com" }, { "private", "wss://ws-auth.kraken.com" }, { "privateV2", "wss://ws-auth.kraken.com/v2" }, + { "publicV2", "wss://ws.kraken.com/v2" }, { "beta", "wss://beta-ws.kraken.com" }, { "beta-private", "wss://beta-ws-auth.kraken.com" }, } }, @@ -46,9 +47,13 @@ public override object describe() { "ordersLimit", 1000 }, { "symbolsByOrderId", new Dictionary() {} }, { "watchOrderBook", new Dictionary() { - { "checksum", true }, + { "checksum", false }, } }, } }, + { "streaming", new Dictionary() { + { "ping", this.ping }, + { "keepAlive", 6000 }, + } }, { "exceptions", new Dictionary() { { "ws", new Dictionary() { { "exact", new Dictionary() { @@ -99,6 +104,7 @@ public override object describe() { "EService:Market in post_only mode", typeof(NotSupported) }, { "EService:Unavailable", typeof(ExchangeNotAvailable) }, { "ETrade:Invalid request", typeof(BadRequest) }, + { "ESession:Invalid session", typeof(AuthenticationError) }, } }, } }, } }, @@ -408,8 +414,8 @@ public async override Task editOrderWs(object id, object symbol, object /** * @method * @name kraken#cancelOrdersWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder * @description cancel multiple orders + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_order * @param {string[]} ids order ids * @param {string} [symbol] unified market symbol, default is undefined * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -441,8 +447,8 @@ public async override Task cancelOrdersWs(object ids, object symbol = nu /** * @method * @name kraken#cancelOrderWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder * @description cancels an open order + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_order * @param {string} id order id * @param {string} [symbol] unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -492,8 +498,8 @@ public virtual void handleCancelOrder(WebSocketClient client, object message) /** * @method * @name kraken#cancelAllOrdersWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelall * @description cancel all open orders + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_all * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} @@ -538,56 +544,59 @@ public virtual void handleCancelAllOrders(WebSocketClient client, object message callDynamically(client as WebSocketClient, "resolve", new object[] {message, reqId}); } - public virtual void handleTicker(WebSocketClient client, object message, object subscription) + public virtual void handleTicker(WebSocketClient client, object message) { // - // [ - // 0, // channelID - // { - // "a": [ "5525.40000", 1, "1.000" ], // ask, wholeAskVolume, askVolume - // "b": [ "5525.10000", 1, "1.000" ], // bid, wholeBidVolume, bidVolume - // "c": [ "5525.10000", "0.00398963" ], // closing price, volume - // "h": [ "5783.00000", "5783.00000" ], // high price today, high price 24h ago - // "l": [ "5505.00000", "5505.00000" ], // low price today, low price 24h ago - // "o": [ "5760.70000", "5763.40000" ], // open price today, open price 24h ago - // "p": [ "5631.44067", "5653.78939" ], // vwap today, vwap 24h ago - // "t": [ 11493, 16267 ], // number of trades today, 24 hours ago - // "v": [ "2634.11501494", "3591.17907851" ], // volume today, volume 24 hours ago - // }, - // "ticker", - // "XBT/USD" - // ] + // { + // "channel": "ticker", + // "type": "snapshot", + // "data": [ + // { + // "symbol": "BTC/USD", + // "bid": 108359.8, + // "bid_qty": 0.01362603, + // "ask": 108359.9, + // "ask_qty": 17.17988863, + // "last": 108359.8, + // "volume": 2158.32346723, + // "vwap": 108894.5, + // "low": 106824, + // "high": 111300, + // "change": -2679.9, + // "change_pct": -2.41 + // } + // ] + // } // - object wsName = getValue(message, 3); - object market = this.safeValue(getValue(this.options, "marketsByWsName"), wsName); - object symbol = getValue(market, "symbol"); + object data = this.safeList(message, "data", new List() {}); + object ticker = getValue(data, 0); + object symbol = this.safeString(ticker, "symbol"); object messageHash = this.getMessageHash("ticker", null, symbol); - object ticker = getValue(message, 1); - object vwap = this.safeString(getValue(ticker, "p"), 0); + object vwap = this.safeString(ticker, "vwap"); object quoteVolume = null; - object baseVolume = this.safeString(getValue(ticker, "v"), 0); + object baseVolume = this.safeString(ticker, "volume"); if (isTrue(isTrue(!isEqual(baseVolume, null)) && isTrue(!isEqual(vwap, null)))) { quoteVolume = Precise.stringMul(baseVolume, vwap); } - object last = this.safeString(getValue(ticker, "c"), 0); + object last = this.safeString(ticker, "last"); object result = this.safeTicker(new Dictionary() { { "symbol", symbol }, { "timestamp", null }, { "datetime", null }, - { "high", this.safeString(getValue(ticker, "h"), 0) }, - { "low", this.safeString(getValue(ticker, "l"), 0) }, - { "bid", this.safeString(getValue(ticker, "b"), 0) }, - { "bidVolume", this.safeString(getValue(ticker, "b"), 2) }, - { "ask", this.safeString(getValue(ticker, "a"), 0) }, - { "askVolume", this.safeString(getValue(ticker, "a"), 2) }, + { "high", this.safeString(ticker, "high") }, + { "low", this.safeString(ticker, "low") }, + { "bid", this.safeString(ticker, "bid") }, + { "bidVolume", this.safeString(ticker, "bid_qty") }, + { "ask", this.safeString(ticker, "ask") }, + { "askVolume", this.safeString(ticker, "ask_qty") }, { "vwap", vwap }, - { "open", this.safeString(getValue(ticker, "o"), 0) }, + { "open", null }, { "close", last }, { "last", last }, { "previousClose", null }, - { "change", null }, - { "percentage", null }, + { "change", this.safeString(ticker, "change") }, + { "percentage", this.safeString(ticker, "change_pct") }, { "average", null }, { "baseVolume", baseVolume }, { "quoteVolume", quoteVolume }, @@ -597,24 +606,29 @@ public virtual void handleTicker(WebSocketClient client, object message, object callDynamically(client as WebSocketClient, "resolve", new object[] {result, messageHash}); } - public virtual void handleTrades(WebSocketClient client, object message, object subscription) + public virtual void handleTrades(WebSocketClient client, object message) { // - // [ - // 0, // channelID - // [ // price volume time side type misc - // [ "5541.20000", "0.15850568", "1534614057.321596", "s", "l", "" ], - // [ "6060.00000", "0.02455000", "1534614057.324998", "b", "l", "" ], - // ], - // "trade", - // "XBT/USD" - // ] + // { + // "channel": "trade", + // "type": "update", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "side": "sell", + // "price": 0.5117, + // "qty": 40.0, + // "ord_type": "market", + // "trade_id": 4665906, + // "timestamp": "2023-09-25T07:49:37.708706Z" + // } + // ] + // } // - object wsName = this.safeString(message, 3); - object name = this.safeString(message, 2); - object market = this.safeValue(getValue(this.options, "marketsByWsName"), wsName); - object symbol = getValue(market, "symbol"); - object messageHash = this.getMessageHash(name, null, symbol); + object data = this.safeList(message, "data", new List() {}); + object trade = getValue(data, 0); + object symbol = this.safeString(trade, "symbol"); + object messageHash = this.getMessageHash("trade", null, symbol); object stored = this.safeValue(this.trades, symbol); if (isTrue(isEqual(stored, null))) { @@ -622,8 +636,8 @@ public virtual void handleTrades(WebSocketClient client, object message, object stored = new ArrayCache(limit); ((IDictionary)this.trades)[(string)symbol] = stored; } - object trades = this.safeValue(message, 1, new List() {}); - object parsed = this.parseTrades(trades, market); + object market = this.market(symbol); + object parsed = this.parseTrades(data, market); for (object i = 0; isLessThan(i, getArrayLength(parsed)); postFixIncrement(ref i)) { callDynamically(stored, "append", new object[] {getValue(parsed, i)}); @@ -713,7 +727,7 @@ public async virtual Task watchPublic(object name, object symbol, object * @method * @name kraken#watchTicker * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://docs.kraken.com/api/docs/websocket-v1/ticker + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string} symbol unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -731,7 +745,7 @@ public async override Task watchTicker(object symbol, object parameters * @method * @name kraken#watchTickers * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://docs.kraken.com/api/docs/websocket-v1/ticker + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string[]} symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -754,8 +768,8 @@ public async override Task watchTickers(object symbols = null, object pa /** * @method * @name kraken#watchBidsAsks - * @see https://docs.kraken.com/api/docs/websocket-v1/spread * @description watches best bid & ask for symbols + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string[]} symbols unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -765,7 +779,8 @@ public async override Task watchBidsAsks(object symbols = null, object p parameters ??= new Dictionary(); await this.loadMarkets(); symbols = this.marketSymbols(symbols, null, false); - object ticker = await this.watchMultiHelper("bidask", "spread", symbols, null, parameters); + ((IDictionary)parameters)["event_trigger"] = "bbo"; + object ticker = await this.watchMultiHelper("bidask", "ticker", symbols, null, parameters); if (isTrue(this.newUpdates)) { object result = new Dictionary() {}; @@ -775,53 +790,11 @@ public async override Task watchBidsAsks(object symbols = null, object p return this.filterByArray(this.bidsasks, "symbol", symbols); } - public virtual void handleBidAsk(WebSocketClient client, object message, object subscription) - { - // - // [ - // 7208974, // channelID - // [ - // "63758.60000", // bid - // "63759.10000", // ask - // "1726814731.089778", // timestamp - // "0.00057917", // bid_volume - // "0.15681688" // ask_volume - // ], - // "spread", - // "XBT/USDT" - // ] - // - object parsedTicker = this.parseWsBidAsk(message); - object symbol = getValue(parsedTicker, "symbol"); - ((IDictionary)this.bidsasks)[(string)symbol] = parsedTicker; - object messageHash = this.getMessageHash("bidask", null, symbol); - callDynamically(client as WebSocketClient, "resolve", new object[] {parsedTicker, messageHash}); - } - - public virtual object parseWsBidAsk(object ticker, object market = null) - { - object data = this.safeList(ticker, 1, new List() {}); - object marketId = this.safeString(ticker, 3); - market = this.safeValue(getValue(this.options, "marketsByWsName"), marketId); - object symbol = this.safeString(market, "symbol"); - object timestamp = multiply(this.parseToInt(this.safeInteger(data, 2)), 1000); - return this.safeTicker(new Dictionary() { - { "symbol", symbol }, - { "timestamp", timestamp }, - { "datetime", this.iso8601(timestamp) }, - { "ask", this.safeString(data, 1) }, - { "askVolume", this.safeString(data, 4) }, - { "bid", this.safeString(data, 0) }, - { "bidVolume", this.safeString(data, 3) }, - { "info", ticker }, - }, market); - } - /** * @method * @name kraken#watchTrades * @description get the list of most recent trades for a particular symbol - * @see https://docs.kraken.com/api/docs/websocket-v1/trade + * @see https://docs.kraken.com/api/docs/websocket-v2/trade * @param {string} symbol unified symbol of the market to fetch trades for * @param {int} [since] timestamp in ms of the earliest trade to fetch * @param {int} [limit] the maximum amount of trades to fetch @@ -837,8 +810,8 @@ public async override Task watchTrades(object symbol, object since = nul /** * @method * @name kraken#watchTradesForSymbols - * @see https://docs.kraken.com/api/docs/websocket-v1/trade * @description get the list of most recent trades for a list of symbols + * @see https://docs.kraken.com/api/docs/websocket-v2/trade * @param {string[]} symbols unified symbol of the market to fetch trades for * @param {int} [since] timestamp in ms of the earliest trade to fetch * @param {int} [limit] the maximum amount of trades to fetch @@ -862,7 +835,7 @@ public async override Task watchTradesForSymbols(object symbols, object * @method * @name kraken#watchOrderBook * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://docs.kraken.com/api/docs/websocket-v1/book + * @see https://docs.kraken.com/api/docs/websocket-v2/book * @param {string} symbol unified symbol of the market to fetch the order book for * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -878,7 +851,7 @@ public async override Task watchOrderBook(object symbol, object limit = * @method * @name kraken#watchOrderBookForSymbols * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://docs.kraken.com/api/docs/websocket-v1/book + * @see https://docs.kraken.com/api/docs/websocket-v2/book * @param {string[]} symbols unified array of symbols * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -892,7 +865,7 @@ public async override Task watchOrderBookForSymbols(object symbols, obje { if (isTrue(this.inArray(limit, new List() {10, 25, 100, 500, 1000}))) { - ((IDictionary)request)["subscription"] = new Dictionary() { + ((IDictionary)request)["params"] = new Dictionary() { { "depth", limit }, }; } else @@ -970,6 +943,26 @@ public async override Task loadMarkets(object reload = null, object para return markets; } + public override object ping(WebSocketClient client) + { + object url = client.url; + object request = new Dictionary() {}; + if (isTrue(isGreaterThanOrEqual(getIndexOf(url, "v2"), 0))) + { + ((IDictionary)request)["method"] = "ping"; + } else + { + ((IDictionary)request)["event"] = "ping"; + } + return request; + } + + public virtual object handlePong(WebSocketClient client, object message) + { + client.lastPong = this.milliseconds(); + return message; + } + public async virtual Task watchHeartbeat(object parameters = null) { parameters ??= new Dictionary(); @@ -990,194 +983,175 @@ public virtual void handleHeartbeat(WebSocketClient client, object message) callDynamically(client as WebSocketClient, "resolve", new object[] {message, eventVar}); } - public virtual void handleOrderBook(WebSocketClient client, object message, object subscription) + public virtual void handleOrderBook(WebSocketClient client, object message) { // // first message (snapshot) // - // [ - // 1234, // channelID - // { - // "as": [ - // [ "5541.30000", "2.50700000", "1534614248.123678" ], - // [ "5541.80000", "0.33000000", "1534614098.345543" ], - // [ "5542.70000", "0.64700000", "1534614244.654432" ] - // ], - // "bs": [ - // [ "5541.20000", "1.52900000", "1534614248.765567" ], - // [ "5539.90000", "0.30000000", "1534614241.769870" ], - // [ "5539.50000", "5.00000000", "1534613831.243486" ] - // ] - // }, - // "book-10", - // "XBT/USD" - // ] + // { + // "channel": "book", + // "type": "snapshot", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "bids": [ + // { + // "price": 0.5666, + // "qty": 4831.75496356 + // }, + // { + // "price": 0.5665, + // "qty": 6658.22734739 + // } + // ], + // "asks": [ + // { + // "price": 0.5668, + // "qty": 4410.79769741 + // }, + // { + // "price": 0.5669, + // "qty": 4655.40412487 + // } + // ], + // "checksum": 2439117997 + // } + // ] + // } // // subsequent updates // - // [ - // 1234, - // { // optional - // "a": [ - // [ "5541.30000", "2.50700000", "1534614248.456738" ], - // [ "5542.50000", "0.40100000", "1534614248.456738" ] - // ] - // }, - // { // optional - // "b": [ - // [ "5541.30000", "0.00000000", "1534614335.345903" ] - // ] - // }, - // "book-10", - // "XBT/USD" - // ] + // { + // "channel": "book", + // "type": "update", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "bids": [ + // { + // "price": 0.5657, + // "qty": 1098.3947558 + // } + // ], + // "asks": [], + // "checksum": 2114181697, + // "timestamp": "2023-10-06T17:35:55.440295Z" + // } + // ] + // } // - object messageLength = getArrayLength(message); - object wsName = getValue(message, subtract(messageLength, 1)); - object bookDepthString = getValue(message, subtract(messageLength, 2)); - object parts = ((string)bookDepthString).Split(new [] {((string)"-")}, StringSplitOptions.None).ToList(); - object depth = this.safeInteger(parts, 1, 10); - object market = this.safeValue(getValue(this.options, "marketsByWsName"), wsName); - object symbol = getValue(market, "symbol"); - object timestamp = null; + object type = this.safeString(message, "type"); + object data = this.safeList(message, "data", new List() {}); + object first = this.safeDict(data, 0, new Dictionary() {}); + object symbol = this.safeString(first, "symbol"); + object a = this.safeValue(first, "asks", new List() {}); + object b = this.safeValue(first, "bids", new List() {}); + object c = this.safeInteger(first, "checksum"); object messageHash = this.getMessageHash("orderbook", null, symbol); - // if this is a snapshot - if (isTrue(inOp(getValue(message, 1), "as"))) + object orderbook = null; + if (isTrue(isEqual(type, "update"))) { - // todo get depth from marketsByWsName - ((IDictionary)this.orderbooks)[(string)symbol] = this.orderBook(new Dictionary() {}, depth); - object orderbook = getValue(this.orderbooks, symbol); - object sides = new Dictionary() { - { "as", "asks" }, - { "bs", "bids" }, - }; - object keys = new List(((IDictionary)sides).Keys); - for (object i = 0; isLessThan(i, getArrayLength(keys)); postFixIncrement(ref i)) + orderbook = getValue(this.orderbooks, symbol); + object storedAsks = getValue(orderbook, "asks"); + object storedBids = getValue(orderbook, "bids"); + if (isTrue(!isEqual(a, null))) { - object key = getValue(keys, i); - object side = getValue(sides, key); - object bookside = getValue(orderbook, side); - object deltas = this.safeValue(getValue(message, 1), key, new List() {}); - timestamp = this.customHandleDeltas(bookside, deltas, timestamp); + this.customHandleDeltas(storedAsks, a); } + if (isTrue(!isEqual(b, null))) + { + this.customHandleDeltas(storedBids, b); + } + object datetime = this.safeString(first, "timestamp"); ((IDictionary)orderbook)["symbol"] = symbol; - ((IDictionary)orderbook)["timestamp"] = timestamp; - ((IDictionary)orderbook)["datetime"] = this.iso8601(timestamp); - callDynamically(client as WebSocketClient, "resolve", new object[] {orderbook, messageHash}); + ((IDictionary)orderbook)["timestamp"] = this.parse8601(datetime); + ((IDictionary)orderbook)["datetime"] = datetime; } else { - object orderbook = getValue(this.orderbooks, symbol); - // else, if this is an orderbook update - object a = null; - object b = null; - object c = null; - if (isTrue(isEqual(messageLength, 5))) - { - a = this.safeValue(getValue(message, 1), "a", new List() {}); - b = this.safeValue(getValue(message, 2), "b", new List() {}); - c = this.safeInteger(getValue(message, 1), "c"); - c = this.safeInteger(getValue(message, 2), "c", c); - } else + // snapshot + object depth = getArrayLength(a); + ((IDictionary)this.orderbooks)[(string)symbol] = this.orderBook(new Dictionary() {}, depth); + orderbook = getValue(this.orderbooks, symbol); + object keys = new List() {"asks", "bids"}; + for (object i = 0; isLessThan(i, getArrayLength(keys)); postFixIncrement(ref i)) { - c = this.safeInteger(getValue(message, 1), "c"); - if (isTrue(inOp(getValue(message, 1), "a"))) - { - a = this.safeValue(getValue(message, 1), "a", new List() {}); - } else + object key = getValue(keys, i); + object bookside = getValue(orderbook, key); + object deltas = this.safeValue(first, key, new List() {}); + if (isTrue(isGreaterThan(getArrayLength(deltas), 0))) { - b = this.safeValue(getValue(message, 1), "b", new List() {}); + this.customHandleDeltas(bookside, deltas); } } - object storedAsks = getValue(orderbook, "asks"); - object storedBids = getValue(orderbook, "bids"); - object example = null; - if (isTrue(!isEqual(a, null))) - { - timestamp = this.customHandleDeltas(storedAsks, a, timestamp); - example = this.safeValue(a, 0); - } - if (isTrue(!isEqual(b, null))) - { - timestamp = this.customHandleDeltas(storedBids, b, timestamp); - example = this.safeValue(b, 0); - } - // don't remove this line or I will poop on your face - (orderbook as IOrderBook).limit(); - object checksum = this.handleOption("watchOrderBook", "checksum", true); - if (isTrue(checksum)) + ((IDictionary)orderbook)["symbol"] = symbol; + } + (orderbook as IOrderBook).limit(); + // checksum temporarily disabled because the exchange checksum was not reliable + object checksum = this.handleOption("watchOrderBook", "checksum", false); + if (isTrue(checksum)) + { + object payloadArray = new List() {}; + if (isTrue(!isEqual(c, null))) { - object priceString = this.safeString(example, 0); - object amountString = this.safeString(example, 1); - object priceParts = ((string)priceString).Split(new [] {((string)".")}, StringSplitOptions.None).ToList(); - object amountParts = ((string)amountString).Split(new [] {((string)".")}, StringSplitOptions.None).ToList(); - object priceLength = subtract(((string)getValue(priceParts, 1)).Length, 0); - object amountLength = subtract(((string)getValue(amountParts, 1)).Length, 0); - object payloadArray = new List() {}; - if (isTrue(!isEqual(c, null))) + object checkAsks = getValue(orderbook, "asks"); + object checkBids = getValue(orderbook, "bids"); + // const checkAsks = asks.map ((elem) => [ elem['price'], elem['qty'] ]); + // const checkBids = bids.map ((elem) => [ elem['price'], elem['qty'] ]); + for (object i = 0; isLessThan(i, 10); postFixIncrement(ref i)) { - for (object i = 0; isLessThan(i, 10); postFixIncrement(ref i)) - { - object formatted = add(this.formatNumber(getValue(getValue(storedAsks, i), 0), priceLength), this.formatNumber(getValue(getValue(storedAsks, i), 1), amountLength)); - ((IList)payloadArray).Add(formatted); - } - for (object i = 0; isLessThan(i, 10); postFixIncrement(ref i)) - { - object formatted = add(this.formatNumber(getValue(getValue(storedBids, i), 0), priceLength), this.formatNumber(getValue(getValue(storedBids, i), 1), amountLength)); - ((IList)payloadArray).Add(formatted); - } + object currentAsk = this.safeValue(checkAsks, i, new Dictionary() {}); + object formattedAsk = add(this.formatNumber(getValue(currentAsk, 0)), this.formatNumber(getValue(currentAsk, 1))); + ((IList)payloadArray).Add(formattedAsk); } - object payload = String.Join("", ((IList)payloadArray).ToArray()); - object localChecksum = this.crc32(payload, false); - if (isTrue(!isEqual(localChecksum, c))) + for (object i = 0; isLessThan(i, 10); postFixIncrement(ref i)) { - var error = new ChecksumError(add(add(this.id, " "), this.orderbookChecksumMessage(symbol))); - ((IDictionary)((WebSocketClient)client).subscriptions).Remove((string)messageHash); - ((IDictionary)this.orderbooks).Remove((string)symbol); - ((WebSocketClient)client).reject(error, messageHash); - return; + object currentBid = this.safeValue(checkBids, i, new Dictionary() {}); + object formattedBid = add(this.formatNumber(getValue(currentBid, 0)), this.formatNumber(getValue(currentBid, 1))); + ((IList)payloadArray).Add(formattedBid); } } - ((IDictionary)orderbook)["symbol"] = symbol; - ((IDictionary)orderbook)["timestamp"] = timestamp; - ((IDictionary)orderbook)["datetime"] = this.iso8601(timestamp); - callDynamically(client as WebSocketClient, "resolve", new object[] {orderbook, messageHash}); + object payload = String.Join("", ((IList)payloadArray).ToArray()); + object localChecksum = this.crc32(payload, false); + if (isTrue(!isEqual(localChecksum, c))) + { + var error = new ChecksumError(add(add(this.id, " "), this.orderbookChecksumMessage(symbol))); + ((IDictionary)((WebSocketClient)client).subscriptions).Remove((string)messageHash); + ((IDictionary)this.orderbooks).Remove((string)symbol); + ((WebSocketClient)client).reject(error, messageHash); + return; + } } + callDynamically(client as WebSocketClient, "resolve", new object[] {orderbook, messageHash}); } - public virtual object formatNumber(object n, object length) + public virtual void customHandleDeltas(object bookside, object deltas) { - object stringNumber = this.numberToString(n); - object parts = ((string)stringNumber).Split(new [] {((string)".")}, StringSplitOptions.None).ToList(); + // const sortOrder = (key === 'bids') ? true : false; + for (object j = 0; isLessThan(j, getArrayLength(deltas)); postFixIncrement(ref j)) + { + object delta = getValue(deltas, j); + object price = this.safeNumber(delta, "price"); + object amount = this.safeNumber(delta, "qty"); + (bookside as IOrderBookSide).store(price, amount); + } + } + + public virtual object formatNumber(object data) + { + object parts = ((string)data).Split(new [] {((string)".")}, StringSplitOptions.None).ToList(); object integer = this.safeString(parts, 0); object decimals = this.safeString(parts, 1, ""); - object paddedDecimals = (decimals as String).PadRight(Convert.ToInt32(length), Convert.ToChar("0")); - object joined = add(integer, paddedDecimals); + object joinedResult = add(integer, decimals); object i = 0; - while (isEqual(getValue(joined, i), "0")) + while (isEqual(getValue(joinedResult, i), "0")) { i = add(i, 1); } if (isTrue(isGreaterThan(i, 0))) { - return slice(joined, i, null); - } else - { - return joined; + joinedResult = slice(joinedResult, i, null); } - } - - public virtual object customHandleDeltas(object bookside, object deltas, object timestamp = null) - { - for (object j = 0; isLessThan(j, getArrayLength(deltas)); postFixIncrement(ref j)) - { - object delta = getValue(deltas, j); - object price = this.parseNumber(getValue(delta, 0)); - object amount = this.parseNumber(getValue(delta, 1)); - object oldTimestamp = ((bool) isTrue(timestamp)) ? timestamp : 0; - timestamp = mathMax(oldTimestamp, this.parseToInt(multiply(parseFloat(getValue(delta, 2)), 1000))); - (bookside as IOrderBookSide).store(price, amount); - } - return timestamp; + return joinedResult; } public virtual object handleSystemStatus(WebSocketClient client, object message) @@ -1218,8 +1192,12 @@ public async virtual Task authenticate(object parameters = null) var client = this.client(url); object authenticated = "authenticated"; object subscription = this.safeValue(((WebSocketClient)client).subscriptions, authenticated); - if (isTrue(isEqual(subscription, null))) + object now = this.seconds(); + object start = this.safeInteger(subscription, "start"); + object expires = this.safeInteger(subscription, "expires"); + if (isTrue(isTrue((isEqual(subscription, null))) || isTrue((isTrue((!isEqual(subscription, null))) && isTrue(isLessThanOrEqual((add(start, expires)), now)))))) { + // https://docs.kraken.com/api/docs/rest-api/get-websockets-token object response = await this.privatePostGetWebSocketsToken(parameters); // // { @@ -1230,7 +1208,8 @@ public async virtual Task authenticate(object parameters = null) // } // } // - subscription = this.safeValue(response, "result"); + subscription = this.safeDict(response, "result"); + ((IDictionary)subscription)["start"] = now; ((IDictionary)((WebSocketClient)client).subscriptions)[(string)authenticated] = subscription; } return this.safeString(subscription, "token"); @@ -1750,26 +1729,26 @@ public async virtual Task watchMultiHelper(object unifiedName, object ch object messageHashes = new List() {}; for (object i = 0; isLessThan(i, getArrayLength(symbols)); postFixIncrement(ref i)) { - ((IList)messageHashes).Add(this.getMessageHash(unifiedName, null, this.symbol(getValue(symbols, i)))); - } - // for WS subscriptions, we can't use .marketIds (symbols), instead a custom is field needed - object markets = this.marketsForSymbols(symbols); - object wsMarketIds = new List() {}; - for (object i = 0; isLessThan(i, getArrayLength(markets)); postFixIncrement(ref i)) - { - object wsMarketId = this.safeString(getValue(getValue(markets, i), "info"), "wsname"); - ((IList)wsMarketIds).Add(wsMarketId); + object eventTrigger = this.safeString(parameters, "event_trigger"); + if (isTrue(!isEqual(eventTrigger, null))) + { + ((IList)messageHashes).Add(this.getMessageHash(channelName, null, this.symbol(getValue(symbols, i)))); + } else + { + ((IList)messageHashes).Add(this.getMessageHash(unifiedName, null, this.symbol(getValue(symbols, i)))); + } } object request = new Dictionary() { - { "event", "subscribe" }, - { "reqid", this.requestId() }, - { "pair", wsMarketIds }, - { "subscription", new Dictionary() { - { "name", channelName }, + { "method", "subscribe" }, + { "params", new Dictionary() { + { "channel", channelName }, + { "symbol", symbols }, } }, + { "req_id", this.requestId() }, }; - object url = getValue(getValue(getValue(this.urls, "api"), "ws"), "public"); - return await this.watchMultiple(url, messageHashes, this.deepExtend(request, parameters), messageHashes, subscriptionArgs); + ((IDictionary)request)["params"] = this.deepExtend(getValue(request, "params"), parameters); + object url = getValue(getValue(getValue(this.urls, "api"), "ws"), "publicV2"); + return await this.watchMultiple(url, messageHashes, request, messageHashes, subscriptionArgs); } /** @@ -1952,11 +1931,7 @@ public override void handleMessage(WebSocketClient client, object message) object channelName = this.safeString(message, subtract(messageLength, 2)); object name = this.safeString(info, "name"); object methods = new Dictionary() { - { "book", this.handleOrderBook }, { "ohlc", this.handleOHLCV }, - { "ticker", this.handleTicker }, - { "spread", this.handleBidAsk }, - { "trade", this.handleTrades }, { "openOrders", this.handleOrders }, { "ownTrades", this.handleMyTrades }, }; @@ -1972,6 +1947,9 @@ public override void handleMessage(WebSocketClient client, object message) { object methods = new Dictionary() { { "balances", this.handleBalance }, + { "book", this.handleOrderBook }, + { "ticker", this.handleTicker }, + { "trade", this.handleTrades }, }; object method = this.safeValue(methods, channel); if (isTrue(!isEqual(method, null))) @@ -1990,6 +1968,7 @@ public override void handleMessage(WebSocketClient client, object message) { "amend_order", this.handleCreateEditOrder }, { "cancel_order", this.handleCancelOrder }, { "cancel_all", this.handleCancelAllOrders }, + { "pong", this.handlePong }, }; object method = this.safeValue(methods, eventVar); if (isTrue(!isEqual(method, null))) diff --git a/cs/ccxt/exchanges/pro/mexc.cs b/cs/ccxt/exchanges/pro/mexc.cs index ba2a7da623791..6ec26c5d679a5 100644 --- a/cs/ccxt/exchanges/pro/mexc.cs +++ b/cs/ccxt/exchanges/pro/mexc.cs @@ -1221,7 +1221,6 @@ public async override Task watchOrders(object symbol = null, object sinc { parameters ??= new Dictionary(); await this.loadMarkets(); - parameters = this.omit(parameters, "type"); object messageHash = "orders"; object market = null; if (isTrue(!isEqual(symbol, null))) diff --git a/cs/ccxt/exchanges/pro/wrappers/kraken.cs b/cs/ccxt/exchanges/pro/wrappers/kraken.cs index 292f0aa8c443c..d25875cd5e5bb 100644 --- a/cs/ccxt/exchanges/pro/wrappers/kraken.cs +++ b/cs/ccxt/exchanges/pro/wrappers/kraken.cs @@ -65,7 +65,7 @@ public async Task EditOrderWs(string id, string symbol, string type, stri /// cancel multiple orders /// /// - /// See
+ /// See
/// /// /// symbol @@ -91,7 +91,7 @@ public async Task> CancelOrdersWs(List ids, s /// cancels an open order /// /// - /// See
+ /// See
/// /// /// symbol @@ -117,7 +117,7 @@ public async Task CancelOrderWs(string id, string symbol = null, Dictiona /// cancel all open orders /// /// - /// See
+ /// See
/// /// /// symbol @@ -143,7 +143,7 @@ public async Task> CancelAllOrdersWs(string symbol = /// watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market /// /// - /// See
+ /// See
/// /// /// params @@ -163,7 +163,7 @@ public async Task WatchTicker(string symbol, Dictionary /// watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market /// /// - /// See
+ /// See
/// /// /// params @@ -183,7 +183,7 @@ public async Task WatchTickers(List symbols = null, Dictionary< /// watches best bid & ask for symbols /// /// - /// See
+ /// See
/// /// /// params @@ -203,7 +203,7 @@ public async Task WatchBidsAsks(List symbols = null, Dictionary /// get the list of most recent trades for a particular symbol /// /// - /// See
+ /// See
/// /// /// since @@ -237,7 +237,7 @@ public async Task> WatchTrades(string symbol, Int64? since2 = 0, Int /// get the list of most recent trades for a list of symbols /// /// - /// See
+ /// See
/// /// /// since @@ -271,7 +271,7 @@ public async Task> WatchTradesForSymbols(List symbols, Int64 /// watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data /// /// - /// See
+ /// See
/// /// /// limit @@ -298,7 +298,7 @@ public async Task> WatchTradesForSymbols(List symbols, Int64 /// watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data /// /// - /// See
+ /// See
/// /// /// limit diff --git a/cs/ccxt/exchanges/tradeogre.cs b/cs/ccxt/exchanges/tradeogre.cs index b6032cc14ceb4..8b7f60ca4f68a 100644 --- a/cs/ccxt/exchanges/tradeogre.cs +++ b/cs/ccxt/exchanges/tradeogre.cs @@ -431,13 +431,13 @@ public override object parseTicker(object ticker, object market = null) { "vwap", null }, { "open", this.safeString(ticker, "initialprice") }, { "close", this.safeString(ticker, "price") }, - { "last", null }, + { "last", this.safeString(ticker, "price") }, { "previousClose", null }, { "change", null }, { "percentage", null }, { "average", null }, - { "baseVolume", null }, - { "quoteVolume", this.safeString(ticker, "volume") }, + { "baseVolume", this.safeString(ticker, "volume") }, + { "quoteVolume", null }, { "info", ticker }, }, market); } diff --git a/cs/ccxt/exchanges/xt.cs b/cs/ccxt/exchanges/xt.cs index fed8e45f07d75..a60b2d92627a3 100644 --- a/cs/ccxt/exchanges/xt.cs +++ b/cs/ccxt/exchanges/xt.cs @@ -3093,7 +3093,7 @@ public async virtual Task fetchOrdersByStatus(object status, object symb ((IDictionary)request)["state"] = "NOT_TRIGGERED"; } else if (isTrue(isEqual(type, "swap"))) { - ((IDictionary)request)["state"] = "NEW"; + ((IDictionary)request)["state"] = "UNFINISHED"; // NEW & PARTIALLY_FILLED } } else if (isTrue(isEqual(status, "closed"))) { diff --git a/cs/ccxt/wrappers/binance.cs b/cs/ccxt/wrappers/binance.cs index 5cf0a3822877c..1f49006a552cc 100644 --- a/cs/ccxt/wrappers/binance.cs +++ b/cs/ccxt/wrappers/binance.cs @@ -2823,6 +2823,26 @@ public async Task FetchGreeks(string symbol, Dictionary var res = await this.fetchGreeks(symbol, parameters); return new Greeks(res); } + /// + /// fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + /// + /// + /// See
+ /// + /// + /// params + /// + /// object : extra parameters specific to the exchange API endpoint + /// + /// + /// + ///
+ /// object a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}. + public async Task> FetchAllGreeks(List symbols = null, Dictionary parameters = null) + { + var res = await this.fetchAllGreeks(symbols, parameters); + return ((IList)res).Select(item => new Greeks(item)).ToList(); + } public async Task> FetchTradingLimits(List symbols = null, Dictionary parameters = null) { var res = await this.fetchTradingLimits(symbols, parameters); diff --git a/cs/ccxt/wrappers/bitmart.cs b/cs/ccxt/wrappers/bitmart.cs index 4b6d48a84a4ce..c014d98edf811 100644 --- a/cs/ccxt/wrappers/bitmart.cs +++ b/cs/ccxt/wrappers/bitmart.cs @@ -316,6 +316,12 @@ public async Task> FetchOHLCV(string symbol, string timeframe = "1m" /// boolean : *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported) /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// Trade[] a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}. @@ -350,6 +356,12 @@ public async Task> FetchMyTrades(string symbol = null, Int64? since2 /// object : extra parameters specific to the exchange API endpoint /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// object[] a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}. @@ -530,6 +542,12 @@ public async Task CreateMarketBuyOrderWithCost(string symbol, double cost /// int : *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1 /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// object an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. @@ -551,6 +569,12 @@ public async Task CreateOrder(string symbol, string type, string side, do /// object : extra parameters specific to the exchange API endpoint /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// object an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. @@ -865,6 +889,12 @@ public async Task> FetchOrdersByStatus(object status, string symbol /// boolean : *swap only* set to true if you want to fetch trigger orders /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// Order[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. @@ -912,6 +942,12 @@ public async Task> FetchOpenOrders(string symbol = null, Int64? sinc /// string : *spot only* 'cross' or 'isolated', for margin trading /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// Order[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. @@ -987,6 +1023,12 @@ public async Task> FetchCanceledOrders(string symbol = null, Int64? /// boolean : *swap only* set to true if you want to fetch a trailing order /// /// + /// + /// params.stpMode + /// + /// string : self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] + /// + /// /// /// /// object An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. diff --git a/cs/ccxt/wrappers/coinlist.cs b/cs/ccxt/wrappers/coinlist.cs deleted file mode 100644 index 8adfcb154f323..0000000000000 --- a/cs/ccxt/wrappers/coinlist.cs +++ /dev/null @@ -1,831 +0,0 @@ -namespace ccxt; - -// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: -// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code - - -public partial class coinlist -{ - /// - /// fetches the current integer timestamp in milliseconds from the exchange server - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// int the current integer timestamp in milliseconds from the exchange server. - public async Task FetchTime(Dictionary parameters = null) - { - var res = await this.fetchTime(parameters); - return (Int64)res; - } - /// - /// retrieves data on all markets for coinlist - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object[] an array of objects representing market data. - public async Task> FetchMarkets(Dictionary parameters = null) - { - var res = await this.fetchMarkets(parameters); - return ((IList)res).Select(item => new MarketInterface(item)).ToList(); - } - /// - /// fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}. - public async Task FetchTickers(List symbols = null, Dictionary parameters = null) - { - var res = await this.fetchTickers(symbols, parameters); - return new Tickers(res); - } - /// - /// fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}. - public async Task FetchTicker(string symbol, Dictionary parameters = null) - { - var res = await this.fetchTicker(symbol, parameters); - return new Ticker(res); - } - /// - /// fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - /// - /// - /// See
- /// - /// - /// limit - /// - /// int : the maximum amount of order book entries to return (default 100, max 200) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols. - public async Task FetchOrderBook(string symbol, Int64? limit2 = 0, Dictionary parameters = null) - { - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchOrderBook(symbol, limit, parameters); - return new OrderBook(res); - } - /// - /// fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market - /// - /// - /// See
- /// - /// - /// since - /// - /// int : timestamp in ms of the earliest candle to fetch - /// - /// - /// - /// limit - /// - /// int : the maximum amount of candles to fetch - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// int[][] A list of candles ordered as timestamp, open, high, low, close, volume. - public async Task> FetchOHLCV(string symbol, string timeframe = "1m", Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchOHLCV(symbol, timeframe, since, limit, parameters); - return ((IList)res).Select(item => new OHLCV(item)).ToList(); - } - /// - /// get the list of most recent trades for a particular symbol - /// - /// - /// See
- /// - /// - /// since - /// - /// int : timestamp in ms of the earliest trade to fetch - /// - /// - /// - /// limit - /// - /// int : the maximum amount of trades to fetch (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// Trade[] a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}. - public async Task> FetchTrades(string symbol, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchTrades(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Trade(item)).ToList(); - } - /// - /// fetch the trading fees for multiple markets - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols. - public async Task FetchTradingFees(Dictionary parameters = null) - { - var res = await this.fetchTradingFees(parameters); - return new TradingFees(res); - } - /// - /// fetch all the accounts associated with a profile - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type. - public async Task> FetchAccounts(Dictionary parameters = null) - { - var res = await this.fetchAccounts(parameters); - return ((IList)res).Select(item => new Account(item)).ToList(); - } - /// - /// query for balance and get the amount of funds available for trading or funds locked in orders - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}. - public async Task FetchBalance(Dictionary parameters = null) - { - var res = await this.fetchBalance(parameters); - return new Balances(res); - } - /// - /// fetch all trades made by the user - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch trades for - /// - /// - /// - /// limit - /// - /// int : the maximum number of trades structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// Trade[] a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}. - public async Task> FetchMyTrades(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchMyTrades(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Trade(item)).ToList(); - } - /// - /// fetch all the trades made from a single order - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch trades for - /// - /// - /// - /// limit - /// - /// int : the maximum number of trades to retrieve - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object[] a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}. - public async Task> FetchOrderTrades(string id, string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchOrderTrades(id, symbol, since, limit, parameters); - return ((IList)res).Select(item => new Trade(item)).ToList(); - } - /// - /// fetches information on multiple orders made by the user - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch orders for - /// - /// - /// - /// limit - /// - /// int : the maximum number of order structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// Order[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task> FetchOrders(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchOrders(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Order(item)).ToList(); - } - /// - /// fetches information on an order made by the user - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task FetchOrder(string id, string symbol = null, Dictionary parameters = null) - { - var res = await this.fetchOrder(id, symbol, parameters); - return new Order(res); - } - /// - /// fetch all unfilled currently open orders - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch open orders for - /// - /// - /// - /// limit - /// - /// int : the maximum number of open order structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// Order[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task> FetchOpenOrders(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchOpenOrders(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Order(item)).ToList(); - } - /// - /// fetches information on multiple closed orders made by the user - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch orders for - /// - /// - /// - /// limit - /// - /// int : the maximum number of closed order structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// Order[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task> FetchClosedOrders(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchClosedOrders(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Order(item)).ToList(); - } - /// - /// fetches information on multiple canceled orders made by the user - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch orders for - /// - /// - /// - /// limit - /// - /// int : the maximum number of canceled order structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// object a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task> FetchCanceledOrders(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchCanceledOrders(symbol, since, limit, parameters); - return ((IList)res).Select(item => new Order(item)).ToList(); - } - /// - /// cancel open orders of market - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object[] a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task> CancelAllOrders(string symbol = null, Dictionary parameters = null) - { - var res = await this.cancelAllOrders(symbol, parameters); - return ((IList)res).Select(item => new Order(item)).ToList(); - } - /// - /// cancels an open order - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task CancelOrder(string id, string symbol = null, Dictionary parameters = null) - { - var res = await this.cancelOrder(id, symbol, parameters); - return new Order(res); - } - /// - /// cancel multiple orders - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task>> CancelOrders(object ids, string symbol = null, Dictionary parameters = null) - { - var res = await this.cancelOrders(ids, symbol, parameters); - return ((IList)res).Select(item => (item as Dictionary)).ToList(); - } - /// - /// create a trade order - /// - /// - /// See
- /// - /// - /// price - /// - /// float : the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.postOnly - /// - /// bool : if true, the order will only be posted to the order book and not executed immediately (default false) - /// - /// - /// - /// params.triggerPrice - /// - /// float : only for the 'stop_market', 'stop_limit', 'take_market' or 'take_limit' orders (the price at which an order is triggered) - /// - /// - /// - /// params.clientOrderId - /// - /// string : client order id (default undefined) - /// - /// - /// - ///
- /// object an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task CreateOrder(string symbol, string type, string side, double amount, double? price2 = 0, Dictionary parameters = null) - { - var price = price2 == 0 ? null : (object)price2; - var res = await this.createOrder(symbol, type, side, amount, price, parameters); - return new Order(res); - } - /// - /// create a trade order - /// - /// - /// See
- /// - /// - /// price - /// - /// float : the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}. - public async Task EditOrder(string id, string symbol, string type, string side, double? amount2 = 0, double? price2 = 0, Dictionary parameters = null) - { - var amount = amount2 == 0 ? null : (object)amount2; - var price = price2 == 0 ? null : (object)price2; - var res = await this.editOrder(id, symbol, type, side, amount, price, parameters); - return new Order(res); - } - /// - /// transfer currency internally between wallets on the same account - /// - /// - /// See
- /// See
- /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}. - public async Task Transfer(string code, double amount, string fromAccount, string toAccount, Dictionary parameters = null) - { - var res = await this.transfer(code, amount, fromAccount, toAccount, parameters); - return new TransferEntry(res); - } - /// - /// fetch a history of internal transfers between CoinList.co and CoinList Pro. It does not return external deposits or withdrawals - /// - /// - /// See
- /// - /// - /// since - /// - /// int : the earliest time in ms to fetch transfers for - /// - /// - /// - /// limit - /// - /// int : the maximum number of transfer structures to retrieve (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// object[] a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}. - public async Task> FetchTransfers(string code = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchTransfers(code, since, limit, parameters); - return ((IList)res).Select(item => new TransferEntry(item)).ToList(); - } - /// - /// fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet - /// - /// - /// See
- /// - /// - /// code - /// - /// string : unified currency code for the currency of the deposit/withdrawals - /// - /// - /// - /// since - /// - /// int : timestamp in ms of the earliest deposit/withdrawal - /// - /// - /// - /// limit - /// - /// int : max number of deposit/withdrawals to return (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}. - public async Task> FetchDepositsWithdrawals(string code = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchDepositsWithdrawals(code, since, limit, parameters); - return ((IList)res).Select(item => new Transaction(item)).ToList(); - } - /// - /// request a withdrawal from CoinList wallet. (Disabled by default. Contact CoinList to apply for an exception.) - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}. - public async Task Withdraw(string code, double amount, string address, object tag = null, Dictionary parameters = null) - { - var res = await this.withdraw(code, amount, address, tag, parameters); - return new Transaction(res); - } - /// - /// fetch the history of changes, actions done by the user or operations that altered the balance of the user - /// - /// - /// See
- /// - /// - /// code - /// - /// string : unified currency code, default is undefined - /// - /// - /// - /// since - /// - /// int : timestamp in ms of the earliest ledger entry, default is undefined - /// - /// - /// - /// limit - /// - /// int : max number of ledger entries to return (default 200, max 500) - /// - /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - /// params.until - /// - /// int : the latest time in ms to fetch entries for - /// - /// - /// - ///
- /// object a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}. - public async Task> FetchLedger(string code = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) - { - var since = since2 == 0 ? null : (object)since2; - var limit = limit2 == 0 ? null : (object)limit2; - var res = await this.fetchLedger(code, since, limit, parameters); - return ((IList)res).Select(item => new LedgerEntry(item)).ToList(); - } - /// - /// fetch the current funding rate - /// - /// - /// See
- /// - /// - /// params - /// - /// object : extra parameters specific to the exchange API endpoint - /// - /// - /// - ///
- /// object a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}. - public async Task FetchFundingRate(string symbol, Dictionary parameters = null) - { - var res = await this.fetchFundingRate(symbol, parameters); - return new FundingRate(res); - } -} diff --git a/cs/ccxt/wrappers/hollaex.cs b/cs/ccxt/wrappers/hollaex.cs index c8806bed9ea5f..271bba1733cea 100644 --- a/cs/ccxt/wrappers/hollaex.cs +++ b/cs/ccxt/wrappers/hollaex.cs @@ -189,7 +189,7 @@ public async Task FetchTradingFees(Dictionary param /// /// limit /// - /// int : the maximum amount of candles to fetch + /// int : the maximum amount of candles to fetch (max 500) /// /// /// diff --git a/cs/ccxt/wrappers/hyperliquid.cs b/cs/ccxt/wrappers/hyperliquid.cs index b2a2eedf4dc44..caecb74ebb962 100644 --- a/cs/ccxt/wrappers/hyperliquid.cs +++ b/cs/ccxt/wrappers/hyperliquid.cs @@ -362,6 +362,11 @@ public async Task> CreateOrders(List orders, Dictionar var res = await this.createOrders(orders, parameters); return ((IList)res).Select(item => new Order(item)).ToList(); } + public Dictionary CreateOrderRequest(string symbol, string type, string side, string amount, string price = null, Dictionary parameters = null) + { + var res = this.createOrderRequest(symbol, type, side, amount, price, parameters); + return ((Dictionary)res); + } /// /// create a list of trade orders /// diff --git a/cs/ccxt/wrappers/latoken.cs b/cs/ccxt/wrappers/latoken.cs index 04f63fd38601d..72b9d2925c358 100644 --- a/cs/ccxt/wrappers/latoken.cs +++ b/cs/ccxt/wrappers/latoken.cs @@ -46,11 +46,6 @@ public async Task> FetchMarkets(Dictionary var res = await this.fetchMarkets(parameters); return ((IList)res).Select(item => new MarketInterface(item)).ToList(); } - public async Task> FetchCurrenciesFromCache(Dictionary parameters = null) - { - var res = await this.fetchCurrenciesFromCache(parameters); - return ((Dictionary)res); - } /// /// query for balance and get the amount of funds available for trading or funds locked in orders /// diff --git a/cs/ccxt/wrappers/okx.cs b/cs/ccxt/wrappers/okx.cs index 231276f7dbd04..ee44881513506 100644 --- a/cs/ccxt/wrappers/okx.cs +++ b/cs/ccxt/wrappers/okx.cs @@ -1832,7 +1832,7 @@ public async Task> FetchMarketLeverageTiers(string symbol, Di return ((IList)res).Select(item => new LeverageTier(item)).ToList(); } /// - /// fetch the interest owed by the user for borrowing currency for margin trading + /// fetch the interest owed b the user for borrowing currency for margin trading /// /// /// See
diff --git a/cs/ccxt/wrappers/paradex.cs b/cs/ccxt/wrappers/paradex.cs index ee74cefb7dd1d..2bdf06ede2f70 100644 --- a/cs/ccxt/wrappers/paradex.cs +++ b/cs/ccxt/wrappers/paradex.cs @@ -785,4 +785,24 @@ public async Task FetchGreeks(string symbol, Dictionary var res = await this.fetchGreeks(symbol, parameters); return new Greeks(res); } + /// + /// fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + /// + /// + /// See
+ /// + /// + /// params + /// + /// object : extra parameters specific to the exchange API endpoint + /// + /// + /// + ///
+ /// object a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}. + public async Task> FetchAllGreeks(List symbols = null, Dictionary parameters = null) + { + var res = await this.fetchAllGreeks(symbols, parameters); + return ((IList)res).Select(item => new Greeks(item)).ToList(); + } } diff --git a/cs/ccxt/ws/Client.cs b/cs/ccxt/ws/Client.cs index 5a40047293ac0..bddc046afdcc6 100644 --- a/cs/ccxt/ws/Client.cs +++ b/cs/ccxt/ws/Client.cs @@ -19,8 +19,6 @@ public class WebSocketClient public IDictionary futures = new ConcurrentDictionary(); public IDictionary subscriptions = new ConcurrentDictionary(); public IDictionary rejections = new ConcurrentDictionary(); - public IDictionary> messageQueue = new ConcurrentDictionary>(); - public bool useMessageQueue = false; public bool verbose = false; public bool isConnected = false; public bool startedConnecting = false; @@ -54,7 +52,7 @@ public class WebSocketClient public bool error = false; - public WebSocketClient(string url, string proxy, handleMessageDelegate handleMessage, pingDelegate ping = null, onCloseDelegate onClose = null, onErrorDelegate onError = null, bool isVerbose = false, Int64 keepA = 30000, bool useMessageQueue = false) + public WebSocketClient(string url, string proxy, handleMessageDelegate handleMessage, pingDelegate ping = null, onCloseDelegate onClose = null, onErrorDelegate onError = null, bool isVerbose = false, Int64 keepA = 30000) { this.url = url; var tcs = new TaskCompletionSource(); @@ -65,7 +63,6 @@ public WebSocketClient(string url, string proxy, handleMessageDelegate handleMes this.onClose = onClose; this.onError = onError; this.keepAlive = keepA; - this.useMessageQueue = useMessageQueue; if (proxy != null) { @@ -81,17 +78,6 @@ public Future future(object messageHash2) if ((this.rejections as ConcurrentDictionary).TryRemove(messageHash, out object rejection)) { future.reject(rejection); - (this.messageQueue as ConcurrentDictionary>).AddOrUpdate(messageHash, new ConcurrentQueue(), (key, value) => new ConcurrentQueue()); - return future; - } - if (this.useMessageQueue) - { - var queue = (this.messageQueue as ConcurrentDictionary>).GetOrAdd(messageHash, (key) => new ConcurrentQueue()); - if (queue.TryDequeue(out object result)) - { - future.resolve(result); - (this.futures as ConcurrentDictionary).TryRemove(messageHash, out Future removedFuture); - } } return future; } @@ -103,27 +89,9 @@ public void resolve(object content, object messageHash2) Console.WriteLine("resolve received undefined messageHash"); } var messageHash = messageHash2.ToString(); - if (this.useMessageQueue) - { - var queue = (this.messageQueue as ConcurrentDictionary>).GetOrAdd(messageHash, (key) => new ConcurrentQueue()); - queue.Enqueue(content); - while (queue.Count > 10) { - queue.TryDequeue(out object _); - } - if ((this.futures as ConcurrentDictionary).TryRemove(messageHash, out Future future)) - { - if (queue.TryDequeue(out object result)) - { - future.resolve(result); - } - } - } - else + if ((this.futures as ConcurrentDictionary).TryRemove(messageHash, out Future future)) { - if ((this.futures as ConcurrentDictionary).TryRemove(messageHash, out Future future)) - { - future.resolve(content); - } + future.resolve(content); } } @@ -155,7 +123,6 @@ public void reject(object content, object messageHash2 = null) public void reset(object message2) { // stub implement this later - this.messageQueue = new ConcurrentDictionary>(); this.reject(error); } diff --git a/cs/ccxt/ws/Exchange.WsBridge.cs b/cs/ccxt/ws/Exchange.WsBridge.cs index 31507e4e77f25..1a13ea7bb4727 100644 --- a/cs/ccxt/ws/Exchange.WsBridge.cs +++ b/cs/ccxt/ws/Exchange.WsBridge.cs @@ -136,8 +136,7 @@ public WebSocketClient client(object url2) var wsOptions = this.safeValue(ws, "options", new Dictionary() { }); wsOptions = this.deepExtend(this.streaming, wsOptions); var keepAlive = ((Int64)this.safeInteger(wsOptions, "keepAlive", 30000)); - var useMessageQueue = ((bool)this.safeBool(wsOptions, "useMessageQueue", true)); - var client = new WebSocketClient(url, proxy, handleMessage, ping, onClose, onError, this.verbose, keepAlive, useMessageQueue); + var client = new WebSocketClient(url, proxy, handleMessage, ping, onClose, onError, this.verbose, keepAlive); var wsHeaders = this.safeValue(wsOptions, "headers", new Dictionary() { }); // iterate through headers diff --git a/cs/tests/Generated/Base/test.handleMethods.cs b/cs/tests/Generated/Base/test.handleMethods.cs index c9022c1352c77..b6803f53b4d83 100644 --- a/cs/tests/Generated/Base/test.handleMethods.cs +++ b/cs/tests/Generated/Base/test.handleMethods.cs @@ -82,7 +82,7 @@ public void helperTestHandleNetworkRequest() } }, } }, }); - exchange.currencies = new Dictionary() {}; // todo: initialize in C# base files + exchange.currencies = exchange.createSafeDictionary(); // todo: initialize in C# base files object currencyCode = "ETH"; // todo: in future with complex cases // no-case var request1params1Variable = exchange.handleRequestNetwork(new Dictionary() { diff --git a/cs/tests/Generated/Exchange/Base/test.ticker.cs b/cs/tests/Generated/Exchange/Base/test.ticker.cs index e53437097fe12..9ef9c4ca739de 100644 --- a/cs/tests/Generated/Exchange/Base/test.ticker.cs +++ b/cs/tests/Generated/Exchange/Base/test.ticker.cs @@ -49,16 +49,24 @@ public static void testTicker(Exchange exchange, object skippedProperties, objec { market = exchange.market(symbolForMarket); } - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "open", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "high", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "low", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "close", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "ask", "0"); + object exchangeHasIndexMarkets = exchange.safeBool(exchange.has, "index", false); + object isStandardMarket = (isTrue(!isEqual(market, null)) && isTrue(exchange.inArray(getValue(market, "type"), new List() {"spot", "swap", "future", "option"}))); + // only check "above zero" values if exchange is not supposed to have exotic index markets + object valuesShouldBePositive = isTrue(isStandardMarket) || isTrue((isTrue(isEqual(market, null)) && !isTrue(exchangeHasIndexMarkets))); + if (isTrue(valuesShouldBePositive)) + { + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "open", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "high", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "low", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "close", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "ask", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "bid", "0"); + testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "average", "0"); + testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "vwap", "0"); + } + // volume can not be negative testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "askVolume", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "bid", "0"); testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "bidVolume", "0"); - testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "vwap", "0"); - testSharedMethods.assertGreater(exchange, skippedProperties, method, entry, "average", "0"); testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "baseVolume", "0"); testSharedMethods.assertGreaterOrEqual(exchange, skippedProperties, method, entry, "quoteVolume", "0"); object lastString = exchange.safeString(entry, "last"); @@ -77,6 +85,7 @@ public static void testTicker(Exchange exchange, object skippedProperties, objec // to avoid abnormal long precision issues (like https://discord.com/channels/690203284119617602/1338828283902689280/1338846071278927912 ) object mPrecision = exchange.safeDict(market, "precision"); object amountPrecision = exchange.safeString(mPrecision, "amount"); + object tolerance = "1.0001"; if (isTrue(!isEqual(amountPrecision, null))) { baseLow = Precise.stringMul(Precise.stringSub(baseVolume, amountPrecision), low); @@ -84,9 +93,12 @@ public static void testTicker(Exchange exchange, object skippedProperties, objec } else { // if nothing found, as an exclusion, just add 0.001% - baseLow = Precise.stringMul(Precise.stringMul(baseVolume, "1.0001"), low); - baseHigh = Precise.stringMul(Precise.stringDiv(baseVolume, "1.0001"), high); + baseLow = Precise.stringMul(Precise.stringDiv(baseVolume, tolerance), low); + baseHigh = Precise.stringMul(Precise.stringMul(baseVolume, tolerance), high); } + // because of exchange engines might not rounding numbers propertly, we add some tolerance of calculated 24hr high/low + baseLow = Precise.stringDiv(baseLow, tolerance); + baseHigh = Precise.stringMul(baseHigh, tolerance); assert(Precise.stringGe(quoteVolume, baseLow), add("quoteVolume should be => baseVolume * low", logText)); assert(Precise.stringLe(quoteVolume, baseHigh), add("quoteVolume should be <= baseVolume * high", logText)); } @@ -99,7 +111,7 @@ public static void testTicker(Exchange exchange, object skippedProperties, objec // assert (low !== undefined, 'vwap is defined, but low is not' + logText); // assert (vwap >= low && vwap <= high) // todo: calc compare - assert(Precise.stringGe(vwap, "0"), add("vwap is not greater than zero", logText)); + assert(!isTrue(valuesShouldBePositive) || isTrue(Precise.stringGe(vwap, "0")), add("vwap is not greater than zero", logText)); if (isTrue(!isEqual(baseVolume, null))) { assert(!isEqual(quoteVolume, null), add("baseVolume & vwap is defined, but quoteVolume is not", logText)); diff --git a/cs/tests/Generated/Exchange/test.fetchCurrencies.cs b/cs/tests/Generated/Exchange/test.fetchCurrencies.cs index 673802bbe9373..6f7c51b4f5236 100644 --- a/cs/tests/Generated/Exchange/test.fetchCurrencies.cs +++ b/cs/tests/Generated/Exchange/test.fetchCurrencies.cs @@ -22,7 +22,8 @@ async static public Task testFetchCurrencies(Exchange exchange, object s testSharedMethods.assertNonEmtpyArray(exchange, skippedProperties, method, values); object currenciesLength = getArrayLength(values); // ensure exchange returns enough length of currencies - assert(isGreaterThan(currenciesLength, 5), add(add(add(add(exchange.id, " "), method), " must return at least several currencies, but it returned "), ((object)currenciesLength).ToString())); + object skipAmount = (inOp(skippedProperties, "amountOfCurrencies")); + assert(isTrue(skipAmount) || isTrue(isGreaterThan(currenciesLength, 5)), add(add(add(add(exchange.id, " "), method), " must return at least several currencies, but it returned "), ((object)currenciesLength).ToString())); // allow skipped exchanges object skipActive = (inOp(skippedProperties, "activeCurrenciesQuota")); object skipMajorCurrencyCheck = (inOp(skippedProperties, "activeMajorCurrencies")); diff --git a/cs/tests/Generated/Exchange/test.fetchTrades.cs b/cs/tests/Generated/Exchange/test.fetchTrades.cs index 683c5797e8e5e..423a17c459f43 100644 --- a/cs/tests/Generated/Exchange/test.fetchTrades.cs +++ b/cs/tests/Generated/Exchange/test.fetchTrades.cs @@ -18,7 +18,7 @@ async static public Task testFetchTrades(Exchange exchange, object skipp testTrade(exchange, skippedProperties, method, getValue(trades, i), symbol, now); testSharedMethods.assertInArray(exchange, skippedProperties, method, getValue(trades, i), "takerOrMaker", new List() {"taker", null}); } - if (!isTrue((inOp(skippedProperties, "timestamp")))) + if (!isTrue((inOp(skippedProperties, "timestampSort")))) { testSharedMethods.assertTimestampOrder(exchange, method, symbol, trades); } diff --git a/cs/tests/tests.csproj b/cs/tests/tests.csproj index 8a9584b457b10..db8a343639fcf 100644 --- a/cs/tests/tests.csproj +++ b/cs/tests/tests.csproj @@ -6,7 +6,7 @@ Exe - net7.0 + net9.0 enable enable CS1998,CS0168, CS0108, CS8604, CS8600, CS8601, CS8602, CS8603, CS8625, CS8618, CS8981, CA2200, CS8974, CS043, CS0436, CA2200 diff --git a/dist/ccxt.browser.js b/dist/ccxt.browser.js index 03a100c2c0efa..03725c0fa3257 100644 --- a/dist/ccxt.browser.js +++ b/dist/ccxt.browser.js @@ -576,22 +576,6 @@ class Exchange extends _base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchang /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Exchange); -/***/ }), - -/***/ 2948: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2961); -// ------------------------------------------------------------------------------- - -class Exchange extends _base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .k { -} -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Exchange); - - /***/ }), /***/ 8109: @@ -6853,6 +6837,8 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de // "timestamp": 1573576916201 // } // + // & linear (fetchClosedOrders) + // // { // "ac": "FUTURES", // "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn", @@ -6860,7 +6846,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de // "orderId": "a17e0874ecbdU0711043490bbtcpDU5X", // "seqNum": -1, // "orderType": "Limit", - // "execInst": "NULL_VAL", + // "execInst": "NULL_VAL", // NULL_VAL, ReduceOnly , ... // "side": "Buy", // "symbol": "BTC-PERP", // "price": "30000", @@ -6949,14 +6935,14 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de const status = this.parseOrderStatus(this.safeString(order, 'status')); const marketId = this.safeString(order, 'symbol'); const symbol = this.safeSymbol(marketId, market, '/'); - let timestamp = this.safeInteger2(order, 'timestamp', 'sendingTime'); + let timestamp = this.safeIntegerN(order, ['timestamp', 'sendingTime', 'time']); const lastTradeTimestamp = this.safeInteger(order, 'lastExecTime'); if (timestamp === undefined) { timestamp = lastTradeTimestamp; } const price = this.safeString(order, 'price'); const amount = this.safeString(order, 'orderQty'); - const average = this.safeString(order, 'avgPx'); + const average = this.safeString2(order, 'avgPx', 'avgFilledPx'); const filled = this.safeStringN(order, ['cumFilledQty', 'cumQty', 'fillQty']); const id = this.safeString(order, 'orderId'); let clientOrderId = this.safeString(order, 'id'); @@ -6988,12 +6974,12 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de } const triggerPrice = this.omitZero(this.safeString(order, 'stopPrice')); let reduceOnly = undefined; - const execInst = this.safeString(order, 'execInst'); - if (execInst === 'reduceOnly') { + const execInst = this.safeStringLower(order, 'execInst'); + if (execInst === 'reduceonly') { reduceOnly = true; } let postOnly = undefined; - if (execInst === 'Post') { + if (execInst === 'post') { postOnly = true; } return this.safeOrder({ @@ -7757,8 +7743,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de // } // let data = this.safeList(response, 'data', []); - const isArray = Array.isArray(data); - if (!isArray) { + if (!Array.isArray(data)) { data = this.safeList(data, 'data', []); } return this.parseOrders(data, market, since, limit); @@ -9975,6 +9960,12 @@ class Exchange { return hexData; } } + mapToSafeMap(dict) { + return dict; // wrapper for go + } + safeMapToMap(dict) { + return dict; // wrapper for go + } spawn(method, ...args) { const future = (0,_ws_Future_js__WEBPACK_IMPORTED_MODULE_5__/* .Future */ .K)(); // using setTimeout 0 to force the execution to run after the future is returned @@ -10230,17 +10221,12 @@ class Exchange { async close() { const clients = Object.values(this.clients || {}); const closedClients = []; - for (let i = 0; i < clients.length; i++) { - const client = clients[i]; - client.error = new _errors_js__WEBPACK_IMPORTED_MODULE_4__.ExchangeClosedByUser(this.id + ' closedByUser'); - closedClients.push(client.close()); - } - await Promise.all(closedClients); for (let i = 0; i < clients.length; i++) { const client = clients[i]; delete this.clients[client.url]; + closedClients.push(client.close()); } - return; + return Promise.all(closedClients); } async loadOrderBook(client, messageHash, symbol, limit = undefined, params = {}) { if (!(symbol in this.orderbooks)) { @@ -11226,6 +11212,9 @@ class Exchange { async watchTrades(symbol, since = undefined, limit = undefined, params = {}) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' watchTrades() is not supported yet'); } + async unWatchOrders(symbol = undefined, params = {}) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' unWatchOrders() is not supported yet'); + } async unWatchTrades(symbol, params = {}) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' unWatchTrades() is not supported yet'); } @@ -11937,14 +11926,14 @@ class Exchange { } values.push(market); } - this.markets = this.indexBy(values, 'symbol'); + this.markets = this.mapToSafeMap(this.indexBy(values, 'symbol')); const marketsSortedBySymbol = this.keysort(this.markets); const marketsSortedById = this.keysort(this.markets_by_id); this.symbols = Object.keys(marketsSortedBySymbol); this.ids = Object.keys(marketsSortedById); if (currencies !== undefined) { // currencies is always undefined when called in constructor but not when called from loadMarkets - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); } else { let baseCurrencies = []; @@ -11974,8 +11963,8 @@ class Exchange { } baseCurrencies = this.sortBy(baseCurrencies, 'code', false, ''); quoteCurrencies = this.sortBy(quoteCurrencies, 'code', false, ''); - this.baseCurrencies = this.indexBy(baseCurrencies, 'code'); - this.quoteCurrencies = this.indexBy(quoteCurrencies, 'code'); + this.baseCurrencies = this.mapToSafeMap(this.indexBy(baseCurrencies, 'code')); + this.quoteCurrencies = this.mapToSafeMap(this.indexBy(quoteCurrencies, 'code')); const allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies); const groupedCurrencies = this.groupBy(allCurrencies, 'code'); const codes = Object.keys(groupedCurrencies); @@ -11996,7 +11985,7 @@ class Exchange { resultingCurrencies.push(highestPrecisionCurrency); } const sortedCurrencies = this.sortBy(resultingCurrencies, 'code'); - this.currencies = this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code')); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code'))); } this.currencies_by_id = this.indexBySafe(this.currencies, 'id'); const currenciesSortedByCode = this.keysort(this.currencies); @@ -13136,7 +13125,7 @@ class Exchange { return this.filterBySinceLimit(sorted, since, limit, 0, tail); } parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) { - // marketIdKey should only be undefined when response is a dictionary + // marketIdKey should only be undefined when response is a dictionary. symbols = this.marketSymbols(symbols); const tiers = {}; let symbolsLength = 0; @@ -14574,6 +14563,9 @@ class Exchange { async fetchGreeks(symbol, params = {}) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' fetchGreeks() is not supported yet'); } + async fetchAllGreeks(symbols = undefined, params = {}) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' fetchAllGreeks() is not supported yet'); + } async fetchOptionChain(code, params = {}) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' fetchOptionChain() is not supported yet'); } @@ -16029,6 +16021,31 @@ class Exchange { parseGreeks(greeks, market = undefined) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' parseGreeks () is not supported yet'); } + parseAllGreeks(greeks, symbols = undefined, params = {}) { + // + // the value of greeks is either a dict or a list + // + const results = []; + if (Array.isArray(greeks)) { + for (let i = 0; i < greeks.length; i++) { + const parsedTicker = this.parseGreeks(greeks[i]); + const greek = this.extend(parsedTicker, params); + results.push(greek); + } + } + else { + const marketIds = Object.keys(greeks); + for (let i = 0; i < marketIds.length; i++) { + const marketId = marketIds[i]; + const market = this.safeMarket(marketId); + const parsed = this.parseGreeks(greeks[marketId], market); + const greek = this.extend(parsed, params); + results.push(greek); + } + } + symbols = this.marketSymbols(symbols); + return this.filterByArray(results, 'symbol', symbols); + } parseOption(chain, currency = undefined, market = undefined) { throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' parseOption () is not supported yet'); } @@ -16169,7 +16186,7 @@ class Exchange { return reconstructedDate; } convertMarketIdExpireDate(date) { - // parse 03JAN24 to 240103 + // parse 03JAN24 to 240103. const monthMappping = { 'JAN': '01', 'FEB': '02', @@ -16267,16 +16284,35 @@ class Exchange { */ throw new _errors_js__WEBPACK_IMPORTED_MODULE_4__.NotSupported(this.id + ' fetchTransfers () is not supported yet'); } - cleanUnsubscription(client, subHash, unsubHash) { + cleanUnsubscription(client, subHash, unsubHash, subHashIsPrefix = false) { if (unsubHash in client.subscriptions) { delete client.subscriptions[unsubHash]; } - if (subHash in client.subscriptions) { - delete client.subscriptions[subHash]; + if (!subHashIsPrefix) { + if (subHash in client.subscriptions) { + delete client.subscriptions[subHash]; + } + if (subHash in client.futures) { + const error = new _errors_js__WEBPACK_IMPORTED_MODULE_4__.UnsubscribeError(this.id + ' ' + subHash); + client.reject(error, subHash); + } } - if (subHash in client.futures) { - const error = new _errors_js__WEBPACK_IMPORTED_MODULE_4__.UnsubscribeError(this.id + ' ' + subHash); - client.reject(error, subHash); + else { + const clientSubscriptions = Object.keys(client.subscriptions); + for (let i = 0; i < clientSubscriptions.length; i++) { + const sub = clientSubscriptions[i]; + if (sub.startsWith(subHash)) { + delete client.subscriptions[sub]; + } + } + const clientFutures = Object.keys(client.futures); + for (let i = 0; i < clientFutures.length; i++) { + const future = clientFutures[i]; + if (future.startsWith(subHash)) { + const error = new _errors_js__WEBPACK_IMPORTED_MODULE_4__.UnsubscribeError(this.id + ' ' + future); + client.reject(error, future); + } + } } client.resolve(true, unsubHash); } @@ -16290,7 +16326,7 @@ class Exchange { const symbolAndTimeFrame = symbolsAndTimeFrames[i]; const symbol = this.safeString(symbolAndTimeFrame, 0); const timeframe = this.safeString(symbolAndTimeFrame, 1); - if (symbol in this.ohlcvs) { + if ((this.ohlcvs !== undefined) && (symbol in this.ohlcvs)) { if (timeframe in this.ohlcvs[symbol]) { delete this.ohlcvs[symbol][timeframe]; } @@ -16318,27 +16354,13 @@ class Exchange { } } else { - if (topic === 'myTrades') { - // don't reset this.myTrades directly here - // because in c# we need to use a different object (thread-safe dict) - const keys = Object.keys(this.myTrades); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (key in this.myTrades) { - delete this.myTrades[key]; - } - } + if (topic === 'myTrades' && (this.myTrades !== undefined)) { + this.myTrades = undefined; } - else if (topic === 'orders') { - const orderSymbols = Object.keys(this.orders); - for (let i = 0; i < orderSymbols.length; i++) { - const orderSymbol = orderSymbols[i]; - if (orderSymbol in this.orders) { - delete this.orders[orderSymbol]; - } - } + else if (topic === 'orders' && (this.orders !== undefined)) { + this.orders = undefined; } - else if (topic === 'ticker') { + else if (topic === 'ticker' && (this.tickers !== undefined)) { const tickerSymbols = Object.keys(this.tickers); for (let i = 0; i < tickerSymbols.length; i++) { const tickerSymbol = tickerSymbols[i]; @@ -18887,7 +18909,6 @@ class ArrayCacheBySymbolBySide extends ArrayCache { class Client { constructor(url, onMessageCallback, onErrorCallback, onCloseCallback, onConnectedCallback, config = {}) { - this.useMessageQueue = false; this.verbose = false; const defaults = { url, @@ -18901,8 +18922,6 @@ class Client { futures: {}, subscriptions: {}, rejections: {}, - messageQueue: {}, - useMessageQueue: false, connected: undefined, error: undefined, connectionStarted: undefined, @@ -18933,15 +18952,6 @@ class Client { if (messageHash in this.rejections) { future.reject(this.rejections[messageHash]); delete this.rejections[messageHash]; - delete this.messageQueue[messageHash]; - return future; - } - if (this.useMessageQueue) { - const queue = this.messageQueue[messageHash]; - if (queue && queue.length) { - future.resolve(queue.shift()); - delete this.futures[messageHash]; - } } return future; } @@ -18949,27 +18959,10 @@ class Client { if (this.verbose && (messageHash === undefined)) { this.log(new Date(), 'resolve received undefined messageHash'); } - if (this.useMessageQueue === true) { - if (!(messageHash in this.messageQueue)) { - this.messageQueue[messageHash] = []; - } - const queue = this.messageQueue[messageHash]; - queue.push(result); - while (queue.length > 10) { // limit size to 10 messages in the queue - queue.shift(); - } - if ((messageHash !== undefined) && (messageHash in this.futures)) { - const promise = this.futures[messageHash]; - promise.resolve(queue.shift()); - delete this.futures[messageHash]; - } - } - else { - if (messageHash in this.futures) { - const promise = this.futures[messageHash]; - promise.resolve(result); - delete this.futures[messageHash]; - } + if ((messageHash !== undefined) && (messageHash in this.futures)) { + const promise = this.futures[messageHash]; + promise.resolve(result); + delete this.futures[messageHash]; } return result; } @@ -19010,7 +19003,6 @@ class Client { reset(error) { this.clearConnectionTimeout(); this.clearPingInterval(); - this.messageQueue = {}; this.reject(error); } onConnectionTimeout() { @@ -22224,6 +22216,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'editOrder': true, 'editOrders': true, 'fetchAccounts': undefined, + 'fetchAllGreeks': true, 'fetchBalance': true, 'fetchBidsAsks': true, 'fetchBorrowInterest': true, @@ -26157,7 +26150,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // // { // "symbol": "BTCUSDT", - // "markPrice": "11793.63104562", // mark price + // "markPrice": "11793.63104561", // mark price // "indexPrice": "11781.80495970", // index price // "estimatedSettlePrice": "11781.16138815", // Estimated Settle Price, only useful in the last hour before the settlement starts // "lastFundingRate": "0.00038246", // This is the lastest estimated funding rate @@ -32644,7 +32637,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa else { throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' loadLeverageBrackets() supports linear and inverse contracts only'); } - this.options['leverageBrackets'] = {}; + this.options['leverageBrackets'] = this.createSafeDictionary(); for (let i = 0; i < response.length; i++) { const entry = response[i]; const marketId = this.safeString(entry, 'symbol'); @@ -35492,6 +35485,47 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // return this.parseGreeks(response[0], market); } + /** + * @method + * @name binance#fetchAllGreeks + * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + * @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price + * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} + */ + async fetchAllGreeks(symbols = undefined, params = {}) { + await this.loadMarkets(); + symbols = this.marketSymbols(symbols, undefined, true, true, true); + const request = {}; + let market = undefined; + if (symbols !== undefined) { + const symbolsLength = symbols.length; + if (symbolsLength === 1) { + market = this.market(symbols[0]); + request['symbol'] = market['id']; + } + } + const response = await this.eapiPublicGetMark(this.extend(request, params)); + // + // [ + // { + // "symbol": "BTC-231229-40000-C", + // "markPrice": "2012", + // "bidIV": "0.60236275", + // "askIV": "0.62267244", + // "markIV": "0.6125176", + // "delta": "0.39111646", + // "theta": "-32.13948531", + // "gamma": "0.00004656", + // "vega": "51.70062218", + // "highPriceLimit": "6474", + // "lowPriceLimit": "5" + // } + // ] + // + return this.parseAllGreeks(response, symbols); + } parseGreeks(greeks, market = undefined) { // // { @@ -65091,6 +65125,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] the latest time in ms to fetch trades for * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported) + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) { @@ -65206,6 +65241,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {int} [since] the earliest time in ms to fetch trades for * @param {int} [limit] the maximum number of trades to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) { @@ -65667,6 +65703,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1 + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ async createOrder(symbol, type, side, amount, price = undefined, params = {}) { @@ -65737,6 +65774,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ async createOrders(orders, params = {}) { @@ -66321,6 +66359,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing' * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { @@ -66447,6 +66486,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] timestamp in ms of the latest entry * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { @@ -66515,6 +66555,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing' * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order + * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ async fetchOrder(id, symbol = undefined, params = {}) { @@ -68615,6 +68656,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'fetchTransactions': 'emulated', 'fetchTransfer': false, 'fetchTransfers': false, + 'index': true, 'reduceMargin': undefined, 'sandbox': true, 'setLeverage': true, @@ -68941,8 +68983,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul // // "mediumPrecision": "8", // // "shorterPrecision": "4", // // "symbol": "₿", - // // "weight": "1", // // "tickLog": "0", + // // "weight": "1", // "enabled": true, // "isMarginCurrency": true, // "minDepositAmount": "10000", @@ -73539,7 +73581,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'id': 'bitrue', 'name': 'Bitrue', 'countries': ['SG'], - 'rateLimit': 1000, + 'rateLimit': 10, 'certified': false, 'version': 'v1', 'pro': true, @@ -73680,56 +73722,62 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul ], 'fees': 'https://bitrue.zendesk.com/hc/en-001/articles/4405479952537', }, + // from spotV1PublicGetExchangeInfo: + // general 25000 weight in 1 minute per IP. = 416.66 per second a weight of 0.24 for 1 + // orders 750 weight in 6 seconds per IP. = 125 per second a weight of 0.8 for 1 + // orders 200 weight in 10 seconds per User. = 20 per second a weight of 5 for 1 + // withdraw 3000 weight in 1 hour per User. = 0.833 per second a weight of 120 for 1 + // withdraw 1000 weight in 1 day per User. = 0.011574 per second a weight of 8640 for 1 'api': { 'spot': { 'kline': { 'public': { 'get': { - 'public.json': 1, - 'public{currency}.json': 1, + 'public.json': 0.24, + 'public{currency}.json': 0.24, }, }, }, 'v1': { 'public': { 'get': { - 'ping': 1, - 'time': 1, - 'exchangeInfo': 1, - 'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10]] }, - 'trades': 1, - 'historicalTrades': 5, - 'aggTrades': 1, - 'ticker/24hr': { 'cost': 1, 'noSymbol': 40 }, - 'ticker/price': { 'cost': 1, 'noSymbol': 2 }, - 'ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 }, - 'market/kline': 1, + 'ping': 0.24, + 'time': 0.24, + 'exchangeInfo': 0.24, + 'depth': { 'cost': 1, 'byLimit': [[100, 0.24], [500, 1.2], [1000, 2.4]] }, + 'trades': 0.24, + 'historicalTrades': 1.2, + 'aggTrades': 0.24, + 'ticker/24hr': { 'cost': 0.24, 'noSymbol': 9.6 }, + 'ticker/price': 0.24, + 'ticker/bookTicker': 0.24, + 'market/kline': 0.24, }, }, 'private': { 'get': { - 'order': 1, - 'openOrders': 1, - 'allOrders': 5, - 'account': 5, - 'myTrades': { 'cost': 5, 'noSymbol': 40 }, - 'etf/net-value/{symbol}': 1, - 'withdraw/history': 1, - 'deposit/history': 1, + 'order': 5, + 'openOrders': 5, + 'allOrders': 25, + 'account': 25, + 'myTrades': 25, + 'etf/net-value/{symbol}': 0.24, + 'withdraw/history': 120, + 'deposit/history': 120, }, 'post': { - 'order': 4, - 'withdraw/commit': 1, + 'order': 5, + 'withdraw/commit': 120, }, 'delete': { - 'order': 1, + 'order': 5, }, }, }, 'v2': { 'private': { 'get': { - 'myTrades': 5, + 'myTrades': 1.2, }, }, }, @@ -73738,34 +73786,34 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'v1': { 'public': { 'get': { - 'ping': 1, - 'time': 1, - 'contracts': 1, - 'depth': 1, - 'ticker': 1, - 'klines': 1, + 'ping': 0.24, + 'time': 0.24, + 'contracts': 0.24, + 'depth': 0.24, + 'ticker': 0.24, + 'klines': 0.24, }, }, }, 'v2': { 'private': { 'get': { - 'myTrades': 1, - 'openOrders': 1, - 'order': 1, - 'account': 1, - 'leverageBracket': 1, - 'commissionRate': 1, - 'futures_transfer_history': 1, - 'forceOrdersHistory': 1, + 'myTrades': 5, + 'openOrders': 5, + 'order': 5, + 'account': 5, + 'leverageBracket': 5, + 'commissionRate': 5, + 'futures_transfer_history': 5, + 'forceOrdersHistory': 5, }, 'post': { - 'positionMargin': 1, - 'level_edit': 1, - 'cancel': 1, - 'order': 1, - 'allOpenOrders': 1, - 'futures_transfer': 1, + 'positionMargin': 5, + 'level_edit': 5, + 'cancel': 5, + 'order': 25, + 'allOpenOrders': 5, + 'futures_transfer': 5, }, }, }, @@ -73774,34 +73822,34 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'v1': { 'public': { 'get': { - 'ping': 1, - 'time': 1, - 'contracts': 1, - 'depth': 1, - 'ticker': 1, - 'klines': 1, + 'ping': 0.24, + 'time': 0.24, + 'contracts': 0.24, + 'depth': 0.24, + 'ticker': 0.24, + 'klines': 0.24, }, }, }, 'v2': { 'private': { 'get': { - 'myTrades': 1, - 'openOrders': 1, - 'order': 1, - 'account': 1, - 'leverageBracket': 1, - 'commissionRate': 1, - 'futures_transfer_history': 1, - 'forceOrdersHistory': 1, + 'myTrades': 5, + 'openOrders': 5, + 'order': 5, + 'account': 5, + 'leverageBracket': 5, + 'commissionRate': 5, + 'futures_transfer_history': 5, + 'forceOrdersHistory': 5, }, 'post': { - 'positionMargin': 1, - 'level_edit': 1, - 'cancel': 1, - 'order': 1, - 'allOpenOrders': 1, - 'futures_transfer': 1, + 'positionMargin': 5, + 'level_edit': 5, + 'cancel': 5, + 'order': 5, + 'allOpenOrders': 5, + 'futures_transfer': 5, }, }, }, @@ -86382,7 +86430,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa }); } // set currencies here to avoid calling publicGetAssets twice - this.currencies = this.deepExtend(this.currencies, result); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, result)); return result; } /** @@ -86954,6 +87002,9 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa if (operatorId !== undefined) { request['operatorId'] = this.parseToInt(operatorId); } + else { + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890'); + } return this.extend(request, params); } /** @@ -87058,6 +87109,9 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa if (operatorId !== undefined) { request['operatorId'] = this.parseToInt(operatorId); } + else { + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890'); + } request['market'] = market['id']; return request; } @@ -87099,6 +87153,9 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa if (operatorId !== undefined) { request['operatorId'] = this.parseToInt(operatorId); } + else { + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890'); + } return this.extend(request, params); } /** @@ -95143,35 +95200,64 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'future': false, 'option': false, 'addMargin': false, + 'borrowCrossMargin': false, + 'borrowIsolatedMargin': false, + 'borrowMargin': false, 'cancelOrder': true, 'closeAllPositions': false, 'closePosition': false, 'createDepositAddress': false, 'createOrder': true, + 'createOrderWithTakeProfitAndStopLoss': false, + 'createOrderWithTakeProfitAndStopLossWs': false, + 'createPostOnlyOrder': false, 'createReduceOnlyOrder': false, 'fetchBalance': true, + 'fetchBorrowInterest': false, + 'fetchBorrowRate': false, 'fetchBorrowRateHistories': false, 'fetchBorrowRateHistory': false, + 'fetchBorrowRates': false, + 'fetchBorrowRatesPerSymbol': false, 'fetchCrossBorrowRate': false, 'fetchCrossBorrowRates': false, 'fetchDepositAddress': false, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': false, 'fetchFundingHistory': false, + 'fetchFundingInterval': false, + 'fetchFundingIntervals': false, 'fetchFundingRate': false, 'fetchFundingRateHistory': false, 'fetchFundingRates': false, + 'fetchGreeks': false, 'fetchIndexOHLCV': false, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, + 'fetchIsolatedPositions': false, 'fetchLeverage': false, + 'fetchLeverages': false, + 'fetchLeverageTiers': false, + 'fetchLiquidations': false, + 'fetchLongShortRatio': false, + 'fetchLongShortRatioHistory': false, + 'fetchMarginAdjustmentHistory': false, 'fetchMarginMode': false, + 'fetchMarginModes': false, + 'fetchMarketLeverageTiers': false, 'fetchMarkets': true, 'fetchMarkOHLCV': false, + 'fetchMarkPrices': false, + 'fetchMyLiquidations': false, + 'fetchMySettlementHistory': false, 'fetchMyTrades': true, 'fetchOHLCV': true, + 'fetchOpenInterest': false, 'fetchOpenInterestHistory': false, + 'fetchOpenInterests': false, 'fetchOpenOrders': true, + 'fetchOption': false, + 'fetchOptionChain': false, 'fetchOrderBook': true, 'fetchOrders': true, 'fetchPosition': false, @@ -95182,11 +95268,17 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'fetchPositionsHistory': false, 'fetchPositionsRisk': false, 'fetchPremiumIndexOHLCV': false, + 'fetchSettlementHistory': false, 'fetchTicker': true, 'fetchTickers': true, 'fetchTrades': true, + 'fetchVolatilityHistory': false, 'reduceMargin': false, + 'repayCrossMargin': false, + 'repayIsolatedMargin': false, + 'repayMargin': false, 'setLeverage': false, + 'setMargin': false, 'setMarginMode': false, 'setPositionMode': false, 'ws': false, @@ -105475,34 +105567,95 @@ class cex extends _abstract_cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ 'swap': false, 'future': false, 'option': false, + 'addMargin': false, + 'borrowCrossMargin': false, + 'borrowIsolatedMargin': false, + 'borrowMargin': false, 'cancelAllOrders': true, 'cancelOrder': true, + 'closeAllPositions': false, + 'closePosition': false, 'createOrder': true, + 'createOrderWithTakeProfitAndStopLoss': false, + 'createOrderWithTakeProfitAndStopLossWs': false, + 'createPostOnlyOrder': false, 'createReduceOnlyOrder': false, 'createStopOrder': true, 'createTriggerOrder': true, 'fetchAccounts': true, 'fetchBalance': true, + 'fetchBorrowInterest': false, + 'fetchBorrowRate': false, + 'fetchBorrowRateHistories': false, + 'fetchBorrowRateHistory': false, + 'fetchBorrowRates': false, + 'fetchBorrowRatesPerSymbol': false, 'fetchClosedOrder': true, 'fetchClosedOrders': true, + 'fetchCrossBorrowRate': false, + 'fetchCrossBorrowRates': false, 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositsWithdrawals': true, 'fetchFundingHistory': false, + 'fetchFundingInterval': false, + 'fetchFundingIntervals': false, 'fetchFundingRate': false, 'fetchFundingRateHistory': false, 'fetchFundingRates': false, + 'fetchGreeks': false, + 'fetchIndexOHLCV': false, + 'fetchIsolatedBorrowRate': false, + 'fetchIsolatedBorrowRates': false, + 'fetchIsolatedPositions': false, 'fetchLedger': true, + 'fetchLeverage': false, + 'fetchLeverages': false, + 'fetchLeverageTiers': false, + 'fetchLiquidations': false, + 'fetchLongShortRatio': false, + 'fetchLongShortRatioHistory': false, + 'fetchMarginAdjustmentHistory': false, + 'fetchMarginMode': false, + 'fetchMarginModes': false, + 'fetchMarketLeverageTiers': false, 'fetchMarkets': true, + 'fetchMarkOHLCV': false, + 'fetchMarkPrices': false, + 'fetchMyLiquidations': false, + 'fetchMySettlementHistory': false, 'fetchOHLCV': true, + 'fetchOpenInterest': false, + 'fetchOpenInterestHistory': false, + 'fetchOpenInterests': false, 'fetchOpenOrder': true, 'fetchOpenOrders': true, + 'fetchOption': false, + 'fetchOptionChain': false, 'fetchOrderBook': true, + 'fetchPosition': false, + 'fetchPositionHistory': false, + 'fetchPositionMode': false, + 'fetchPositions': false, + 'fetchPositionsForSymbol': false, + 'fetchPositionsHistory': false, + 'fetchPositionsRisk': false, + 'fetchPremiumIndexOHLCV': false, + 'fetchSettlementHistory': false, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFees': true, + 'fetchVolatilityHistory': false, + 'reduceMargin': false, + 'repayCrossMargin': false, + 'repayIsolatedMargin': false, + 'repayMargin': false, + 'setLeverage': false, + 'setMargin': false, + 'setMarginMode': false, + 'setPositionMode': false, 'transfer': true, }, 'urls': { @@ -111793,7 +111946,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de * @method * @name coinbase#closePosition * @description *futures only* closes open positions for a market - * @see https://coinbase-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions + * @see https://docs.cdp.coinbase.com/coinbase-app/trade/reference/retailbrokerageapi_closeposition * @param {string} symbol Unified CCXT market symbol * @param {string} [side] not used by coinbase * @param {object} [params] extra parameters specific to the coinbase api endpoint @@ -111804,9 +111957,6 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de async closePosition(symbol, side = undefined, params = {}) { await this.loadMarkets(); const market = this.market(symbol); - if (!market['future']) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' closePosition() only supported for futures markets'); - } const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId'); params = this.omit(params, 'clientOrderId'); const request = { @@ -123913,6 +124063,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'broad': { 'ip not allow visit': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied, 'service too busy': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeNotAvailable, + 'Service is not available during funding fee settlement': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OperationFailed, }, }, }); @@ -124109,7 +124260,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul 'settleId': undefined, 'type': 'spot', 'spot': true, - 'margin': undefined, + 'margin': this.safeBool(market, 'is_margin_available'), 'swap': false, 'future': false, 'option': false, @@ -129352,2625 +129503,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul } -/***/ }), - -/***/ 7477: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ A: () => (/* binding */ coinlist) -/* harmony export */ }); -/* harmony import */ var _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2948); -/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2079); -/* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1579); -/* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5147); -/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4852); - - - - - -/** - * @class coinlist - * @augments Exchange - */ -class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { - describe() { - return this.deepExtend(super.describe(), { - 'id': 'coinlist', - 'name': 'Coinlist', - 'countries': ['US'], - 'version': 'v1', - 'rateLimit': 300, - 'certified': false, - 'pro': false, - 'has': { - 'CORS': undefined, - 'spot': true, - 'margin': false, - 'swap': false, - 'future': false, - 'option': false, - 'addMargin': false, - 'cancelAllOrders': true, - 'cancelOrder': true, - 'cancelOrders': true, - 'closeAllPositions': false, - 'closePosition': false, - 'createDepositAddress': false, - 'createOrder': true, - 'createPostOnlyOrder': true, - 'createReduceOnlyOrder': false, - 'createStopLimitOrder': true, - 'createStopMarketOrder': true, - 'createStopOrder': true, - 'deposit': false, - 'editOrder': true, - 'fetchAccounts': true, - 'fetchBalance': true, - 'fetchBidsAsks': false, - 'fetchBorrowInterest': false, - 'fetchBorrowRateHistories': false, - 'fetchBorrowRateHistory': false, - 'fetchCanceledOrders': true, - 'fetchClosedOrder': false, - 'fetchClosedOrders': true, - 'fetchCrossBorrowRate': false, - 'fetchCrossBorrowRates': false, - 'fetchCurrencies': true, - 'fetchDeposit': false, - 'fetchDepositAddress': false, - 'fetchDepositAddresses': false, - 'fetchDepositAddressesByNetwork': false, - 'fetchDeposits': false, - 'fetchDepositsWithdrawals': true, - 'fetchDepositWithdrawFee': false, - 'fetchDepositWithdrawFees': false, - 'fetchFundingHistory': false, - 'fetchFundingRate': true, - 'fetchFundingRateHistory': false, - 'fetchFundingRates': false, - 'fetchIndexOHLCV': false, - 'fetchIsolatedBorrowRate': false, - 'fetchIsolatedBorrowRates': false, - 'fetchL3OrderBook': false, - 'fetchLedger': true, - 'fetchLeverage': false, - 'fetchLeverageTiers': false, - 'fetchMarketLeverageTiers': false, - 'fetchMarkets': true, - 'fetchMarkOHLCV': false, - 'fetchMyTrades': true, - 'fetchOHLCV': true, - 'fetchOpenInterestHistory': false, - 'fetchOpenOrder': false, - 'fetchOpenOrders': true, - 'fetchOrder': true, - 'fetchOrderBook': true, - 'fetchOrderBooks': false, - 'fetchOrders': true, - 'fetchOrderTrades': true, - 'fetchPosition': false, - 'fetchPositionHistory': false, - 'fetchPositionMode': false, - 'fetchPositions': false, - 'fetchPositionsForSymbol': false, - 'fetchPositionsHistory': false, - 'fetchPositionsRisk': false, - 'fetchPremiumIndexOHLCV': false, - 'fetchStatus': false, - 'fetchTicker': true, - 'fetchTickers': true, - 'fetchTime': true, - 'fetchTrades': true, - 'fetchTradingFee': false, - 'fetchTradingFees': true, - 'fetchTradingLimits': false, - 'fetchTransactionFee': false, - 'fetchTransactionFees': false, - 'fetchTransactions': true, - 'fetchTransfers': true, - 'fetchWithdrawal': false, - 'fetchWithdrawals': false, - 'fetchWithdrawalWhitelist': false, - 'reduceMargin': false, - 'repayCrossMargin': false, - 'repayIsolatedMargin': false, - 'setLeverage': false, - 'setMargin': false, - 'setMarginMode': false, - 'setPositionMode': false, - 'signIn': false, - 'transfer': true, - 'withdraw': true, - 'ws': false, - }, - 'timeframes': { - '1m': '1m', - '5m': '5m', - '30m': '30m', - }, - 'urls': { - 'logo': 'https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg', - 'api': { - 'public': 'https://trade-api.coinlist.co', - 'private': 'https://trade-api.coinlist.co', - }, - 'www': 'https://coinlist.co', - 'doc': [ - 'https://trade-docs.coinlist.co', - ], - 'fees': 'https://coinlist.co/fees', - }, - 'api': { - 'public': { - 'get': { - 'v1/symbols': 1, - 'v1/symbols/summary': 1, - 'v1/symbols/{symbol}': 1, - 'v1/symbols/{symbol}/summary': 1, - 'v1/symbols/{symbol}/book': 1, - 'v1/symbols/{symbol}/quote': 1, - 'v1/symbols/{symbol}/candles': 1, - 'v1/symbols/{symbol}/auctions': 1, - 'v1/symbols/{symbol}/auctions/{auction_code}': 1, - 'v1/time': 1, - 'v1/assets': 1, - 'v1/leaderboard': 1, - 'v1/affiliate/{competition_code}': 1, - 'v1/competition/{competition_id}': 1, - 'v1/symbols/{symbol}/funding': 1, - }, - }, - 'private': { - 'get': { - 'v1/fees': 1, - 'v1/accounts': 1, - 'v1/accounts/{trader_id}': 1, - 'v1/accounts/{trader_id}/alias': 1, - 'v1/accounts/{trader_id}/ledger': 1, - 'v1/accounts/{trader_id}/wallets': 1, - 'v1/accounts/{trader_id}/wallet-ledger': 1, - 'v1/accounts/{trader_id}/ledger-summary': 1, - 'v1/keys': 1, - 'v1/fills': 1, - 'v1/orders': 1, - 'v1/orders/{order_id}': 1, - 'v1/reports': 1, - 'v1/balances': 1, - 'v1/transfers': 1, - 'v1/user': 1, - 'v1/credits': 1, - 'v1/positions': 1, - 'v1/accounts/{trader_id}/competitions': 1, - 'v1/closedPositions': 1, - }, - 'post': { - 'v1/keys': 1, - 'v1/orders': 1, - 'v1/orders/cancel-all-after': 1, - 'v1/reports': 1, - 'v1/transfers/to-wallet': 1, - 'v1/transfers/from-wallet': 1, - 'v1/transfers/internal-transfer': 1, - 'v1/transfers/withdrawal-request': 1, - 'v1/orders/bulk': 1, - 'v1/accounts/{trader_id}/competitions': 1, - 'v1/accounts/{trader_id}/create-competition': 1, - }, - 'patch': { - 'v1/orders/{order_id}': 1, - 'v1/orders/bulk': 1, // not unified - }, - 'put': { - 'v1/accounts/{trader_id}/alias': 1, - }, - 'delete': { - 'v1/keys/{key}': 1, - 'v1/orders': 1, - 'v1/orders/{order_id}': 1, - 'v1/orders/bulk': 1, - }, - }, - }, - 'features': { - 'default': { - 'sandbox': false, - 'createOrder': { - 'marginMode': false, - 'triggerPrice': true, - 'triggerPriceType': { - 'last': true, - 'mark': true, - 'index': true, - }, - 'triggerDirection': false, - 'stopLossPrice': false, - 'takeProfitPrice': false, - 'attachedStopLossTakeProfit': undefined, - 'timeInForce': { - 'IOC': false, - 'FOK': false, - 'PO': true, - 'GTD': false, - }, - 'hedged': false, - 'trailing': true, - 'leverage': false, - 'marketBuyByCost': false, - 'marketBuyRequiresPrice': false, - 'selfTradePrevention': true, - 'iceberg': false, - }, - 'createOrders': undefined, - 'fetchMyTrades': { - 'marginMode': false, - 'limit': 500, - 'daysBack': 100000, - 'untilDays': 100000, - 'symbolRequired': false, - }, - 'fetchOrder': { - 'marginMode': false, - 'trigger': false, - 'trailing': false, - 'symbolRequired': false, - }, - 'fetchOpenOrders': { - 'marginMode': false, - 'limit': 500, - 'trigger': false, - 'trailing': false, - 'symbolRequired': false, - }, - 'fetchOrders': { - 'marginMode': false, - 'limit': 500, - 'daysBack': 100000, - 'untilDays': 100000, - 'trigger': false, - 'trailing': false, - 'symbolRequired': false, - }, - 'fetchClosedOrders': { - 'marginMode': false, - 'limit': 500, - 'daysBack': 100000, - 'daysBackCanceled': undefined, - 'untilDays': 100000, - 'trigger': false, - 'trailing': false, - 'symbolRequired': false, - }, - 'fetchOHLCV': { - 'limit': 300, - }, - }, - 'swap': { - 'linear': undefined, - 'inverse': undefined, - }, - 'future': { - 'linear': undefined, - 'inverse': undefined, - }, - }, - 'fees': { - 'trading': { - 'feeSide': 'get', - 'tierBased': true, - 'percentage': true, - 'taker': this.parseNumber('0.0045'), - 'maker': this.parseNumber('0.0025'), - 'tiers': { - 'taker': [ - [this.parseNumber('0'), this.parseNumber('0.0045')], - [this.parseNumber('20000'), this.parseNumber('0.003')], - [this.parseNumber('50000'), this.parseNumber('0.0025')], - [this.parseNumber('100000'), this.parseNumber('0.002')], - [this.parseNumber('500000'), this.parseNumber('0.0018')], - [this.parseNumber('750000'), this.parseNumber('0.0018')], - [this.parseNumber('1000000'), this.parseNumber('0.0016')], - [this.parseNumber('2500000'), this.parseNumber('0.0013')], - [this.parseNumber('5000000'), this.parseNumber('0.0012')], - [this.parseNumber('10000000'), this.parseNumber('0.001')], - [this.parseNumber('50000000'), this.parseNumber('0.0005')], - [this.parseNumber('100000000'), this.parseNumber('0.0005')], - ], - 'maker': [ - [this.parseNumber('0'), this.parseNumber('0.0025')], - [this.parseNumber('20000'), this.parseNumber('0.0025')], - [this.parseNumber('50000'), this.parseNumber('0.0025')], - [this.parseNumber('100000'), this.parseNumber('0.002')], - [this.parseNumber('500000'), this.parseNumber('0.0015')], - [this.parseNumber('750000'), this.parseNumber('0.0012')], - [this.parseNumber('1000000'), this.parseNumber('0.001')], - [this.parseNumber('2500000'), this.parseNumber('0.0008')], - [this.parseNumber('5000000'), this.parseNumber('0.0007')], - [this.parseNumber('10000000'), this.parseNumber('0.0006')], - [this.parseNumber('50000000'), this.parseNumber('0.0000')], - [this.parseNumber('100000000'), this.parseNumber('0.00')], - ], - }, - }, - }, - 'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .kb, - // exchange-specific options - 'options': { - 'accountsByType': { - 'CoinList Pro': 'trading', - 'CoinList Pro trading account': 'trading', - 'Pro': 'trading', - 'pro': 'trading', - 'trade': 'trading', - 'trading': 'trading', - 'CoinList': 'funding', - 'CoinList wallet': 'funding', - 'Wallet': 'funding', - 'wallet': 'funding', - 'fund': 'funding', - 'funding': 'funding', - }, - }, - 'exceptions': { - // https://trade-docs.coinlist.co/?javascript--nodejs#message-codes - 'exact': { - 'AUTH_SIG_INVALID': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError, - 'DENIED_MAINTENANCE': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OnMaintenance, - 'ORDER_REJECT_BAD_STATUS': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_INVALID_POST_ONLY': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_INVALID_CLOSE_ONLY': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_POST_ONLY_REQUIRED': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_FROZEN_ORDER': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_LIMIT_PRICE_PROTECTION_VIOLATION': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_CLOSED': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported, - 'ORDER_REJECT_MAX_ORDERS': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'ORDER_REJECT_NOT_FOUND': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound, - 'ORDER_REJECT_PARSE_ERROR': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'ORDER_REJECT_PRICE_INVALID': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_QUANTITY_ZERO': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_TOKEN_LIMIT': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds, - 'ORDER_REJECT_TOKEN_LIMIT_OTHER': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_REJECT_SELF_TRADE': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_VALIDATE_BAD_SIZE_ALIGNMENT': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_VALIDATE_BAD_TICK_ALIGNMENT': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder, - 'ORDER_VALIDATE_SYMBOL_NOT_FOUND': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol, - 'TRANSFERS_WITHDRAWAL_REQUEST_TOO_LARGE': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds, - 'WITHDRAWAL_REQUEST_NOT_ALLOWED': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied, // {"message":"Withdrawal from CoinList not allowed for trader.","message_code":"WITHDRAWAL_REQUEST_NOT_ALLOWED","message_details":{"asset":"USDT","amount":"5","trader_id":"9c6f737e-a829-4843-87b1-b1ce86f2853b","destination_address":"0x9050dfA063D1bE7cA711c750b18D51fDD13e90Ee"}} - }, - 'broad': { - 'A destinationAddress is required for non-USD withdrawals': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddress, - 'fails to match the JsonSchema date-time format pattern': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'is required': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired, - 'must be a string': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'must be a valid GUID': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'must be greater than or equal to': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'must be less than or equal to': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'must be one of': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, - 'Symbol not found': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol, // {"message":"Symbol not found: {symbol}"} - }, - }, - }); - } - calculateRateLimiterCost(api, method, path, params, config = {}) { - if (Array.isArray(params)) { - const length = params.length; - return Math.ceil(length / 2); - } - return 1; - } - /** - * @method - * @name coinlist#fetchTime - * @description fetches the current integer timestamp in milliseconds from the exchange server - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-system-time - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {int} the current integer timestamp in milliseconds from the exchange server - */ - async fetchTime(params = {}) { - const response = await this.publicGetV1Time(params); - // - // { - // "epoch": 1698087996.039, - // "iso": "2023-10-23T19:06:36.039Z" - // } - // - const string = this.safeString(response, 'iso'); - return this.parse8601(string); - } - /** - * @method - * @name coinlist#fetchCurrencies - * @description fetches all available currencies on an exchange - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-supported-assets - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an associative dictionary of currencies - */ - async fetchCurrencies(params = {}) { - const response = await this.publicGetV1Assets(params); - // - // { - // "assets": [ - // { - // "asset": "AAVE", - // "index_code": ".AAVEUSD", - // "decimal_places": 18, - // "min_withdrawal": "1.0000", - // "is_transferable": true, - // "is_visible": true - // }, - // { - // "asset": "ALGO", - // "index_code": ".ALGOUSD", - // "decimal_places": 6, - // "min_withdrawal": "1.0000", - // "is_transferable": true, - // "is_visible": true - // } - // ] - // } - // - const currencies = this.safeValue(response, 'assets', []); - const result = {}; - for (let i = 0; i < currencies.length; i++) { - const currency = currencies[i]; - const id = this.safeString(currency, 'asset'); - const code = this.safeCurrencyCode(id); - const isFiat = code === 'USD'; - const isTransferable = this.safeBool(currency, 'is_transferable', false); - result[code] = this.safeCurrencyStructure({ - 'id': id, - 'code': code, - 'name': code, - 'info': currency, - 'active': undefined, - 'deposit': isTransferable, - 'withdraw': isTransferable, - 'fee': undefined, - 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimal_places'))), - 'limits': { - 'amount': { - 'min': undefined, - 'max': undefined, - }, - 'withdraw': { - 'min': this.safeNumber(currency, 'min_withdrawal'), - 'max': undefined, - }, - }, - 'networks': {}, - 'type': isFiat ? 'fiat' : 'crypto', - }); - } - return result; - } - /** - * @method - * @name coinlist#fetchMarkets - * @description retrieves data on all markets for coinlist - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-symbols - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} an array of objects representing market data - */ - async fetchMarkets(params = {}) { - const response = await this.publicGetV1Symbols(params); - // - // { - // "symbols": [ - // { - // "symbol": "CQT-USDT", // spot - // "base_currency": "CQT", - // "is_trader_geofenced": false, - // "list_time": "2021-06-15T00:00:00.000Z", - // "type": "spot", - // "series_code": "CQT-USDT-SPOT", - // "long_name": "Covalent", - // "asset_class": "CRYPTO", - // "minimum_price_increment": "0.0001", - // "minimum_size_increment": "0.0001", - // "quote_currency": "USDT", - // "index_code": null, - // "price_band_threshold_market": "0.05", - // "price_band_threshold_limit": "0.25", - // "last_price": "0.12160000", - // "fair_price": "0.12300000", - // "index_price": null - // }, - // ] - // } - // - const markets = this.safeValue(response, 'symbols', []); - return this.parseMarkets(markets); - } - parseMarket(market) { - // perp - // { - // "symbol":"BTC-PERP", - // "base_currency":"BTC", - // "is_trader_geofenced":false, - // "expiry_name":null, - // "expiry_time":null, - // "list_time":"2024-09-16T00:00:00.000Z", - // "type":"perp-swap", - // "series_code":"BTC", - // "long_name":"Bitcoin", - // "asset_class":"CRYPTO", - // "minimum_price_increment":"0.01", - // "minimum_size_increment":"0.0001", - // "quote_currency":"USDT", - // "multiplier":"1", - // "contract_frequency":"FGHJKMNQUVXZ", - // "index_code":".BTC-USDT", - // "price_band_threshold_market":"0.05", - // "price_band_threshold_limit":"0.25", - // "maintenance_initial_ratio":"0.500000000000000000", - // "liquidation_initial_ratio":"0.500000000000000000", - // "last_price":"75881.36000000", - // "fair_price":"76256.00000000", - // "index_price":"77609.90000000", - // "mark_price":"76237.75000000", - // "mark_price_dollarizer":"0.99950000", - // "funding_interval":{ - // "hours":"8" - // }, - // "funding_rate_index_code":".BTC-USDT-FR8H", - // "initial_margin_base":"0.200000000000000000", - // "initial_margin_per_contract":"0.160000000000000000", - // "position_limit":"5.0000" - // } - // spot - // { - // "symbol": "CQT-USDT", // spot - // "base_currency": "CQT", - // "is_trader_geofenced": false, - // "list_time": "2021-06-15T00:00:00.000Z", - // "type": "spot", - // "series_code": "CQT-USDT-SPOT", - // "long_name": "Covalent", - // "asset_class": "CRYPTO", - // "minimum_price_increment": "0.0001", - // "minimum_size_increment": "0.0001", - // "quote_currency": "USDT", - // "index_code": null, - // "price_band_threshold_market": "0.05", - // "price_band_threshold_limit": "0.25", - // "last_price": "0.12160000", - // "fair_price": "0.12300000", - // "index_price": null - // } - const isSwap = this.safeString(market, 'type') === 'perp-swap'; - const id = this.safeString(market, 'symbol'); - const baseId = this.safeString(market, 'base_currency'); - const quoteId = this.safeString(market, 'quote_currency'); - const base = this.safeCurrencyCode(baseId); - const quote = this.safeCurrencyCode(quoteId); - const amountPrecision = this.safeString(market, 'minimum_size_increment'); - const pricePrecision = this.safeString(market, 'minimum_price_increment'); - const created = this.safeString(market, 'list_time'); - let settledId = undefined; - let settled = undefined; - let linear = undefined; - let inverse = undefined; - let contractSize = undefined; - let symbol = base + '/' + quote; - if (isSwap) { - contractSize = this.parseNumber('1'); - linear = true; - inverse = false; - settledId = quoteId; - settled = quote; - symbol = symbol + ':' + quote; - } - const type = isSwap ? 'swap' : 'spot'; - return { - 'id': id, - 'symbol': symbol, - 'base': base, - 'quote': quote, - 'settle': settled, - 'baseId': baseId, - 'quoteId': quoteId, - 'settleId': settledId, - 'type': type, - 'spot': !isSwap, - 'margin': false, - 'swap': isSwap, - 'future': false, - 'option': false, - 'active': true, - 'contract': isSwap, - 'linear': linear, - 'inverse': inverse, - 'contractSize': contractSize, - 'expiry': undefined, - 'expiryDatetime': undefined, - 'strike': undefined, - 'optionType': undefined, - 'precision': { - 'amount': this.parseNumber(amountPrecision), - 'price': this.parseNumber(pricePrecision), - }, - 'limits': { - 'leverage': { - 'min': undefined, - 'max': undefined, - }, - 'amount': { - 'min': undefined, - 'max': undefined, - }, - 'price': { - 'min': undefined, - 'max': undefined, - }, - 'cost': { - 'min': undefined, - 'max': undefined, - }, - }, - 'created': this.parse8601(created), - 'info': market, - }; - } - /** - * @method - * @name coinlist#fetchTickers - * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-symbol-summaries - * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure} - */ - async fetchTickers(symbols = undefined, params = {}) { - await this.loadMarkets(); - const request = {}; - const tickers = await this.publicGetV1SymbolsSummary(this.extend(request, params)); - // - // { - // "MATIC-USD": { - // "type":"spot", - // "last_price":"0.60990000", - // "lowest_ask":"0.61190000", - // "highest_bid":"0.60790000", - // "last_trade": { - // "price":"0.60000000", - // "volume":"2.0000", - // "imbalance":"198.0000", - // "logicalTime":"2023-10-22T23:02:25.000Z", - // "auctionCode":"MATIC-USD-2023-10-22T23:02:25.000Z" - // }, - // "volume_base_24h":"34.0555", - // "volume_quote_24h":"19.9282", - // "price_change_percent_24h":"7.50925436", - // "highest_price_24h":"0.68560000", - // "lowest_price_24h":"0.55500000" - // }, - // } - // - return this.parseTickers(tickers, symbols, params); - } - /** - * @method - * @name coinlist#fetchTicker - * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-market-summary - * @param {string} symbol unified symbol of the market to fetch the ticker for - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} - */ - async fetchTicker(symbol, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - const request = { - 'symbol': market['id'], - }; - const ticker = await this.publicGetV1SymbolsSymbolSummary(this.extend(request, params)); - // - // { - // "type":"spot", - // "last_price":"31125.00000000", - // "lowest_ask":"31349.99000000", - // "highest_bid":"30900.00000000", - // "last_trade": { - // "price":"31000.00000000", - // "volume":"0.0003", - // "imbalance":"0.0000", - // "logicalTime":"2023-10-23T16:57:15.000Z", - // "auctionCode":"BTC-USDT-2023-10-23T16:57:15.000Z" - // }, - // "volume_base_24h":"0.3752", - // "volume_quote_24h":"11382.7181", - // "price_change_percent_24h":"3.66264694", - // "highest_price_24h":"31225.12000000", - // "lowest_price_24h":"29792.81000000" - // } - // - return this.parseTicker(ticker, market); - } - parseTicker(ticker, market = undefined) { - // - // { - // "type":"spot", - // "last_price":"0.60990000", - // "lowest_ask":"0.61190000", - // "highest_bid":"0.60790000", - // "last_trade": { - // "price":"0.60000000", - // "volume":"2.0000", - // "imbalance":"198.0000", - // "logicalTime":"2023-10-22T23:02:25.000Z", - // "auctionCode":"MATIC-USD-2023-10-22T23:02:25.000Z" - // }, - // "volume_base_24h":"34.0555", - // "volume_quote_24h":"19.9282", - // "price_change_percent_24h":"7.50925436", - // "highest_price_24h":"0.68560000", - // "lowest_price_24h":"0.55500000" - // } - // - const lastTrade = this.safeValue(ticker, 'last_trade', {}); - const timestamp = this.parse8601(this.safeString(lastTrade, 'logicalTime')); - const bid = this.safeString(ticker, 'highest_bid'); - const ask = this.safeString(ticker, 'lowest_ask'); - const baseVolume = this.safeString(ticker, 'volume_base_24h'); - const quoteVolume = this.safeString(ticker, 'volume_quote_24h'); - const high = this.safeString(ticker, 'highest_price_24h'); - const low = this.safeString(ticker, 'lowest_price_24h'); - const close = this.safeString(ticker, 'last_price'); - const changePcnt = this.safeString(ticker, 'price_change_percent_24h'); - return this.safeTicker({ - 'symbol': market['symbol'], - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'open': undefined, - 'high': high, - 'low': low, - 'close': close, - 'bid': bid, - 'bidVolume': undefined, - 'ask': ask, - 'askVolume': undefined, - 'vwap': undefined, - 'previousClose': undefined, - 'change': undefined, - 'percentage': changePcnt, - 'average': undefined, - 'baseVolume': baseVolume, - 'quoteVolume': quoteVolume, - 'info': ticker, - }, market); - } - /** - * @method - * @name coinlist#fetchOrderBook - * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-order-book-level-2 - * @param {string} symbol unified symbol of the market to fetch the order book for - * @param {int} [limit] the maximum amount of order book entries to return (default 100, max 200) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols - */ - async fetchOrderBook(symbol, limit = undefined, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - const request = { - 'symbol': market['id'], - }; - const response = await this.publicGetV1SymbolsSymbolBook(this.extend(request, params)); - // - // { - // "bids": [ - // [ "30900.00000000", "0.0001" ], - // [ "30664.21000000", "0.0172" ], - // [ "30664.20000000", "0.0906" ], - // ], - // "asks": [ - // [ "31349.99000000", "0.0003" ], - // [ "31350.00000000", "0.0023" ], - // [ "31359.33000000", "0.0583" ], - // ], - // "after_auction_code": "BTC-USDT-2023-10-23T18:40:51.000Z", - // "call_time": "2023-10-23T18:40:51.068Z", - // "logical_time": "2023-10-23T18:40:51.000Z" - // } - // - const logical_time = this.parse8601(this.safeString(response, 'logical_time')); - const orderbook = this.parseOrderBook(response, symbol, logical_time); - orderbook['nonce'] = undefined; - return orderbook; - } - /** - * @method - * @name coinlist#fetchOHLCV - * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-candles - * @param {string} symbol unified symbol of the market to fetch OHLCV data for - * @param {string} timeframe the length of time each candle represents - * @param {int} [since] timestamp in ms of the earliest candle to fetch - * @param {int} [limit] the maximum amount of candles to fetch - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume - */ - async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - const granularity = this.safeString(this.timeframes, timeframe); - const request = { - 'symbol': market['id'], - 'granularity': granularity, - }; - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - if (limit !== undefined) { - const duration = this.parseTimeframe(timeframe) * 1000; - request['end_time'] = this.iso8601(this.sum(since, duration * (limit))); - } - else { - request['end_time'] = this.iso8601(this.milliseconds()); - } - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - const response = await this.publicGetV1SymbolsSymbolCandles(this.extend(request, params)); - // - // { - // "candles": [ - // [ - // "2023-10-17T15:00:00.000Z", - // "28522.96000000", - // "28522.96000000", - // "28522.96000000", - // "28522.96000000", - // "0.1881", - // null - // ], - // [ - // "2023-10-17T15:30:00.000Z", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "0.0050", - // null - // ] - // ] - // } - // - const candles = this.safeList(response, 'candles', []); - return this.parseOHLCVs(candles, market, timeframe, since, limit); - } - parseOHLCV(ohlcv, market = undefined) { - // - // [ - // "2023-10-17T15:30:00.000Z", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "28582.64000000", - // "0.0050", - // null - // ] - // - return [ - this.parse8601(this.safeString(ohlcv, 0)), - this.safeNumber(ohlcv, 1), - this.safeNumber(ohlcv, 2), - this.safeNumber(ohlcv, 3), - this.safeNumber(ohlcv, 4), - this.safeNumber(ohlcv, 5), - ]; - } - /** - * @method - * @name coinlist#fetchTrades - * @description get the list of most recent trades for a particular symbol - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-auctions - * @param {string} symbol unified symbol of the market to fetch trades for - * @param {int} [since] timestamp in ms of the earliest trade to fetch - * @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades} - */ - async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - const request = { - 'symbol': market['id'], - }; - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - } - if (limit !== undefined) { - request['count'] = Math.min(limit, 500); - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - const response = await this.publicGetV1SymbolsSymbolAuctions(this.extend(request, params)); - // - // { - // "auctions": [ - // { - // "symbol":"BTC-USDT", - // "auction_code":"BTC-USDT-2023-10-01T08:05:56.000Z", - // "price":"27241.53000000", - // "volume":"0.0052", - // "imbalance":"-1.0983", - // "logical_time":"2023-10-01T08:05:56.000Z", - // "call_time":"2023-10-01T08:05:56.068Z" - // }, - // { - // "symbol":"BTC-USDT", - // "auction_code":"BTC-USDT-2023-10-01T08:09:09.000Z", - // "price":"27236.83000000", - // "volume":"0.0283", - // "imbalance":"-1.0754", - // "logical_time":"2023-10-01T08:09:09.000Z", - // "call_time":"2023-10-01T08:09:09.078Z" - // } - // ] - // } - // - const auctions = this.safeList(response, 'auctions', []); - return this.parseTrades(auctions, market, since, limit); - } - parseTrade(trade, market = undefined) { - // - // fetchTrades - // { - // "symbol": "BTC-USDT", - // "auction_code": "BTC-USDT-2023-10-01T08:05:56.000Z", - // "price": "27241.53000000", - // "volume": "0.0052", - // "imbalance": "-1.0983", - // "logical_time": "2023-10-01T08:05:56.000Z", - // "call_time": "2023-10-01T08:05:56.068Z" - // } - // - // fetchMyTrades - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:22:14.000Z", - // "order_id": "83ed365f-497d-433b-96c1-9d08c1a12842", - // "quantity": "0.0008", - // "price": "1615.24000000", - // "fee": "0.005815", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:22:14.000Z" - // } - // - const marketId = this.safeString(trade, 'symbol'); - market = this.safeMarket(marketId, market); - const symbol = market['symbol']; - const id = this.safeString(trade, 'auction_code'); - const timestamp = this.parse8601(this.safeString(trade, 'logical_time')); - const priceString = this.safeString(trade, 'price'); - let amountString = this.safeString2(trade, 'volume', 'quantity'); - const order = this.safeString(trade, 'order_id'); - let fee = undefined; - let side = undefined; - const feeCost = this.safeString(trade, 'fee'); - if (feeCost !== undefined) { - // only in fetchMyTrades - const amountIsNegative = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringLt(amountString, '0'); - if (amountIsNegative) { - side = 'sell'; - amountString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringNeg(amountString); - } - else { - side = 'buy'; - } - fee = { - 'cost': feeCost, - 'currency': this.safeString(trade, 'fee_currency'), - }; - } - else { - const imbalance = this.safeString(trade, 'imbalance'); - if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringLt(imbalance, '0')) { - side = 'buy'; - } - else { - side = 'sell'; - } - } - const takerOrMaker = this.safeString(trade, 'fee_type'); - return this.safeTrade({ - 'id': id, - 'order': order, - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'symbol': symbol, - 'type': undefined, - 'side': side, - 'takerOrMaker': takerOrMaker, - 'price': priceString, - 'amount': amountString, - 'cost': undefined, - 'fee': fee, - 'info': trade, - }, market); - } - /** - * @method - * @name coinlist#fetchTradingFees - * @description fetch the trading fees for multiple markets - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols - */ - async fetchTradingFees(params = {}) { - await this.loadMarkets(); - const response = await this.privateGetV1Fees(params); - // - // { - // fees_by_symbols: { - // 'BTC-USD,BTC-USDT,ETH-USD,ETH-USDT,ETH-BTC,AAVE-USD,AAVE-USDT,ALGO-USD,ALGO-USDT,AVAX-USD,AVAX-USDT,BICO-USD,BICO-USDT,BLD-USD,BLD-USDT,BTRST-USDT,BZZ-USDT,CELO-USD,CELO-BTC,CFG-USD,CFG-USDT,CLV-USDT,COMP-USD,COMP-USDT,CYBER-USDT,CQT-USDT,CSPR-USD,CSPR-USDT,CUSD-USD,CUSD-USDC,DOGE-USD,DOGE-USDT,DOT-USD,DOT-USDT,EFI-USDT,FIL-USD,FIL-USDT,FLOW-USD,FLOW-USDT,GAL-USD,GAL-USDT,GODS-USDT,GOG-USDT,HMT-USD,HMT-USDT,ICP-USD,ICP-USDT,IMX-USD,IMX-USDT,LINK-USD,LINK-USDT,MATIC-USD,MATIC-USDT,MINA-USD,MINA-USDT,MKR-USD,MKR-USDT,NEON-USDT,NYM-USD,NYM-USDT,OCEAN-USD,OXT-USD,ROSE-USD,ROSE-USDT,SKL-USD,SKL-USDT,SOL-USD,SOL-USDT,STX-USDT,SUI-USDT,T-USDT,UNI-USD,UNI-USDT,USDT-USD,VEGA-USDT,WAXL-USD,WAXL-USDT,WBTC-BTC,WCFG-USD,WCFG-USDT,XTZ-USD': { - // base: { - // fees: { maker: '0', taker: '0.0045', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_1: { - // fees: { maker: '0', taker: '0.003', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_2: { - // fees: { maker: '0', taker: '0.0025', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_3: { - // fees: { maker: '0', taker: '0.002', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_4: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_5: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_6: { - // fees: { maker: '0', taker: '0.0016', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_7: { - // fees: { maker: '0', taker: '0.0013', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_8: { - // fees: { maker: '0', taker: '0.0012', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_9: { - // fees: { maker: '0', taker: '0.001', liquidation: '0' }, - // floors: { maker: null, taker: null } - // } - // volume_tier_10: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_11: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // } - // } - // } - // - const fees = this.safeValue(response, 'fees_by_symbols', {}); - const result = {}; - const groupsOfSymbols = Object.keys(fees); - for (let i = 0; i < groupsOfSymbols.length; i++) { - const group = groupsOfSymbols[i]; - const feeTiers = this.safeValue(fees, group, {}); - const tiers = this.parseFeeTiers(feeTiers); - const firstTier = this.safeValue(feeTiers, 'base', {}); - const firstTierFees = this.safeValue(firstTier, 'fees', {}); - const ids = group.split(','); - for (let j = 0; j < ids.length; j++) { - const id = ids[j]; - const market = this.safeMarket(id); - const symbol = market['symbol']; - const info = {}; - info[group] = feeTiers; - result[symbol] = { - 'info': info, - 'symbol': symbol, - 'maker': this.safeNumber(firstTierFees, 'maker'), - 'taker': this.safeNumber(firstTierFees, 'taker'), - 'percentage': true, - 'tierBased': true, - 'tiers': tiers, - }; - } - } - return result; - } - parseFeeTiers(feeTiers, market = undefined) { - // - // base: { - // fees: { maker: '0', taker: '0.0045', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_1: { - // fees: { maker: '0', taker: '0.003', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_2: { - // fees: { maker: '0', taker: '0.0025', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_3: { - // fees: { maker: '0', taker: '0.002', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_4: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_5: { - // fees: { maker: '0', taker: '0.0018', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_6: { - // fees: { maker: '0', taker: '0.0016', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_7: { - // fees: { maker: '0', taker: '0.0013', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_8: { - // fees: { maker: '0', taker: '0.0012', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_9: { - // fees: { maker: '0', taker: '0.001', liquidation: '0' }, - // floors: { maker: null, taker: null } - // } - // volume_tier_10: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // volume_tier_11: { - // fees: { maker: '0', taker: '0.0005', liquidation: '0' }, - // floors: { maker: null, taker: null } - // }, - // - let takerFees = []; - let makerFees = []; - const keys = Object.keys(feeTiers); - const keysLength = keys.length; - if (keysLength > 0) { - for (let i = 0; i < keysLength; i++) { - const key = keys[i]; - const tier = this.safeValue(feeTiers, key, {}); - const tierFees = this.safeValue(tier, 'fees', {}); - const taker = this.safeString(tierFees, 'taker'); - const maker = this.safeString(tierFees, 'maker'); - makerFees.push([undefined, this.parseNumber(maker)]); - takerFees.push([undefined, this.parseNumber(taker)]); - } - takerFees = this.sortBy(takerFees, 1, true); - makerFees = this.sortBy(makerFees, 1, true); - const firstTier = this.safeDict(takerFees, 0, []); - const exchangeFees = this.safeDict(this, 'fees', {}); - const exchangeFeesTrading = this.safeDict(exchangeFees, 'trading', {}); - const exchangeFeesTradingTiers = this.safeDict(exchangeFeesTrading, 'tiers', {}); - const exchangeFeesTradingTiersTaker = this.safeList(exchangeFeesTradingTiers, 'taker', []); - const exchangeFeesTradingTiersMaker = this.safeList(exchangeFeesTradingTiers, 'maker', []); - const exchangeFeesTradingTiersTakerLength = exchangeFeesTradingTiersTaker.length; - const firstTierLength = firstTier.length; - if ((keysLength === exchangeFeesTradingTiersTakerLength) && (firstTierLength > 0)) { - for (let i = 0; i < keysLength; i++) { - takerFees[i][0] = exchangeFeesTradingTiersTaker[i][0]; - makerFees[i][0] = exchangeFeesTradingTiersMaker[i][0]; - } - } - } - return { - 'maker': makerFees, - 'taker': takerFees, - }; - } - /** - * @method - * @name coinlist#fetchAccounts - * @description fetch all the accounts associated with a profile - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-accounts - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type - */ - async fetchAccounts(params = {}) { - await this.loadMarkets(); - const response = await this.privateGetV1Accounts(params); - // - // { - // "accounts": [ - // { - // "trader_id": "b18507ce-7d55-4bf1-b12a-0ccca5b90936", - // "name": "string" - // } - // ] - // } - // - const accounts = this.safeValue(response, 'accounts', []); - return this.parseAccounts(accounts, params); - } - parseAccount(account) { - // - // { - // "trader_id": "b18507ce-7d55-4bf1-b12a-0ccca5b90936", - // "name": "string" - // } - // - return { - 'id': this.safeString(account, 'trader_id'), - 'type': 'trading', - 'code': undefined, - 'info': account, - }; - } - /** - * @method - * @name coinlist#fetchBalance - * @description query for balance and get the amount of funds available for trading or funds locked in orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-balances - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure} - */ - async fetchBalance(params = {}) { - await this.loadMarkets(); - const response = await this.privateGetV1Balances(params); - return this.parseBalance(response); - } - parseBalance(response) { - // - // { - // "asset_balances": { - // "BTC": "0.00308696", - // "ETH": "20.000000000000000000" - // }, - // "asset_holds": { - // "BTC": "0.00000000", - // "ETH": "1.000000000000000000" - // }, - // "net_liquidation_value_usd": "string" - // } - // - const result = { - 'info': response, - 'timestamp': undefined, - 'datetime': undefined, - }; - const totalBalances = this.safeValue(response, 'asset_balances', {}); - const usedBalances = this.safeValue(response, 'asset_holds', {}); - const currencyIds = Object.keys(totalBalances); - for (let i = 0; i < currencyIds.length; i++) { - const currencyId = currencyIds[i]; - const code = this.safeCurrencyCode(currencyId); - const account = this.account(); - account['total'] = this.safeString(totalBalances, currencyId); - account['used'] = this.safeString(usedBalances, currencyId, '0'); - result[code] = account; - } - return this.safeBalance(result); - } - /** - * @method - * @name coinlist#fetchMyTrades - * @description fetch all trades made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fills - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch trades for - * @param {int} [limit] the maximum number of trades structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} - */ - async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const request = {}; - let market = undefined; - if (symbol !== undefined) { - market = this.market(symbol); - request['symbol'] = market['id']; - } - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - } - if (limit !== undefined) { - request['count'] = limit; - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - const response = await this.privateGetV1Fills(this.extend(request, params)); - // - // { - // "fills": [ - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:16:30.000Z", - // "order_id": "39911d5f-c789-4a7d-ad34-820a804d1da6", - // "quantity": "-0.0009", - // "price": "1608.83000000", - // "fee": "0.006516", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:16:30.000Z" - // }, - // { - // "symbol": "ETH-USDT", - // "auction_code": "ETH-USDT-2023-10-20T13:22:14.000Z", - // "order_id": "83ed365f-497d-433b-96c1-9d08c1a12842", - // "quantity": "0.0008", - // "price": "1615.24000000", - // "fee": "0.005815", - // "fee_type": "taker", - // "fee_currency": "USDT", - // "logical_time": "2023-10-20T13:22:14.000Z" - // }, - // ] - // } - // - const fills = this.safeList(response, 'fills', []); - return this.parseTrades(fills, market, since, limit); - } - /** - * @method - * @name coinlist#fetchOrderTrades - * @description fetch all the trades made from a single order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fills - * @param {string} id order id - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch trades for - * @param {int} [limit] the maximum number of trades to retrieve - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} - */ - async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) { - const request = { - 'order_id': id, - }; - return await this.fetchMyTrades(symbol, since, limit, this.extend(request, params)); - } - /** - * @method - * @name coinlist#fetchOrders - * @description fetches information on multiple orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @param {string|string[]} [params.status] the status of the order - 'accepted', 'done', 'canceled', 'rejected', 'pending' (default [ 'accepted', 'done', 'canceled', 'rejected', 'pending' ]) - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - let status = this.safeString(params, 'status'); - if (status === undefined) { - status = ['accepted', 'done', 'canceled', 'rejected', 'pending']; - } - const request = { - 'status': status, - }; - let market = undefined; - if (symbol !== undefined) { - market = this.market(symbol); - request['symbol'] = market['id']; - } - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - } - if (limit !== undefined) { - request['count'] = limit; - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - const response = await this.privateGetV1Orders(this.extend(request, params)); - // - // { - // "orders":[ - // { - // "order_id":"913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price":"35800.00000000", - // "stop_price":null, - // "cost":"0.00000000", - // "fill_fees":"0.00000000", - // "trader_id":"9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status":"accepted", - // "epoch_timestamp":"2023-10-26T08:20:56.307Z", - // "origin":"web", - // "self_trade_prevention":null, - // "client_id":null, - // "created_at":"2023-10-26T08:20:56.307Z", - // "symbol":"BTC-USDT", - // "size":"0.0003", - // "side":"sell", - // "type":"limit", - // "post_only":false, - // "size_filled":"0.0000" - // } - // ] - // } - // - const orders = this.safeList(response, 'orders', []); - return this.parseOrders(orders, market, since, limit); - } - /** - * @method - * @name coinlist#fetchOrder - * @description fetches information on an order made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-specific-order-by-id - * @param {int|string} id order id - * @param {string} symbol not used by coinlist fetchOrder () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async fetchOrder(id, symbol = undefined, params = {}) { - await this.loadMarkets(); - const request = { - 'order_id': id, - }; - const response = await this.privateGetV1OrdersOrderId(this.extend(request, params)); - // - // { - // "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe", - // "client_id": "string", - // "symbol": "string", - // "type": "market", - // "side": "buy", - // "size": "string", - // "price": "string", - // "stop_price": "string", - // "stop_trigger": "last", - // "self_trade_prevention": "keep-newest", - // "average_fill_price": "string", - // "fill_fees": "string", - // "size_filled": "string", - // "created_at": "2019-08-24T14:15:22Z", - // "epoch_timestamp": "2019-08-24T14:15:22Z", - // "post_only": true, - // "peg_price_type": "trailing-stop", - // "peg_offset_value": "string", - // "origin": "web", - // "status": "pending" - // } - // - return this.parseOrder(response); - } - /** - * @method - * @name coinlist#fetchOpenOrders - * @description fetch all unfilled currently open orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol - * @param {int} [since] the earliest time in ms to fetch open orders for - * @param {int} [limit] the maximum number of open order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const request = { - 'status': 'accepted', - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, params)); - } - /** - * @method - * @name coinlist#fetchClosedOrders - * @description fetches information on multiple closed orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of closed order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const request = { - 'status': 'done', - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, params)); - } - /** - * @method - * @name coinlist#fetchCanceledOrders - * @description fetches information on multiple canceled orders made by the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders - * @param {string} symbol unified market symbol of the market orders were made in - * @param {int} [since] the earliest time in ms to fetch orders for - * @param {int} [limit] the maximum number of canceled order structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - const request = { - 'status': 'canceled', - }; - return this.fetchOrders(symbol, since, limit, this.extend(request, params)); - } - /** - * @method - * @name coinlist#cancelAllOrders - * @description cancel open orders of market - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-all-orders - * @param {string} symbol unified market symbol - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async cancelAllOrders(symbol = undefined, params = {}) { - await this.loadMarkets(); - let market = undefined; - const request = {}; - if (symbol !== undefined) { - market = this.market(symbol); - request['symbol'] = market['id']; - } - const response = await this.privateDeleteV1Orders(this.extend(request, params)); - // - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - const orders = [response]; - return this.parseOrders(orders, market); - } - /** - * @method - * @name coinlist#cancelOrder - * @description cancels an open order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-specific-order-by-id - * @param {string} id order id - * @param {string} symbol not used by coinlist cancelOrder () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async cancelOrder(id, symbol = undefined, params = {}) { - await this.loadMarkets(); - const request = { - 'order_id': id, - }; - const response = await this.privateDeleteV1OrdersOrderId(this.extend(request, params)); - // - // { - // "message": "Cancel order request received.", - // "order_id": "d36e7588-6525-485c-b768-8ad8b3f745f9", - // "timestamp": "2023-10-26T14:36:37.559Z" - // } - // - return this.parseOrder(response); - } - /** - * @method - * @name coinlist#cancelOrders - * @description cancel multiple orders - * @see https://trade-docs.coinlist.co/?javascript--nodejs#cancel-specific-orders - * @param {string[]} ids order ids - * @param {string} symbol not used by coinlist cancelOrders () - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async cancelOrders(ids, symbol = undefined, params = {}) { - await this.loadMarkets(); - params = ids; - const response = await this.privateDeleteV1OrdersBulk(params); - // - // { - // "message": "Cancel order requests received.", - // "order_ids": [ - // "ff132955-43bc-4fe5-9d9c-5ba226cc89a0" - // ], - // "timestamp": "2024-06-01T02:32:30.305Z" - // } - // - const orderIds = this.safeList(response, 'order_ids', []); - const orders = []; - const datetime = this.safeString(response, 'timestamp'); - for (let i = 0; i < orderIds.length; i++) { - orders.push(this.safeOrder({ - 'info': orderIds[i], - 'id': orderIds[i], - 'lastUpdateTimestamp': this.parse8601(datetime), - })); - } - return orders; - } - /** - * @method - * @name coinlist#createOrder - * @description create a trade order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#create-new-order - * @param {string} symbol unified symbol of the market to create an order in - * @param {string} type 'market' or 'limit' or 'stop_market' or 'stop_limit' or 'take_market' or 'take_limit' - * @param {string} side 'buy' or 'sell' - * @param {float} amount how much of currency you want to trade in units of base currency - * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately (default false) - * @param {float} [params.triggerPrice] only for the 'stop_market', 'stop_limit', 'take_market' or 'take_limit' orders (the price at which an order is triggered) - * @param {string} [params.clientOrderId] client order id (default undefined) - * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async createOrder(symbol, type, side, amount, price = undefined, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - const request = { - 'symbol': market['id'], - 'type': type, - 'side': side, - 'size': this.amountToPrecision(symbol, amount), - }; - let isMarket = false; - if ((type === 'limit') || (type === 'stop_limit') || (type === 'take_limit')) { - if (price === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires a price argument for a ' + type + ' order'); - } - request['price'] = this.priceToPrecision(symbol, price); - } - else { - isMarket = true; - } - let postOnly = undefined; - [postOnly, params] = this.handlePostOnly(isMarket, false, params); - if (postOnly) { - request['post_only'] = true; - } - const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'trigger_price', 'stopPrice', 'stop_price']); - if (triggerPrice !== undefined) { - params = this.omit(params, ['triggerPrice', 'trigger_price', 'stopPrice']); - request['stop_price'] = this.priceToPrecision(symbol, triggerPrice); - if (type === 'market') { - request['type'] = 'stop_market'; - } - else if (type === 'limit') { - request['type'] = 'stop_limit'; - } - } - else if ((type === 'stop_market') || (type === 'stop_limit') || (type === 'take_market') || (type === 'take_limit')) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders'); - } - const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_id'); - if (clientOrderId !== undefined) { - request['client_id'] = clientOrderId; - params = this.omit(params, ['clientOrderId', 'client_id']); - } - const response = await this.privatePostV1Orders(this.extend(request, params)); - // - // { - // "message": "New order request received.", - // "order": { - // "symbol": "BTC-USDT", - // "type": "market", - // "side": "sell", - // "size": "0.0003", - // "order_id": "cad67c0f-9aec-4ac8-ac03-aaf5db299ff7", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b" - // }, - // "timestamp": "2023-10-26T11:30:55.376Z" - // } - // - const order = this.safeDict(response, 'order', {}); - return this.parseOrder(order, market); - } - /** - * @method - * @name coinlist#editOrder - * @description create a trade order - * @see https://trade-docs.coinlist.co/?javascript--nodejs#modify-existing-order - * @param {string} id order id - * @param {string} symbol unified symbol of the market to create an order in - * @param {string} type 'market' or 'limit' or 'stop_market' or 'stop_limit' or 'take_market' or 'take_limit' - * @param {string} side 'buy' or 'sell' - * @param {float} amount how much of currency you want to trade in units of base currency - * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} - */ - async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) { - await this.loadMarkets(); - if (amount === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' editOrder() requires an amount argument'); - } - const market = this.market(symbol); - const request = { - 'order_id': id, - 'type': type, - 'side': side, - 'size': this.amountToPrecision(symbol, amount), - }; - if (price !== undefined) { - request['price'] = this.priceToPrecision(symbol, price); - } - const response = await this.privatePatchV1OrdersOrderId(this.extend(request, params)); - return this.parseOrder(response, market); - } - parseOrder(order, market = undefined) { - // - // fetchOrder - // { - // "order_id": "913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price": "35800.00000000", - // "stop_price":null, - // "cost": "0.00000000", - // "fill_fees": "0.00000000", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status": "canceled", - // "epoch_timestamp": "2023-10-26T08:20:56.307Z", - // "origin": "web", - // "self_trade_prevention":null, - // "client_id":null, - // "symbol": "BTC-USDT", - // "size": "0.0003", - // "side": "sell", - // "type": "limit", - // "post_only":false, - // "size_filled": "0.0000" - // } - // - // fetchOrders - // { - // "order_id":"913ea6e7-9fc9-43fb-9db1-f195d3baa93f", - // "price":"35800.00000000", - // "stop_price":null, - // "cost":"0.00000000", - // "fill_fees":"0.00000000", - // "trader_id":"9c6f737e-a829-4843-87b1-b1ce86f2853b", - // "status":"accepted", - // "epoch_timestamp":"2023-10-26T08:20:56.307Z", - // "origin":"web", - // "self_trade_prevention":null, - // "client_id":null, - // "created_at":"2023-10-26T08:20:56.307Z", - // "symbol":"BTC-USDT", - // "size":"0.0003", - // "side":"sell", - // "type":"limit", - // "post_only":false, - // "size_filled":"0.0000" - // } - // - // createOrder - // { - // "symbol": "BTC-USDT", - // "type": "market", - // "side": "sell", - // "size": "0.0003", - // "order_id": "cad67c0f-9aec-4ac8-ac03-aaf5db299ff7", - // "trader_id": "9c6f737e-a829-4843-87b1-b1ce86f2853b" - // }, - // - // cancelOrder - // { - // "message": "Cancel order request received.", - // "order_id": "d36e7588-6525-485c-b768-8ad8b3f745f9", - // "timestamp": "2023-10-26T14:36:37.559Z" - // } - // - // cancelOrders - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - // cancelAllOrders - // { - // "message": "Order cancellation request received.", - // "timestamp": "2023-10-26T10:29:28.652Z" - // } - // - const id = this.safeString(order, 'order_id'); - const marketId = this.safeString(order, 'symbol'); - market = this.safeMarket(marketId, market); - const clientOrderId = this.safeString(order, 'client_id'); - let timestampString = this.safeString2(order, 'created_at', 'epoch_timestamp'); - if (timestampString === undefined) { - timestampString = this.safeString(order, 'timestamp'); - } - const timestamp = this.parse8601(timestampString); - const status = this.parseOrderStatus(this.safeString(order, 'status')); - const type = this.parseOrderType(this.safeString(order, 'type')); - const side = this.safeString(order, 'side'); - const price = this.safeString(order, 'price'); - const triggerPrice = this.safeString(order, 'stop_price'); - const average = this.safeString(order, 'average_fill_price'); // from documentation - const amount = this.safeString(order, 'size'); - const filled = this.safeString(order, 'size_filled'); - const feeCost = this.safeString(order, 'fill_fees'); - const postOnly = this.safeValue(order, 'post_only'); - let fee = undefined; - if (feeCost !== undefined) { - fee = { - 'currency': market['quote'], - 'cost': feeCost, - 'rate': undefined, - }; - } - return this.safeOrder({ - 'id': id, - 'clientOrderId': clientOrderId, - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'lastTradeTimestamp': undefined, - 'status': status, - 'symbol': market['symbol'], - 'type': type, - 'timeInForce': 'GTC', - 'side': side, - 'price': price, - 'triggerPrice': triggerPrice, - 'average': average, - 'amount': amount, - 'cost': undefined, - 'filled': filled, - 'remaining': undefined, - 'fee': fee, - 'trades': undefined, - 'info': order, - 'postOnly': postOnly, - }, market); - } - parseOrderStatus(status) { - const statuses = { - 'pending': 'open', - 'accepted': 'open', - 'rejected': 'rejected', - 'done': 'closed', - 'canceled': 'canceled', - }; - return this.safeString(statuses, status, status); - } - parseOrderType(status) { - const statuses = { - 'market': 'market', - 'limit': 'limit', - 'stop_market': 'market', - 'stop_limit': 'limit', - 'take_market': 'market', - 'take_limit': 'limit', - }; - return this.safeString(statuses, status, status); - } - /** - * @method - * @name coinlist#transfer - * @description transfer currency internally between wallets on the same account - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-between-entities - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-from-wallet-to-pro - * @see https://trade-docs.coinlist.co/?javascript--nodejs#transfer-funds-from-pro-to-wallet - * @param {string} code unified currency code - * @param {float} amount amount to transfer - * @param {string} fromAccount account to transfer from - * @param {string} toAccount account to transfer to - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure} - */ - async transfer(code, amount, fromAccount, toAccount, params = {}) { - await this.loadMarkets(); - const currency = this.currency(code); - const request = { - 'asset': currency['id'], - 'amount': this.currencyToPrecision(code, amount), - }; - const accountsByType = this.safeValue(this.options, 'accountsByType', {}); - const fromAcc = this.safeString(accountsByType, fromAccount, fromAccount); - const toAcc = this.safeString(accountsByType, toAccount, toAccount); - let response = undefined; - if ((fromAcc === 'funding') && (toAcc === 'trading')) { - response = await this.privatePostV1TransfersFromWallet(this.extend(request, params)); - } - else if ((fromAcc === 'trading') && (toAcc === 'funding')) { - response = await this.privatePostV1TransfersToWallet(this.extend(request, params)); - } - else { - request['from_trader_id'] = fromAcc; - request['to_trader_id'] = toAcc; - response = await this.privatePostV1TransfersInternalTransfer(this.extend(request, params)); - } - // - // privatePostV1TransfersInternalTransfer - // { - // "from_trader_id": "1f494ace-b3ed-4324-b202-55526ed06381", - // "to_trader_id": "d32c7a40-cc24-44b0-8597-f9edb3da989f", - // "asset": "string", - // "amount": "string" - // } - // - // privatePostV1TransfersFromWallet, privatePostV1TransfersToWallet - // { - // "transfer_id": "bb34f528-d9b0-47c6-b11f-4d4840b86ee3" - // } - // - const transfer = this.parseTransfer(response, currency); - return transfer; - } - /** - * @method - * @name coinlist#fetchTransfers - * @description fetch a history of internal transfers between CoinList.co and CoinList Pro. It does not return external deposits or withdrawals - * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-transfers - * @param {string} code unified currency code - * @param {int} [since] the earliest time in ms to fetch transfers for - * @param {int} [limit] the maximum number of transfer structures to retrieve (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure} - */ - async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) { - await this.loadMarkets(); - let currency = undefined; - if (code !== undefined) { - currency = this.currency(code); - } - const request = {}; - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - } - if (limit !== undefined) { - request['count'] = limit; - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - const response = await this.privateGetV1Transfers(this.extend(request, params)); - // - // { - // "transfers": [ - // { - // "transfer_id": "2c02db25-e8f2-4271-8222-e110bfd0aa2a", - // "created_at": "2023-10-20T13:15:37.000Z", - // "confirmed_at": "2023-10-20T13:15:37.000Z", - // "asset": "ETH", - // "amount": "0.010000000000000000", - // "status": "confirmed" - // }, - // { - // "transfer_id": "890694db-156c-4e93-a3ef-4db61685aca7", - // "created_at": "2023-10-26T14:32:22.000Z", - // "confirmed_at": "2023-10-26T14:32:22.000Z", - // "asset": "USD", - // "amount": "-3.00", - // "status": "confirmed" - // } - // ] - // } - // - const transfers = this.safeList(response, 'transfers', []); - return this.parseTransfers(transfers, currency, since, limit); - } - parseTransfer(transfer, currency = undefined) { - // - // fetchTransfers - // { - // "transfer_id": "890694db-156c-4e93-a3ef-4db61685aca7", - // "created_at": "2023-10-26T14:32:22.000Z", - // "confirmed_at": "2023-10-26T14:32:22.000Z", - // "asset": "USD", - // "amount": "-3.00", - // "status": "confirmed" - // } - // - // transfer - privatePostV1TransfersInternalTransfer - // { - // "from_trader_id": "1f494ace-b3ed-4324-b202-55526ed06381", - // "to_trader_id": "d32c7a40-cc24-44b0-8597-f9edb3da989f", - // "asset": "string", - // "amount": "string" - // } - // - // transfer - privatePostV1TransfersFromWallet, privatePostV1TransfersToWallet - // { - // "transfer_id": "bb34f528-d9b0-47c6-b11f-4d4840b86ee3" - // } - // - const currencyId = this.safeString(transfer, 'asset'); - const confirmedAt = this.safeString(transfer, 'confirmed_at'); - const timetstamp = this.parse8601(confirmedAt); - const status = this.safeString(transfer, 'status'); - let amountString = this.safeString(transfer, 'amount'); - let fromAccount = undefined; - let toAccount = undefined; - let amount = undefined; - if (amountString !== undefined) { - const amountIsNegative = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringLt(amountString, '0'); - if (amountIsNegative) { - fromAccount = 'trading'; - toAccount = 'funding'; - amountString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringNeg(amountString); - } - else { - fromAccount = 'funding'; - toAccount = 'trading'; - } - amount = this.parseNumber(amountString); - } - return { - 'info': transfer, - 'id': this.safeString(transfer, 'transfer_id'), - 'timestamp': timetstamp, - 'datetime': this.iso8601(timetstamp), - 'currency': this.safeCurrencyCode(currencyId, currency), - 'amount': amount, - 'fromAccount': fromAccount, - 'toAccount': toAccount, - 'status': this.parseTransferStatus(status), - }; - } - parseTransferStatus(status) { - const statuses = { - 'confirmed': 'ok', - }; - return this.safeString(statuses, status, status); - } - /** - * @method - * @name coinlist#fetchDepositsWithdrawals - * @description fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-coinlist-wallet-ledger - * @param {string} [code] unified currency code for the currency of the deposit/withdrawals - * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal - * @param {int} [limit] max number of deposit/withdrawals to return (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure} - */ - async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) { - if (code === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDepositsWithdrawals() requires a code argument'); - } - const traderId = this.safeString2(params, 'trader_id', 'traderId'); - if (traderId === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDepositsWithdrawals() requires a traderId argument in the params'); - } - await this.loadMarkets(); - const currency = this.currency(code); - const request = { - 'asset': currency['id'], - 'trader_id': traderId, - }; - if (limit !== undefined) { - request['count'] = limit; - } - params = this.omit(params, ['trader_id', 'traderId']); - const response = await this.privateGetV1AccountsTraderIdWalletLedger(this.extend(request, params)); - // - // [ - // { - // "id": "2c02db25-e8f2-4271-8222-e110bfd0aa2a", - // "asset": "ETH", - // "amount": "0.01", - // "created_at": "2023-10-20T13:15:37.000Z", - // "description": "Transfer to CoinList Pro", - // "type": "PRO_TRANSFER", - // "delta": "-0.010000000000000000" - // }, - // { - // "id": "7139384d-6cec-479e-a19c-d498647ccb47", - // "asset": "ETH", - // "amount": "0.01", - // "created_at": "2023-10-20T13:10:55.000Z", - // "description": "CRYPTO_DEPOSIT", - // "type": "CRYPTO_DEPOSIT", - // "delta": "0.010000000000000000" - // }, - // - // ... - // - // { - // "id": "91bbbb22-5ede-4e9a-81ef-3f9318aa83d2", - // "asset": "USDT", - // "amount": "4.169654", - // "withdrawal_fee_amount": "8.830346000000000000", - // "created_at": "2023-10-27T16:14:11.000Z", - // "description": "CRYPTO_WITHDRAWAL", - // "type": "CRYPTO_WITHDRAWAL", - // "delta": "-4.169654000000000000" - // }, - // { - // "id": "830261bd-cda9-401f-b6df-105f4da3b37c", - // "asset": "USDT", - // "amount": "13", - // "created_at": "2023-10-27T14:52:05.000Z", - // "description": "Transfer from CoinList Pro", - // "type": "PRO_TRANSFER", - // "delta": "13.000000000000000000" - // } - // ] - // - // coinlist returns both internal transfers and blockchain transactions - return this.parseTransactions(response, currency, since, limit); - } - /** - * @method - * @name coinlist#withdraw - * @description request a withdrawal from CoinList wallet. (Disabled by default. Contact CoinList to apply for an exception.) - * @see https://trade-docs.coinlist.co/?javascript--nodejs#request-withdrawal-from-wallet - * @param {string} code unified currency code - * @param {float} amount the amount to withdraw - * @param {string} address the address to withdraw to - * @param {string} tag - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure} - */ - async withdraw(code, amount, address, tag = undefined, params = {}) { - await this.loadMarkets(); - const currency = this.currency(code); - const request = { - 'asset': currency['id'], - 'amount': this.currencyToPrecision(code, amount), - 'destination_address': address, - }; - const response = await this.privatePostV1TransfersWithdrawalRequest(this.extend(request, params)); - // - // { - // "transfer_id": "d4a2d8dd-7def-4545-a062-761683b9aa05" - // } - // - const data = this.safeDict(response, 'data', {}); - return this.parseTransaction(data, currency); - } - parseTransaction(transaction, currency = undefined) { - // withdraw - // - // { - // "transfer_id": "d4a2d8dd-7def-4545-a062-761683b9aa05" - // } - // - // fetchDepositsWithdrawals - // { - // "id": "91bbbb22-5ede-4e9a-81ef-3f9318aa83d2", - // "asset": "USDT", - // "amount": "4.169654", - // "withdrawal_fee_amount": "8.830346000000000000", - // "created_at": "2023-10-27T16:14:11.000Z", - // "description": "CRYPTO_WITHDRAWAL", - // "type": "CRYPTO_WITHDRAWAL", - // "delta": "-4.169654000000000000" - // }, - // - const currencyId = this.safeString(transaction, 'asset'); - const code = this.safeCurrencyCode(currencyId, currency); - const id = this.safeString2(transaction, 'id', 'transfer_id'); - const amount = this.safeNumber(transaction, 'amount'); - const timestamp = this.parse8601(this.safeString(transaction, 'created_at')); - let type = this.safeString(transaction, 'type', undefined); - if (type === undefined) { - type = 'withdrawal'; // undefined only in withdraw() method - } - else { - type = this.parseTransactionType(type); - } - let fee = undefined; - const feeCost = this.safeString(transaction, 'withdrawal_fee_amount'); - if (feeCost !== undefined) { - fee = { - 'cost': feeCost, - 'currency': code, - }; - } - return { - 'info': transaction, - 'id': id, - 'txid': undefined, - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'network': undefined, - 'addressFrom': undefined, - 'address': undefined, - 'addressTo': undefined, - 'tagFrom': undefined, - 'tag': undefined, - 'tagTo': undefined, - 'type': type, - 'amount': amount, - 'currency': code, - 'status': undefined, - 'updated': undefined, - 'fee': fee, - 'comment': this.safeString(transaction, 'description'), - 'internal': undefined, - }; - } - parseTransactionType(type) { - const types = { - 'CRYPTO_DEPOSIT': 'deposit', - 'CRYPTO_WITHDRAWAL': 'withdrawal', - 'PRO_TRANSFER': 'transfer', - }; - return this.safeString(types, type, type); - } - /** - * @method - * @name coinlist#fetchLedger - * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user - * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history - * @param {string} [code] unified currency code, default is undefined - * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined - * @param {int} [limit] max number of ledger entries to return (default 200, max 500) - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @param {int} [params.until] the latest time in ms to fetch entries for - * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger} - */ - async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) { - const traderId = this.safeString2(params, 'trader_id', 'traderId'); - if (traderId === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchLedger() requires a traderId argument in the params'); - } - await this.loadMarkets(); - const request = { - 'trader_id': traderId, - }; - let currency = undefined; - if (code !== undefined) { - currency = this.currency(code); - } - if (since !== undefined) { - request['start_time'] = this.iso8601(since); - } - if (limit !== undefined) { - request['count'] = limit; - } - const until = this.safeInteger(params, 'until'); - if (until !== undefined) { - params = this.omit(params, ['until']); - request['end_time'] = this.iso8601(until); - } - params = this.omit(params, ['trader_id', 'traderId']); - const response = await this.privateGetV1AccountsTraderIdLedger(this.extend(request, params)); - // - // { - // "transactions": [ - // { - // "transaction_id": "0288634e-49bd-494d-b04a-18fd1832d394", - // "transaction_type": "XFER", - // "type": "deposit", - // "asset": "ETH", - // "symbol": null, - // "amount": "0.010000000000000000", - // "details": null, - // "created_at": "2023-10-20T13:15:39.443Z" - // }, - // { - // "transaction_id": "47a45928-abcd-4c12-8bd6-587c3028025f", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "1.447947", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "1ffe3a54-916e-41f0-b957-3a01309eb009", - // "transaction_type": "FEE", - // "type": "fee", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "-0.006516", - // "details": { - // "fee_details": [ - // { - // "insurance_fee": "0", - // "order_id": "39911d5f-c789-4a7d-ad34-820a804d1da6", - // "fee_type": "taker", - // "fee_currency": "USDT" - // } - // ] - // }, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "3930e8a3-2218-481f-8c3c-2219287e205e", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "ETH", - // "symbol": "ETH-USDT", - // "amount": "-0.000900000000000000", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // }, - // { - // "transaction_id": "a6c65cb3-95d0-44e2-8202-f70581d6e55c", - // "transaction_type": "XFER", - // "type": "withdrawal", - // "asset": "USD", - // "symbol": null, - // "amount": "-3.00", - // "details": null, - // "created_at": "2023-10-26T14:32:24.887Z" - // } - // ] - // } - // - const ledger = this.safeValue(response, 'transactions', []); - return this.parseLedger(ledger, currency, since, limit); - } - parseLedgerEntry(item, currency = undefined) { - // - // deposit transaction from wallet (funding) to pro (trading) - // { - // "transaction_id": "0288634e-49bd-494d-b04a-18fd1832d394", - // "transaction_type": "XFER", - // "type": "deposit", - // "asset": "ETH", - // "symbol": null, - // "amount": "0.010000000000000000", - // "details": null, - // "created_at": "2023-10-20T13:15:39.443Z" - // } - // - // withdrawal transaction from pro (trading) to wallet (funding) - // { - // "transaction_id": "a6c65cb3-95d0-44e2-8202-f70581d6e55c", - // "transaction_type": "XFER", - // "type": "withdrawal", - // "asset": "USD", - // "symbol": null, - // "amount": "-3.00", - // "details": null, - // "created_at": "2023-10-26T14:32:24.887Z" - // } - // - // sell trade - // { - // "transaction_id": "47a45928-abcd-4c12-8bd6-587c3028025f", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "USDT", - // "symbol": "ETH-USDT", - // "amount": "1.447947", - // "details": null, - // "created_at": "2023-10-20T13:16:30.373Z" - // } - // - // buy trade - // { - // "transaction_id": "46d20a93-45c4-4441-a238-f89602eb8c8c", - // "transaction_type": "SWAP", - // "type": "atomic token swap", - // "asset": "ETH", - // "symbol": "ETH-USDT", - // "amount": "0.000800000000000000", - // "details": null, - // "created_at": "2023-10-20T13:22:14.256Z" - // }, - // - // fee - // { - // "transaction_id": "57fd526c-36b1-4721-83ce-42aadcb1e953", - // "transaction_type": "FEE", - // "type": "fee", - // "asset": "USDT", - // "symbol": "BTC-USDT", - // "amount": "-0.047176", - // "details": { - // "fee_details": [ - // { - // "insurance_fee": "0", - // "order_id": "c0bc33cd-eeb9-40a0-ab5f-2d99f323ef58", - // "fee_type": "taker", - // "fee_currency": "USDT" - // } - // ] - // }, - // "created_at": "2023-10-25T16:46:24.294Z" - // } - // - const id = this.safeString(item, 'transaction_id'); - const createdAt = this.safeString(item, 'created_at'); - const timestamp = this.parse8601(createdAt); - let amount = this.safeString(item, 'amount'); - const amountIsNegative = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringLt(amount, '0'); - let direction = undefined; - if (amountIsNegative) { - direction = 'out'; - amount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringNeg(amount); - } - else { - direction = 'in'; - } - const currencyId = this.safeString(item, 'asset'); - const code = this.safeCurrencyCode(currencyId, currency); - currency = this.safeCurrency(currencyId, currency); - const type = this.parseLedgerEntryType(this.safeString(item, 'type')); - return this.safeLedgerEntry({ - 'info': item, - 'id': id, - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'direction': direction, - 'account': 'trading', - 'referenceId': undefined, - 'referenceAccount': undefined, - 'type': type, - 'currency': code, - 'amount': this.parseNumber(amount), - 'before': undefined, - 'after': undefined, - 'status': 'ok', - 'fee': undefined, - }, currency); - } - parseLedgerEntryType(type) { - const types = { - 'atomic token swap': 'trade', - 'fee': 'fee', - 'deposit': 'transfer', - 'withdrawal': 'transfer', - }; - return this.safeString(types, type, type); - } - /** - * @method - * @name coinlist#fetchFundingRate - * @description fetch the current funding rate - * @see https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates - * @param {string} symbol unified market symbol - * @param {object} [params] extra parameters specific to the exchange API endpoint - * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure} - */ - async fetchFundingRate(symbol, params = {}) { - await this.loadMarkets(); - const market = this.market(symbol); - if (!market['swap']) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchFundingRate() supports swap contracts only'); - } - const request = { - 'symbol': market['id'], - }; - const response = await this.publicGetV1SymbolsSymbolFunding(this.extend(request, params)); - // - // { - // "last": { - // "funding_rate": "-0.00043841", - // "funding_time": "2025-04-15T04:00:00.000Z" - // }, - // "next": { - // "funding_rate": "-0.00046952", - // "funding_time": "2025-04-15T12:00:00.000Z" - // }, - // "indicative": { - // "funding_rate": "-0.00042517", - // "funding_time": "2025-04-15T20:00:00.000Z" - // }, - // "timestamp": "2025-04-15T07:01:15.219Z" - // } - // - return this.parseFundingRate(response, market); - } - parseFundingRate(contract, market = undefined) { - // - // { - // "last": { - // "funding_rate": "-0.00043841", - // "funding_time": "2025-04-15T04:00:00.000Z" - // }, - // "next": { - // "funding_rate": "-0.00046952", - // "funding_time": "2025-04-15T12:00:00.000Z" - // }, - // "indicative": { - // "funding_rate": "-0.00042517", - // "funding_time": "2025-04-15T20:00:00.000Z" - // }, - // "timestamp": "2025-04-15T07:01:15.219Z" - // } - // - const previous = this.safeDict(contract, 'last', {}); - const current = this.safeDict(contract, 'next', {}); - const next = this.safeDict(contract, 'indicative', {}); - const previousDatetime = this.safeString(previous, 'funding_time'); - const currentDatetime = this.safeString(current, 'funding_time'); - const nextDatetime = this.safeString(next, 'funding_time'); - const datetime = this.safeString(contract, 'timestamp'); - return { - 'info': contract, - 'symbol': this.safeSymbol(undefined, market), - 'markPrice': undefined, - 'indexPrice': undefined, - 'interestRate': undefined, - 'estimatedSettlePrice': undefined, - 'timestamp': this.parse8601(datetime), - 'datetime': datetime, - 'fundingRate': this.safeNumber(current, 'funding_rate'), - 'fundingTimestamp': this.parse8601(currentDatetime), - 'fundingDatetime': currentDatetime, - 'nextFundingRate': this.safeNumber(next, 'funding_rate'), - 'nextFundingTimestamp': this.parse8601(nextDatetime), - 'nextFundingDatetime': nextDatetime, - 'previousFundingRate': this.safeNumber(previous, 'funding_rate'), - 'previousFundingTimestamp': this.parse8601(previousDatetime), - 'previousFundingDatetime': previousDatetime, - 'interval': '8h', - }; - } - sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) { - const request = this.omit(params, this.extractParams(path)); - const endpoint = '/' + this.implodeParams(path, params); - let url = this.urls['api'][api] + endpoint; - const isBulk = Array.isArray(params); - let query = undefined; - if (!isBulk) { - query = this.urlencode(request); - } - if (api === 'private') { - this.checkRequiredCredentials(); - const timestamp = this.seconds().toString(); - let auth = timestamp + method + endpoint; - if ((method === 'POST') || (method === 'PATCH') || isBulk) { - body = this.json(request); - auth += body; - } - else if (query !== undefined && query.length !== 0) { - auth += '?' + query; - url += '?' + query; - } - const signature = this.hmac(this.encode(auth), this.base64ToBinary(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .s, 'base64'); - headers = { - 'CL-ACCESS-KEY': this.apiKey, - 'CL-ACCESS-SIG': signature, - 'CL-ACCESS-TIMESTAMP': timestamp, - 'Content-Type': 'application/json', - }; - } - else if (query !== undefined && query.length !== 0) { - url += '?' + query; - } - return { 'url': url, 'method': method, 'body': body, 'headers': headers }; - } - handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) { - if (response === undefined) { - // In some cases the exchange returns 202 Accepted for bad orders. - // The body of that response contains order_id of the order. - // Some bad orders will get status 'rejected' and could be fetched later (by using fetchOrders() or fetchOrder(order_id)). - // While others don't get any status, they simply disappear, but the response is still 202 Accepted and contains their order_id. - // When using fechOrder(order_id) for such disappeared orders, the exchange returns an empty response with code 404. - if ((code === 404) && (url.indexOf('/orders/') >= 0) && (method === 'GET')) { - const parts = url.split('/orders/'); - const orderId = this.safeString(parts, 1); - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound(this.id + ' order ' + orderId + ' not found (or rejected on the exchange side)'); - } - return undefined; - } - const responseCode = this.safeString(response, 'status'); - const messageCode = this.safeString(response, 'message_code'); - if ((messageCode !== undefined) || ((responseCode !== undefined) && (code !== 200) && (code !== 202) && (responseCode !== '200') && (responseCode !== '202'))) { - const feedback = this.id + ' ' + body; - const message = this.safeString(response, 'message'); - this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback); - this.throwExactlyMatchedException(this.exceptions['exact'], messageCode, feedback); - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(feedback); - } - return undefined; - } -} - - /***/ }), /***/ 6016: @@ -139787,7 +137319,26 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* [" if (!this.checkRequiredCredentials(false)) { return undefined; } - const response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params); + let skipFetchCurrencies = false; + [skipFetchCurrencies, params] = this.handleOptionAndParams(params, 'fetchCurrencies', 'skipFetchCurrencies', false); + if (skipFetchCurrencies) { + // sub-accounts can't access this endpoint + return undefined; + } + let response = {}; + try { + response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params); + } + catch (e) { + if (e instanceof _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError) { + // sub-accounts can't access this endpoint + // {"code":"10001","msg":"SYS_ERROR"} + return undefined; + } + throw e; + // do nothing + // sub-accounts can't access this endpoint + } // // { // "id": "1747502328559", @@ -139812,7 +137363,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* [" // "network_id": "CRONOS", // "withdrawal_fee": "0.18000000", // "withdraw_enabled": true, - // "min_withdrawal_amount": "0.36", + // "min_withdrawal_amount": "0.35", // "deposit_enabled": true, // "confirmation_required": "15" // }, @@ -143081,68 +140632,45 @@ class cryptomus extends _abstract_cryptomus_js__WEBPACK_IMPORTED_MODULE_0__/* [" // } // const coins = this.safeList(response, 'result'); + const groupedById = this.groupBy(coins, 'currency_code'); + const keys = Object.keys(groupedById); const result = {}; - for (let i = 0; i < coins.length; i++) { - const networkEntry = coins[i]; - const currencyId = this.safeString(networkEntry, 'currency_code'); - const code = this.safeCurrencyCode(currencyId); - if (!(code in result)) { - result[code] = { - 'id': currencyId, - 'code': code, - 'precision': undefined, - 'type': undefined, - 'name': undefined, - 'active': undefined, - 'deposit': undefined, - 'withdraw': undefined, - 'fee': undefined, + for (let i = 0; i < keys.length; i++) { + const id = keys[i]; + const code = this.safeCurrencyCode(id); + const networks = {}; + const networkEntries = groupedById[id]; + for (let j = 0; j < networkEntries.length; j++) { + const networkEntry = networkEntries[j]; + const networkId = this.safeString(networkEntry, 'network_code'); + const networkCode = this.networkIdToCode(networkId); + networks[networkCode] = { + 'id': networkId, + 'network': networkCode, 'limits': { 'withdraw': { - 'min': undefined, - 'max': undefined, + 'min': this.safeNumber(networkEntry, 'min_withdraw'), + 'max': this.safeNumber(networkEntry, 'max_withdraw'), }, 'deposit': { - 'min': undefined, - 'max': undefined, + 'min': this.safeNumber(networkEntry, 'min_deposit'), + 'max': this.safeNumber(networkEntry, 'max_deposit'), }, }, - 'networks': {}, - 'info': {}, + 'active': undefined, + 'deposit': this.safeBool(networkEntry, 'can_withdraw'), + 'withdraw': this.safeBool(networkEntry, 'can_deposit'), + 'fee': undefined, + 'precision': undefined, + 'info': networkEntry, }; } - const networkId = this.safeString(networkEntry, 'network_code'); - const networkCode = this.networkIdToCode(networkId); - result[code]['networks'][networkCode] = { - 'id': networkId, - 'network': networkCode, - 'limits': { - 'withdraw': { - 'min': this.safeNumber(networkEntry, 'min_withdraw'), - 'max': this.safeNumber(networkEntry, 'max_withdraw'), - }, - 'deposit': { - 'min': this.safeNumber(networkEntry, 'min_deposit'), - 'max': this.safeNumber(networkEntry, 'max_deposit'), - }, - }, - 'active': undefined, - 'deposit': this.safeBool(networkEntry, 'can_withdraw'), - 'withdraw': this.safeBool(networkEntry, 'can_deposit'), - 'fee': undefined, - 'precision': undefined, - 'info': networkEntry, - }; - // add entry in info - const info = this.safeList(result[code], 'info', []); - info.push(networkEntry); - result[code]['info'] = info; - } - // only after all entries are formed in currencies, restructure each entry - const allKeys = Object.keys(result); - for (let i = 0; i < allKeys.length; i++) { - const code = allKeys[i]; - result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry + result[code] = this.safeCurrencyStructure({ + 'id': id, + 'code': code, + 'networks': networks, + 'info': networkEntries, + }); } return result; } @@ -143178,7 +140706,7 @@ class cryptomus extends _abstract_cryptomus_js__WEBPACK_IMPORTED_MODULE_0__/* [" // // { // "currency_pair": "XMR_USDT", - // "last_price": "158.04829771", + // "last_price": "158.04829772", // "base_volume": "0.35185785", // "quote_volume": "55.523761128544" // } @@ -146947,9 +144475,9 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" 'inverse': spot ? undefined : !linear, 'taker': this.safeNumber(market, 'taker_commission_rate'), 'maker': this.safeNumber(market, 'maker_commission_rate'), - 'contractSize': contractSize, + 'contractSize': spot ? undefined : contractSize, 'expiry': expiry, - 'expiryDatetime': expiryDatetime, + 'expiryDatetime': this.iso8601(expiry), 'strike': this.parseNumber(strike), 'optionType': optionType, 'precision': { @@ -163330,8 +160858,9 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * @returns {object} an associative dictionary of currencies */ async fetchCurrencies(params = {}) { + const promises = []; // - const currencyList = await this.publicGetCurrencyListExtended(params); + promises.push(this.publicGetCurrencyListExtended(params)); // // [ // {"name":"VLX","description":"Velas"}, @@ -163340,7 +160869,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] // {"name":"USD","description":"US Dollar"} // ] // - const cryptoList = await this.publicGetPaymentsProvidersCryptoList(params); + promises.push(this.publicGetPaymentsProvidersCryptoList(params)); // // { // "BTC":[ @@ -163365,86 +160894,98 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] // ], // } // + const responses = await Promise.all(promises); + const currencyList = responses[0]; + const cryptoList = responses[1]; const result = {}; for (let i = 0; i < currencyList.length; i++) { const currency = currencyList[i]; const currencyId = this.safeString(currency, 'name'); - const name = this.safeString(currency, 'description'); - const providers = this.safeValue(cryptoList, currencyId); - let active = false; + const code = this.safeCurrencyCode(currencyId); let type = 'crypto'; - const limits = { - 'deposit': { - 'min': undefined, - 'max': undefined, - }, - 'withdraw': { - 'min': undefined, - 'max': undefined, - }, - }; - let fee = undefined; - let depositEnabled = undefined; - let withdrawEnabled = undefined; + const networks = {}; + const providers = this.safeList(cryptoList, currencyId); if (providers === undefined) { - active = true; type = 'fiat'; } else { for (let j = 0; j < providers.length; j++) { const provider = providers[j]; + const name = this.safeString(provider, 'name'); + // get network-id by removing extra things + let networkId = name.replace(currencyId + ' ', ''); + networkId = networkId.replace('(', ''); + const replaceChar = ')'; // transpiler trick + networkId = networkId.replace(replaceChar, ''); + const networkCode = this.networkIdToCode(networkId); + if (!(networkCode in networks)) { + networks[networkCode] = { + 'id': networkId, + 'network': networkCode, + 'active': undefined, + 'deposit': undefined, + 'withdraw': undefined, + 'fee': undefined, + 'limits': { + 'withdraw': { + 'min': undefined, + 'max': undefined, + }, + 'deposit': { + 'min': undefined, + 'max': undefined, + }, + }, + 'info': [], // set as array, because of multiple network sub-entries + }; + } const typeInner = this.safeString(provider, 'type'); const minValue = this.safeString(provider, 'min'); - let maxValue = this.safeString(provider, 'max'); - if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringEq(maxValue, '0.0')) { - maxValue = undefined; - } - const activeProvider = this.safeValue(provider, 'enabled'); + const maxValue = this.safeString(provider, 'max'); + const activeProvider = this.safeBool(provider, 'enabled'); + const networkEntry = networks[networkCode]; if (typeInner === 'deposit') { - if (activeProvider && !depositEnabled) { - depositEnabled = true; - } - else if (!activeProvider) { - depositEnabled = false; - } + networkEntry['deposit'] = activeProvider; + networkEntry['limits']['deposit']['min'] = minValue; + networkEntry['limits']['deposit']['max'] = maxValue; } else if (typeInner === 'withdraw') { - if (activeProvider && !withdrawEnabled) { - withdrawEnabled = true; - } - else if (!activeProvider) { - withdrawEnabled = false; - } - } - if (activeProvider) { - active = true; - const limitMin = this.numberToString(limits[typeInner]['min']); - if ((limits[typeInner]['min'] === undefined) || (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringLt(minValue, limitMin))) { - limits[typeInner]['min'] = minValue; - limits[typeInner]['max'] = maxValue; - if (typeInner === 'withdraw') { - const commissionDesc = this.safeString(provider, 'commission_desc'); - fee = this.parseFixedFloatValue(commissionDesc); - } - } + networkEntry['withdraw'] = activeProvider; + networkEntry['limits']['withdraw']['min'] = minValue; + networkEntry['limits']['withdraw']['max'] = maxValue; } + const info = this.safeList(networkEntry, 'info'); + info.push(provider); + networkEntry['info'] = info; + networks[networkCode] = networkEntry; } } - const code = this.safeCurrencyCode(currencyId); - result[code] = { + result[code] = this.safeCurrencyStructure({ 'id': currencyId, 'code': code, - 'name': name, + 'name': this.safeString(currency, 'description'), 'type': type, - 'active': active, - 'deposit': depositEnabled, - 'withdraw': withdrawEnabled, - 'fee': fee, + 'active': undefined, + 'deposit': undefined, + 'withdraw': undefined, + 'fee': undefined, 'precision': this.parseNumber('1e-8'), - 'limits': limits, - 'info': providers, - 'networks': {}, - }; + 'limits': { + 'withdraw': { + 'min': undefined, + 'max': undefined, + }, + 'deposit': { + 'min': undefined, + 'max': undefined, + }, + }, + 'info': { + 'currency': currency, + 'providers': providers, + }, + 'networks': networks, + }); } return result; } @@ -163457,7 +160998,8 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * @returns {object[]} an array of objects representing market data */ async fetchMarkets(params = {}) { - const response = await this.publicGetPairSettings(params); + const promises = []; + promises.push(this.publicGetPairSettings(params)); // // { // "BTC_USD":{ @@ -163474,8 +161016,9 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] // } // let marginPairsDict = {}; - if (this.checkRequiredCredentials(false)) { - const marginPairs = await this.privatePostMarginPairList(params); + const fetchMargin = this.checkRequiredCredentials(false); + if (fetchMargin) { + promises.push(this.privatePostMarginPairList(params)); // // { // "pairs": [ @@ -163505,15 +161048,20 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] // ] // } // - const pairs = this.safeValue(marginPairs, 'pairs'); + } + const responses = await Promise.all(promises); + const spotResponse = responses[0]; + if (fetchMargin) { + const marginPairs = responses[1]; + const pairs = this.safeList(marginPairs, 'pairs'); marginPairsDict = this.indexBy(pairs, 'name'); } - const keys = Object.keys(response); + const keys = Object.keys(spotResponse); const result = []; for (let i = 0; i < keys.length; i++) { const id = keys[i]; - const market = response[id]; - const marginMarket = this.safeValue(marginPairsDict, id); + const market = spotResponse[id]; + const marginMarket = this.safeDict(marginPairsDict, id); const symbol = id.replace('_', '/'); const [baseId, quoteId] = symbol.split('/'); const base = this.safeCurrencyCode(baseId); @@ -165471,9 +163019,9 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] /* harmony export */ A: () => (/* binding */ fmfwio) /* harmony export */ }); /* harmony import */ var _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7996); -// --------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- -// --------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- class fmfwio extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { describe() { return this.deepExtend(super.describe(), { @@ -166746,7 +164294,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] this.fetchOptionMarkets(params), ]; if (!sandboxMode) { - // gate does not have a sandbox for spot markets + // gate doesn't have a sandbox for spot markets const mainnetOnly = [this.fetchSpotMarkets(params)]; rawPromises = this.arrayConcat(rawPromises, mainnetOnly); } @@ -167166,7 +164714,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] 'contractSize': this.parseNumber('1'), 'expiry': expiry, 'expiryDatetime': this.iso8601(expiry), - 'strike': strike, + 'strike': this.parseNumber(strike), 'optionType': optionType, 'precision': { 'amount': this.parseNumber('1'), @@ -184245,6 +181793,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa }, 'exceptions': { 'broad': { + 'API request is expired': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidNonce, 'Invalid token': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError, 'Order not found': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound, 'Insufficient balance': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds, @@ -184784,7 +182333,8 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // "price":0.147411, // "timestamp":"2022-01-26T17:53:34.650Z", // "order_id":"cba78ecb-4187-4da2-9d2f-c259aa693b5a", - // "fee":0.01031877,"fee_coin":"usdt" + // "fee":0.01031877, + // "fee_coin":"usdt" // } // const marketId = this.safeString(trade, 'symbol'); @@ -184797,11 +182347,12 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const priceString = this.safeString(trade, 'price'); const amountString = this.safeString(trade, 'size'); const feeCostString = this.safeString(trade, 'fee'); + const feeCoin = this.safeString(trade, 'fee_coin'); let fee = undefined; if (feeCostString !== undefined) { fee = { 'cost': feeCostString, - 'currency': market['quote'], + 'currency': this.safeCurrencyCode(feeCoin), }; } return this.safeTrade({ @@ -184888,7 +182439,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch - * @param {int} [limit] the maximum amount of candles to fetch + * @param {int} [limit] the maximum amount of candles to fetch (max 500) * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] timestamp in ms of the latest candle to fetch * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume @@ -184900,19 +182451,28 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'symbol': market['id'], 'resolution': this.safeString(this.timeframes, timeframe, timeframe), }; - const until = this.safeInteger(params, 'until'); - let end = this.seconds(); - if (until !== undefined) { - end = this.parseToInt(until / 1000); + let paginate = false; + const maxLimit = 500; + [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', paginate); + if (paginate) { + return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimit); } - const defaultSpan = 2592000; // 30 days - if (since !== undefined) { - request['from'] = this.parseToInt(since / 1000); + let until = this.safeInteger(params, 'until'); + const timeDelta = this.parseTimeframe(timeframe) * maxLimit * 1000; + let start = since; + const now = this.milliseconds(); + if (until === undefined && start === undefined) { + until = now; + start = until - timeDelta; } - else { - request['from'] = end - defaultSpan; + else if (until === undefined) { + until = now; // the exchange has not a lot of trades, so if we count until by limit and limit is small, it may return empty result } - request['to'] = end; + else if (start === undefined) { + start = until - timeDelta; + } + request['from'] = this.parseToInt(start / 1000); // convert to seconds + request['to'] = this.parseToInt(until / 1000); // convert to seconds params = this.omit(params, 'until'); const response = await this.publicGetChart(this.extend(request, params)); // @@ -185275,11 +182835,10 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa async createOrder(symbol, type, side, amount, price = undefined, params = {}) { await this.loadMarkets(); const market = this.market(symbol); - const convertedAmount = parseFloat(this.amountToPrecision(symbol, amount)); const request = { 'symbol': market['id'], 'side': side, - 'size': this.normalizeNumberIfNeeded(convertedAmount), + 'size': this.amountToPrecision(symbol, amount), 'type': type, // 'stop': parseFloat (this.priceToPrecision (symbol, stopPrice)), // 'meta': {}, // other options such as post_only @@ -185290,11 +182849,10 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const isMarketOrder = type === 'market'; const postOnly = this.isPostOnly(isMarketOrder, exchangeSpecificParam, params); if (!isMarketOrder) { - const convertedPrice = parseFloat(this.priceToPrecision(symbol, price)); - request['price'] = this.normalizeNumberIfNeeded(convertedPrice); + request['price'] = this.priceToPrecision(symbol, price); } if (triggerPrice !== undefined) { - request['stop'] = this.normalizeNumberIfNeeded(parseFloat(this.priceToPrecision(symbol, triggerPrice))); + request['stop'] = this.priceToPrecision(symbol, triggerPrice); } if (postOnly) { request['meta'] = { 'post_only': true }; @@ -185967,12 +183525,6 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const coins = this.safeDict(response, 'coins', {}); return this.parseDepositWithdrawFees(coins, codes, 'symbol'); } - normalizeNumberIfNeeded(number) { - if (this.isRoundNumber(number)) { - number = parseInt(number); - } - return number; - } sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) { const query = this.omit(params, this.extractParams(path)); path = '/' + this.version + '/' + this.implodeParams(path, params); @@ -192898,7 +190450,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ let fee = this.safeNumber(params, 'fee'); if (fee === undefined) { const currencies = await this.fetchCurrencies(); - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); const targetNetwork = this.safeValue(currency['networks'], networkCode, {}); fee = this.safeNumber(targetNetwork, 'fee'); if (fee === undefined) { @@ -195783,6 +193335,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ 'createMarketSellOrderWithCost': false, 'createOrder': true, 'createOrders': true, + 'createOrderWithTakeProfitAndStopLoss': true, 'createReduceOnlyOrder': true, 'createStopOrder': true, 'createTriggerOrder': true, @@ -195964,7 +193517,16 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ 'triggerDirection': false, 'stopLossPrice': false, 'takeProfitPrice': false, - 'attachedStopLossTakeProfit': undefined, + 'attachedStopLossTakeProfit': { + 'triggerPriceType': { + 'last': false, + 'mark': false, + 'index': false, + }, + 'triggerPrice': true, + 'type': true, + 'price': true, + }, 'timeInForce': { 'IOC': true, 'FOK': false, @@ -196418,7 +193980,8 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ // } // const quoteId = 'USDC'; - const base = this.safeString(market, 'name'); + const baseName = this.safeString(market, 'name'); + const base = this.safeCurrencyCode(baseName); const quote = this.safeCurrencyCode(quoteId); const baseId = this.safeString(market, 'baseId'); const settleId = 'USDC'; @@ -197154,6 +194717,74 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ const statuses = this.safeList(data, 'statuses', []); return this.parseOrders(statuses, undefined); } + createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) { + const market = this.market(symbol); + type = type.toUpperCase(); + side = side.toUpperCase(); + const isMarket = (type === 'MARKET'); + const isBuy = (side === 'BUY'); + const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_id'); + const slippage = this.safeString(params, 'slippage'); + let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc'; + const postOnly = this.safeBool(params, 'postOnly', false); + if (postOnly) { + defaultTimeInForce = 'alo'; + } + let timeInForce = this.safeStringLower(params, 'timeInForce', defaultTimeInForce); + timeInForce = this.capitalize(timeInForce); + let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice'); + const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); + const takeProfitPrice = this.safeString(params, 'takeProfitPrice'); + const isTrigger = (stopLossPrice || takeProfitPrice); + let px = undefined; + if (isMarket) { + if (price === undefined) { + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).'); + } + px = (isBuy) ? _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringMul(price, _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringAdd('1', slippage)) : _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringMul(price, _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringSub('1', slippage)); + px = this.priceToPrecision(symbol, px); // round after adding slippage + } + else { + px = this.priceToPrecision(symbol, price); + } + const sz = this.amountToPrecision(symbol, amount); + const reduceOnly = this.safeBool(params, 'reduceOnly', false); + const orderType = {}; + if (isTrigger) { + let isTp = false; + if (takeProfitPrice !== undefined) { + triggerPrice = this.priceToPrecision(symbol, takeProfitPrice); + isTp = true; + } + else { + triggerPrice = this.priceToPrecision(symbol, stopLossPrice); + } + orderType['trigger'] = { + 'isMarket': isMarket, + 'triggerPx': triggerPrice, + 'tpsl': (isTp) ? 'tp' : 'sl', + }; + } + else { + orderType['limit'] = { + 'tif': timeInForce, + }; + } + params = this.omit(params, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']); + const orderObj = { + 'a': this.parseToInt(market['baseId']), + 'b': isBuy, + 'p': px, + 's': sz, + 'r': reduceOnly, + 't': orderType, + // 'c': clientOrderId, + }; + if (clientOrderId !== undefined) { + orderObj['c'] = clientOrderId; + } + return orderObj; + } createOrdersRequest(orders, params = {}) { /** * @method @@ -197188,79 +194819,57 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']); const nonce = this.milliseconds(); const orderReq = []; + let grouping = 'na'; for (let i = 0; i < orders.length; i++) { const rawOrder = orders[i]; const marketId = this.safeString(rawOrder, 'symbol'); const market = this.market(marketId); const symbol = market['symbol']; const type = this.safeStringUpper(rawOrder, 'type'); - const isMarket = (type === 'MARKET'); const side = this.safeStringUpper(rawOrder, 'side'); - const isBuy = (side === 'BUY'); const amount = this.safeString(rawOrder, 'amount'); const price = this.safeString(rawOrder, 'price'); let orderParams = this.safeDict(rawOrder, 'params', {}); - const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id'); const slippage = this.safeString(orderParams, 'slippage', defaultSlippage); - let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc'; - const postOnly = this.safeBool(orderParams, 'postOnly', false); - if (postOnly) { - defaultTimeInForce = 'alo'; - } - let timeInForce = this.safeStringLower(orderParams, 'timeInForce', defaultTimeInForce); - timeInForce = this.capitalize(timeInForce); - let triggerPrice = this.safeString2(orderParams, 'triggerPrice', 'stopPrice'); - const stopLossPrice = this.safeString(orderParams, 'stopLossPrice', triggerPrice); - const takeProfitPrice = this.safeString(orderParams, 'takeProfitPrice'); - const isTrigger = (stopLossPrice || takeProfitPrice); - let px = undefined; - if (isMarket) { - if (price === undefined) { - throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).'); - } - px = (isBuy) ? _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringMul(price, _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringAdd('1', slippage)) : _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringMul(price, _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringSub('1', slippage)); - px = this.priceToPrecision(symbol, px); // round after adding slippage - } - else { - px = this.priceToPrecision(symbol, price); - } - const sz = this.amountToPrecision(symbol, amount); - const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false); - const orderType = {}; + orderParams['slippage'] = slippage; + const stopLoss = this.safeValue(orderParams, 'stopLoss'); + const takeProfit = this.safeValue(orderParams, 'takeProfit'); + const isTrigger = (stopLoss || takeProfit); + orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']); + const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams); + orderReq.push(mainOrderObj); if (isTrigger) { - let isTp = false; - if (takeProfitPrice !== undefined) { - triggerPrice = this.priceToPrecision(symbol, takeProfitPrice); - isTp = true; + // grouping opposed orders for sl/tp + const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']); + const stopLossOrderType = this.safeString(stopLoss, 'type'); + const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice); + const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']); + const takeProfitOrderType = this.safeString(takeProfit, 'type'); + const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice); + grouping = 'normalTpsl'; + orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']); + let triggerOrderSide = ''; + if (side === 'BUY') { + triggerOrderSide = 'sell'; } else { - triggerPrice = this.priceToPrecision(symbol, stopLossPrice); + triggerOrderSide = 'buy'; + } + if (takeProfit !== undefined) { + const orderObj = this.createOrderRequest(symbol, takeProfitOrderType, triggerOrderSide, amount, takeProfitOrderLimitPrice, this.extend(orderParams, { + 'takeProfitPrice': takeProfitOrderTriggerPrice, + 'reduceOnly': true, + })); + orderReq.push(orderObj); + } + if (stopLoss !== undefined) { + const orderObj = this.createOrderRequest(symbol, stopLossOrderType, triggerOrderSide, amount, stopLossOrderLimitPrice, this.extend(orderParams, { + 'stopLossPrice': stopLossOrderTriggerPrice, + 'reduceOnly': true, + })); + orderReq.push(orderObj); } - orderType['trigger'] = { - 'isMarket': isMarket, - 'triggerPx': triggerPrice, - 'tpsl': (isTp) ? 'tp' : 'sl', - }; - } - else { - orderType['limit'] = { - 'tif': timeInForce, - }; - } - orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']); - const orderObj = { - 'a': this.parseToInt(market['baseId']), - 'b': isBuy, - 'p': px, - 's': sz, - 'r': reduceOnly, - 't': orderType, - // 'c': clientOrderId, - }; - if (clientOrderId !== undefined) { - orderObj['c'] = clientOrderId; } - orderReq.push(orderObj); } let vaultAddress = undefined; [vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress'); @@ -197268,7 +194877,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/ const orderAction = { 'type': 'order', 'orders': orderReq, - 'grouping': 'na', + 'grouping': grouping, // 'brokerCode': 1, // cant }; if (vaultAddress === undefined) { @@ -203343,7 +200952,20 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul // "maker": false // } // + // watchTrades + // + // { + // "symbol": "BTC/USD", + // "side": "buy", + // "price": 109601.2, + // "qty": 0.04561994, + // "ord_type": "market", + // "trade_id": 83449369, + // "timestamp": "2025-05-27T11:24:03.847761Z" + // } + // let timestamp = undefined; + let datetime = undefined; let side = undefined; let type = undefined; let price = undefined; @@ -203394,6 +201016,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul }; } } + else { + symbol = this.safeString(trade, 'symbol'); + datetime = this.safeString(trade, 'timestamp'); + id = this.safeString(trade, 'trade_id'); + side = this.safeString(trade, 'side'); + type = this.safeString(trade, 'ord_type'); + price = this.safeString(trade, 'price'); + amount = this.safeString(trade, 'qty'); + } if (market !== undefined) { symbol = market['symbol']; } @@ -203403,12 +201034,18 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul if (maker !== undefined) { takerOrMaker = maker ? 'maker' : 'taker'; } + if (datetime === undefined) { + datetime = this.iso8601(timestamp); + } + else { + timestamp = this.parse8601(datetime); + } return this.safeTrade({ 'id': id, 'order': orderId, 'info': trade, 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), + 'datetime': datetime, 'symbol': symbol, 'type': type, 'side': side, @@ -205994,7 +203631,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_ 'precision': undefined, }); } - this.currencies = this.deepExtend(currencies, this.currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(currencies, this.currencies)); return result; } /** @@ -209742,36 +207379,32 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul // } // const currenciesData = this.safeList(response, 'data', []); + const brokenCurrencies = this.safeList(this.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT']); + const otherFiats = this.safeList(this.options, 'fiats', ['KWD', 'IRR', 'PKR']); const result = {}; for (let i = 0; i < currenciesData.length; i++) { const entry = currenciesData[i]; const id = this.safeString(entry, 'currency'); - const name = this.safeString(entry, 'fullName'); + if (this.inArray(id, brokenCurrencies)) { + continue; // skip buggy entries: https://t.me/KuCoin_API/217798 + } const code = this.safeCurrencyCode(id); const networks = {}; const chains = this.safeList(entry, 'chains', []); - const rawPrecision = this.safeString(entry, 'precision'); - const precision = this.parseNumber(this.parsePrecision(rawPrecision)); const chainsLength = chains.length; - if (!chainsLength) { - // one buggy coin, which doesn't contain info https://t.me/KuCoin_API/173118 - continue; - } for (let j = 0; j < chainsLength; j++) { const chain = chains[j]; const chainId = this.safeString(chain, 'chainId'); const networkCode = this.networkIdToCode(chainId, code); - const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false); - const chainDepositEnabled = this.safeBool(chain, 'isDepositEnabled', false); networks[networkCode] = { 'info': chain, 'id': chainId, 'name': this.safeString(chain, 'chainName'), 'code': networkCode, - 'active': chainWithdrawEnabled && chainDepositEnabled, + 'active': undefined, 'fee': this.safeNumber(chain, 'withdrawalMinFee'), - 'deposit': chainDepositEnabled, - 'withdraw': chainWithdrawEnabled, + 'deposit': this.safeBool(chain, 'isDepositEnabled'), + 'withdraw': this.safeBool(chain, 'isWithdrawEnabled'), 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawPrecision'))), 'limits': { 'withdraw': { @@ -209786,10 +207419,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul }; } // kucoin has determined 'fiat' currencies with below logic - const isFiat = (rawPrecision === '2') && (chainsLength === 0); + const rawPrecision = this.safeString(entry, 'precision'); + const precision = this.parseNumber(this.parsePrecision(rawPrecision)); + const isFiat = this.inArray(id, otherFiats) || ((rawPrecision === '2') && (chainsLength === 0)); result[code] = this.safeCurrencyStructure({ 'id': id, - 'name': name, + 'name': this.safeString(entry, 'fullName'), 'code': code, 'type': isFiat ? 'fiat' : 'crypto', 'precision': precision, @@ -217138,6 +214773,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'fetchTradingFee': { 'method': 'fetchPrivateTradingFee', // or 'fetchPublicTradingFee' }, + 'timeDifference': 0, + 'adjustForTimeDifference': true, // controls the adjustment logic upon instantiation }, 'features': { 'spot': { @@ -217238,39 +214875,6 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @returns {object[]} an array of objects representing market data */ async fetchMarkets(params = {}) { - const currencies = await this.fetchCurrenciesFromCache(params); - // - // [ - // { - // "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d", - // "status":"CURRENCY_STATUS_ACTIVE", - // "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO - // "name":"MyCryptoBank", - // "tag":"MCB", - // "description":"", - // "logo":"", - // "decimals":18, - // "created":1572912000000, - // "tier":1, - // "assetClass":"ASSET_CLASS_UNKNOWN", - // "minTransferAmount":0 - // }, - // { - // "id":"db02758e-2507-46a5-a805-7bc60355b3eb", - // "status":"CURRENCY_STATUS_ACTIVE", - // "type":"CURRENCY_TYPE_FUTURES_CONTRACT", - // "name":"BTC USDT Futures Contract", - // "tag":"BTCUSDT", - // "description":"", - // "logo":"", - // "decimals":8, - // "created":1589459984395, - // "tier":1, - // "assetClass":"ASSET_CLASS_UNKNOWN", - // "minTransferAmount":0 - // }, - // ] - // const response = await this.publicGetPair(params); // // [ @@ -217292,9 +214896,10 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // } // ] // - if (this.safeValue(this.options, 'adjustForTimeDifference', true)) { + if (this.safeBool(this.options, 'adjustForTimeDifference', false)) { await this.loadTimeDifference(); } + const currencies = this.safeDict(this.options, 'cachedCurrencies', {}); const currenciesById = this.indexBy(currencies, 'id'); const result = []; for (let i = 0; i < response.length; i++) { @@ -217303,11 +214908,13 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // the exchange shows them inverted const baseId = this.safeString(market, 'baseCurrency'); const quoteId = this.safeString(market, 'quoteCurrency'); - const baseCurrency = this.safeValue(currenciesById, baseId); - const quoteCurrency = this.safeValue(currenciesById, quoteId); - if (baseCurrency !== undefined && quoteCurrency !== undefined) { - const base = this.safeCurrencyCode(this.safeString(baseCurrency, 'tag')); - const quote = this.safeCurrencyCode(this.safeString(quoteCurrency, 'tag')); + const baseCurrency = this.safeDict(currenciesById, baseId); + const quoteCurrency = this.safeDict(currenciesById, quoteId); + const baseCurrencyInfo = this.safeDict(baseCurrency, 'info'); + const quoteCurrencyInfo = this.safeDict(quoteCurrency, 'info'); + if (baseCurrencyInfo !== undefined && quoteCurrencyInfo !== undefined) { + const base = this.safeCurrencyCode(this.safeString(baseCurrencyInfo, 'tag')); + const quote = this.safeCurrencyCode(this.safeString(quoteCurrencyInfo, 'tag')); const lowercaseQuote = quote.toLowerCase(); const capitalizedQuote = this.capitalize(lowercaseQuote); const status = this.safeString(market, 'status'); @@ -217364,22 +214971,6 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa } return result; } - async fetchCurrenciesFromCache(params = {}) { - // this method is now redundant - // currencies are now fetched before markets - const options = this.safeValue(this.options, 'fetchCurrencies', {}); - const timestamp = this.safeInteger(options, 'timestamp'); - const expires = this.safeInteger(options, 'expires', 1000); - const now = this.milliseconds(); - if ((timestamp === undefined) || ((now - timestamp) > expires)) { - const response = await this.publicGetCurrency(params); - this.options['fetchCurrencies'] = this.extend(options, { - 'response': response, - 'timestamp': now, - }); - } - return this.safeValue(this.options['fetchCurrencies'], 'response'); - } /** * @method * @name latoken#fetchCurrencies @@ -217388,7 +214979,7 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa * @returns {object} an associative dictionary of currencies */ async fetchCurrencies(params = {}) { - const response = await this.fetchCurrenciesFromCache(params); + const response = await this.publicGetCurrency(params); // // [ // { @@ -217427,29 +215018,18 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const id = this.safeString(currency, 'id'); const tag = this.safeString(currency, 'tag'); const code = this.safeCurrencyCode(tag); - const fee = this.safeNumber(currency, 'fee'); const currencyType = this.safeString(currency, 'type'); - let type = undefined; - if (currencyType === 'CURRENCY_TYPE_ALTERNATIVE') { - type = 'other'; - } - else { - // CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos - type = 'crypto'; - } - const status = this.safeString(currency, 'status'); - const active = (status === 'CURRENCY_STATUS_ACTIVE'); - const name = this.safeString(currency, 'name'); - result[code] = { + const isCrypto = (currencyType === 'CURRENCY_TYPE_CRYPTO' || currencyType === 'CURRENCY_TYPE_IEO'); + result[code] = this.safeCurrencyStructure({ 'id': id, 'code': code, 'info': currency, - 'name': name, - 'type': type, - 'active': active, + 'name': this.safeString(currency, 'name'), + 'type': isCrypto ? 'crypto' : 'other', + 'active': this.safeString(currency, 'status') === 'CURRENCY_STATUS_ACTIVE', 'deposit': undefined, 'withdraw': undefined, - 'fee': fee, + 'fee': this.safeNumber(currency, 'fee'), 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))), 'limits': { 'amount': { @@ -217462,7 +215042,7 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa }, }, 'networks': {}, - }; + }); } return result; } @@ -218802,6 +216382,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" 'fetchClosedOrders': false, 'fetchCrossBorrowRate': false, 'fetchCrossBorrowRates': false, + 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': false, @@ -218876,7 +216457,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" 'currencyPairs': 2.5, 'accuracy': 2.5, 'usdToCny': 2.5, - 'withdrawConfigs': 2.5, + 'assetConfigs': 2.5, + 'withdrawConfigs': 2.5 * 1.5, 'timestamp': 2.5, 'ticker/24hr': 2.5, 'ticker': 2.5, @@ -218962,6 +216544,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" }, }, 'commonCurrencies': { + 'XBT': 'XBT', 'HIT': 'Hiver', 'VET_ERC20': 'VEN', 'PNT': 'Penta', @@ -219029,21 +216612,12 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" // ptx: 1 // } }, - 'inverse-networks': { + 'networksById': { 'erc20': 'ERC20', 'trc20': 'TRC20', - 'omni': 'OMNI', - 'asa': 'ASA', - 'bep20(bsc)': 'BSC', - 'bep20': 'BSC', - 'heco': 'HT', - 'bep2': 'BNB', - 'btc': 'BTC', - 'dogecoin': 'DOGE', - 'matic': 'MATIC', - 'oec': 'OEC', - 'btctron': 'BTCTRON', - 'xrp': 'XRP', + 'TRX': 'TRC20', + 'bep20(bsc)': 'BEP20', + 'bep20': 'BEP20', }, 'defaultNetworks': { 'USDT': 'TRC20', @@ -219166,6 +216740,108 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" // return this.safeInteger(response, 'data'); } + /** + * @method + * @name lbank#fetchCurrencies + * @description fetches all available currencies on an exchange + * @param {dict} [params] extra parameters specific to the exchange API endpoint + * @returns {dict} an associative dictionary of currencies + */ + async fetchCurrencies(params = {}) { + const response = await this.spotPublicGetWithdrawConfigs(params); + // + // { + // "msg": "Success", + // "result": "true", + // "data": [ + // { + // "amountScale": "4", + // "chain": "bep20(bsc)", + // "assetCode": "usdt", + // "min": "10", + // "transferAmtScale": "4", + // "canWithDraw": true, + // "fee": "0.0000", + // "minTransfer": "0.0001", + // "type": "1" + // }, + // { + // "amountScale": "4", + // "chain": "trc20", + // "assetCode": "usdt", + // "min": "1", + // "transferAmtScale": "4", + // "canWithDraw": true, + // "fee": "1.0000", + // "minTransfer": "0.0001", + // "type": "1" + // }, + // ... + // ], + // "error_code": "0", + // "ts": "1747973911431" + // } + // + const currenciesData = this.safeList(response, 'data', []); + const grouped = this.groupBy(currenciesData, 'assetCode'); + const groupedKeys = Object.keys(grouped); + const result = {}; + for (let i = 0; i < groupedKeys.length; i++) { + const id = (groupedKeys[i]).toString(); // some currencies are numeric + const code = this.safeCurrencyCode(id); + const networksRaw = grouped[id]; + const networks = {}; + for (let j = 0; j < networksRaw.length; j++) { + const networkEntry = networksRaw[j]; + const networkId = this.safeString(networkEntry, 'chain'); + const networkCode = this.networkIdToCode(networkId); + networks[networkCode] = { + 'id': networkId, + 'network': networkCode, + 'limits': { + 'withdraw': { + 'min': this.safeNumber(networkEntry, 'min'), + 'max': undefined, + }, + 'deposit': { + 'min': this.safeNumber(networkEntry, 'minTransfer'), + 'max': undefined, + }, + }, + 'active': undefined, + 'deposit': undefined, + 'withdraw': this.safeBool(networkEntry, 'canWithDraw'), + 'fee': this.safeNumber(networkEntry, 'fee'), + 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))), + 'info': networkEntry, + }; + } + result[code] = this.safeCurrencyStructure({ + 'id': id, + 'code': code, + 'precision': undefined, + 'type': undefined, + 'name': undefined, + 'active': undefined, + 'deposit': undefined, + 'withdraw': undefined, + 'fee': undefined, + 'limits': { + 'withdraw': { + 'min': undefined, + 'max': undefined, + }, + 'deposit': { + 'min': undefined, + 'max': undefined, + }, + }, + 'networks': networks, + 'info': networksRaw, + }); + } + return result; + } /** * @method * @name lbank#fetchMarkets @@ -220921,13 +218597,10 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" const result = this.safeValue(response, 'data'); const address = this.safeString(result, 'address'); const tag = this.safeString(result, 'memo'); - const networkId = this.safeString(result, 'netWork'); - const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {}); - const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId); return { 'info': response, 'currency': code, - 'network': networkCode, + 'network': this.networkIdToCode(this.safeString(result, 'netWork')), 'address': address, 'tag': tag, }; @@ -220962,12 +218635,10 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" const result = this.safeValue(response, 'data'); const address = this.safeString(result, 'address'); const tag = this.safeString(result, 'memo'); - const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {}); - const networkCode = this.safeStringUpper(inverseNetworks, network, network); return { 'info': response, 'currency': code, - 'network': networkCode, + 'network': undefined, 'address': address, 'tag': tag, }; @@ -221091,9 +218762,6 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" } const txid = this.safeString(transaction, 'txId'); const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime'); - const networks = this.safeValue(this.options, 'inverse-networks', {}); - const networkId = this.safeString(transaction, 'networkName'); - const network = this.safeString(networks, networkId, networkId); const address = this.safeString(transaction, 'address'); let addressFrom = undefined; let addressTo = undefined; @@ -221121,7 +218789,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" 'txid': txid, 'timestamp': timestamp, 'datetime': this.iso8601(timestamp), - 'network': network, + 'network': this.networkIdToCode(this.safeString(transaction, 'networkName')), 'address': address, 'addressTo': addressTo, 'addressFrom': addressFrom, @@ -221324,10 +218992,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" withdrawFees[code] = {}; for (let j = 0; j < networkList.length; j++) { const networkEntry = networkList[j]; - const networkId = this.safeString(networkEntry, 'name'); - const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId); const fee = this.safeNumber(networkEntry, 'withdrawFee'); if (fee !== undefined) { + const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name')); withdrawFees[code][networkCode] = fee; } } @@ -221379,8 +219046,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" if (canWithdraw === 'true') { const currencyId = this.safeString(item, 'assetCode'); const codeInner = this.safeCurrencyCode(currencyId); - const chain = this.safeString(item, 'chain'); - let network = this.safeString(this.options['inverse-networks'], chain, chain); + let network = this.networkIdToCode(this.safeString(item, 'chain')); if (network === undefined) { network = codeInner; } @@ -221531,8 +219197,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" const resultCodeInfo = result[code]['info']; resultCodeInfo.push(fee); } - const chain = this.safeString(fee, 'chain'); - const networkCode = this.safeString(this.options['inverse-networks'], chain, chain); + const networkCode = this.networkIdToCode(this.safeString(fee, 'chain')); if (networkCode !== undefined) { result[code]['networks'][networkCode] = { 'withdraw': { @@ -221588,8 +219253,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default" const networkList = this.safeValue(fee, 'networkList', []); for (let j = 0; j < networkList.length; j++) { const networkEntry = networkList[j]; - const networkId = this.safeString(networkEntry, 'name'); - const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId); + const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name')); const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee'); const isDefault = this.safeValue(networkEntry, 'isDefault'); if (withdrawFee !== undefined) { @@ -225101,6 +222765,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] 'PROS': 'PROSFINANCE', 'SIN': 'SINCITYTOKEN', 'SOUL': 'SOULSWAP', + 'XBT': 'XBT', // restore original mapping }, 'exceptions': { 'exact': { @@ -232075,7 +229740,7 @@ class modetrade extends _abstract_modetrade_js__WEBPACK_IMPORTED_MODULE_0__/* [" // // { // "success": true, - // "timestamp": 1702989203989, + // "timestamp": 1702989203988, // "data": { // "status": "CANCEL_SENT" // } @@ -232083,7 +229748,7 @@ class modetrade extends _abstract_modetrade_js__WEBPACK_IMPORTED_MODULE_0__/* [" // // { // "success": true, - // "timestamp": 1702989203989, + // "timestamp": 1702989203988, // "status": "CANCEL_SENT" // } // @@ -247027,7 +244692,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ let fee = this.safeString(params, 'fee'); if (fee === undefined) { const currencies = await this.fetchCurrencies(); - this.currencies = this.deepExtend(this.currencies, currencies); + this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies)); const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {}); fee = this.safeString(targetNetwork, 'fee'); if (fee === undefined) { @@ -249082,7 +246747,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ /** * @method * @name okx#fetchBorrowInterest - * @description fetch the interest owed by the user for borrowing currency for margin trading + * @description fetch the interest owed b the user for borrowing currency for margin trading * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data * @param {string} code the unified currency code for the currency of the interest * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned @@ -256853,6 +254518,7 @@ class paradex extends _abstract_paradex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'fetchFundingRateHistory': false, 'fetchFundingRates': false, 'fetchGreeks': true, + 'fetchAllGreeks': true, 'fetchIndexOHLCV': false, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, @@ -257569,7 +255235,7 @@ class paradex extends _abstract_paradex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa // "ask": "69578.2", // "volume_24h": "5815541.397939004", // "total_volume": "584031465.525259686", - // "created_at": 1718170156580, + // "created_at": 1718170156581, // "underlying_price": "67367.37268422", // "open_interest": "162.272", // "funding_rate": "0.01629574927887", @@ -259190,6 +256856,59 @@ class paradex extends _abstract_paradex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const greeks = this.safeDict(data, 0, {}); return this.parseGreeks(greeks, market); } + /** + * @method + * @name paradex#fetchAllGreeks + * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary + * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} + */ + async fetchAllGreeks(symbols = undefined, params = {}) { + await this.loadMarkets(); + symbols = this.marketSymbols(symbols, undefined, true, true, true); + const request = { + 'market': 'ALL', + }; + const response = await this.publicGetMarketsSummary(this.extend(request, params)); + // + // { + // "results": [ + // { + // "symbol": "BTC-USD-114000-P", + // "mark_price": "10835.66892602", + // "mark_iv": "0.71781855", + // "delta": "-0.98726024", + // "greeks": { + // "delta": "-0.9872602390817709", + // "gamma": "0.000004560958862297231", + // "vega": "227.11344863639806", + // "rho": "-302.0617972461581", + // "vanna": "0.06609830491614832", + // "volga": "925.9501532805552" + // }, + // "last_traded_price": "10551.5", + // "bid": "10794.9", + // "bid_iv": "0.05", + // "ask": "10887.3", + // "ask_iv": "0.8783283", + // "last_iv": "0.05", + // "volume_24h": "0", + // "total_volume": "195240.72672261014", + // "created_at": 1747644009995, + // "underlying_price": "103164.79162649", + // "open_interest": "0", + // "funding_rate": "0.000004464241170536191", + // "price_change_rate_24h": "0.074915", + // "future_funding_rate": "0.0001" + // } + // ] + // } + // + const results = this.safeList(response, 'results', []); + return this.parseAllGreeks(results, symbols); + } parseGreeks(greeks, market = undefined) { // // { @@ -286152,10 +283871,12 @@ class bitrue extends _bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /* harmony import */ var _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(382); /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2079); /* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2931); +/* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5147); // --------------------------------------------------------------------------- + // --------------------------------------------------------------------------- class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { describe() { @@ -286457,6 +284178,7 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * // "price_str":"1000.00" // }, // "channel":"private-my_orders_ltcusd-4848701", + // "event": "order_deleted" // field only present for cancelOrder // } // const channel = this.safeString(message, 'channel'); @@ -286469,29 +284191,65 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * const subscription = this.safeValue(client.subscriptions, channel); const symbol = this.safeString(subscription, 'symbol'); const market = this.market(symbol); + order['event'] = this.safeString(message, 'event'); const parsed = this.parseWsOrder(order, market); stored.append(parsed); client.resolve(this.orders, channel); } parseWsOrder(order, market = undefined) { // - // { - // "id":"1463471322288128", - // "id_str":"1463471322288128", - // "order_type":1, - // "datetime":"1646127778", - // "microtimestamp":"1646127777950000", - // "amount":0.05, - // "amount_str":"0.05000000", - // "price":1000, - // "price_str":"1000.00" + // { + // "id": "1894876776091648", + // "id_str": "1894876776091648", + // "order_type": 0, + // "order_subtype": 0, + // "datetime": "1751451375", + // "microtimestamp": "1751451375070000", + // "amount": 1.1, + // "amount_str": "1.10000000", + // "amount_traded": "0", + // "amount_at_create": "1.10000000", + // "price": 10.23, + // "price_str": "10.23", + // "is_liquidation": false, + // "trade_account_id": 0 // } // const id = this.safeString(order, 'id_str'); - const orderType = this.safeStringLower(order, 'order_type'); + const orderTypeRaw = this.safeStringLower(order, 'order_type'); + const side = (orderTypeRaw === '1') ? 'sell' : 'buy'; + const orderSubTypeRaw = this.safeStringLower(order, 'order_subtype'); // https://www.bitstamp.net/websocket/v2/#:~:text=order_subtype + let orderType = undefined; + let timeInForce = undefined; + if (orderSubTypeRaw === '0') { + orderType = 'limit'; + } + else if (orderSubTypeRaw === '2') { + orderType = 'market'; + } + else if (orderSubTypeRaw === '4') { + orderType = 'limit'; + timeInForce = 'IOC'; + } + else if (orderSubTypeRaw === '6') { + orderType = 'limit'; + timeInForce = 'FOK'; + } + else if (orderSubTypeRaw === '8') { + orderType = 'limit'; + timeInForce = 'GTD'; + } const price = this.safeString(order, 'price_str'); const amount = this.safeString(order, 'amount_str'); - const side = (orderType === '1') ? 'sell' : 'buy'; + const filled = this.safeString(order, 'amount_traded'); + const event = this.safeString(order, 'event'); + let status = undefined; + if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .Y.stringEq(filled, amount)) { + status = 'closed'; + } + else if (event === 'order_deleted') { + status = 'canceled'; + } const timestamp = this.safeTimestamp(order, 'datetime'); market = this.safeMarket(undefined, market); const symbol = market['symbol']; @@ -286503,8 +284261,8 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * 'timestamp': timestamp, 'datetime': this.iso8601(timestamp), 'lastTradeTimestamp': undefined, - 'type': undefined, - 'timeInForce': undefined, + 'type': orderType, + 'timeInForce': timeInForce, 'postOnly': undefined, 'side': side, 'price': price, @@ -286513,9 +284271,9 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * 'amount': amount, 'cost': undefined, 'average': undefined, - 'filled': undefined, + 'filled': filled, 'remaining': undefined, - 'status': undefined, + 'status': status, 'fee': undefined, 'trades': undefined, }, market); @@ -286580,6 +284338,7 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * // "price_str":"1000.00" // }, // "channel":"private-my_orders_ltcusd-4848701", + // "event": "order_deleted" // field only present for cancelOrder // } // const channel = this.safeString(message, 'channel'); @@ -286671,7 +284430,7 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] * // const sessionToken = this.safeString(response, 'token'); if (sessionToken !== undefined) { - const userId = this.safeNumber(response, 'user_id'); + const userId = this.safeString(response, 'user_id'); const validity = this.safeIntegerProduct(response, 'valid_sec', 1000); this.options['expiresIn'] = this.sum(time, validity); this.options['userId'] = userId; @@ -291591,11 +289350,10 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { async unWatchMyTrades(symbol = undefined, params = {}) { const method = 'watchMyTrades'; const messageHash = 'unsubscribe:myTrades'; - let subHash = 'myTrades'; + const subHash = 'myTrades'; await this.loadMarkets(); if (symbol !== undefined) { - symbol = this.symbol(symbol); - subHash += ':' + symbol; + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' unWatchMyTrades() does not support a symbol parameter, you must unwatch all my trades'); } const url = await this.getUrlByMarketType(symbol, true, method, params); await this.authenticate(url); @@ -292040,10 +289798,9 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { await this.loadMarkets(); const method = 'watchOrders'; const messageHash = 'unsubscribe:orders'; - let subHash = 'orders'; + const subHash = 'orders'; if (symbol !== undefined) { - symbol = this.symbol(symbol); - subHash += ':' + symbol; + throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' unWatchOrders() does not support a symbol parameter, you must unwatch all orders'); } const url = await this.getUrlByMarketType(symbol, true, method, params); await this.authenticate(url); @@ -292179,13 +289936,12 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { } const symbols = {}; for (let i = 0; i < rawOrders.length; i++) { - let parsed = undefined; - if (isSpot) { - parsed = this.parseWsSpotOrder(rawOrders[i]); - } - else { - parsed = this.parseOrder(rawOrders[i]); - } + const parsed = this.parseOrder(rawOrders[i]); + // if (isSpot) { + // parsed = this.parseWsSpotOrder (rawOrders[i]); + // } else { + // parsed = this.parseOrder (rawOrders[i]); + // } const symbol = parsed['symbol']; symbols[symbol] = true; orders.append(parsed); @@ -292198,142 +289954,6 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { const messageHash = 'orders'; client.resolve(orders, messageHash); } - parseWsSpotOrder(order, market = undefined) { - // - // { - // "e": "executionReport", - // "E": "1653297251061", // timestamp - // "s": "LTCUSDT", // symbol - // "c": "1653297250740", // user id - // "S": "SELL", // side - // "o": "MARKET_OF_BASE", // order type - // "f": "GTC", // time in force - // "q": "0.16233", // quantity - // "p": "0", // price - // "X": "NEW", // status - // "i": "1162336018974750208", // order id - // "M": "0", - // "l": "0", // last filled - // "z": "0", // total filled - // "L": "0", // last traded price - // "n": "0", // trading fee - // "N": '', // fee asset - // "u": true, - // "w": true, - // "m": false, // is limit_maker - // "O": "1653297251042", // order creation - // "Z": "0", // total filled - // "A": "0", // account id - // "C": false, // is close - // "v": "0", // leverage - // "d": "NO_LIQ" - // } - // v5 - // { - // "category":"spot", - // "symbol":"LTCUSDT", - // "orderId":"1474764674982492160", - // "orderLinkId":"1690541649154749", - // "blockTradeId":"", - // "side":"Buy", - // "positionIdx":0, - // "orderStatus":"Cancelled", - // "cancelType":"UNKNOWN", - // "rejectReason":"EC_NoError", - // "timeInForce":"GTC", - // "isLeverage":"0", - // "price":"0", - // "qty":"5.00000", - // "avgPrice":"0", - // "leavesQty":"0.00000", - // "leavesValue":"5.0000000", - // "cumExecQty":"0.00000", - // "cumExecValue":"0.0000000", - // "cumExecFee":"", - // "orderType":"Market", - // "stopOrderType":"", - // "orderIv":"", - // "triggerPrice":"0.000", - // "takeProfit":"", - // "stopLoss":"", - // "triggerBy":"", - // "tpTriggerBy":"", - // "slTriggerBy":"", - // "triggerDirection":0, - // "placeType":"", - // "lastPriceOnCreated":"0.000", - // "closeOnTrigger":false, - // "reduceOnly":false, - // "smpGroup":0, - // "smpType":"None", - // "smpOrderId":"", - // "createdTime":"1690541649160", - // "updatedTime":"1690541649168" - // } - // - const id = this.safeString2(order, 'i', 'orderId'); - const marketId = this.safeString2(order, 's', 'symbol'); - const symbol = this.safeSymbol(marketId, market, undefined, 'spot'); - const timestamp = this.safeInteger2(order, 'O', 'createdTime'); - let price = this.safeString2(order, 'p', 'price'); - if (price === '0') { - price = undefined; // market orders - } - const filled = this.safeString2(order, 'z', 'cumExecQty'); - const status = this.parseOrderStatus(this.safeString2(order, 'X', 'orderStatus')); - const side = this.safeStringLower2(order, 'S', 'side'); - const lastTradeTimestamp = this.safeString2(order, 'E', 'updatedTime'); - const timeInForce = this.safeString2(order, 'f', 'timeInForce'); - let amount = undefined; - const cost = this.safeString2(order, 'Z', 'cumExecValue'); - let type = this.safeStringLower2(order, 'o', 'orderType'); - if ((type !== undefined) && (type.indexOf('market') >= 0)) { - type = 'market'; - } - if (type === 'market' && side === 'buy') { - amount = filled; - } - else { - amount = this.safeString2(order, 'orderQty', 'qty'); - } - let fee = undefined; - const feeCost = this.safeString2(order, 'n', 'cumExecFee'); - if (feeCost !== undefined && feeCost !== '0') { - const feeCurrencyId = this.safeString(order, 'N'); - const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId); - fee = { - 'cost': feeCost, - 'currency': feeCurrencyCode, - }; - } - const triggerPrice = this.omitZero(this.safeString(order, 'triggerPrice')); - return this.safeOrder({ - 'info': order, - 'id': id, - 'clientOrderId': this.safeString2(order, 'c', 'orderLinkId'), - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'lastTradeTimestamp': lastTradeTimestamp, - 'symbol': symbol, - 'type': type, - 'timeInForce': timeInForce, - 'postOnly': undefined, - 'side': side, - 'price': price, - 'stopPrice': triggerPrice, - 'triggerPrice': triggerPrice, - 'takeProfitPrice': this.safeString(order, 'takeProfit'), - 'stopLossPrice': this.safeString(order, 'stopLoss'), - 'reduceOnly': this.safeValue(order, 'reduceOnly'), - 'amount': amount, - 'cost': cost, - 'average': this.safeString(order, 'avgPrice'), - 'filled': filled, - 'remaining': undefined, - 'status': status, - 'fee': fee, - }, market); - } /** * @method * @name bybit#watchBalance @@ -292929,7 +290549,8 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { for (let j = 0; j < messageHashes.length; j++) { const unsubHash = messageHashes[j]; const subHash = subMessageHashes[j]; - this.cleanUnsubscription(client, subHash, unsubHash); + const usePrefix = (subHash === 'orders') || (subHash === 'myTrades'); + this.cleanUnsubscription(client, subHash, unsubHash, usePrefix); } this.cleanCache(subscription); } @@ -315503,6 +313124,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A 'public': 'wss://ws.kraken.com', 'private': 'wss://ws-auth.kraken.com', 'privateV2': 'wss://ws-auth.kraken.com/v2', + 'publicV2': 'wss://ws.kraken.com/v2', 'beta': 'wss://beta-ws.kraken.com', 'beta-private': 'wss://beta-ws-auth.kraken.com', }, @@ -315517,9 +313139,13 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A 'ordersLimit': 1000, 'symbolsByOrderId': {}, 'watchOrderBook': { - 'checksum': true, + 'checksum': false, }, }, + 'streaming': { + 'ping': this.ping, + 'keepAlive': 6000, + }, 'exceptions': { 'ws': { 'exact': { @@ -315570,6 +313196,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A 'EService:Market in post_only mode': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported, 'EService:Unavailable': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable, 'ETrade:Invalid request': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest, + 'ESession:Invalid session': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError, }, }, }, @@ -315837,8 +313464,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /** * @method * @name kraken#cancelOrdersWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder * @description cancel multiple orders + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_order * @param {string[]} ids order ids * @param {string} [symbol] unified market symbol, default is undefined * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -315866,8 +313493,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /** * @method * @name kraken#cancelOrderWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder * @description cancels an open order + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_order * @param {string} id order id * @param {string} [symbol] unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -315911,8 +313538,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /** * @method * @name kraken#cancelAllOrdersWs - * @see https://docs.kraken.com/api/docs/websocket-v1/cancelall * @description cancel all open orders + * @see https://docs.kraken.com/api/docs/websocket-v2/cancel_all * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} @@ -315951,54 +313578,57 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A const reqId = this.safeValue(message, 'req_id'); client.resolve(message, reqId); } - handleTicker(client, message, subscription) { + handleTicker(client, message) { // - // [ - // 0, // channelID - // { - // "a": [ "5525.40000", 1, "1.000" ], // ask, wholeAskVolume, askVolume - // "b": [ "5525.10000", 1, "1.000" ], // bid, wholeBidVolume, bidVolume - // "c": [ "5525.10000", "0.00398963" ], // closing price, volume - // "h": [ "5783.00000", "5783.00000" ], // high price today, high price 24h ago - // "l": [ "5505.00000", "5505.00000" ], // low price today, low price 24h ago - // "o": [ "5760.70000", "5763.40000" ], // open price today, open price 24h ago - // "p": [ "5631.44067", "5653.78939" ], // vwap today, vwap 24h ago - // "t": [ 11493, 16267 ], // number of trades today, 24 hours ago - // "v": [ "2634.11501494", "3591.17907851" ], // volume today, volume 24 hours ago - // }, - // "ticker", - // "XBT/USD" - // ] + // { + // "channel": "ticker", + // "type": "snapshot", + // "data": [ + // { + // "symbol": "BTC/USD", + // "bid": 108359.8, + // "bid_qty": 0.01362603, + // "ask": 108359.9, + // "ask_qty": 17.17988863, + // "last": 108359.8, + // "volume": 2158.32346723, + // "vwap": 108894.5, + // "low": 106824, + // "high": 111300, + // "change": -2679.9, + // "change_pct": -2.41 + // } + // ] + // } // - const wsName = message[3]; - const market = this.safeValue(this.options['marketsByWsName'], wsName); - const symbol = market['symbol']; + const data = this.safeList(message, 'data', []); + const ticker = data[0]; + const symbol = this.safeString(ticker, 'symbol'); const messageHash = this.getMessageHash('ticker', undefined, symbol); - const ticker = message[1]; - const vwap = this.safeString(ticker['p'], 0); + const vwap = this.safeString(ticker, 'vwap'); let quoteVolume = undefined; - const baseVolume = this.safeString(ticker['v'], 0); + const baseVolume = this.safeString(ticker, 'volume'); if (baseVolume !== undefined && vwap !== undefined) { quoteVolume = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .Y.stringMul(baseVolume, vwap); } - const last = this.safeString(ticker['c'], 0); + const last = this.safeString(ticker, 'last'); const result = this.safeTicker({ 'symbol': symbol, 'timestamp': undefined, 'datetime': undefined, - 'high': this.safeString(ticker['h'], 0), - 'low': this.safeString(ticker['l'], 0), - 'bid': this.safeString(ticker['b'], 0), - 'bidVolume': this.safeString(ticker['b'], 2), - 'ask': this.safeString(ticker['a'], 0), - 'askVolume': this.safeString(ticker['a'], 2), + 'high': this.safeString(ticker, 'high'), + 'low': this.safeString(ticker, 'low'), + 'bid': this.safeString(ticker, 'bid'), + 'bidVolume': this.safeString(ticker, 'bid_qty'), + 'ask': this.safeString(ticker, 'ask'), + 'askVolume': this.safeString(ticker, 'ask_qty'), 'vwap': vwap, - 'open': this.safeString(ticker['o'], 0), + 'open': undefined, 'close': last, 'last': last, 'previousClose': undefined, - 'change': undefined, - 'percentage': undefined, + 'change': this.safeString(ticker, 'change'), + 'percentage': this.safeString(ticker, 'change_pct'), 'average': undefined, 'baseVolume': baseVolume, 'quoteVolume': quoteVolume, @@ -316007,31 +313637,36 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A this.tickers[symbol] = result; client.resolve(result, messageHash); } - handleTrades(client, message, subscription) { + handleTrades(client, message) { // - // [ - // 0, // channelID - // [ // price volume time side type misc - // [ "5541.20000", "0.15850568", "1534614057.321596", "s", "l", "" ], - // [ "6060.00000", "0.02455000", "1534614057.324998", "b", "l", "" ], - // ], - // "trade", - // "XBT/USD" - // ] + // { + // "channel": "trade", + // "type": "update", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "side": "sell", + // "price": 0.5117, + // "qty": 40.0, + // "ord_type": "market", + // "trade_id": 4665906, + // "timestamp": "2023-09-25T07:49:37.708706Z" + // } + // ] + // } // - const wsName = this.safeString(message, 3); - const name = this.safeString(message, 2); - const market = this.safeValue(this.options['marketsByWsName'], wsName); - const symbol = market['symbol']; - const messageHash = this.getMessageHash(name, undefined, symbol); + const data = this.safeList(message, 'data', []); + const trade = data[0]; + const symbol = this.safeString(trade, 'symbol'); + const messageHash = this.getMessageHash('trade', undefined, symbol); let stored = this.safeValue(this.trades, symbol); if (stored === undefined) { const limit = this.safeInteger(this.options, 'tradesLimit', 1000); stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCache */ .I3(limit); this.trades[symbol] = stored; } - const trades = this.safeValue(message, 1, []); - const parsed = this.parseTrades(trades, market); + const market = this.market(symbol); + const parsed = this.parseTrades(data, market); for (let i = 0; i < parsed.length; i++) { stored.append(parsed[i]); } @@ -316119,7 +313754,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A * @method * @name kraken#watchTicker * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://docs.kraken.com/api/docs/websocket-v1/ticker + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string} symbol unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -316134,7 +313769,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A * @method * @name kraken#watchTickers * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market - * @see https://docs.kraken.com/api/docs/websocket-v1/ticker + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string[]} symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -316153,8 +313788,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /** * @method * @name kraken#watchBidsAsks - * @see https://docs.kraken.com/api/docs/websocket-v1/spread * @description watches best bid & ask for symbols + * @see https://docs.kraken.com/api/docs/websocket-v2/ticker * @param {string[]} symbols unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} @@ -316162,7 +313797,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A async watchBidsAsks(symbols = undefined, params = {}) { await this.loadMarkets(); symbols = this.marketSymbols(symbols, undefined, false); - const ticker = await this.watchMultiHelper('bidask', 'spread', symbols, undefined, params); + params['event_trigger'] = 'bbo'; + const ticker = await this.watchMultiHelper('bidask', 'ticker', symbols, undefined, params); if (this.newUpdates) { const result = {}; result[ticker['symbol']] = ticker; @@ -316170,49 +313806,11 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A } return this.filterByArray(this.bidsasks, 'symbol', symbols); } - handleBidAsk(client, message, subscription) { - // - // [ - // 7208974, // channelID - // [ - // "63758.60000", // bid - // "63759.10000", // ask - // "1726814731.089778", // timestamp - // "0.00057917", // bid_volume - // "0.15681688" // ask_volume - // ], - // "spread", - // "XBT/USDT" - // ] - // - const parsedTicker = this.parseWsBidAsk(message); - const symbol = parsedTicker['symbol']; - this.bidsasks[symbol] = parsedTicker; - const messageHash = this.getMessageHash('bidask', undefined, symbol); - client.resolve(parsedTicker, messageHash); - } - parseWsBidAsk(ticker, market = undefined) { - const data = this.safeList(ticker, 1, []); - const marketId = this.safeString(ticker, 3); - market = this.safeValue(this.options['marketsByWsName'], marketId); - const symbol = this.safeString(market, 'symbol'); - const timestamp = this.parseToInt(this.safeInteger(data, 2)) * 1000; - return this.safeTicker({ - 'symbol': symbol, - 'timestamp': timestamp, - 'datetime': this.iso8601(timestamp), - 'ask': this.safeString(data, 1), - 'askVolume': this.safeString(data, 4), - 'bid': this.safeString(data, 0), - 'bidVolume': this.safeString(data, 3), - 'info': ticker, - }, market); - } /** * @method * @name kraken#watchTrades * @description get the list of most recent trades for a particular symbol - * @see https://docs.kraken.com/api/docs/websocket-v1/trade + * @see https://docs.kraken.com/api/docs/websocket-v2/trade * @param {string} symbol unified symbol of the market to fetch trades for * @param {int} [since] timestamp in ms of the earliest trade to fetch * @param {int} [limit] the maximum amount of trades to fetch @@ -316225,8 +313823,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A /** * @method * @name kraken#watchTradesForSymbols - * @see https://docs.kraken.com/api/docs/websocket-v1/trade * @description get the list of most recent trades for a list of symbols + * @see https://docs.kraken.com/api/docs/websocket-v2/trade * @param {string[]} symbols unified symbol of the market to fetch trades for * @param {int} [since] timestamp in ms of the earliest trade to fetch * @param {int} [limit] the maximum amount of trades to fetch @@ -316246,7 +313844,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A * @method * @name kraken#watchOrderBook * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://docs.kraken.com/api/docs/websocket-v1/book + * @see https://docs.kraken.com/api/docs/websocket-v2/book * @param {string} symbol unified symbol of the market to fetch the order book for * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -316259,7 +313857,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A * @method * @name kraken#watchOrderBookForSymbols * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data - * @see https://docs.kraken.com/api/docs/websocket-v1/book + * @see https://docs.kraken.com/api/docs/websocket-v2/book * @param {string[]} symbols unified array of symbols * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint @@ -316269,7 +313867,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A const request = {}; if (limit !== undefined) { if (this.inArray(limit, [10, 25, 100, 500, 1000])) { - request['subscription'] = { + request['params'] = { 'depth': limit, // default 10, valid options 10, 25, 100, 500, 1000 }; } @@ -316335,6 +313933,21 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A } return markets; } + ping(client) { + const url = client.url; + const request = {}; + if (url.indexOf('v2') >= 0) { + request['method'] = 'ping'; + } + else { + request['event'] = 'ping'; + } + return request; + } + handlePong(client, message) { + client.lastPong = this.milliseconds(); + return message; + } async watchHeartbeat(params = {}) { await this.loadMarkets(); const event = 'heartbeat'; @@ -316350,175 +313963,165 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A const event = this.safeString(message, 'event'); client.resolve(message, event); } - handleOrderBook(client, message, subscription) { + handleOrderBook(client, message) { // // first message (snapshot) // - // [ - // 1234, // channelID - // { - // "as": [ - // [ "5541.30000", "2.50700000", "1534614248.123678" ], - // [ "5541.80000", "0.33000000", "1534614098.345543" ], - // [ "5542.70000", "0.64700000", "1534614244.654432" ] - // ], - // "bs": [ - // [ "5541.20000", "1.52900000", "1534614248.765567" ], - // [ "5539.90000", "0.30000000", "1534614241.769870" ], - // [ "5539.50000", "5.00000000", "1534613831.243486" ] - // ] - // }, - // "book-10", - // "XBT/USD" - // ] + // { + // "channel": "book", + // "type": "snapshot", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "bids": [ + // { + // "price": 0.5666, + // "qty": 4831.75496356 + // }, + // { + // "price": 0.5665, + // "qty": 6658.22734739 + // } + // ], + // "asks": [ + // { + // "price": 0.5668, + // "qty": 4410.79769741 + // }, + // { + // "price": 0.5669, + // "qty": 4655.40412487 + // } + // ], + // "checksum": 2439117997 + // } + // ] + // } // // subsequent updates // - // [ - // 1234, - // { // optional - // "a": [ - // [ "5541.30000", "2.50700000", "1534614248.456738" ], - // [ "5542.50000", "0.40100000", "1534614248.456738" ] - // ] - // }, - // { // optional - // "b": [ - // [ "5541.30000", "0.00000000", "1534614335.345903" ] - // ] - // }, - // "book-10", - // "XBT/USD" - // ] + // { + // "channel": "book", + // "type": "update", + // "data": [ + // { + // "symbol": "MATIC/USD", + // "bids": [ + // { + // "price": 0.5657, + // "qty": 1098.3947558 + // } + // ], + // "asks": [], + // "checksum": 2114181697, + // "timestamp": "2023-10-06T17:35:55.440295Z" + // } + // ] + // } // - const messageLength = message.length; - const wsName = message[messageLength - 1]; - const bookDepthString = message[messageLength - 2]; - const parts = bookDepthString.split('-'); - const depth = this.safeInteger(parts, 1, 10); - const market = this.safeValue(this.options['marketsByWsName'], wsName); - const symbol = market['symbol']; - let timestamp = undefined; + const type = this.safeString(message, 'type'); + const data = this.safeList(message, 'data', []); + const first = this.safeDict(data, 0, {}); + const symbol = this.safeString(first, 'symbol'); + const a = this.safeValue(first, 'asks', []); + const b = this.safeValue(first, 'bids', []); + const c = this.safeInteger(first, 'checksum'); const messageHash = this.getMessageHash('orderbook', undefined, symbol); - // if this is a snapshot - if ('as' in message[1]) { - // todo get depth from marketsByWsName - this.orderbooks[symbol] = this.orderBook({}, depth); - const orderbook = this.orderbooks[symbol]; - const sides = { - 'as': 'asks', - 'bs': 'bids', - }; - const keys = Object.keys(sides); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - const side = sides[key]; - const bookside = orderbook[side]; - const deltas = this.safeValue(message[1], key, []); - timestamp = this.customHandleDeltas(bookside, deltas, timestamp); - } - orderbook['symbol'] = symbol; - orderbook['timestamp'] = timestamp; - orderbook['datetime'] = this.iso8601(timestamp); - client.resolve(orderbook, messageHash); - } - else { - const orderbook = this.orderbooks[symbol]; - // else, if this is an orderbook update - let a = undefined; - let b = undefined; - let c = undefined; - if (messageLength === 5) { - a = this.safeValue(message[1], 'a', []); - b = this.safeValue(message[2], 'b', []); - c = this.safeInteger(message[1], 'c'); - c = this.safeInteger(message[2], 'c', c); - } - else { - c = this.safeInteger(message[1], 'c'); - if ('a' in message[1]) { - a = this.safeValue(message[1], 'a', []); - } - else { - b = this.safeValue(message[1], 'b', []); - } - } + let orderbook = undefined; + if (type === 'update') { + orderbook = this.orderbooks[symbol]; const storedAsks = orderbook['asks']; const storedBids = orderbook['bids']; - let example = undefined; if (a !== undefined) { - timestamp = this.customHandleDeltas(storedAsks, a, timestamp); - example = this.safeValue(a, 0); + this.customHandleDeltas(storedAsks, a); } if (b !== undefined) { - timestamp = this.customHandleDeltas(storedBids, b, timestamp); - example = this.safeValue(b, 0); + this.customHandleDeltas(storedBids, b); } - // don't remove this line or I will poop on your face - orderbook.limit(); - const checksum = this.handleOption('watchOrderBook', 'checksum', true); - if (checksum) { - const priceString = this.safeString(example, 0); - const amountString = this.safeString(example, 1); - const priceParts = priceString.split('.'); - const amountParts = amountString.split('.'); - const priceLength = priceParts[1].length - 0; - const amountLength = amountParts[1].length - 0; - const payloadArray = []; - if (c !== undefined) { - for (let i = 0; i < 10; i++) { - const formatted = this.formatNumber(storedAsks[i][0], priceLength) + this.formatNumber(storedAsks[i][1], amountLength); - payloadArray.push(formatted); - } - for (let i = 0; i < 10; i++) { - const formatted = this.formatNumber(storedBids[i][0], priceLength) + this.formatNumber(storedBids[i][1], amountLength); - payloadArray.push(formatted); - } - } - const payload = payloadArray.join(''); - const localChecksum = this.crc32(payload, false); - if (localChecksum !== c) { - const error = new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ChecksumError(this.id + ' ' + this.orderbookChecksumMessage(symbol)); - delete client.subscriptions[messageHash]; - delete this.orderbooks[symbol]; - client.reject(error, messageHash); - return; + const datetime = this.safeString(first, 'timestamp'); + orderbook['symbol'] = symbol; + orderbook['timestamp'] = this.parse8601(datetime); + orderbook['datetime'] = datetime; + } + else { + // snapshot + const depth = a.length; + this.orderbooks[symbol] = this.orderBook({}, depth); + orderbook = this.orderbooks[symbol]; + const keys = ['asks', 'bids']; + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const bookside = orderbook[key]; + const deltas = this.safeValue(first, key, []); + if (deltas.length > 0) { + this.customHandleDeltas(bookside, deltas); } } orderbook['symbol'] = symbol; - orderbook['timestamp'] = timestamp; - orderbook['datetime'] = this.iso8601(timestamp); - client.resolve(orderbook, messageHash); + } + orderbook.limit(); + // checksum temporarily disabled because the exchange checksum was not reliable + const checksum = this.handleOption('watchOrderBook', 'checksum', false); + if (checksum) { + const payloadArray = []; + if (c !== undefined) { + const checkAsks = orderbook['asks']; + const checkBids = orderbook['bids']; + // const checkAsks = asks.map ((elem) => [ elem['price'], elem['qty'] ]); + // const checkBids = bids.map ((elem) => [ elem['price'], elem['qty'] ]); + for (let i = 0; i < 10; i++) { + const currentAsk = this.safeValue(checkAsks, i, {}); + const formattedAsk = this.formatNumber(currentAsk[0]) + this.formatNumber(currentAsk[1]); + payloadArray.push(formattedAsk); + } + for (let i = 0; i < 10; i++) { + const currentBid = this.safeValue(checkBids, i, {}); + const formattedBid = this.formatNumber(currentBid[0]) + this.formatNumber(currentBid[1]); + payloadArray.push(formattedBid); + } + } + const payload = payloadArray.join(''); + const localChecksum = this.crc32(payload, false); + if (localChecksum !== c) { + const error = new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ChecksumError(this.id + ' ' + this.orderbookChecksumMessage(symbol)); + delete client.subscriptions[messageHash]; + delete this.orderbooks[symbol]; + client.reject(error, messageHash); + return; + } + } + client.resolve(orderbook, messageHash); + } + customHandleDeltas(bookside, deltas) { + // const sortOrder = (key === 'bids') ? true : false; + for (let j = 0; j < deltas.length; j++) { + const delta = deltas[j]; + const price = this.safeNumber(delta, 'price'); + const amount = this.safeNumber(delta, 'qty'); + bookside.store(price, amount); + // if (amount === 0) { + // const index = bookside.findIndex ((x: Int) => x[0] === price); + // bookside.splice (index, 1); + // } else { + // bookside.store (price, amount); + // } + // bookside = this.sortBy (bookside, 0, sortOrder); + // bookside.slice (0, 9); } } - formatNumber(n, length) { - const stringNumber = this.numberToString(n); - const parts = stringNumber.split('.'); + formatNumber(data) { + const parts = data.split('.'); const integer = this.safeString(parts, 0); const decimals = this.safeString(parts, 1, ''); - const paddedDecimals = decimals.padEnd(length, '0'); - const joined = integer + paddedDecimals; + let joinedResult = integer + decimals; let i = 0; - while (joined[i] === '0') { + while (joinedResult[i] === '0') { i += 1; } if (i > 0) { - return joined.slice(i); - } - else { - return joined; + joinedResult = joinedResult.slice(i); } - } - customHandleDeltas(bookside, deltas, timestamp = undefined) { - for (let j = 0; j < deltas.length; j++) { - const delta = deltas[j]; - const price = this.parseNumber(delta[0]); - const amount = this.parseNumber(delta[1]); - const oldTimestamp = timestamp ? timestamp : 0; - timestamp = Math.max(oldTimestamp, this.parseToInt(parseFloat(delta[2]) * 1000)); - bookside.store(price, amount); - } - return timestamp; + return joinedResult; } handleSystemStatus(client, message) { // @@ -316554,7 +314157,11 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A const client = this.client(url); const authenticated = 'authenticated'; let subscription = this.safeValue(client.subscriptions, authenticated); - if (subscription === undefined) { + const now = this.seconds(); + const start = this.safeInteger(subscription, 'start'); + const expires = this.safeInteger(subscription, 'expires'); + if ((subscription === undefined) || ((subscription !== undefined) && (start + expires) <= now)) { + // https://docs.kraken.com/api/docs/rest-api/get-websockets-token const response = await this.privatePostGetWebSocketsToken(params); // // { @@ -316565,7 +314172,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A // } // } // - subscription = this.safeValue(response, 'result'); + subscription = this.safeDict(response, 'result'); + subscription['start'] = now; client.subscriptions[authenticated] = subscription; } return this.safeString(subscription, 'token'); @@ -317031,25 +314639,25 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A symbols = this.marketSymbols(symbols, undefined, false, true, false); const messageHashes = []; for (let i = 0; i < symbols.length; i++) { - messageHashes.push(this.getMessageHash(unifiedName, undefined, this.symbol(symbols[i]))); - } - // for WS subscriptions, we can't use .marketIds (symbols), instead a custom is field needed - const markets = this.marketsForSymbols(symbols); - const wsMarketIds = []; - for (let i = 0; i < markets.length; i++) { - const wsMarketId = this.safeString(markets[i]['info'], 'wsname'); - wsMarketIds.push(wsMarketId); + const eventTrigger = this.safeString(params, 'event_trigger'); + if (eventTrigger !== undefined) { + messageHashes.push(this.getMessageHash(channelName, undefined, this.symbol(symbols[i]))); + } + else { + messageHashes.push(this.getMessageHash(unifiedName, undefined, this.symbol(symbols[i]))); + } } const request = { - 'event': 'subscribe', - 'reqid': this.requestId(), - 'pair': wsMarketIds, - 'subscription': { - 'name': channelName, + 'method': 'subscribe', + 'params': { + 'channel': channelName, + 'symbol': symbols, }, + 'req_id': this.requestId(), }; - const url = this.urls['api']['ws']['public']; - return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), messageHashes, subscriptionArgs); + request['params'] = this.deepExtend(request['params'], params); + const url = this.urls['api']['ws']['publicV2']; + return await this.watchMultiple(url, messageHashes, request, messageHashes, subscriptionArgs); } /** * @method @@ -317214,11 +314822,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A const name = this.safeString(info, 'name'); const methods = { // public - 'book': this.handleOrderBook, 'ohlc': this.handleOHLCV, - 'ticker': this.handleTicker, - 'spread': this.handleBidAsk, - 'trade': this.handleTrades, // private 'openOrders': this.handleOrders, 'ownTrades': this.handleMyTrades, @@ -317233,6 +314837,9 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A if (channel !== undefined) { const methods = { 'balances': this.handleBalance, + 'book': this.handleOrderBook, + 'ticker': this.handleTicker, + 'trade': this.handleTrades, }; const method = this.safeValue(methods, channel); if (method !== undefined) { @@ -317249,6 +314856,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A 'amend_order': this.handleCreateEditOrder, 'cancel_order': this.handleCancelOrder, 'cancel_all': this.handleCancelAllOrders, + 'pong': this.handlePong, }; const method = this.safeValue(methods, event); if (method !== undefined) { @@ -323948,7 +321556,6 @@ class mexc extends _mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A { */ async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) { await this.loadMarkets(); - params = this.omit(params, 'type'); let messageHash = 'orders'; let market = undefined; if (symbol !== undefined) { @@ -370468,13 +368075,13 @@ class tradeogre extends _abstract_tradeogre_js__WEBPACK_IMPORTED_MODULE_0__/* [" 'vwap': undefined, 'open': this.safeString(ticker, 'initialprice'), 'close': this.safeString(ticker, 'price'), - 'last': undefined, + 'last': this.safeString(ticker, 'price'), 'previousClose': undefined, 'change': undefined, 'percentage': undefined, 'average': undefined, - 'baseVolume': undefined, - 'quoteVolume': this.safeString(ticker, 'volume'), + 'baseVolume': this.safeString(ticker, 'volume'), + 'quoteVolume': undefined, 'info': ticker, }, market); } @@ -392227,7 +389834,7 @@ class xt extends _abstract_xt_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ . request['state'] = 'NOT_TRIGGERED'; } else if (type === 'swap') { - request['state'] = 'NEW'; + request['state'] = 'UNFINISHED'; // NEW & PARTIALLY_FILLED } } else if (status === 'closed') { @@ -407570,48 +405177,48 @@ async function __wbg_init(input) { var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ AccountNotEnabled: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.AccountNotEnabled), -/* harmony export */ AccountSuspended: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.AccountSuspended), -/* harmony export */ AddressPending: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.AddressPending), -/* harmony export */ ArgumentsRequired: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ArgumentsRequired), -/* harmony export */ AuthenticationError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.AuthenticationError), -/* harmony export */ BadRequest: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.BadRequest), -/* harmony export */ BadResponse: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.BadResponse), -/* harmony export */ BadSymbol: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.BadSymbol), -/* harmony export */ BaseError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.BaseError), -/* harmony export */ CancelPending: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.CancelPending), -/* harmony export */ ChecksumError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ChecksumError), -/* harmony export */ ContractUnavailable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ContractUnavailable), -/* harmony export */ DDoSProtection: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.DDoSProtection), -/* harmony export */ DuplicateOrderId: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.DuplicateOrderId), +/* harmony export */ AccountNotEnabled: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.AccountNotEnabled), +/* harmony export */ AccountSuspended: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.AccountSuspended), +/* harmony export */ AddressPending: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.AddressPending), +/* harmony export */ ArgumentsRequired: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ArgumentsRequired), +/* harmony export */ AuthenticationError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.AuthenticationError), +/* harmony export */ BadRequest: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.BadRequest), +/* harmony export */ BadResponse: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.BadResponse), +/* harmony export */ BadSymbol: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.BadSymbol), +/* harmony export */ BaseError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.BaseError), +/* harmony export */ CancelPending: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.CancelPending), +/* harmony export */ ChecksumError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ChecksumError), +/* harmony export */ ContractUnavailable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ContractUnavailable), +/* harmony export */ DDoSProtection: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.DDoSProtection), +/* harmony export */ DuplicateOrderId: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.DuplicateOrderId), /* harmony export */ Exchange: () => (/* reexport safe */ ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_.k), -/* harmony export */ ExchangeClosedByUser: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ExchangeClosedByUser), -/* harmony export */ ExchangeError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ExchangeError), -/* harmony export */ ExchangeNotAvailable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ExchangeNotAvailable), -/* harmony export */ InsufficientFunds: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.InsufficientFunds), -/* harmony export */ InvalidAddress: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.InvalidAddress), -/* harmony export */ InvalidNonce: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.InvalidNonce), -/* harmony export */ InvalidOrder: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.InvalidOrder), -/* harmony export */ InvalidProxySettings: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.InvalidProxySettings), -/* harmony export */ ManualInteractionNeeded: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.ManualInteractionNeeded), -/* harmony export */ MarginModeAlreadySet: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.MarginModeAlreadySet), -/* harmony export */ MarketClosed: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.MarketClosed), -/* harmony export */ NetworkError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.NetworkError), -/* harmony export */ NoChange: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.NoChange), -/* harmony export */ NotSupported: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.NotSupported), -/* harmony export */ NullResponse: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.NullResponse), -/* harmony export */ OnMaintenance: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OnMaintenance), -/* harmony export */ OperationFailed: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OperationFailed), -/* harmony export */ OperationRejected: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OperationRejected), -/* harmony export */ OrderImmediatelyFillable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OrderImmediatelyFillable), -/* harmony export */ OrderNotCached: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OrderNotCached), -/* harmony export */ OrderNotFillable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OrderNotFillable), -/* harmony export */ OrderNotFound: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.OrderNotFound), -/* harmony export */ PermissionDenied: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.PermissionDenied), -/* harmony export */ Precise: () => (/* reexport safe */ ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_180_.Y), -/* harmony export */ RateLimitExceeded: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.RateLimitExceeded), -/* harmony export */ RequestTimeout: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.RequestTimeout), -/* harmony export */ UnsubscribeError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_.UnsubscribeError), +/* harmony export */ ExchangeClosedByUser: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ExchangeClosedByUser), +/* harmony export */ ExchangeError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ExchangeError), +/* harmony export */ ExchangeNotAvailable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ExchangeNotAvailable), +/* harmony export */ InsufficientFunds: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.InsufficientFunds), +/* harmony export */ InvalidAddress: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.InvalidAddress), +/* harmony export */ InvalidNonce: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.InvalidNonce), +/* harmony export */ InvalidOrder: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.InvalidOrder), +/* harmony export */ InvalidProxySettings: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.InvalidProxySettings), +/* harmony export */ ManualInteractionNeeded: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.ManualInteractionNeeded), +/* harmony export */ MarginModeAlreadySet: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.MarginModeAlreadySet), +/* harmony export */ MarketClosed: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.MarketClosed), +/* harmony export */ NetworkError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.NetworkError), +/* harmony export */ NoChange: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.NoChange), +/* harmony export */ NotSupported: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.NotSupported), +/* harmony export */ NullResponse: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.NullResponse), +/* harmony export */ OnMaintenance: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OnMaintenance), +/* harmony export */ OperationFailed: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OperationFailed), +/* harmony export */ OperationRejected: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OperationRejected), +/* harmony export */ OrderImmediatelyFillable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OrderImmediatelyFillable), +/* harmony export */ OrderNotCached: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OrderNotCached), +/* harmony export */ OrderNotFillable: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OrderNotFillable), +/* harmony export */ OrderNotFound: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.OrderNotFound), +/* harmony export */ PermissionDenied: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.PermissionDenied), +/* harmony export */ Precise: () => (/* reexport safe */ ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_179_.Y), +/* harmony export */ RateLimitExceeded: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.RateLimitExceeded), +/* harmony export */ RequestTimeout: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.RequestTimeout), +/* harmony export */ UnsubscribeError: () => (/* reexport safe */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_.UnsubscribeError), /* harmony export */ alpaca: () => (/* reexport safe */ ccxt_src_alpaca_js_WEBPACK_IMPORTED_MODULE_1_.A), /* harmony export */ apex: () => (/* reexport safe */ ccxt_src_apex_js_WEBPACK_IMPORTED_MODULE_2_.A), /* harmony export */ ascendex: () => (/* reexport safe */ ccxt_src_ascendex_js_WEBPACK_IMPORTED_MODULE_3_.A), @@ -407653,82 +405260,81 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ coincatch: () => (/* reexport safe */ ccxt_src_coincatch_js_WEBPACK_IMPORTED_MODULE_39_.A), /* harmony export */ coincheck: () => (/* reexport safe */ ccxt_src_coincheck_js_WEBPACK_IMPORTED_MODULE_40_.A), /* harmony export */ coinex: () => (/* reexport safe */ ccxt_src_coinex_js_WEBPACK_IMPORTED_MODULE_41_.A), -/* harmony export */ coinlist: () => (/* reexport safe */ ccxt_src_coinlist_js_WEBPACK_IMPORTED_MODULE_42_.A), -/* harmony export */ coinmate: () => (/* reexport safe */ ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_43_.A), -/* harmony export */ coinmetro: () => (/* reexport safe */ ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_44_.A), -/* harmony export */ coinone: () => (/* reexport safe */ ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_45_.A), -/* harmony export */ coinsph: () => (/* reexport safe */ ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_46_.A), -/* harmony export */ coinspot: () => (/* reexport safe */ ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_47_.A), -/* harmony export */ cryptocom: () => (/* reexport safe */ ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_48_.A), -/* harmony export */ cryptomus: () => (/* reexport safe */ ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_49_.A), +/* harmony export */ coinmate: () => (/* reexport safe */ ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_42_.A), +/* harmony export */ coinmetro: () => (/* reexport safe */ ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_43_.A), +/* harmony export */ coinone: () => (/* reexport safe */ ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_44_.A), +/* harmony export */ coinsph: () => (/* reexport safe */ ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_45_.A), +/* harmony export */ coinspot: () => (/* reexport safe */ ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_46_.A), +/* harmony export */ cryptocom: () => (/* reexport safe */ ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_47_.A), +/* harmony export */ cryptomus: () => (/* reexport safe */ ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_48_.A), /* harmony export */ "default": () => (ts_ccxt), -/* harmony export */ defx: () => (/* reexport safe */ ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_50_.A), -/* harmony export */ delta: () => (/* reexport safe */ ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_51_.A), -/* harmony export */ deribit: () => (/* reexport safe */ ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_52_.A), -/* harmony export */ derive: () => (/* reexport safe */ ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_53_.A), -/* harmony export */ digifinex: () => (/* reexport safe */ ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_54_.A), -/* harmony export */ ellipx: () => (/* reexport safe */ ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_55_.A), -/* harmony export */ errors: () => (/* reexport module object */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_), +/* harmony export */ defx: () => (/* reexport safe */ ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_49_.A), +/* harmony export */ delta: () => (/* reexport safe */ ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_50_.A), +/* harmony export */ deribit: () => (/* reexport safe */ ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_51_.A), +/* harmony export */ derive: () => (/* reexport safe */ ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_52_.A), +/* harmony export */ digifinex: () => (/* reexport safe */ ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_53_.A), +/* harmony export */ ellipx: () => (/* reexport safe */ ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_54_.A), +/* harmony export */ errors: () => (/* reexport module object */ ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_), /* harmony export */ exchanges: () => (/* binding */ ccxt_exchanges), -/* harmony export */ exmo: () => (/* reexport safe */ ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_56_.A), -/* harmony export */ fmfwio: () => (/* reexport safe */ ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_57_.A), -/* harmony export */ functions: () => (/* reexport module object */ ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_181_), -/* harmony export */ gate: () => (/* reexport safe */ ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_58_.A), -/* harmony export */ gateio: () => (/* reexport safe */ ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_59_.A), -/* harmony export */ gemini: () => (/* reexport safe */ ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_60_.A), -/* harmony export */ hashkey: () => (/* reexport safe */ ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_61_.A), -/* harmony export */ hitbtc: () => (/* reexport safe */ ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_62_.A), -/* harmony export */ hollaex: () => (/* reexport safe */ ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_63_.A), -/* harmony export */ htx: () => (/* reexport safe */ ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_64_.A), -/* harmony export */ huobi: () => (/* reexport safe */ ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_65_.A), -/* harmony export */ hyperliquid: () => (/* reexport safe */ ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_66_.A), -/* harmony export */ independentreserve: () => (/* reexport safe */ ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_67_.A), -/* harmony export */ indodax: () => (/* reexport safe */ ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_68_.A), -/* harmony export */ kraken: () => (/* reexport safe */ ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_69_.A), -/* harmony export */ krakenfutures: () => (/* reexport safe */ ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_70_.A), -/* harmony export */ kucoin: () => (/* reexport safe */ ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_71_.A), -/* harmony export */ kucoinfutures: () => (/* reexport safe */ ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_72_.A), -/* harmony export */ latoken: () => (/* reexport safe */ ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_73_.A), -/* harmony export */ lbank: () => (/* reexport safe */ ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_74_.A), -/* harmony export */ luno: () => (/* reexport safe */ ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_75_.A), -/* harmony export */ mercado: () => (/* reexport safe */ ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_76_.A), -/* harmony export */ mexc: () => (/* reexport safe */ ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_77_.A), -/* harmony export */ modetrade: () => (/* reexport safe */ ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_78_.A), -/* harmony export */ myokx: () => (/* reexport safe */ ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_79_.A), -/* harmony export */ ndax: () => (/* reexport safe */ ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_80_.A), -/* harmony export */ novadax: () => (/* reexport safe */ ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_81_.A), -/* harmony export */ oceanex: () => (/* reexport safe */ ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_82_.A), -/* harmony export */ okcoin: () => (/* reexport safe */ ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_83_.A), -/* harmony export */ okx: () => (/* reexport safe */ ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_84_.A), -/* harmony export */ okxus: () => (/* reexport safe */ ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_85_.A), -/* harmony export */ onetrading: () => (/* reexport safe */ ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_86_.A), -/* harmony export */ oxfun: () => (/* reexport safe */ ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_87_.A), -/* harmony export */ p2b: () => (/* reexport safe */ ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_88_.A), -/* harmony export */ paradex: () => (/* reexport safe */ ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_89_.A), -/* harmony export */ paymium: () => (/* reexport safe */ ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_90_.A), -/* harmony export */ phemex: () => (/* reexport safe */ ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_91_.A), -/* harmony export */ poloniex: () => (/* reexport safe */ ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_92_.A), +/* harmony export */ exmo: () => (/* reexport safe */ ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_55_.A), +/* harmony export */ fmfwio: () => (/* reexport safe */ ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_56_.A), +/* harmony export */ functions: () => (/* reexport module object */ ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_180_), +/* harmony export */ gate: () => (/* reexport safe */ ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_57_.A), +/* harmony export */ gateio: () => (/* reexport safe */ ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_58_.A), +/* harmony export */ gemini: () => (/* reexport safe */ ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_59_.A), +/* harmony export */ hashkey: () => (/* reexport safe */ ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_60_.A), +/* harmony export */ hitbtc: () => (/* reexport safe */ ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_61_.A), +/* harmony export */ hollaex: () => (/* reexport safe */ ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_62_.A), +/* harmony export */ htx: () => (/* reexport safe */ ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_63_.A), +/* harmony export */ huobi: () => (/* reexport safe */ ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_64_.A), +/* harmony export */ hyperliquid: () => (/* reexport safe */ ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_65_.A), +/* harmony export */ independentreserve: () => (/* reexport safe */ ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_66_.A), +/* harmony export */ indodax: () => (/* reexport safe */ ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_67_.A), +/* harmony export */ kraken: () => (/* reexport safe */ ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_68_.A), +/* harmony export */ krakenfutures: () => (/* reexport safe */ ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_69_.A), +/* harmony export */ kucoin: () => (/* reexport safe */ ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_70_.A), +/* harmony export */ kucoinfutures: () => (/* reexport safe */ ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_71_.A), +/* harmony export */ latoken: () => (/* reexport safe */ ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_72_.A), +/* harmony export */ lbank: () => (/* reexport safe */ ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_73_.A), +/* harmony export */ luno: () => (/* reexport safe */ ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_74_.A), +/* harmony export */ mercado: () => (/* reexport safe */ ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_75_.A), +/* harmony export */ mexc: () => (/* reexport safe */ ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_76_.A), +/* harmony export */ modetrade: () => (/* reexport safe */ ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_77_.A), +/* harmony export */ myokx: () => (/* reexport safe */ ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_78_.A), +/* harmony export */ ndax: () => (/* reexport safe */ ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_79_.A), +/* harmony export */ novadax: () => (/* reexport safe */ ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_80_.A), +/* harmony export */ oceanex: () => (/* reexport safe */ ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_81_.A), +/* harmony export */ okcoin: () => (/* reexport safe */ ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_82_.A), +/* harmony export */ okx: () => (/* reexport safe */ ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_83_.A), +/* harmony export */ okxus: () => (/* reexport safe */ ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_84_.A), +/* harmony export */ onetrading: () => (/* reexport safe */ ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_85_.A), +/* harmony export */ oxfun: () => (/* reexport safe */ ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_86_.A), +/* harmony export */ p2b: () => (/* reexport safe */ ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_87_.A), +/* harmony export */ paradex: () => (/* reexport safe */ ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_88_.A), +/* harmony export */ paymium: () => (/* reexport safe */ ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_89_.A), +/* harmony export */ phemex: () => (/* reexport safe */ ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_90_.A), +/* harmony export */ poloniex: () => (/* reexport safe */ ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_91_.A), /* harmony export */ pro: () => (/* binding */ ccxt_pro), -/* harmony export */ probit: () => (/* reexport safe */ ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_93_.A), -/* harmony export */ timex: () => (/* reexport safe */ ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_94_.A), -/* harmony export */ tokocrypto: () => (/* reexport safe */ ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_95_.A), -/* harmony export */ tradeogre: () => (/* reexport safe */ ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_96_.A), -/* harmony export */ upbit: () => (/* reexport safe */ ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_97_.A), +/* harmony export */ probit: () => (/* reexport safe */ ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_92_.A), +/* harmony export */ timex: () => (/* reexport safe */ ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_93_.A), +/* harmony export */ tokocrypto: () => (/* reexport safe */ ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_94_.A), +/* harmony export */ tradeogre: () => (/* reexport safe */ ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_95_.A), +/* harmony export */ upbit: () => (/* reexport safe */ ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_96_.A), /* harmony export */ version: () => (/* binding */ ccxt_version), -/* harmony export */ vertex: () => (/* reexport safe */ ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_98_.A), -/* harmony export */ wavesexchange: () => (/* reexport safe */ ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_99_.A), -/* harmony export */ whitebit: () => (/* reexport safe */ ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_100_.A), -/* harmony export */ woo: () => (/* reexport safe */ ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_101_.A), -/* harmony export */ woofipro: () => (/* reexport safe */ ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_102_.A), -/* harmony export */ xt: () => (/* reexport safe */ ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_103_.A), -/* harmony export */ yobit: () => (/* reexport safe */ ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_104_.A), -/* harmony export */ zaif: () => (/* reexport safe */ ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_105_.A), -/* harmony export */ zonda: () => (/* reexport safe */ ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_106_.A) +/* harmony export */ vertex: () => (/* reexport safe */ ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_97_.A), +/* harmony export */ wavesexchange: () => (/* reexport safe */ ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_98_.A), +/* harmony export */ whitebit: () => (/* reexport safe */ ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_99_.A), +/* harmony export */ woo: () => (/* reexport safe */ ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_100_.A), +/* harmony export */ woofipro: () => (/* reexport safe */ ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_101_.A), +/* harmony export */ xt: () => (/* reexport safe */ ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_102_.A), +/* harmony export */ yobit: () => (/* reexport safe */ ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_103_.A), +/* harmony export */ zaif: () => (/* reexport safe */ ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_104_.A), +/* harmony export */ zonda: () => (/* reexport safe */ ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_105_.A) /* harmony export */ }); /* harmony import */ var ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(2961); -/* harmony import */ var ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_180_ = __webpack_require__(5147); -/* harmony import */ var ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_181_ = __webpack_require__(5095); -/* harmony import */ var ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_ = __webpack_require__(2079); +/* harmony import */ var ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_179_ = __webpack_require__(5147); +/* harmony import */ var ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_180_ = __webpack_require__(5095); +/* harmony import */ var ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_ = __webpack_require__(2079); /* harmony import */ var ccxt_src_alpaca_js_WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(7930); /* harmony import */ var ccxt_src_apex_js_WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(4920); /* harmony import */ var ccxt_src_ascendex_js_WEBPACK_IMPORTED_MODULE_3_ = __webpack_require__(1411); @@ -407770,144 +405376,143 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var ccxt_src_coincatch_js_WEBPACK_IMPORTED_MODULE_39_ = __webpack_require__(570); /* harmony import */ var ccxt_src_coincheck_js_WEBPACK_IMPORTED_MODULE_40_ = __webpack_require__(2741); /* harmony import */ var ccxt_src_coinex_js_WEBPACK_IMPORTED_MODULE_41_ = __webpack_require__(9344); -/* harmony import */ var ccxt_src_coinlist_js_WEBPACK_IMPORTED_MODULE_42_ = __webpack_require__(7477); -/* harmony import */ var ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_43_ = __webpack_require__(6016); -/* harmony import */ var ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_44_ = __webpack_require__(8692); -/* harmony import */ var ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_45_ = __webpack_require__(5377); -/* harmony import */ var ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_46_ = __webpack_require__(2692); -/* harmony import */ var ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_47_ = __webpack_require__(1669); -/* harmony import */ var ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_48_ = __webpack_require__(6068); -/* harmony import */ var ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_49_ = __webpack_require__(870); -/* harmony import */ var ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_50_ = __webpack_require__(6077); -/* harmony import */ var ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_51_ = __webpack_require__(1080); -/* harmony import */ var ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_52_ = __webpack_require__(2591); -/* harmony import */ var ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_53_ = __webpack_require__(1839); -/* harmony import */ var ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_54_ = __webpack_require__(779); -/* harmony import */ var ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_55_ = __webpack_require__(1962); -/* harmony import */ var ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_56_ = __webpack_require__(7057); -/* harmony import */ var ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_57_ = __webpack_require__(3042); -/* harmony import */ var ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_58_ = __webpack_require__(9403); -/* harmony import */ var ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_59_ = __webpack_require__(784); -/* harmony import */ var ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_60_ = __webpack_require__(8823); -/* harmony import */ var ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_61_ = __webpack_require__(2937); -/* harmony import */ var ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_62_ = __webpack_require__(7996); -/* harmony import */ var ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_63_ = __webpack_require__(4455); -/* harmony import */ var ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_64_ = __webpack_require__(9946); -/* harmony import */ var ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_65_ = __webpack_require__(63); -/* harmony import */ var ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_66_ = __webpack_require__(1936); -/* harmony import */ var ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_67_ = __webpack_require__(4162); -/* harmony import */ var ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_68_ = __webpack_require__(7325); -/* harmony import */ var ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_69_ = __webpack_require__(8042); -/* harmony import */ var ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_70_ = __webpack_require__(2300); -/* harmony import */ var ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_71_ = __webpack_require__(1397); -/* harmony import */ var ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_72_ = __webpack_require__(6217); -/* harmony import */ var ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_73_ = __webpack_require__(8146); -/* harmony import */ var ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_74_ = __webpack_require__(3144); -/* harmony import */ var ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_75_ = __webpack_require__(9248); -/* harmony import */ var ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_76_ = __webpack_require__(6419); -/* harmony import */ var ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_77_ = __webpack_require__(2403); -/* harmony import */ var ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_78_ = __webpack_require__(5345); -/* harmony import */ var ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_79_ = __webpack_require__(8982); -/* harmony import */ var ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_80_ = __webpack_require__(4460); -/* harmony import */ var ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_81_ = __webpack_require__(8473); -/* harmony import */ var ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_82_ = __webpack_require__(3805); -/* harmony import */ var ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_83_ = __webpack_require__(7915); -/* harmony import */ var ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_84_ = __webpack_require__(3660); -/* harmony import */ var ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_85_ = __webpack_require__(3536); -/* harmony import */ var ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_86_ = __webpack_require__(3573); -/* harmony import */ var ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_87_ = __webpack_require__(6358); -/* harmony import */ var ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_88_ = __webpack_require__(4998); -/* harmony import */ var ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_89_ = __webpack_require__(6993); -/* harmony import */ var ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_90_ = __webpack_require__(3280); -/* harmony import */ var ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_91_ = __webpack_require__(9075); -/* harmony import */ var ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_92_ = __webpack_require__(288); -/* harmony import */ var ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_93_ = __webpack_require__(5037); -/* harmony import */ var ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_94_ = __webpack_require__(6213); -/* harmony import */ var ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_95_ = __webpack_require__(2490); -/* harmony import */ var ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_96_ = __webpack_require__(5887); -/* harmony import */ var ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_97_ = __webpack_require__(930); -/* harmony import */ var ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_98_ = __webpack_require__(4910); -/* harmony import */ var ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_99_ = __webpack_require__(7073); -/* harmony import */ var ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_100_ = __webpack_require__(5336); -/* harmony import */ var ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_101_ = __webpack_require__(669); -/* harmony import */ var ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_102_ = __webpack_require__(9641); -/* harmony import */ var ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_103_ = __webpack_require__(5344); -/* harmony import */ var ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_104_ = __webpack_require__(7469); -/* harmony import */ var ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_105_ = __webpack_require__(1530); -/* harmony import */ var ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_106_ = __webpack_require__(6022); -/* harmony import */ var ccxt_src_pro_alpaca_js_WEBPACK_IMPORTED_MODULE_107_ = __webpack_require__(6810); -/* harmony import */ var ccxt_src_pro_apex_js_WEBPACK_IMPORTED_MODULE_108_ = __webpack_require__(136); -/* harmony import */ var ccxt_src_pro_ascendex_js_WEBPACK_IMPORTED_MODULE_109_ = __webpack_require__(1657); -/* harmony import */ var ccxt_src_pro_bequant_js_WEBPACK_IMPORTED_MODULE_110_ = __webpack_require__(9338); -/* harmony import */ var ccxt_src_pro_binance_js_WEBPACK_IMPORTED_MODULE_111_ = __webpack_require__(9544); -/* harmony import */ var ccxt_src_pro_binancecoinm_js_WEBPACK_IMPORTED_MODULE_112_ = __webpack_require__(902); -/* harmony import */ var ccxt_src_pro_binanceus_js_WEBPACK_IMPORTED_MODULE_113_ = __webpack_require__(8788); -/* harmony import */ var ccxt_src_pro_binanceusdm_js_WEBPACK_IMPORTED_MODULE_114_ = __webpack_require__(8251); -/* harmony import */ var ccxt_src_pro_bingx_js_WEBPACK_IMPORTED_MODULE_115_ = __webpack_require__(9456); -/* harmony import */ var ccxt_src_pro_bitfinex_js_WEBPACK_IMPORTED_MODULE_116_ = __webpack_require__(1038); -/* harmony import */ var ccxt_src_pro_bitget_js_WEBPACK_IMPORTED_MODULE_117_ = __webpack_require__(205); -/* harmony import */ var ccxt_src_pro_bithumb_js_WEBPACK_IMPORTED_MODULE_118_ = __webpack_require__(6181); -/* harmony import */ var ccxt_src_pro_bitmart_js_WEBPACK_IMPORTED_MODULE_119_ = __webpack_require__(3069); -/* harmony import */ var ccxt_src_pro_bitmex_js_WEBPACK_IMPORTED_MODULE_120_ = __webpack_require__(3731); -/* harmony import */ var ccxt_src_pro_bitopro_js_WEBPACK_IMPORTED_MODULE_121_ = __webpack_require__(4401); -/* harmony import */ var ccxt_src_pro_bitrue_js_WEBPACK_IMPORTED_MODULE_122_ = __webpack_require__(3333); -/* harmony import */ var ccxt_src_pro_bitstamp_js_WEBPACK_IMPORTED_MODULE_123_ = __webpack_require__(3326); -/* harmony import */ var ccxt_src_pro_bittrade_js_WEBPACK_IMPORTED_MODULE_124_ = __webpack_require__(2391); -/* harmony import */ var ccxt_src_pro_bitvavo_js_WEBPACK_IMPORTED_MODULE_125_ = __webpack_require__(1327); -/* harmony import */ var ccxt_src_pro_blockchaincom_js_WEBPACK_IMPORTED_MODULE_126_ = __webpack_require__(8693); -/* harmony import */ var ccxt_src_pro_blofin_js_WEBPACK_IMPORTED_MODULE_127_ = __webpack_require__(1672); -/* harmony import */ var ccxt_src_pro_bybit_js_WEBPACK_IMPORTED_MODULE_128_ = __webpack_require__(8518); -/* harmony import */ var ccxt_src_pro_cex_js_WEBPACK_IMPORTED_MODULE_129_ = __webpack_require__(3774); -/* harmony import */ var ccxt_src_pro_coinbase_js_WEBPACK_IMPORTED_MODULE_130_ = __webpack_require__(8160); -/* harmony import */ var ccxt_src_pro_coinbaseadvanced_js_WEBPACK_IMPORTED_MODULE_131_ = __webpack_require__(5918); -/* harmony import */ var ccxt_src_pro_coinbaseexchange_js_WEBPACK_IMPORTED_MODULE_132_ = __webpack_require__(1925); -/* harmony import */ var ccxt_src_pro_coinbaseinternational_js_WEBPACK_IMPORTED_MODULE_133_ = __webpack_require__(998); -/* harmony import */ var ccxt_src_pro_coincatch_js_WEBPACK_IMPORTED_MODULE_134_ = __webpack_require__(3242); -/* harmony import */ var ccxt_src_pro_coincheck_js_WEBPACK_IMPORTED_MODULE_135_ = __webpack_require__(5317); -/* harmony import */ var ccxt_src_pro_coinex_js_WEBPACK_IMPORTED_MODULE_136_ = __webpack_require__(9088); -/* harmony import */ var ccxt_src_pro_coinone_js_WEBPACK_IMPORTED_MODULE_137_ = __webpack_require__(8673); -/* harmony import */ var ccxt_src_pro_cryptocom_js_WEBPACK_IMPORTED_MODULE_138_ = __webpack_require__(6292); -/* harmony import */ var ccxt_src_pro_defx_js_WEBPACK_IMPORTED_MODULE_139_ = __webpack_require__(8717); -/* harmony import */ var ccxt_src_pro_deribit_js_WEBPACK_IMPORTED_MODULE_140_ = __webpack_require__(7791); -/* harmony import */ var ccxt_src_pro_derive_js_WEBPACK_IMPORTED_MODULE_141_ = __webpack_require__(2127); -/* harmony import */ var ccxt_src_pro_exmo_js_WEBPACK_IMPORTED_MODULE_142_ = __webpack_require__(5233); -/* harmony import */ var ccxt_src_pro_gate_js_WEBPACK_IMPORTED_MODULE_143_ = __webpack_require__(9195); -/* harmony import */ var ccxt_src_pro_gateio_js_WEBPACK_IMPORTED_MODULE_144_ = __webpack_require__(5843); -/* harmony import */ var ccxt_src_pro_gemini_js_WEBPACK_IMPORTED_MODULE_145_ = __webpack_require__(375); -/* harmony import */ var ccxt_src_pro_hashkey_js_WEBPACK_IMPORTED_MODULE_146_ = __webpack_require__(1481); -/* harmony import */ var ccxt_src_pro_hitbtc_js_WEBPACK_IMPORTED_MODULE_147_ = __webpack_require__(4524); -/* harmony import */ var ccxt_src_pro_hollaex_js_WEBPACK_IMPORTED_MODULE_148_ = __webpack_require__(8247); -/* harmony import */ var ccxt_src_pro_htx_js_WEBPACK_IMPORTED_MODULE_149_ = __webpack_require__(3898); -/* harmony import */ var ccxt_src_pro_huobi_js_WEBPACK_IMPORTED_MODULE_150_ = __webpack_require__(6335); -/* harmony import */ var ccxt_src_pro_hyperliquid_js_WEBPACK_IMPORTED_MODULE_151_ = __webpack_require__(3984); -/* harmony import */ var ccxt_src_pro_independentreserve_js_WEBPACK_IMPORTED_MODULE_152_ = __webpack_require__(98); -/* harmony import */ var ccxt_src_pro_kraken_js_WEBPACK_IMPORTED_MODULE_153_ = __webpack_require__(9050); -/* harmony import */ var ccxt_src_pro_krakenfutures_js_WEBPACK_IMPORTED_MODULE_154_ = __webpack_require__(6396); -/* harmony import */ var ccxt_src_pro_kucoin_js_WEBPACK_IMPORTED_MODULE_155_ = __webpack_require__(4965); -/* harmony import */ var ccxt_src_pro_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_156_ = __webpack_require__(905); -/* harmony import */ var ccxt_src_pro_lbank_js_WEBPACK_IMPORTED_MODULE_157_ = __webpack_require__(1736); -/* harmony import */ var ccxt_src_pro_luno_js_WEBPACK_IMPORTED_MODULE_158_ = __webpack_require__(2208); -/* harmony import */ var ccxt_src_pro_mexc_js_WEBPACK_IMPORTED_MODULE_159_ = __webpack_require__(9219); -/* harmony import */ var ccxt_src_pro_modetrade_js_WEBPACK_IMPORTED_MODULE_160_ = __webpack_require__(49); -/* harmony import */ var ccxt_src_pro_myokx_js_WEBPACK_IMPORTED_MODULE_161_ = __webpack_require__(3062); -/* harmony import */ var ccxt_src_pro_ndax_js_WEBPACK_IMPORTED_MODULE_162_ = __webpack_require__(3887); -/* harmony import */ var ccxt_src_pro_okcoin_js_WEBPACK_IMPORTED_MODULE_163_ = __webpack_require__(6187); -/* harmony import */ var ccxt_src_pro_okx_js_WEBPACK_IMPORTED_MODULE_164_ = __webpack_require__(8588); -/* harmony import */ var ccxt_src_pro_okxus_js_WEBPACK_IMPORTED_MODULE_165_ = __webpack_require__(3296); -/* harmony import */ var ccxt_src_pro_onetrading_js_WEBPACK_IMPORTED_MODULE_166_ = __webpack_require__(4357); -/* harmony import */ var ccxt_src_pro_oxfun_js_WEBPACK_IMPORTED_MODULE_167_ = __webpack_require__(550); -/* harmony import */ var ccxt_src_pro_p2b_js_WEBPACK_IMPORTED_MODULE_168_ = __webpack_require__(4934); -/* harmony import */ var ccxt_src_pro_paradex_js_WEBPACK_IMPORTED_MODULE_169_ = __webpack_require__(1057); -/* harmony import */ var ccxt_src_pro_phemex_js_WEBPACK_IMPORTED_MODULE_170_ = __webpack_require__(1619); -/* harmony import */ var ccxt_src_pro_poloniex_js_WEBPACK_IMPORTED_MODULE_171_ = __webpack_require__(3456); -/* harmony import */ var ccxt_src_pro_probit_js_WEBPACK_IMPORTED_MODULE_172_ = __webpack_require__(5738); -/* harmony import */ var ccxt_src_pro_tradeogre_js_WEBPACK_IMPORTED_MODULE_173_ = __webpack_require__(8719); -/* harmony import */ var ccxt_src_pro_upbit_js_WEBPACK_IMPORTED_MODULE_174_ = __webpack_require__(5794); -/* harmony import */ var ccxt_src_pro_vertex_js_WEBPACK_IMPORTED_MODULE_175_ = __webpack_require__(910); -/* harmony import */ var ccxt_src_pro_whitebit_js_WEBPACK_IMPORTED_MODULE_176_ = __webpack_require__(4712); -/* harmony import */ var ccxt_src_pro_woo_js_WEBPACK_IMPORTED_MODULE_177_ = __webpack_require__(5869); -/* harmony import */ var ccxt_src_pro_woofipro_js_WEBPACK_IMPORTED_MODULE_178_ = __webpack_require__(8713); -/* harmony import */ var ccxt_src_pro_xt_js_WEBPACK_IMPORTED_MODULE_179_ = __webpack_require__(2368); +/* harmony import */ var ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_42_ = __webpack_require__(6016); +/* harmony import */ var ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_43_ = __webpack_require__(8692); +/* harmony import */ var ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_44_ = __webpack_require__(5377); +/* harmony import */ var ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_45_ = __webpack_require__(2692); +/* harmony import */ var ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_46_ = __webpack_require__(1669); +/* harmony import */ var ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_47_ = __webpack_require__(6068); +/* harmony import */ var ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_48_ = __webpack_require__(870); +/* harmony import */ var ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_49_ = __webpack_require__(6077); +/* harmony import */ var ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_50_ = __webpack_require__(1080); +/* harmony import */ var ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_51_ = __webpack_require__(2591); +/* harmony import */ var ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_52_ = __webpack_require__(1839); +/* harmony import */ var ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_53_ = __webpack_require__(779); +/* harmony import */ var ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_54_ = __webpack_require__(1962); +/* harmony import */ var ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_55_ = __webpack_require__(7057); +/* harmony import */ var ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_56_ = __webpack_require__(3042); +/* harmony import */ var ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_57_ = __webpack_require__(9403); +/* harmony import */ var ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_58_ = __webpack_require__(784); +/* harmony import */ var ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_59_ = __webpack_require__(8823); +/* harmony import */ var ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_60_ = __webpack_require__(2937); +/* harmony import */ var ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_61_ = __webpack_require__(7996); +/* harmony import */ var ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_62_ = __webpack_require__(4455); +/* harmony import */ var ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_63_ = __webpack_require__(9946); +/* harmony import */ var ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_64_ = __webpack_require__(63); +/* harmony import */ var ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_65_ = __webpack_require__(1936); +/* harmony import */ var ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_66_ = __webpack_require__(4162); +/* harmony import */ var ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_67_ = __webpack_require__(7325); +/* harmony import */ var ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_68_ = __webpack_require__(8042); +/* harmony import */ var ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_69_ = __webpack_require__(2300); +/* harmony import */ var ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_70_ = __webpack_require__(1397); +/* harmony import */ var ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_71_ = __webpack_require__(6217); +/* harmony import */ var ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_72_ = __webpack_require__(8146); +/* harmony import */ var ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_73_ = __webpack_require__(3144); +/* harmony import */ var ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_74_ = __webpack_require__(9248); +/* harmony import */ var ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_75_ = __webpack_require__(6419); +/* harmony import */ var ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_76_ = __webpack_require__(2403); +/* harmony import */ var ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_77_ = __webpack_require__(5345); +/* harmony import */ var ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_78_ = __webpack_require__(8982); +/* harmony import */ var ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_79_ = __webpack_require__(4460); +/* harmony import */ var ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_80_ = __webpack_require__(8473); +/* harmony import */ var ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_81_ = __webpack_require__(3805); +/* harmony import */ var ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_82_ = __webpack_require__(7915); +/* harmony import */ var ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_83_ = __webpack_require__(3660); +/* harmony import */ var ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_84_ = __webpack_require__(3536); +/* harmony import */ var ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_85_ = __webpack_require__(3573); +/* harmony import */ var ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_86_ = __webpack_require__(6358); +/* harmony import */ var ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_87_ = __webpack_require__(4998); +/* harmony import */ var ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_88_ = __webpack_require__(6993); +/* harmony import */ var ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_89_ = __webpack_require__(3280); +/* harmony import */ var ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_90_ = __webpack_require__(9075); +/* harmony import */ var ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_91_ = __webpack_require__(288); +/* harmony import */ var ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_92_ = __webpack_require__(5037); +/* harmony import */ var ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_93_ = __webpack_require__(6213); +/* harmony import */ var ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_94_ = __webpack_require__(2490); +/* harmony import */ var ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_95_ = __webpack_require__(5887); +/* harmony import */ var ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_96_ = __webpack_require__(930); +/* harmony import */ var ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_97_ = __webpack_require__(4910); +/* harmony import */ var ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_98_ = __webpack_require__(7073); +/* harmony import */ var ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_99_ = __webpack_require__(5336); +/* harmony import */ var ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_100_ = __webpack_require__(669); +/* harmony import */ var ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_101_ = __webpack_require__(9641); +/* harmony import */ var ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_102_ = __webpack_require__(5344); +/* harmony import */ var ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_103_ = __webpack_require__(7469); +/* harmony import */ var ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_104_ = __webpack_require__(1530); +/* harmony import */ var ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_105_ = __webpack_require__(6022); +/* harmony import */ var ccxt_src_pro_alpaca_js_WEBPACK_IMPORTED_MODULE_106_ = __webpack_require__(6810); +/* harmony import */ var ccxt_src_pro_apex_js_WEBPACK_IMPORTED_MODULE_107_ = __webpack_require__(136); +/* harmony import */ var ccxt_src_pro_ascendex_js_WEBPACK_IMPORTED_MODULE_108_ = __webpack_require__(1657); +/* harmony import */ var ccxt_src_pro_bequant_js_WEBPACK_IMPORTED_MODULE_109_ = __webpack_require__(9338); +/* harmony import */ var ccxt_src_pro_binance_js_WEBPACK_IMPORTED_MODULE_110_ = __webpack_require__(9544); +/* harmony import */ var ccxt_src_pro_binancecoinm_js_WEBPACK_IMPORTED_MODULE_111_ = __webpack_require__(902); +/* harmony import */ var ccxt_src_pro_binanceus_js_WEBPACK_IMPORTED_MODULE_112_ = __webpack_require__(8788); +/* harmony import */ var ccxt_src_pro_binanceusdm_js_WEBPACK_IMPORTED_MODULE_113_ = __webpack_require__(8251); +/* harmony import */ var ccxt_src_pro_bingx_js_WEBPACK_IMPORTED_MODULE_114_ = __webpack_require__(9456); +/* harmony import */ var ccxt_src_pro_bitfinex_js_WEBPACK_IMPORTED_MODULE_115_ = __webpack_require__(1038); +/* harmony import */ var ccxt_src_pro_bitget_js_WEBPACK_IMPORTED_MODULE_116_ = __webpack_require__(205); +/* harmony import */ var ccxt_src_pro_bithumb_js_WEBPACK_IMPORTED_MODULE_117_ = __webpack_require__(6181); +/* harmony import */ var ccxt_src_pro_bitmart_js_WEBPACK_IMPORTED_MODULE_118_ = __webpack_require__(3069); +/* harmony import */ var ccxt_src_pro_bitmex_js_WEBPACK_IMPORTED_MODULE_119_ = __webpack_require__(3731); +/* harmony import */ var ccxt_src_pro_bitopro_js_WEBPACK_IMPORTED_MODULE_120_ = __webpack_require__(4401); +/* harmony import */ var ccxt_src_pro_bitrue_js_WEBPACK_IMPORTED_MODULE_121_ = __webpack_require__(3333); +/* harmony import */ var ccxt_src_pro_bitstamp_js_WEBPACK_IMPORTED_MODULE_122_ = __webpack_require__(3326); +/* harmony import */ var ccxt_src_pro_bittrade_js_WEBPACK_IMPORTED_MODULE_123_ = __webpack_require__(2391); +/* harmony import */ var ccxt_src_pro_bitvavo_js_WEBPACK_IMPORTED_MODULE_124_ = __webpack_require__(1327); +/* harmony import */ var ccxt_src_pro_blockchaincom_js_WEBPACK_IMPORTED_MODULE_125_ = __webpack_require__(8693); +/* harmony import */ var ccxt_src_pro_blofin_js_WEBPACK_IMPORTED_MODULE_126_ = __webpack_require__(1672); +/* harmony import */ var ccxt_src_pro_bybit_js_WEBPACK_IMPORTED_MODULE_127_ = __webpack_require__(8518); +/* harmony import */ var ccxt_src_pro_cex_js_WEBPACK_IMPORTED_MODULE_128_ = __webpack_require__(3774); +/* harmony import */ var ccxt_src_pro_coinbase_js_WEBPACK_IMPORTED_MODULE_129_ = __webpack_require__(8160); +/* harmony import */ var ccxt_src_pro_coinbaseadvanced_js_WEBPACK_IMPORTED_MODULE_130_ = __webpack_require__(5918); +/* harmony import */ var ccxt_src_pro_coinbaseexchange_js_WEBPACK_IMPORTED_MODULE_131_ = __webpack_require__(1925); +/* harmony import */ var ccxt_src_pro_coinbaseinternational_js_WEBPACK_IMPORTED_MODULE_132_ = __webpack_require__(998); +/* harmony import */ var ccxt_src_pro_coincatch_js_WEBPACK_IMPORTED_MODULE_133_ = __webpack_require__(3242); +/* harmony import */ var ccxt_src_pro_coincheck_js_WEBPACK_IMPORTED_MODULE_134_ = __webpack_require__(5317); +/* harmony import */ var ccxt_src_pro_coinex_js_WEBPACK_IMPORTED_MODULE_135_ = __webpack_require__(9088); +/* harmony import */ var ccxt_src_pro_coinone_js_WEBPACK_IMPORTED_MODULE_136_ = __webpack_require__(8673); +/* harmony import */ var ccxt_src_pro_cryptocom_js_WEBPACK_IMPORTED_MODULE_137_ = __webpack_require__(6292); +/* harmony import */ var ccxt_src_pro_defx_js_WEBPACK_IMPORTED_MODULE_138_ = __webpack_require__(8717); +/* harmony import */ var ccxt_src_pro_deribit_js_WEBPACK_IMPORTED_MODULE_139_ = __webpack_require__(7791); +/* harmony import */ var ccxt_src_pro_derive_js_WEBPACK_IMPORTED_MODULE_140_ = __webpack_require__(2127); +/* harmony import */ var ccxt_src_pro_exmo_js_WEBPACK_IMPORTED_MODULE_141_ = __webpack_require__(5233); +/* harmony import */ var ccxt_src_pro_gate_js_WEBPACK_IMPORTED_MODULE_142_ = __webpack_require__(9195); +/* harmony import */ var ccxt_src_pro_gateio_js_WEBPACK_IMPORTED_MODULE_143_ = __webpack_require__(5843); +/* harmony import */ var ccxt_src_pro_gemini_js_WEBPACK_IMPORTED_MODULE_144_ = __webpack_require__(375); +/* harmony import */ var ccxt_src_pro_hashkey_js_WEBPACK_IMPORTED_MODULE_145_ = __webpack_require__(1481); +/* harmony import */ var ccxt_src_pro_hitbtc_js_WEBPACK_IMPORTED_MODULE_146_ = __webpack_require__(4524); +/* harmony import */ var ccxt_src_pro_hollaex_js_WEBPACK_IMPORTED_MODULE_147_ = __webpack_require__(8247); +/* harmony import */ var ccxt_src_pro_htx_js_WEBPACK_IMPORTED_MODULE_148_ = __webpack_require__(3898); +/* harmony import */ var ccxt_src_pro_huobi_js_WEBPACK_IMPORTED_MODULE_149_ = __webpack_require__(6335); +/* harmony import */ var ccxt_src_pro_hyperliquid_js_WEBPACK_IMPORTED_MODULE_150_ = __webpack_require__(3984); +/* harmony import */ var ccxt_src_pro_independentreserve_js_WEBPACK_IMPORTED_MODULE_151_ = __webpack_require__(98); +/* harmony import */ var ccxt_src_pro_kraken_js_WEBPACK_IMPORTED_MODULE_152_ = __webpack_require__(9050); +/* harmony import */ var ccxt_src_pro_krakenfutures_js_WEBPACK_IMPORTED_MODULE_153_ = __webpack_require__(6396); +/* harmony import */ var ccxt_src_pro_kucoin_js_WEBPACK_IMPORTED_MODULE_154_ = __webpack_require__(4965); +/* harmony import */ var ccxt_src_pro_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_155_ = __webpack_require__(905); +/* harmony import */ var ccxt_src_pro_lbank_js_WEBPACK_IMPORTED_MODULE_156_ = __webpack_require__(1736); +/* harmony import */ var ccxt_src_pro_luno_js_WEBPACK_IMPORTED_MODULE_157_ = __webpack_require__(2208); +/* harmony import */ var ccxt_src_pro_mexc_js_WEBPACK_IMPORTED_MODULE_158_ = __webpack_require__(9219); +/* harmony import */ var ccxt_src_pro_modetrade_js_WEBPACK_IMPORTED_MODULE_159_ = __webpack_require__(49); +/* harmony import */ var ccxt_src_pro_myokx_js_WEBPACK_IMPORTED_MODULE_160_ = __webpack_require__(3062); +/* harmony import */ var ccxt_src_pro_ndax_js_WEBPACK_IMPORTED_MODULE_161_ = __webpack_require__(3887); +/* harmony import */ var ccxt_src_pro_okcoin_js_WEBPACK_IMPORTED_MODULE_162_ = __webpack_require__(6187); +/* harmony import */ var ccxt_src_pro_okx_js_WEBPACK_IMPORTED_MODULE_163_ = __webpack_require__(8588); +/* harmony import */ var ccxt_src_pro_okxus_js_WEBPACK_IMPORTED_MODULE_164_ = __webpack_require__(3296); +/* harmony import */ var ccxt_src_pro_onetrading_js_WEBPACK_IMPORTED_MODULE_165_ = __webpack_require__(4357); +/* harmony import */ var ccxt_src_pro_oxfun_js_WEBPACK_IMPORTED_MODULE_166_ = __webpack_require__(550); +/* harmony import */ var ccxt_src_pro_p2b_js_WEBPACK_IMPORTED_MODULE_167_ = __webpack_require__(4934); +/* harmony import */ var ccxt_src_pro_paradex_js_WEBPACK_IMPORTED_MODULE_168_ = __webpack_require__(1057); +/* harmony import */ var ccxt_src_pro_phemex_js_WEBPACK_IMPORTED_MODULE_169_ = __webpack_require__(1619); +/* harmony import */ var ccxt_src_pro_poloniex_js_WEBPACK_IMPORTED_MODULE_170_ = __webpack_require__(3456); +/* harmony import */ var ccxt_src_pro_probit_js_WEBPACK_IMPORTED_MODULE_171_ = __webpack_require__(5738); +/* harmony import */ var ccxt_src_pro_tradeogre_js_WEBPACK_IMPORTED_MODULE_172_ = __webpack_require__(8719); +/* harmony import */ var ccxt_src_pro_upbit_js_WEBPACK_IMPORTED_MODULE_173_ = __webpack_require__(5794); +/* harmony import */ var ccxt_src_pro_vertex_js_WEBPACK_IMPORTED_MODULE_174_ = __webpack_require__(910); +/* harmony import */ var ccxt_src_pro_whitebit_js_WEBPACK_IMPORTED_MODULE_175_ = __webpack_require__(4712); +/* harmony import */ var ccxt_src_pro_woo_js_WEBPACK_IMPORTED_MODULE_176_ = __webpack_require__(5869); +/* harmony import */ var ccxt_src_pro_woofipro_js_WEBPACK_IMPORTED_MODULE_177_ = __webpack_require__(8713); +/* harmony import */ var ccxt_src_pro_xt_js_WEBPACK_IMPORTED_MODULE_178_ = __webpack_require__(2368); /* MIT License @@ -407942,7 +405547,7 @@ SOFTWARE. //----------------------------------------------------------------------------- // this is updated by vss.js when building -const ccxt_version = '4.4.89'; +const ccxt_version = '4.4.92'; ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_/* .Exchange */ .k.ccxtVersion = ccxt_version; //----------------------------------------------------------------------------- @@ -408048,7 +405653,6 @@ ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_/* .Exchange */ .k.ccxtVersi - // pro exchanges @@ -408167,146 +405771,145 @@ const ccxt_exchanges = { 'coincatch': ccxt_src_coincatch_js_WEBPACK_IMPORTED_MODULE_39_/* ["default"] */ .A, 'coincheck': ccxt_src_coincheck_js_WEBPACK_IMPORTED_MODULE_40_/* ["default"] */ .A, 'coinex': ccxt_src_coinex_js_WEBPACK_IMPORTED_MODULE_41_/* ["default"] */ .A, - 'coinlist': ccxt_src_coinlist_js_WEBPACK_IMPORTED_MODULE_42_/* ["default"] */ .A, - 'coinmate': ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_43_/* ["default"] */ .A, - 'coinmetro': ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_44_/* ["default"] */ .A, - 'coinone': ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_45_/* ["default"] */ .A, - 'coinsph': ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_46_/* ["default"] */ .A, - 'coinspot': ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_47_/* ["default"] */ .A, - 'cryptocom': ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_48_/* ["default"] */ .A, - 'cryptomus': ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_49_/* ["default"] */ .A, - 'defx': ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_50_/* ["default"] */ .A, - 'delta': ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_51_/* ["default"] */ .A, - 'deribit': ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_52_/* ["default"] */ .A, - 'derive': ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_53_/* ["default"] */ .A, - 'digifinex': ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_54_/* ["default"] */ .A, - 'ellipx': ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_55_/* ["default"] */ .A, - 'exmo': ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_56_/* ["default"] */ .A, - 'fmfwio': ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_57_/* ["default"] */ .A, - 'gate': ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_58_/* ["default"] */ .A, - 'gateio': ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_59_/* ["default"] */ .A, - 'gemini': ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_60_/* ["default"] */ .A, - 'hashkey': ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_61_/* ["default"] */ .A, - 'hitbtc': ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_62_/* ["default"] */ .A, - 'hollaex': ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_63_/* ["default"] */ .A, - 'htx': ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_64_/* ["default"] */ .A, - 'huobi': ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_65_/* ["default"] */ .A, - 'hyperliquid': ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_66_/* ["default"] */ .A, - 'independentreserve': ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_67_/* ["default"] */ .A, - 'indodax': ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_68_/* ["default"] */ .A, - 'kraken': ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_69_/* ["default"] */ .A, - 'krakenfutures': ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_70_/* ["default"] */ .A, - 'kucoin': ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_71_/* ["default"] */ .A, - 'kucoinfutures': ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_72_/* ["default"] */ .A, - 'latoken': ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_73_/* ["default"] */ .A, - 'lbank': ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_74_/* ["default"] */ .A, - 'luno': ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_75_/* ["default"] */ .A, - 'mercado': ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_76_/* ["default"] */ .A, - 'mexc': ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_77_/* ["default"] */ .A, - 'modetrade': ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_78_/* ["default"] */ .A, - 'myokx': ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_79_/* ["default"] */ .A, - 'ndax': ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_80_/* ["default"] */ .A, - 'novadax': ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_81_/* ["default"] */ .A, - 'oceanex': ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_82_/* ["default"] */ .A, - 'okcoin': ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_83_/* ["default"] */ .A, - 'okx': ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_84_/* ["default"] */ .A, - 'okxus': ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_85_/* ["default"] */ .A, - 'onetrading': ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_86_/* ["default"] */ .A, - 'oxfun': ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_87_/* ["default"] */ .A, - 'p2b': ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_88_/* ["default"] */ .A, - 'paradex': ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_89_/* ["default"] */ .A, - 'paymium': ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_90_/* ["default"] */ .A, - 'phemex': ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_91_/* ["default"] */ .A, - 'poloniex': ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_92_/* ["default"] */ .A, - 'probit': ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_93_/* ["default"] */ .A, - 'timex': ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_94_/* ["default"] */ .A, - 'tokocrypto': ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_95_/* ["default"] */ .A, - 'tradeogre': ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_96_/* ["default"] */ .A, - 'upbit': ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_97_/* ["default"] */ .A, - 'vertex': ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_98_/* ["default"] */ .A, - 'wavesexchange': ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_99_/* ["default"] */ .A, - 'whitebit': ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_100_/* ["default"] */ .A, - 'woo': ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_101_/* ["default"] */ .A, - 'woofipro': ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_102_/* ["default"] */ .A, - 'xt': ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_103_/* ["default"] */ .A, - 'yobit': ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_104_/* ["default"] */ .A, - 'zaif': ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_105_/* ["default"] */ .A, - 'zonda': ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_106_/* ["default"] */ .A, + 'coinmate': ccxt_src_coinmate_js_WEBPACK_IMPORTED_MODULE_42_/* ["default"] */ .A, + 'coinmetro': ccxt_src_coinmetro_js_WEBPACK_IMPORTED_MODULE_43_/* ["default"] */ .A, + 'coinone': ccxt_src_coinone_js_WEBPACK_IMPORTED_MODULE_44_/* ["default"] */ .A, + 'coinsph': ccxt_src_coinsph_js_WEBPACK_IMPORTED_MODULE_45_/* ["default"] */ .A, + 'coinspot': ccxt_src_coinspot_js_WEBPACK_IMPORTED_MODULE_46_/* ["default"] */ .A, + 'cryptocom': ccxt_src_cryptocom_js_WEBPACK_IMPORTED_MODULE_47_/* ["default"] */ .A, + 'cryptomus': ccxt_src_cryptomus_js_WEBPACK_IMPORTED_MODULE_48_/* ["default"] */ .A, + 'defx': ccxt_src_defx_js_WEBPACK_IMPORTED_MODULE_49_/* ["default"] */ .A, + 'delta': ccxt_src_delta_js_WEBPACK_IMPORTED_MODULE_50_/* ["default"] */ .A, + 'deribit': ccxt_src_deribit_js_WEBPACK_IMPORTED_MODULE_51_/* ["default"] */ .A, + 'derive': ccxt_src_derive_js_WEBPACK_IMPORTED_MODULE_52_/* ["default"] */ .A, + 'digifinex': ccxt_src_digifinex_js_WEBPACK_IMPORTED_MODULE_53_/* ["default"] */ .A, + 'ellipx': ccxt_src_ellipx_js_WEBPACK_IMPORTED_MODULE_54_/* ["default"] */ .A, + 'exmo': ccxt_src_exmo_js_WEBPACK_IMPORTED_MODULE_55_/* ["default"] */ .A, + 'fmfwio': ccxt_src_fmfwio_js_WEBPACK_IMPORTED_MODULE_56_/* ["default"] */ .A, + 'gate': ccxt_src_gate_js_WEBPACK_IMPORTED_MODULE_57_/* ["default"] */ .A, + 'gateio': ccxt_src_gateio_js_WEBPACK_IMPORTED_MODULE_58_/* ["default"] */ .A, + 'gemini': ccxt_src_gemini_js_WEBPACK_IMPORTED_MODULE_59_/* ["default"] */ .A, + 'hashkey': ccxt_src_hashkey_js_WEBPACK_IMPORTED_MODULE_60_/* ["default"] */ .A, + 'hitbtc': ccxt_src_hitbtc_js_WEBPACK_IMPORTED_MODULE_61_/* ["default"] */ .A, + 'hollaex': ccxt_src_hollaex_js_WEBPACK_IMPORTED_MODULE_62_/* ["default"] */ .A, + 'htx': ccxt_src_htx_js_WEBPACK_IMPORTED_MODULE_63_/* ["default"] */ .A, + 'huobi': ccxt_src_huobi_js_WEBPACK_IMPORTED_MODULE_64_/* ["default"] */ .A, + 'hyperliquid': ccxt_src_hyperliquid_js_WEBPACK_IMPORTED_MODULE_65_/* ["default"] */ .A, + 'independentreserve': ccxt_src_independentreserve_js_WEBPACK_IMPORTED_MODULE_66_/* ["default"] */ .A, + 'indodax': ccxt_src_indodax_js_WEBPACK_IMPORTED_MODULE_67_/* ["default"] */ .A, + 'kraken': ccxt_src_kraken_js_WEBPACK_IMPORTED_MODULE_68_/* ["default"] */ .A, + 'krakenfutures': ccxt_src_krakenfutures_js_WEBPACK_IMPORTED_MODULE_69_/* ["default"] */ .A, + 'kucoin': ccxt_src_kucoin_js_WEBPACK_IMPORTED_MODULE_70_/* ["default"] */ .A, + 'kucoinfutures': ccxt_src_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_71_/* ["default"] */ .A, + 'latoken': ccxt_src_latoken_js_WEBPACK_IMPORTED_MODULE_72_/* ["default"] */ .A, + 'lbank': ccxt_src_lbank_js_WEBPACK_IMPORTED_MODULE_73_/* ["default"] */ .A, + 'luno': ccxt_src_luno_js_WEBPACK_IMPORTED_MODULE_74_/* ["default"] */ .A, + 'mercado': ccxt_src_mercado_js_WEBPACK_IMPORTED_MODULE_75_/* ["default"] */ .A, + 'mexc': ccxt_src_mexc_js_WEBPACK_IMPORTED_MODULE_76_/* ["default"] */ .A, + 'modetrade': ccxt_src_modetrade_js_WEBPACK_IMPORTED_MODULE_77_/* ["default"] */ .A, + 'myokx': ccxt_src_myokx_js_WEBPACK_IMPORTED_MODULE_78_/* ["default"] */ .A, + 'ndax': ccxt_src_ndax_js_WEBPACK_IMPORTED_MODULE_79_/* ["default"] */ .A, + 'novadax': ccxt_src_novadax_js_WEBPACK_IMPORTED_MODULE_80_/* ["default"] */ .A, + 'oceanex': ccxt_src_oceanex_js_WEBPACK_IMPORTED_MODULE_81_/* ["default"] */ .A, + 'okcoin': ccxt_src_okcoin_js_WEBPACK_IMPORTED_MODULE_82_/* ["default"] */ .A, + 'okx': ccxt_src_okx_js_WEBPACK_IMPORTED_MODULE_83_/* ["default"] */ .A, + 'okxus': ccxt_src_okxus_js_WEBPACK_IMPORTED_MODULE_84_/* ["default"] */ .A, + 'onetrading': ccxt_src_onetrading_js_WEBPACK_IMPORTED_MODULE_85_/* ["default"] */ .A, + 'oxfun': ccxt_src_oxfun_js_WEBPACK_IMPORTED_MODULE_86_/* ["default"] */ .A, + 'p2b': ccxt_src_p2b_js_WEBPACK_IMPORTED_MODULE_87_/* ["default"] */ .A, + 'paradex': ccxt_src_paradex_js_WEBPACK_IMPORTED_MODULE_88_/* ["default"] */ .A, + 'paymium': ccxt_src_paymium_js_WEBPACK_IMPORTED_MODULE_89_/* ["default"] */ .A, + 'phemex': ccxt_src_phemex_js_WEBPACK_IMPORTED_MODULE_90_/* ["default"] */ .A, + 'poloniex': ccxt_src_poloniex_js_WEBPACK_IMPORTED_MODULE_91_/* ["default"] */ .A, + 'probit': ccxt_src_probit_js_WEBPACK_IMPORTED_MODULE_92_/* ["default"] */ .A, + 'timex': ccxt_src_timex_js_WEBPACK_IMPORTED_MODULE_93_/* ["default"] */ .A, + 'tokocrypto': ccxt_src_tokocrypto_js_WEBPACK_IMPORTED_MODULE_94_/* ["default"] */ .A, + 'tradeogre': ccxt_src_tradeogre_js_WEBPACK_IMPORTED_MODULE_95_/* ["default"] */ .A, + 'upbit': ccxt_src_upbit_js_WEBPACK_IMPORTED_MODULE_96_/* ["default"] */ .A, + 'vertex': ccxt_src_vertex_js_WEBPACK_IMPORTED_MODULE_97_/* ["default"] */ .A, + 'wavesexchange': ccxt_src_wavesexchange_js_WEBPACK_IMPORTED_MODULE_98_/* ["default"] */ .A, + 'whitebit': ccxt_src_whitebit_js_WEBPACK_IMPORTED_MODULE_99_/* ["default"] */ .A, + 'woo': ccxt_src_woo_js_WEBPACK_IMPORTED_MODULE_100_/* ["default"] */ .A, + 'woofipro': ccxt_src_woofipro_js_WEBPACK_IMPORTED_MODULE_101_/* ["default"] */ .A, + 'xt': ccxt_src_xt_js_WEBPACK_IMPORTED_MODULE_102_/* ["default"] */ .A, + 'yobit': ccxt_src_yobit_js_WEBPACK_IMPORTED_MODULE_103_/* ["default"] */ .A, + 'zaif': ccxt_src_zaif_js_WEBPACK_IMPORTED_MODULE_104_/* ["default"] */ .A, + 'zonda': ccxt_src_zonda_js_WEBPACK_IMPORTED_MODULE_105_/* ["default"] */ .A, }; const ccxt_pro = { - 'alpaca': ccxt_src_pro_alpaca_js_WEBPACK_IMPORTED_MODULE_107_/* ["default"] */ .A, - 'apex': ccxt_src_pro_apex_js_WEBPACK_IMPORTED_MODULE_108_/* ["default"] */ .A, - 'ascendex': ccxt_src_pro_ascendex_js_WEBPACK_IMPORTED_MODULE_109_/* ["default"] */ .A, - 'bequant': ccxt_src_pro_bequant_js_WEBPACK_IMPORTED_MODULE_110_/* ["default"] */ .A, - 'binance': ccxt_src_pro_binance_js_WEBPACK_IMPORTED_MODULE_111_/* ["default"] */ .A, - 'binancecoinm': ccxt_src_pro_binancecoinm_js_WEBPACK_IMPORTED_MODULE_112_/* ["default"] */ .A, - 'binanceus': ccxt_src_pro_binanceus_js_WEBPACK_IMPORTED_MODULE_113_/* ["default"] */ .A, - 'binanceusdm': ccxt_src_pro_binanceusdm_js_WEBPACK_IMPORTED_MODULE_114_/* ["default"] */ .A, - 'bingx': ccxt_src_pro_bingx_js_WEBPACK_IMPORTED_MODULE_115_/* ["default"] */ .A, - 'bitfinex': ccxt_src_pro_bitfinex_js_WEBPACK_IMPORTED_MODULE_116_/* ["default"] */ .A, - 'bitget': ccxt_src_pro_bitget_js_WEBPACK_IMPORTED_MODULE_117_/* ["default"] */ .A, - 'bithumb': ccxt_src_pro_bithumb_js_WEBPACK_IMPORTED_MODULE_118_/* ["default"] */ .A, - 'bitmart': ccxt_src_pro_bitmart_js_WEBPACK_IMPORTED_MODULE_119_/* ["default"] */ .A, - 'bitmex': ccxt_src_pro_bitmex_js_WEBPACK_IMPORTED_MODULE_120_/* ["default"] */ .A, - 'bitopro': ccxt_src_pro_bitopro_js_WEBPACK_IMPORTED_MODULE_121_/* ["default"] */ .A, - 'bitrue': ccxt_src_pro_bitrue_js_WEBPACK_IMPORTED_MODULE_122_/* ["default"] */ .A, - 'bitstamp': ccxt_src_pro_bitstamp_js_WEBPACK_IMPORTED_MODULE_123_/* ["default"] */ .A, - 'bittrade': ccxt_src_pro_bittrade_js_WEBPACK_IMPORTED_MODULE_124_/* ["default"] */ .A, - 'bitvavo': ccxt_src_pro_bitvavo_js_WEBPACK_IMPORTED_MODULE_125_/* ["default"] */ .A, - 'blockchaincom': ccxt_src_pro_blockchaincom_js_WEBPACK_IMPORTED_MODULE_126_/* ["default"] */ .A, - 'blofin': ccxt_src_pro_blofin_js_WEBPACK_IMPORTED_MODULE_127_/* ["default"] */ .A, - 'bybit': ccxt_src_pro_bybit_js_WEBPACK_IMPORTED_MODULE_128_/* ["default"] */ .A, - 'cex': ccxt_src_pro_cex_js_WEBPACK_IMPORTED_MODULE_129_/* ["default"] */ .A, - 'coinbase': ccxt_src_pro_coinbase_js_WEBPACK_IMPORTED_MODULE_130_/* ["default"] */ .A, - 'coinbaseadvanced': ccxt_src_pro_coinbaseadvanced_js_WEBPACK_IMPORTED_MODULE_131_/* ["default"] */ .A, - 'coinbaseexchange': ccxt_src_pro_coinbaseexchange_js_WEBPACK_IMPORTED_MODULE_132_/* ["default"] */ .A, - 'coinbaseinternational': ccxt_src_pro_coinbaseinternational_js_WEBPACK_IMPORTED_MODULE_133_/* ["default"] */ .A, - 'coincatch': ccxt_src_pro_coincatch_js_WEBPACK_IMPORTED_MODULE_134_/* ["default"] */ .A, - 'coincheck': ccxt_src_pro_coincheck_js_WEBPACK_IMPORTED_MODULE_135_/* ["default"] */ .A, - 'coinex': ccxt_src_pro_coinex_js_WEBPACK_IMPORTED_MODULE_136_/* ["default"] */ .A, - 'coinone': ccxt_src_pro_coinone_js_WEBPACK_IMPORTED_MODULE_137_/* ["default"] */ .A, - 'cryptocom': ccxt_src_pro_cryptocom_js_WEBPACK_IMPORTED_MODULE_138_/* ["default"] */ .A, - 'defx': ccxt_src_pro_defx_js_WEBPACK_IMPORTED_MODULE_139_/* ["default"] */ .A, - 'deribit': ccxt_src_pro_deribit_js_WEBPACK_IMPORTED_MODULE_140_/* ["default"] */ .A, - 'derive': ccxt_src_pro_derive_js_WEBPACK_IMPORTED_MODULE_141_/* ["default"] */ .A, - 'exmo': ccxt_src_pro_exmo_js_WEBPACK_IMPORTED_MODULE_142_/* ["default"] */ .A, - 'gate': ccxt_src_pro_gate_js_WEBPACK_IMPORTED_MODULE_143_/* ["default"] */ .A, - 'gateio': ccxt_src_pro_gateio_js_WEBPACK_IMPORTED_MODULE_144_/* ["default"] */ .A, - 'gemini': ccxt_src_pro_gemini_js_WEBPACK_IMPORTED_MODULE_145_/* ["default"] */ .A, - 'hashkey': ccxt_src_pro_hashkey_js_WEBPACK_IMPORTED_MODULE_146_/* ["default"] */ .A, - 'hitbtc': ccxt_src_pro_hitbtc_js_WEBPACK_IMPORTED_MODULE_147_/* ["default"] */ .A, - 'hollaex': ccxt_src_pro_hollaex_js_WEBPACK_IMPORTED_MODULE_148_/* ["default"] */ .A, - 'htx': ccxt_src_pro_htx_js_WEBPACK_IMPORTED_MODULE_149_/* ["default"] */ .A, - 'huobi': ccxt_src_pro_huobi_js_WEBPACK_IMPORTED_MODULE_150_/* ["default"] */ .A, - 'hyperliquid': ccxt_src_pro_hyperliquid_js_WEBPACK_IMPORTED_MODULE_151_/* ["default"] */ .A, - 'independentreserve': ccxt_src_pro_independentreserve_js_WEBPACK_IMPORTED_MODULE_152_/* ["default"] */ .A, - 'kraken': ccxt_src_pro_kraken_js_WEBPACK_IMPORTED_MODULE_153_/* ["default"] */ .A, - 'krakenfutures': ccxt_src_pro_krakenfutures_js_WEBPACK_IMPORTED_MODULE_154_/* ["default"] */ .A, - 'kucoin': ccxt_src_pro_kucoin_js_WEBPACK_IMPORTED_MODULE_155_/* ["default"] */ .A, - 'kucoinfutures': ccxt_src_pro_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_156_/* ["default"] */ .A, - 'lbank': ccxt_src_pro_lbank_js_WEBPACK_IMPORTED_MODULE_157_/* ["default"] */ .A, - 'luno': ccxt_src_pro_luno_js_WEBPACK_IMPORTED_MODULE_158_/* ["default"] */ .A, - 'mexc': ccxt_src_pro_mexc_js_WEBPACK_IMPORTED_MODULE_159_/* ["default"] */ .A, - 'modetrade': ccxt_src_pro_modetrade_js_WEBPACK_IMPORTED_MODULE_160_/* ["default"] */ .A, - 'myokx': ccxt_src_pro_myokx_js_WEBPACK_IMPORTED_MODULE_161_/* ["default"] */ .A, - 'ndax': ccxt_src_pro_ndax_js_WEBPACK_IMPORTED_MODULE_162_/* ["default"] */ .A, - 'okcoin': ccxt_src_pro_okcoin_js_WEBPACK_IMPORTED_MODULE_163_/* ["default"] */ .A, - 'okx': ccxt_src_pro_okx_js_WEBPACK_IMPORTED_MODULE_164_/* ["default"] */ .A, - 'okxus': ccxt_src_pro_okxus_js_WEBPACK_IMPORTED_MODULE_165_/* ["default"] */ .A, - 'onetrading': ccxt_src_pro_onetrading_js_WEBPACK_IMPORTED_MODULE_166_/* ["default"] */ .A, - 'oxfun': ccxt_src_pro_oxfun_js_WEBPACK_IMPORTED_MODULE_167_/* ["default"] */ .A, - 'p2b': ccxt_src_pro_p2b_js_WEBPACK_IMPORTED_MODULE_168_/* ["default"] */ .A, - 'paradex': ccxt_src_pro_paradex_js_WEBPACK_IMPORTED_MODULE_169_/* ["default"] */ .A, - 'phemex': ccxt_src_pro_phemex_js_WEBPACK_IMPORTED_MODULE_170_/* ["default"] */ .A, - 'poloniex': ccxt_src_pro_poloniex_js_WEBPACK_IMPORTED_MODULE_171_/* ["default"] */ .A, - 'probit': ccxt_src_pro_probit_js_WEBPACK_IMPORTED_MODULE_172_/* ["default"] */ .A, - 'tradeogre': ccxt_src_pro_tradeogre_js_WEBPACK_IMPORTED_MODULE_173_/* ["default"] */ .A, - 'upbit': ccxt_src_pro_upbit_js_WEBPACK_IMPORTED_MODULE_174_/* ["default"] */ .A, - 'vertex': ccxt_src_pro_vertex_js_WEBPACK_IMPORTED_MODULE_175_/* ["default"] */ .A, - 'whitebit': ccxt_src_pro_whitebit_js_WEBPACK_IMPORTED_MODULE_176_/* ["default"] */ .A, - 'woo': ccxt_src_pro_woo_js_WEBPACK_IMPORTED_MODULE_177_/* ["default"] */ .A, - 'woofipro': ccxt_src_pro_woofipro_js_WEBPACK_IMPORTED_MODULE_178_/* ["default"] */ .A, - 'xt': ccxt_src_pro_xt_js_WEBPACK_IMPORTED_MODULE_179_/* ["default"] */ .A, + 'alpaca': ccxt_src_pro_alpaca_js_WEBPACK_IMPORTED_MODULE_106_/* ["default"] */ .A, + 'apex': ccxt_src_pro_apex_js_WEBPACK_IMPORTED_MODULE_107_/* ["default"] */ .A, + 'ascendex': ccxt_src_pro_ascendex_js_WEBPACK_IMPORTED_MODULE_108_/* ["default"] */ .A, + 'bequant': ccxt_src_pro_bequant_js_WEBPACK_IMPORTED_MODULE_109_/* ["default"] */ .A, + 'binance': ccxt_src_pro_binance_js_WEBPACK_IMPORTED_MODULE_110_/* ["default"] */ .A, + 'binancecoinm': ccxt_src_pro_binancecoinm_js_WEBPACK_IMPORTED_MODULE_111_/* ["default"] */ .A, + 'binanceus': ccxt_src_pro_binanceus_js_WEBPACK_IMPORTED_MODULE_112_/* ["default"] */ .A, + 'binanceusdm': ccxt_src_pro_binanceusdm_js_WEBPACK_IMPORTED_MODULE_113_/* ["default"] */ .A, + 'bingx': ccxt_src_pro_bingx_js_WEBPACK_IMPORTED_MODULE_114_/* ["default"] */ .A, + 'bitfinex': ccxt_src_pro_bitfinex_js_WEBPACK_IMPORTED_MODULE_115_/* ["default"] */ .A, + 'bitget': ccxt_src_pro_bitget_js_WEBPACK_IMPORTED_MODULE_116_/* ["default"] */ .A, + 'bithumb': ccxt_src_pro_bithumb_js_WEBPACK_IMPORTED_MODULE_117_/* ["default"] */ .A, + 'bitmart': ccxt_src_pro_bitmart_js_WEBPACK_IMPORTED_MODULE_118_/* ["default"] */ .A, + 'bitmex': ccxt_src_pro_bitmex_js_WEBPACK_IMPORTED_MODULE_119_/* ["default"] */ .A, + 'bitopro': ccxt_src_pro_bitopro_js_WEBPACK_IMPORTED_MODULE_120_/* ["default"] */ .A, + 'bitrue': ccxt_src_pro_bitrue_js_WEBPACK_IMPORTED_MODULE_121_/* ["default"] */ .A, + 'bitstamp': ccxt_src_pro_bitstamp_js_WEBPACK_IMPORTED_MODULE_122_/* ["default"] */ .A, + 'bittrade': ccxt_src_pro_bittrade_js_WEBPACK_IMPORTED_MODULE_123_/* ["default"] */ .A, + 'bitvavo': ccxt_src_pro_bitvavo_js_WEBPACK_IMPORTED_MODULE_124_/* ["default"] */ .A, + 'blockchaincom': ccxt_src_pro_blockchaincom_js_WEBPACK_IMPORTED_MODULE_125_/* ["default"] */ .A, + 'blofin': ccxt_src_pro_blofin_js_WEBPACK_IMPORTED_MODULE_126_/* ["default"] */ .A, + 'bybit': ccxt_src_pro_bybit_js_WEBPACK_IMPORTED_MODULE_127_/* ["default"] */ .A, + 'cex': ccxt_src_pro_cex_js_WEBPACK_IMPORTED_MODULE_128_/* ["default"] */ .A, + 'coinbase': ccxt_src_pro_coinbase_js_WEBPACK_IMPORTED_MODULE_129_/* ["default"] */ .A, + 'coinbaseadvanced': ccxt_src_pro_coinbaseadvanced_js_WEBPACK_IMPORTED_MODULE_130_/* ["default"] */ .A, + 'coinbaseexchange': ccxt_src_pro_coinbaseexchange_js_WEBPACK_IMPORTED_MODULE_131_/* ["default"] */ .A, + 'coinbaseinternational': ccxt_src_pro_coinbaseinternational_js_WEBPACK_IMPORTED_MODULE_132_/* ["default"] */ .A, + 'coincatch': ccxt_src_pro_coincatch_js_WEBPACK_IMPORTED_MODULE_133_/* ["default"] */ .A, + 'coincheck': ccxt_src_pro_coincheck_js_WEBPACK_IMPORTED_MODULE_134_/* ["default"] */ .A, + 'coinex': ccxt_src_pro_coinex_js_WEBPACK_IMPORTED_MODULE_135_/* ["default"] */ .A, + 'coinone': ccxt_src_pro_coinone_js_WEBPACK_IMPORTED_MODULE_136_/* ["default"] */ .A, + 'cryptocom': ccxt_src_pro_cryptocom_js_WEBPACK_IMPORTED_MODULE_137_/* ["default"] */ .A, + 'defx': ccxt_src_pro_defx_js_WEBPACK_IMPORTED_MODULE_138_/* ["default"] */ .A, + 'deribit': ccxt_src_pro_deribit_js_WEBPACK_IMPORTED_MODULE_139_/* ["default"] */ .A, + 'derive': ccxt_src_pro_derive_js_WEBPACK_IMPORTED_MODULE_140_/* ["default"] */ .A, + 'exmo': ccxt_src_pro_exmo_js_WEBPACK_IMPORTED_MODULE_141_/* ["default"] */ .A, + 'gate': ccxt_src_pro_gate_js_WEBPACK_IMPORTED_MODULE_142_/* ["default"] */ .A, + 'gateio': ccxt_src_pro_gateio_js_WEBPACK_IMPORTED_MODULE_143_/* ["default"] */ .A, + 'gemini': ccxt_src_pro_gemini_js_WEBPACK_IMPORTED_MODULE_144_/* ["default"] */ .A, + 'hashkey': ccxt_src_pro_hashkey_js_WEBPACK_IMPORTED_MODULE_145_/* ["default"] */ .A, + 'hitbtc': ccxt_src_pro_hitbtc_js_WEBPACK_IMPORTED_MODULE_146_/* ["default"] */ .A, + 'hollaex': ccxt_src_pro_hollaex_js_WEBPACK_IMPORTED_MODULE_147_/* ["default"] */ .A, + 'htx': ccxt_src_pro_htx_js_WEBPACK_IMPORTED_MODULE_148_/* ["default"] */ .A, + 'huobi': ccxt_src_pro_huobi_js_WEBPACK_IMPORTED_MODULE_149_/* ["default"] */ .A, + 'hyperliquid': ccxt_src_pro_hyperliquid_js_WEBPACK_IMPORTED_MODULE_150_/* ["default"] */ .A, + 'independentreserve': ccxt_src_pro_independentreserve_js_WEBPACK_IMPORTED_MODULE_151_/* ["default"] */ .A, + 'kraken': ccxt_src_pro_kraken_js_WEBPACK_IMPORTED_MODULE_152_/* ["default"] */ .A, + 'krakenfutures': ccxt_src_pro_krakenfutures_js_WEBPACK_IMPORTED_MODULE_153_/* ["default"] */ .A, + 'kucoin': ccxt_src_pro_kucoin_js_WEBPACK_IMPORTED_MODULE_154_/* ["default"] */ .A, + 'kucoinfutures': ccxt_src_pro_kucoinfutures_js_WEBPACK_IMPORTED_MODULE_155_/* ["default"] */ .A, + 'lbank': ccxt_src_pro_lbank_js_WEBPACK_IMPORTED_MODULE_156_/* ["default"] */ .A, + 'luno': ccxt_src_pro_luno_js_WEBPACK_IMPORTED_MODULE_157_/* ["default"] */ .A, + 'mexc': ccxt_src_pro_mexc_js_WEBPACK_IMPORTED_MODULE_158_/* ["default"] */ .A, + 'modetrade': ccxt_src_pro_modetrade_js_WEBPACK_IMPORTED_MODULE_159_/* ["default"] */ .A, + 'myokx': ccxt_src_pro_myokx_js_WEBPACK_IMPORTED_MODULE_160_/* ["default"] */ .A, + 'ndax': ccxt_src_pro_ndax_js_WEBPACK_IMPORTED_MODULE_161_/* ["default"] */ .A, + 'okcoin': ccxt_src_pro_okcoin_js_WEBPACK_IMPORTED_MODULE_162_/* ["default"] */ .A, + 'okx': ccxt_src_pro_okx_js_WEBPACK_IMPORTED_MODULE_163_/* ["default"] */ .A, + 'okxus': ccxt_src_pro_okxus_js_WEBPACK_IMPORTED_MODULE_164_/* ["default"] */ .A, + 'onetrading': ccxt_src_pro_onetrading_js_WEBPACK_IMPORTED_MODULE_165_/* ["default"] */ .A, + 'oxfun': ccxt_src_pro_oxfun_js_WEBPACK_IMPORTED_MODULE_166_/* ["default"] */ .A, + 'p2b': ccxt_src_pro_p2b_js_WEBPACK_IMPORTED_MODULE_167_/* ["default"] */ .A, + 'paradex': ccxt_src_pro_paradex_js_WEBPACK_IMPORTED_MODULE_168_/* ["default"] */ .A, + 'phemex': ccxt_src_pro_phemex_js_WEBPACK_IMPORTED_MODULE_169_/* ["default"] */ .A, + 'poloniex': ccxt_src_pro_poloniex_js_WEBPACK_IMPORTED_MODULE_170_/* ["default"] */ .A, + 'probit': ccxt_src_pro_probit_js_WEBPACK_IMPORTED_MODULE_171_/* ["default"] */ .A, + 'tradeogre': ccxt_src_pro_tradeogre_js_WEBPACK_IMPORTED_MODULE_172_/* ["default"] */ .A, + 'upbit': ccxt_src_pro_upbit_js_WEBPACK_IMPORTED_MODULE_173_/* ["default"] */ .A, + 'vertex': ccxt_src_pro_vertex_js_WEBPACK_IMPORTED_MODULE_174_/* ["default"] */ .A, + 'whitebit': ccxt_src_pro_whitebit_js_WEBPACK_IMPORTED_MODULE_175_/* ["default"] */ .A, + 'woo': ccxt_src_pro_woo_js_WEBPACK_IMPORTED_MODULE_176_/* ["default"] */ .A, + 'woofipro': ccxt_src_pro_woofipro_js_WEBPACK_IMPORTED_MODULE_177_/* ["default"] */ .A, + 'xt': ccxt_src_pro_xt_js_WEBPACK_IMPORTED_MODULE_178_/* ["default"] */ .A, }; for (const exchange in ccxt_pro) { // const ccxtExchange = exchanges[exchange] @@ -408319,7 +405922,7 @@ for (const exchange in ccxt_pro) { ccxt_pro.exchanges = Object.keys(ccxt_pro); ccxt_pro['Exchange'] = ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_/* .Exchange */ .k; // now the same for rest and ts //----------------------------------------------------------------------------- -const ccxt_ccxt = Object.assign({ version: ccxt_version, Exchange: ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_/* .Exchange */ .k, Precise: ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_180_/* .Precise */ .Y, 'exchanges': Object.keys(ccxt_exchanges), 'pro': ccxt_pro }, ccxt_exchanges, ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_181_, ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_182_); +const ccxt_ccxt = Object.assign({ version: ccxt_version, Exchange: ccxt_src_base_Exchange_js_WEBPACK_IMPORTED_MODULE_0_/* .Exchange */ .k, Precise: ccxt_src_base_Precise_js_WEBPACK_IMPORTED_MODULE_179_/* .Precise */ .Y, 'exchanges': Object.keys(ccxt_exchanges), 'pro': ccxt_pro }, ccxt_exchanges, ccxt_src_base_functions_js_WEBPACK_IMPORTED_MODULE_180_, ccxt_src_base_errors_js_WEBPACK_IMPORTED_MODULE_181_); /* harmony default export */ const ts_ccxt = (ccxt_ccxt); //----------------------------------------------------------------------------- diff --git a/dist/ccxt.browser.min.js b/dist/ccxt.browser.min.js index 7b8afe0365c4e..af823d764c3b4 100644 --- a/dist/ccxt.browser.min.js +++ b/dist/ccxt.browser.min.js @@ -1,4 +1,4 @@ -(()=>{"use strict";var e={4523:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1185:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},566:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3971:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},335:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4619:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3885:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2308:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5625:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9332:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1578:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9152:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3974:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1466:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8186:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7202:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8800:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9656:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5223:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8535:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7754:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8716:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5254:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1769:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9644:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3829:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2317:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8430:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1293:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5465:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5661:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1552:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2609:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5769:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2938:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5277:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2948:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8109:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1671:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},6658:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4935:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9360:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4295:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3037:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9872:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7227:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4012:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},970:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9420:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},6351:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1352:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7418:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3434:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9722:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},706:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1180:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8617:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9023:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},359:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4558:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2459:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1359:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3548:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3942:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(1397);class r extends s.A{}const a=r},121:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},575:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7533:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},6928:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9174:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5362:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3414:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},1426:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7774:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9886:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5531:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3800:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},9401:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7849:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},2134:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8563:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4158:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7733:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},995:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},334:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7999:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},4352:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},6405:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8139:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7698:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3965:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7246:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5308:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3521:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},3578:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},8291:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},5517:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(2961);class r extends s.k{}const a=r},7930:(e,t,i)=>{i.d(t,{A:()=>n});var s=i(4523),r=i(5147),a=i(2079),o=i(1579);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"alpaca",name:"Alpaca",countries:["US"],rateLimit:333,hostname:"alpaca.markets",pro:!0,urls:{logo:"https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b",www:"https://alpaca.markets",api:{broker:"https://broker-api.{hostname}",trader:"https://api.{hostname}",market:"https://data.{hostname}"},test:{broker:"https://broker-api.sandbox.{hostname}",trader:"https://paper-api.{hostname}",market:"https://data.{hostname}"},doc:"https://alpaca.markets/docs/",fees:"https://docs.alpaca.markets/docs/crypto-fees"},has:{CORS:!1,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDepositAddress:!0,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchL1OrderBook:!0,fetchL2OrderBook:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},api:{broker:{},trader:{private:{get:["v2/account","v2/orders","v2/orders/{order_id}","v2/positions","v2/positions/{symbol_or_asset_id}","v2/account/portfolio/history","v2/watchlists","v2/watchlists/{watchlist_id}","v2/watchlists:by_name","v2/account/configurations","v2/account/activities","v2/account/activities/{activity_type}","v2/calendar","v2/clock","v2/assets","v2/assets/{symbol_or_asset_id}","v2/corporate_actions/announcements/{id}","v2/corporate_actions/announcements","v2/wallets","v2/wallets/transfers"],post:["v2/orders","v2/watchlists","v2/watchlists/{watchlist_id}","v2/watchlists:by_name","v2/wallets/transfers"],put:["v2/orders/{order_id}","v2/watchlists/{watchlist_id}","v2/watchlists:by_name"],patch:["v2/orders/{order_id}","v2/account/configurations"],delete:["v2/orders","v2/orders/{order_id}","v2/positions","v2/positions/{symbol_or_asset_id}","v2/watchlists/{watchlist_id}","v2/watchlists:by_name","v2/watchlists/{watchlist_id}/{symbol}"]}},market:{public:{get:["v1beta3/crypto/{loc}/bars","v1beta3/crypto/{loc}/latest/bars","v1beta3/crypto/{loc}/latest/orderbooks","v1beta3/crypto/{loc}/latest/quotes","v1beta3/crypto/{loc}/latest/trades","v1beta3/crypto/{loc}/quotes","v1beta3/crypto/{loc}/snapshots","v1beta3/crypto/{loc}/trades"]},private:{get:["v1beta1/corporate-actions","v1beta1/forex/latest/rates","v1beta1/forex/rates","v1beta1/logos/{symbol}","v1beta1/news","v1beta1/screener/stocks/most-actives","v1beta1/screener/{market_type}/movers","v2/stocks/auctions","v2/stocks/bars","v2/stocks/bars/latest","v2/stocks/meta/conditions/{ticktype}","v2/stocks/meta/exchanges","v2/stocks/quotes","v2/stocks/quotes/latest","v2/stocks/snapshots","v2/stocks/trades","v2/stocks/trades/latest","v2/stocks/{symbol}/auctions","v2/stocks/{symbol}/bars","v2/stocks/{symbol}/bars/latest","v2/stocks/{symbol}/quotes","v2/stocks/{symbol}/quotes/latest","v2/stocks/{symbol}/snapshot","v2/stocks/{symbol}/trades","v2/stocks/{symbol}/trades/latest"]}}},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1H","2h":"2H","4h":"4H","6h":"6H","8h":"8H","12h":"12H","1d":"1D","3d":"3D","1w":"1W","1M":"1M"},precisionMode:o.kb,requiredCredentials:{apiKey:!0,secret:!0},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.0015"),taker:this.parseNumber("0.0025"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0022")],[this.parseNumber("500000"),this.parseNumber("0.0020")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("10000000"),this.parseNumber("0.0015")],[this.parseNumber("25000000"),this.parseNumber("0.0013")],[this.parseNumber("50000000"),this.parseNumber("0.0012")],[this.parseNumber("100000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0012")],[this.parseNumber("500000"),this.parseNumber("0.001")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("10000000"),this.parseNumber("0.0005")],[this.parseNumber("25000000"),this.parseNumber("0.0002")],[this.parseNumber("50000000"),this.parseNumber("0.0002")],[this.parseNumber("100000000"),this.parseNumber("0.00")]]}}},headers:{"APCA-PARTNER-ID":"ccxt"},options:{defaultExchange:"CBSE",exchanges:["CBSE","FTX","GNSS","ERSX"],defaultTimeInForce:"gtc",clientOrderId:"ccxt_{id}"},features:{spot:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!0,index:!0},price:!0},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!0,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:500,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:500,daysBack:1e5,daysBackCanceled:void 0,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"forbidden.":a.PermissionDenied,4041e4:a.InvalidOrder,40010001:a.BadRequest,4011e4:a.PermissionDenied,4031e4:a.InsufficientFunds,4291e4:a.RateLimitExceeded},broad:{"Invalid format for parameter":a.BadRequest,"Invalid symbol":a.BadSymbol}}})}async fetchTime(e={}){const t=await this.traderPrivateGetV2Clock(e),i=this.safeString(t,"timestamp"),s=i.slice(0,23),r=i.length-6,a=i.length-3,o=i.slice(r,a);return this.parse8601(s)-3600*this.parseToNumeric(o)*1e3}async fetchMarkets(e={}){const t=await this.traderPrivateGetV2Assets(this.extend({asset_class:"crypto",status:"active"},e));return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"symbol"),i=t.split("/"),s=this.safeString(e,"class"),r=this.safeString(i,0),a=this.safeString(i,1),o=this.safeCurrencyCode(r);let n=this.safeCurrencyCode(a);void 0===n&&"us_equity"===s&&(n="USD");const d=o+"/"+n,h="active"===this.safeString(e,"status"),c=this.safeNumber(e,"min_order_size");return{id:t,symbol:d,base:o,quote:n,settle:void 0,baseId:r,quoteId:a,settleId:void 0,type:"spot",spot:!0,margin:void 0,swap:!1,future:!1,option:!1,active:h,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(e,"min_trade_increment"),price:this.safeNumber(e,"price_increment")},limits:{leverage:{min:void 0,max:void 0},amount:{min:c,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),o=r.id,n=this.safeString(s,"loc","us"),d=this.safeString(s,"method","marketPublicGetV1beta3CryptoLocTrades"),h={symbols:o,loc:n};let c;if(s=this.omit(s,["loc","method"]),"marketPublicGetV1beta3CryptoLocTrades"===d){void 0!==t&&(h.start=this.iso8601(t)),void 0!==i&&(h.limit=i);const e=await this.marketPublicGetV1beta3CryptoLocTrades(this.extend(h,s)),r=this.safeDict(e,"trades",{});c=this.safeList(r,o,[])}else{if("marketPublicGetV1beta3CryptoLocLatestTrades"!==d)throw new a.NotSupported(this.id+" fetchTrades() does not support "+d+", marketPublicGetV1beta3CryptoLocTrades and marketPublicGetV1beta3CryptoLocLatestTrades are supported");{const e=await this.marketPublicGetV1beta3CryptoLocLatestTrades(this.extend(h,s)),t=this.safeDict(e,"trades",{});c=this.safeDict(t,o,{}),c=[c]}}return this.parseTrades(c,r,t,i)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r=s.id,a={symbols:r,loc:this.safeString(i,"loc","us")},o=await this.marketPublicGetV1beta3CryptoLocLatestOrderbooks(this.extend(a,i)),n=this.safeDict(o,"orderbooks",{}),d=this.safeDict(n,r,{}),h=this.parse8601(this.safeString(d,"t"));return this.parseOrderBook(d,s.symbol,h,"b","a","p","s")}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,r={}){await this.loadMarkets();const o=this.market(e),n=o.id,d=this.safeString(r,"loc","us"),h=this.safeString(r,"method","marketPublicGetV1beta3CryptoLocBars"),c={symbols:n,loc:d};let l;if(r=this.omit(r,["loc","method"]),"marketPublicGetV1beta3CryptoLocBars"===h){void 0!==s&&(c.limit=s),void 0!==i&&(c.start=this.yyyymmdd(i)),c.timeframe=this.safeString(this.timeframes,t,t);const e=await this.marketPublicGetV1beta3CryptoLocBars(this.extend(c,r)),a=this.safeDict(e,"bars",{});l=this.safeList(a,n,[])}else{if("marketPublicGetV1beta3CryptoLocLatestBars"!==h)throw new a.NotSupported(this.id+" fetchOHLCV() does not support "+h+", marketPublicGetV1beta3CryptoLocBars and marketPublicGetV1beta3CryptoLocLatestBars are supported");{const e=await this.marketPublicGetV1beta3CryptoLocLatestBars(this.extend(c,r)),t=this.safeDict(e,"bars",{});l=this.safeDict(t,n,{}),l=[l]}}return this.parseOHLCVs(l,o,t,i,s)}parseOHLCV(e,t=void 0){const i=this.safeString(e,"t");return[this.parse8601(i),this.safeNumber(e,"o"),this.safeNumber(e,"h"),this.safeNumber(e,"l"),this.safeNumber(e,"c"),this.safeNumber(e,"v")]}async fetchTicker(e,t={}){await this.loadMarkets(),e=this.symbol(e);const i=await this.fetchTickers([e],t);return this.safeDict(i,e)}async fetchTickers(e=void 0,t={}){if(void 0===e)throw new a.ArgumentsRequired(this.id+" fetchTickers() requires a symbols argument");await this.loadMarkets(),e=this.marketSymbols(e);const i=this.safeString(t,"loc","us"),s={symbols:this.marketIds(e).join(","),loc:i};t=this.omit(t,"loc");const r=await this.marketPublicGetV1beta3CryptoLocSnapshots(this.extend(s,t)),o=[],n=this.safeDict(r,"snapshots",{}),d=Object.keys(n);for(let e=0;e=0))throw new a.NotSupported(this.id+" createOrder() does not support stop orders for "+t+" orders, only stop_limit orders are supported");i="stop_limit",d.stop_price=this.priceToPrecision(e,h),d.type=i}t.indexOf("limit")>=0&&(d.limit_price=this.priceToPrecision(e,r));const c=this.safeString(o,"cost");void 0!==c?(o=this.omit(o,"cost"),d.notional=this.costToPrecision(e,c)):d.qty=this.amountToPrecision(e,s);const l=this.safeString(this.options,"defaultTimeInForce");d.time_in_force=this.safeString(o,"timeInForce",l),o=this.omit(o,["timeInForce","triggerPrice"]),d.client_order_id=this.generateClientOrderId(o),o=this.omit(o,["clientOrderId"]);const u=await this.traderPrivatePostV2Orders(this.extend(d,o));return this.parseOrder(u,n)}async cancelOrder(e,t=void 0,i={}){const s={order_id:e},r=await this.traderPrivateDeleteV2OrdersOrderId(this.extend(s,i));return this.parseOrder(r)}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const i=await this.traderPrivateDeleteV2Orders(t);return Array.isArray(i)?this.parseOrders(i,void 0):[this.safeOrder({info:i})]}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const s={order_id:e},r=await this.traderPrivateGetV2OrdersOrderId(this.extend(s,i)),a=this.safeString(r,"symbol"),o=this.safeMarket(a);return this.parseOrder(r,o)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={status:"all"};let a;void 0!==e&&(a=this.market(e),r.symbols=a.id);const o=this.safeInteger(s,"until");void 0!==o&&(s=this.omit(s,"until"),r.endTime=this.iso8601(o)),void 0!==t&&(r.after=this.iso8601(t)),void 0!==i&&(r.limit=i);const n=await this.traderPrivateGetV2Orders(this.extend(r,s));return this.parseOrders(n,a,t,i)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrders(e,t,i,this.extend({status:"open"},s))}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrders(e,t,i,this.extend({status:"closed"},s))}async editOrder(e,t,i,s,r=void 0,a=void 0,o={}){await this.loadMarkets();const n={order_id:e};let d;void 0!==t&&(d=this.market(t)),void 0!==r&&(n.qty=this.amountToPrecision(t,r));const h=this.safeStringN(o,["triggerPrice","stop_price"]);let c;void 0!==h&&(n.stop_price=this.priceToPrecision(t,h),o=this.omit(o,"triggerPrice")),void 0!==a&&(n.limit_price=this.priceToPrecision(t,a)),[c,o]=this.handleOptionAndParams2(o,"editOrder","timeInForce","defaultTimeInForce"),void 0!==c&&(n.time_in_force=c),n.client_order_id=this.generateClientOrderId(o),o=this.omit(o,["clientOrderId"]);const l=await this.traderPrivatePatchV2OrdersOrderId(this.extend(n,o));return this.parseOrder(l,d)}parseOrder(e,t=void 0){const i=this.safeString(e,"symbol"),s=(t=this.safeMarket(i,t)).symbol,r=this.safeString(e,"status"),a=this.parseOrderStatus(r),o=this.safeString(e,"commission");let n;void 0!==o&&(n={cost:o,currency:"USD"});let d=this.safeString(e,"order_type");void 0!==d&&d.indexOf("limit")>=0&&(d="limit");const h=this.safeString(e,"submitted_at"),c=this.parse8601(h);return this.safeOrder({id:this.safeString(e,"id"),clientOrderId:this.safeString(e,"client_order_id"),timestamp:c,datetime:h,lastTradeTimeStamp:void 0,status:a,symbol:s,type:d,timeInForce:this.parseTimeInForce(this.safeString(e,"time_in_force")),postOnly:void 0,side:this.safeString(e,"side"),price:this.safeNumber(e,"limit_price"),triggerPrice:this.safeNumber(e,"stop_price"),cost:void 0,average:this.safeNumber(e,"filled_avg_price"),amount:this.safeNumber(e,"qty"),filled:this.safeNumber(e,"filled_qty"),remaining:void 0,trades:void 0,fee:n,info:e},t)}parseOrderStatus(e){return this.safeString({pending_new:"open",accepted:"open",new:"open",partially_filled:"open",activated:"open",filled:"closed"},e,e)}parseTimeInForce(e){return this.safeString({day:"Day"},e,e)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();let a={activity_type:"FILL"};void 0!==e&&(r=this.market(e));const o=this.safeInteger(s,"until");void 0!==o&&(s=this.omit(s,"until"),a.until=this.iso8601(o)),void 0!==t&&(a.after=this.iso8601(t)),void 0!==i&&(a.page_size=i),[a,s]=this.handleUntilOption("until",a,s);const n=await this.traderPrivateGetV2AccountActivitiesActivityType(this.extend(a,s));return this.parseTrades(n,r,t,i)}parseTrade(e,t=void 0){const i=this.safeString2(e,"S","symbol"),s=this.safeSymbol(i,t),r=this.safeString2(e,"t","transaction_time"),a=this.parse8601(r),o=this.safeString(e,"tks");let n=this.safeString(e,"side");"B"===o?n="buy":"S"===o&&(n="sell");const d=this.safeString2(e,"p","price"),h=this.safeString2(e,"s","qty");return this.safeTrade({info:e,id:this.safeString2(e,"i","id"),timestamp:a,datetime:this.iso8601(a),symbol:s,order:this.safeString(e,"order_id"),type:void 0,side:n,takerOrMaker:"taker",price:d,amount:h,cost:void 0,fee:void 0},t)}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e),s={asset:i.id},r=await this.traderPrivateGetV2Wallets(this.extend(s,t));return this.parseDepositAddress(r,i)}parseDepositAddress(e,t=void 0){let i;return void 0!==t&&(i=t.id),{info:e,currency:i,network:void 0,address:this.safeString(e,"address"),tag:void 0}}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),this.checkAddress(i),await this.loadMarkets();const a=this.currency(e);s&&(i=i+":"+s);const o={asset:a.id,address:i,amount:this.numberToString(t)},n=await this.traderPrivatePostV2WalletsTransfers(this.extend(o,r));return this.parseTransaction(n,a)}async fetchTransactionsHelper(e,t,i,s,r){let a;await this.loadMarkets(),void 0!==t&&(a=this.currency(t));const o=await this.traderPrivateGetV2WalletsTransfers(r),n=[];for(let t=0;t{i.d(t,{A:()=>d});var s=i(5147),r=i(1185),a=i(1579),o=i(4852),n=i(2079);class d extends r.A{describe(){return this.deepExtend(super.describe(),{id:"apex",name:"Apex",countries:[],version:"v3",rateLimit:20,certified:!1,pro:!0,dex:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!1,cancelOrdersForSymbols:!1,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!1,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!1,fetchAccounts:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!1,fetchCanceledOrders:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDeposits:!1,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!0,fetchTransfers:!0,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","2h":"120","4h":"240","6h":"360","12h":"720","1d":"D","1w":"W","1M":"M"},hostname:"omni.apex.exchange",urls:{logo:"https://github.com/user-attachments/assets/fef8f2f7-4265-46aa-965e-33a91881cb00",api:{public:"https://{hostname}/api",private:"https://{hostname}/api"},test:{public:"https://testnet.omni.apex.exchange/api",private:"https://testnet.omni.apex.exchange/api"},www:"https://apex.exchange/",doc:"https://api-docs.pro.apex.exchange",fees:"https://apex-pro.gitbook.io/apex-pro/apex-omni-live-now/trading-perpetual-contracts/trading-fees",referral:"https://omni.apex.exchange/trade"},api:{public:{get:{"v3/symbols":1,"v3/history-funding":1,"v3/ticker":1,"v3/klines":1,"v3/trades":1,"v3/depth":1,"v3/time":1,"v3/data/all-ticker-info":1}},private:{get:{"v3/account":1,"v3/account-balance":1,"v3/fills":1,"v3/order-fills":1,"v3/order":1,"v3/history-orders":1,"v3/order-by-client-order-id":1,"v3/funding":1,"v3/historical-pnl":1,"v3/open-orders":1,"v3/transfers":1,"v3/transfer":1},post:{"v3/delete-open-orders":1,"v3/delete-client-order-id":1,"v3/delete-order":1,"v3/order":1,"v3/set-initial-margin-rate":1,"v3/transfer-out":1,"v3/contract-transfer-out":1}}},httpExceptions:{403:n.RateLimitExceeded},exceptions:{exact:{20006:"apikey sign error",20016:"request para error",10001:n.BadRequest},broad:{ORDER_PRICE_MUST_GREETER_ZERO:n.InvalidOrder,ORDER_POSSIBLE_LEAD_TO_ACCOUNT_LIQUIDATED:n.InvalidOrder,ORDER_WITH_THIS_PRICE_CANNOT_REDUCE_POSITION_ONLY:n.InvalidOrder}},fees:{swap:{taker:this.parseNumber("0.0005"),maker:this.parseNumber("0.0002")}},requiredCredentials:{apiKey:!0,secret:!0,walletAddress:!1,privateKey:!1,password:!0},precisionMode:a.kb,commonCurrencies:{},options:{defaultType:"swap",defaultSlippage:.05,brokerId:"6956"},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,selfTradePrevention:!1,trailing:!0,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:void 0,fetchOHLCV:{limit:200}},swap:{linear:{extends:"default"},inverse:void 0}}})}async fetchTime(e={}){const t=await this.publicGetV3Time(e),i=this.safeDict(t,"data",{});return this.safeInteger(i,"time")}parseBalance(e){const t=this.milliseconds(),i={info:e,timestamp:t,datetime:this.iso8601(t)},s=this.account();return s.free=this.safeString(e,"availableBalance"),s.total=this.safeString(e,"totalEquityValue"),i.USDT=s,this.safeBalance(i)}async fetchBalance(e={}){await this.loadMarkets();const t=await this.privateGetV3AccountBalance(e),i=this.safeDict(t,"data",{});return this.parseBalance(i)}parseAccount(e){return{id:this.safeString(e,"id","0"),type:void 0,code:void 0,info:e}}async fetchAccount(e={}){await this.loadMarkets();const t=await this.privateGetV3Account(e),i=this.safeDict(t,"data",{});return this.parseAccount(i)}async fetchCurrencies(e={}){const t=await this.publicGetV3Symbols(e),i=this.safeDict(t,"data",{}),s=this.safeDict(i,"spotConfig",{}),r=this.safeDict(s,"multiChain",{}),a=this.safeList(s,"assets",[]),o=this.safeList(r,"chains",[]),n={};for(let e=0;e0&&this.markets_by_id[i][0].id2===e&&(t=this.markets_by_id[i][0])}}return super.safeMarket(e,t,i,s)}generateRandomClientIdOmni(e){return"apexomni-"+(e||this.randNumber(12).toString())+"-"+this.milliseconds().toString()+"-"+this.randNumber(6).toString()}addHyphenBeforeUsdt(e){const t=e.toUpperCase().indexOf("USDT"),i=this.safeString(e,t-1);return t>0&&"-"!==i?e.slice(0,t)+"-"+e.slice(t):e}getSeeds(){const e=this.safeString(this.options,"seeds");if(void 0===e)throw new n.ArgumentsRequired(this.id+' the "seeds" key is required in the options to access private endpoints. You can find it in API Management > Omni Key, and then set it as exchange.options["seeds"] = XXXX');return e}async getAccountId(){if("0"===this.safeString(this.options,"accountId","0")){const e=await this.fetchAccount();this.options.accountId=this.safeString(e,"id","0")}return this.options.accountId}async createOrder(e,t,i,r,o=void 0,d={}){await this.loadMarkets();const h=this.market(e),c=t.toUpperCase(),l=i.toUpperCase(),u=this.amountToPrecision(e,r);let f="0";void 0!==o&&(f=this.priceToPrecision(e,o));const p=this.safeDict(this.fees,"swap",{}),m=this.safeNumber(p,"taker",5e-4),g=this.safeNumber(p,"maker",2e-4),v=this.decimalToPrecision(s.Y.stringAdd(s.Y.stringMul(s.Y.stringMul(f,u),m.toString()),h.precision.price.toString()),a.R3,h.precision.price,this.precisionMode,this.paddingMode),y=this.milliseconds(),w="MARKET"===c;if(w&&void 0===o)throw new n.ArgumentsRequired(this.id+" createOrder() requires a price argument for market orders");let b=this.safeStringUpper(d,"timeInForce");const k=this.isPostOnly(w,void 0,d);void 0===b&&(b="GOOD_TIL_CANCEL"),w||(k?b="POST_ONLY":"ioc"===b&&(b="IMMEDIATE_OR_CANCEL")),d=this.omit(d,"timeInForce"),d=this.omit(d,"postOnly");let S=this.safeStringN(d,["clientId","clientOrderId","client_order_id"]);const O=await this.getAccountId();void 0===S&&(S=this.generateRandomClientIdOmni(O)),d=this.omit(d,["clientId","clientOrderId","client_order_id"]);const T={accountId:O,slotId:S,nonce:S,pairId:h.quoteId,size:u,price:f,direction:l,makerFeeRate:g.toString(),takerFeeRate:m.toString()},P=await this.getZKContractSignatureObj(this.remove0xPrefix(this.getSeeds()),T),I={symbol:h.id,side:l,type:c,size:u,price:f,limitFee:v,expiration:Math.floor(y/1e3+2592e3),timeInForce:b,clientId:S,brokerId:this.safeString(this.options,"brokerId","6956")};I.signature=P;const M=await this.privatePostV3Order(this.extend(I,d)),x=this.safeDict(M,"data",{});return this.parseOrder(x,h)}async transfer(e,t,i,r,a={}){await this.loadMarkets();const o=await this.publicGetV3Symbols(a),n=this.safeDict(o,"data",{}),d=this.safeDict(n,"contractConfig",{}),h=this.safeList(d,"assets",[]),c=this.safeDict(n,"spotConfig",{}),l=this.safeList(c,"assets",[]),u=this.safeDict(c,"global",{}),f=this.safeString(u,"contractAssetPoolEthAddress",""),p=this.safeString(u,"contractAssetPoolZkAccountId",""),m=this.safeString(u,"contractAssetPoolSubAccount",""),g=this.safeString(u,"contractAssetPoolAccountId",""),v=await this.privateGetV3Account(a),y=this.safeDict(v,"data",{}),w=this.safeDict(y,"spotAccount",{}),b=this.safeString(w,"zkAccountId",""),k=this.safeString(w,"defaultSubAccountId","0"),S=this.safeList(w,"subAccounts",[]);let O="0";S.length>0&&(O=this.safeString(S[0],"nonce","0"));const T=this.safeString(y,"ethereumAddress",""),P=this.safeString(y,"id","");let I={},M=[];M=void 0!==i&&"contract"===i.toLowerCase()?h:l;for(let t=0;t{i.d(t,{A:()=>d});var s=i(566),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"ascendex",name:"AscendEX",countries:["SG"],rateLimit:400,certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:"emulated",fetchFundingRateHistory:!1,fetchFundingRates:!0,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!0,fetchMarginMode:"emulated",fetchMarginModes:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMySettlementHistory:!1,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,sandbox:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","2h":"120","4h":"240","6h":"360","12h":"720","1d":"1d","1w":"1w","1M":"1m"},version:"v2",urls:{logo:"https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1",api:{rest:"https://ascendex.com"},test:{rest:"https://api-test.ascendex-sandbox.com"},www:"https://ascendex.com",doc:["https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation"],fees:"https://ascendex.com/en/feerate/transactionfee-traderate",referral:{url:"https://ascendex.com/en-us/register?inviteCode=EL6BXBQM",discount:.25}},api:{v1:{public:{get:{assets:1,products:1,ticker:1,"barhist/info":1,barhist:1,depth:1,trades:1,"cash/assets":1,"cash/products":1,"margin/assets":1,"margin/products":1,"futures/collateral":1,"futures/contracts":1,"futures/ref-px":1,"futures/market-data":1,"futures/funding-rates":1,"risk-limit-info":1,"exchange-info":1}},private:{get:{info:1,"wallet/transactions":1,"wallet/deposit/address":1,"data/balance/snapshot":1,"data/balance/history":1},accountCategory:{get:{balance:1,"order/open":1,"order/status":1,"order/hist/current":1,risk:1},post:{order:1,"order/batch":1},delete:{order:1,"order/all":1,"order/batch":1}},accountGroup:{get:{"cash/balance":1,"margin/balance":1,"margin/risk":1,"futures/collateral-balance":1,"futures/position":1,"futures/risk":1,"futures/funding-payments":1,"order/hist":1,"spot/fee":1},post:{transfer:1,"futures/transfer/deposit":1,"futures/transfer/withdraw":1}}}},v2:{public:{get:{assets:1,"futures/contract":1,"futures/collateral":1,"futures/pricing-data":1,"futures/ticker":1,"risk-limit-info":1}},private:{data:{get:{"order/hist":1}},get:{"account/info":1},accountGroup:{get:{"order/hist":1,"futures/position":1,"futures/free-margin":1,"futures/order/hist/current":1,"futures/funding-payments":1,"futures/order/open":1,"futures/order/status":1},post:{"futures/isolated-position-margin":1,"futures/margin-type":1,"futures/leverage":1,"futures/transfer/deposit":1,"futures/transfer/withdraw":1,"futures/order":1,"futures/order/batch":1,"futures/order/open":1,"subuser/subuser-transfer":1,"subuser/subuser-transfer-hist":1},delete:{"futures/order":1,"futures/order/batch":1,"futures/order/all":1}}}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")}},precisionMode:o.kb,options:{"account-category":"cash","account-group":void 0,fetchClosedOrders:{method:"v2PrivateDataGetOrderHist"},defaultType:"spot",accountsByType:{spot:"cash",swap:"futures",margin:"margin"},transfer:{fillResponseFromRequest:!0},networks:{BSC:"BEP20 (BSC)",ARB:"arbitrum",SOL:"Solana",AVAX:"avalanche C chain",OMNI:"Omni",TRC20:"TRC20",ERC20:"ERC20",GO20:"GO20",BEP2:"BEP2",BTC:"Bitcoin",BCH:"Bitcoin ABC",LTC:"Litecoin",MATIC:"Matic Network",AKT:"Akash"}},features:{default:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:{max:10},fetchMyTrades:void 0,fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,marketType:!0,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,marketType:!0,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:500}},spot:{extends:"default",fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1}},forDerivatives:{extends:"default",createOrder:{attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!1,index:!1},price:!1}},fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1}},swap:{linear:{extends:"forDerivatives"},inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{1900:r.BadRequest,2100:r.AuthenticationError,5002:r.BadSymbol,6001:r.BadSymbol,6010:r.InsufficientFunds,60060:r.InvalidOrder,600503:r.InvalidOrder,100001:r.BadRequest,100002:r.BadRequest,100003:r.BadRequest,100004:r.BadRequest,100005:r.BadRequest,100006:r.BadRequest,100007:r.BadRequest,100008:r.BadSymbol,100009:r.AuthenticationError,100010:r.BadRequest,100011:r.BadRequest,100012:r.BadRequest,100013:r.BadRequest,100101:r.ExchangeError,150001:r.BadRequest,200001:r.AuthenticationError,200002:r.ExchangeError,200003:r.ExchangeError,200004:r.ExchangeError,200005:r.ExchangeError,200006:r.ExchangeError,200007:r.ExchangeError,200008:r.ExchangeError,200009:r.ExchangeError,200010:r.AuthenticationError,200011:r.ExchangeError,200012:r.ExchangeError,200013:r.ExchangeError,200014:r.PermissionDenied,200015:r.PermissionDenied,300001:r.InvalidOrder,300002:r.InvalidOrder,300003:r.InvalidOrder,300004:r.InvalidOrder,300005:r.InvalidOrder,300006:r.InvalidOrder,300007:r.InvalidOrder,300008:r.InvalidOrder,300009:r.InvalidOrder,300011:r.InsufficientFunds,300012:r.BadSymbol,300013:r.InvalidOrder,300014:r.InvalidOrder,300020:r.InvalidOrder,300021:r.AccountSuspended,300031:r.InvalidOrder,310001:r.InsufficientFunds,310002:r.InvalidOrder,310003:r.InvalidOrder,310004:r.BadSymbol,310005:r.InvalidOrder,510001:r.ExchangeError,900001:r.ExchangeError},broad:{}},commonCurrencies:{XBT:"XBT",BOND:"BONDED",BTCBEAR:"BEAR",BTCBULL:"BULL",BYN:"BeyondFi",PLN:"Pollen"}})}getAccount(e={}){const t=this.safeValue(e,"account",this.options.account).toLowerCase();return this.capitalize(t)}async fetchCurrencies(e={}){const t=await this.v2PublicGetAssets(e),i=this.safeList(t,"data",[]),s={};for(let e=0;e=0)continue;const i=h[t],s=this.safeString(i,"status"),r=this.safeString(i,"domain");let a=!1;"Normal"!==s&&"InternalTrading"!==s||"LeveragedETF"===r||(a=!0);const o=this.safeNumber(i,"minQty"),n=this.safeNumber(i,"maxQty"),d=this.safeNumber(i,"tickSize"),u=void 0,f=this.safeString2(i,"underlying","symbol").split("/"),p=this.safeString(f,0),m=this.safeString(f,1),g=this.safeCurrencyCode(p),v=this.safeCurrencyCode(m),y=this.safeNumber(i,"commissionReserveRate"),w=this.safeBool(i,"marginTradable",!1);l.push({id:t,symbol:g+"/"+v,base:g,baseId:p,quote:v,quoteId:m,settle:void 0,settleId:void 0,type:"spot",spot:!0,margin:w,swap:!1,future:!1,option:!1,active:a,contract:!1,linear:void 0,inverse:void 0,taker:y,maker:y,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(i,"lotSize"),price:this.safeNumber(i,"tickSize")},limits:{leverage:{min:void 0,max:void 0},amount:{min:o,max:n},price:{min:d,max:u},cost:{min:this.safeNumber(i,"minNotional"),max:this.safeNumber(i,"maxNotional")}},created:this.safeInteger(i,"tradingStartTime"),info:i})}return l}async fetchContractMarkets(e={}){const t=await this.v2PublicGetFuturesContract(e),i=this.safeList(t,"data",[]),s=[];for(let e=0;e1){const e=this.indexBy(h,"chainName");if(void 0===a){const t=Object.keys(e).join(", ");throw new r.ArgumentsRequired(this.id+" fetchDepositAddress() returned more than one address, a chainName parameter is required, one of "+t)}c=this.safeDict(e,a,{})}else c=this.safeDict(h,0,{});const l=this.parseDepositAddress(c,i);return this.extend(l,{info:n})}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactions(e,t,i,this.extend({txType:"deposit"},s))}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactions(e,t,i,this.extend({txType:"withdrawal"},s))}async fetchDepositsWithdrawals(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.asset=a.id),void 0!==t&&(r.startTs=t),void 0!==i&&(r.pageSize=i);const o=await this.v1PrivateGetWalletTransactions(this.extend(r,s)),n=this.safeDict(o,"data",{}),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,i)}parseTransactionStatus(e){return this.safeString({reviewing:"pending",pending:"pending",confirmed:"ok",rejected:"rejected"},e,e)}parseTransaction(e,t=void 0){const i=this.safeDict(e,"destAddress",{}),s=this.safeString(i,"address"),r=this.safeString(i,"destTag"),o=this.safeInteger(e,"time"),n=this.safeString(e,"asset");let d=this.safeString(e,"amount");const h=this.safeString(e,"commission");d=a.Y.stringSub(d,h);const c=this.safeCurrencyCode(n,t);return{info:e,id:this.safeString(e,"requestId"),txid:this.safeString(e,"networkTransactionId"),type:this.safeString(e,"transactionType"),currency:c,network:void 0,amount:this.parseNumber(d),status:this.parseTransactionStatus(this.safeString(e,"status")),timestamp:o,datetime:this.iso8601(o),address:s,addressFrom:void 0,addressTo:s,tag:r,tagFrom:void 0,tagTo:r,updated:void 0,comment:void 0,fee:{currency:c,cost:this.parseNumber(h),rate:void 0},internal:!1}}async fetchPositions(e=void 0,t={}){await this.loadMarkets(),await this.loadAccounts();const i=this.safeDict(this.accounts,0,{}),s={"account-group":this.safeString(i,"id")},r=await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(s,t)),a=this.safeDict(r,"data",{}),o=this.safeList(a,"contracts",[]),n=[];for(let e=0;e100)throw new r.BadRequest(this.id+" leverage should be between 1 and 100");await this.loadMarkets(),await this.loadAccounts();const s=this.market(t);if(!s.swap)throw new r.BadSymbol(this.id+" setLeverage() supports swap contracts only");const a=this.safeDict(this.accounts,0,{}),o={"account-group":this.safeString(a,"id"),symbol:s.id,leverage:e};return await this.v2PrivateAccountGroupPostFuturesLeverage(this.extend(o,i))}async setMarginMode(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("cross"===(e=e.toLowerCase())&&(e="crossed"),"isolated"!==e&&"crossed"!==e)throw new r.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");await this.loadMarkets(),await this.loadAccounts();const s=this.market(t),a=this.safeDict(this.accounts,0,{}),o={"account-group":this.safeString(a,"id"),symbol:s.id,marginType:e};if(!s.swap)throw new r.BadSymbol(this.id+" setMarginMode() supports swap contracts only");return await this.v2PrivateAccountGroupPostFuturesMarginType(this.extend(o,i))}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const i=await this.v2PublicGetFuturesContract(t),s=this.safeList(i,"data",[]);return e=this.marketSymbols(e),this.parseLeverageTiers(s,e,"symbol")}parseMarketLeverageTiers(e,t=void 0){const i=this.safeList(e,"marginRequirements",[]),s=this.safeString(e,"symbol");t=this.safeMarket(s,t);const r=[];for(let e=0;e=0){const e=u.split("/");u=e[2]}if(s=this.omit(s,this.extractParams(e)),"public"===d)Object.keys(s).length&&(c+="?"+this.urlencode(s));else{this.checkRequiredCredentials();const e=this.milliseconds().toString(),t=e+"+"+u,o=this.hmac(this.encode(t),this.encode(this.secret),n.s,"base64");r={"x-auth-key":this.apiKey,"x-auth-timestamp":e,"x-auth-signature":o},"GET"===i?Object.keys(s).length&&(c+="?"+this.urlencode(s)):(r["Content-Type"]="application/json",a=this.json(s))}return c=this.urls.api.rest+c,{url:c,method:i,body:a,headers:r}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"message");if(void 0!==c&&"0"!==c||void 0!==l){const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,c,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),this.throwBroadlyMatchedException(this.exceptions.broad,l,e),new r.ExchangeError(e)}}}},2961:(e,t,i)=>{i.d(t,{k:()=>St});var s=i(5095),r=i(7437),a=i(6238),o=i(2079),n=i(5147),d=i(7288),h=i(3206),c=i(3828),l=i(8283),u=i(8995),f=i(5897),p=i(4380),m=i(447),g=i(3187),v=i(7661),y=i(6907),w=i(9793),b=i(9491),k=i(1878),S=i(4852);const{isNode:O,selfIsDefined:T,deepExtend:P,extend:I,clone:M,flatten:x,unique:_,indexBy:A,sortBy:C,sortBy2:B,safeFloat2:E,groupBy:N,aggregate:R,uuid:L,unCamelCase:D,precisionFromString:q,Throttler:V,capitalize:F,now:G,decimalToPrecision:H,safeValue:U,safeValue2:W,safeString:j,safeString2:K,seconds:z,milliseconds:Y,binaryToBase16:X,numberToBE:Q,base16ToBinary:Z,iso8601:$,omit:J,isJsonEncodedObject:ee,safeInteger:te,sum:ie,omitZero:se,implodeParams:re,extractParams:ae,json:oe,merge:ne,binaryConcat:de,hash:he,ecdsa:ce,arrayConcat:le,encode:ue,urlencode:fe,hmac:pe,numberToString:me,roundTimeframe:ge,parseTimeframe:ve,safeInteger2:ye,safeStringLower:we,parse8601:be,yyyymmdd:ke,safeStringUpper:Se,safeTimestamp:Oe,binaryConcatArray:Te,uuidv1:Pe,numberToLE:Ie,ymdhms:Me,stringToBase64:xe,decode:_e,uuid22:Ae,safeIntegerProduct2:Ce,safeIntegerProduct:Be,safeStringLower2:Ee,yymmdd:Ne,base58ToBinary:Re,binaryToBase58:Le,safeTimestamp2:De,rawencode:qe,keysort:Ve,sort:Fe,inArray:Ge,isEmpty:He,ordered:Ue,filterBy:We,uuid16:je,safeFloat:Ke,base64ToBinary:ze,safeStringUpper2:Ye,urlencodeWithArrayRepeat:Xe,microseconds:Qe,binaryToBase64:Ze,strip:$e,toArray:Je,safeFloatN:et,safeIntegerN:tt,safeIntegerProductN:it,safeTimestampN:st,safeValueN:rt,safeStringN:at,safeStringLowerN:ot,safeStringUpperN:nt,urlencodeNested:dt,urlencodeBase64:ht,parseDate:ct,ymd:lt,base64ToString:ut,crc32:ft,packb:pt,TRUNCATE:mt,ROUND:gt,DECIMAL_PLACES:vt,NO_PADDING:yt,TICK_SIZE:wt,SIGNIFICANT_DIGITS:bt,sleep:kt}=s;class St{constructor(e={}){this.isSandboxModeEnabled=!1,this.throttleProp=void 0,this.sleep=kt,this.api=void 0,this.certified=!1,this.pro=!1,this.countries=void 0,this.userAgent=void 0,this.user_agent=void 0,this.userAgents={chrome:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",chrome39:"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36",chrome100:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"},this.headers={},this.origin="*",this.MAX_VALUE=Number.MAX_VALUE,this.agent=void 0,this.nodeHttpModuleLoaded=!1,this.httpAgent=void 0,this.httpsAgent=void 0,this.minFundingAddressLength=1,this.substituteCommonCurrencyCodes=!0,this.quoteJsonNumbers=!0,this.number=Number,this.handleContentTypeApplicationZip=!1,this.reduceFees=!0,this.validateServerSsl=!0,this.validateClientSsl=!1,this.timeout=1e4,this.verbose=!1,this.twofa=void 0,this.balance={},this.liquidations={},this.orderbooks={},this.tickers={},this.fundingRates={},this.bidsasks={},this.orders=void 0,this.triggerOrders=void 0,this.transactions={},this.myLiquidations={},this.requiresWeb3=!1,this.requiresEddsa=!1,this.precision=void 0,this.enableLastJsonResponse=!1,this.enableLastHttpResponse=!0,this.enableLastResponseHeaders=!0,this.last_http_response=void 0,this.last_json_response=void 0,this.last_response_headers=void 0,this.last_request_headers=void 0,this.last_request_body=void 0,this.last_request_url=void 0,this.last_request_path=void 0,this.id="Exchange",this.markets=void 0,this.features=void 0,this.status=void 0,this.rateLimit=void 0,this.tokenBucket=void 0,this.throttler=void 0,this.enableRateLimit=void 0,this.httpExceptions=void 0,this.limits=void 0,this.markets_by_id=void 0,this.symbols=void 0,this.ids=void 0,this.currencies={},this.baseCurrencies=void 0,this.quoteCurrencies=void 0,this.currencies_by_id=void 0,this.codes=void 0,this.reloadingMarkets=void 0,this.marketsLoading=void 0,this.accounts=void 0,this.accountsById=void 0,this.commonCurrencies=void 0,this.hostname=void 0,this.precisionMode=void 0,this.paddingMode=void 0,this.exceptions={},this.timeframes={},this.version=void 0,this.marketsByAltname=void 0,this.name=void 0,this.targetAccount=void 0,this.stablePairs={},this.clients={},this.newUpdates=!0,this.streaming={},this.alias=!1,this.deepExtend=P,this.deepExtendSafe=P,this.isNode=O,this.keys=r.HP,this.values=r.zu,this.extend=I,this.clone=M,this.flatten=x,this.unique=_,this.indexBy=A,this.indexBySafe=A,this.roundTimeframe=ge,this.sortBy=C,this.sortBy2=B,this.groupBy=N,this.aggregate=R,this.uuid=L,this.unCamelCase=D,this.precisionFromString=q,this.capitalize=F,this.now=G,this.decimalToPrecision=H,this.safeValue=U,this.safeValue2=W,this.safeString=j,this.safeString2=K,this.safeFloat=Ke,this.safeFloat2=E,this.seconds=z,this.milliseconds=Y,this.binaryToBase16=X,this.numberToBE=Q,this.base16ToBinary=Z,this.iso8601=$,this.omit=J,this.isJsonEncodedObject=ee,this.safeInteger=te,this.sum=ie,this.omitZero=se,this.implodeParams=re,this.extractParams=ae,this.json=oe,this.vwap=a.ru,this.merge=ne,this.binaryConcat=de,this.hash=he,this.arrayConcat=le,this.encode=ue,this.urlencode=fe,this.hmac=pe,this.numberToString=me,this.parseTimeframe=ve,this.safeInteger2=ye,this.safeStringLower=we,this.parse8601=be,this.yyyymmdd=ke,this.safeStringUpper=Se,this.safeTimestamp=Oe,this.binaryConcatArray=Te,this.uuidv1=Pe,this.numberToLE=Ie,this.ymdhms=Me,this.yymmdd=Ne,this.stringToBase64=xe,this.decode=_e,this.uuid22=Ae,this.safeIntegerProduct2=Ce,this.safeIntegerProduct=Be,this.binaryToBase58=Le,this.base58ToBinary=Re,this.base64ToBinary=ze,this.safeTimestamp2=De,this.rawencode=qe,this.keysort=Ve,this.sort=Fe,this.inArray=Ge,this.safeStringLower2=Ee,this.safeStringUpper2=Ye,this.isEmpty=He,this.ordered=Ue,this.filterBy=We,this.uuid16=je,this.urlencodeWithArrayRepeat=Xe,this.microseconds=Qe,this.binaryToBase64=Ze,this.strip=$e,this.toArray=Je,this.safeFloatN=et,this.safeIntegerN=tt,this.safeIntegerProductN=it,this.safeTimestampN=st,this.safeValueN=rt,this.safeStringN=at,this.safeStringLowerN=ot,this.safeStringUpperN=nt,this.urlencodeNested=dt,this.parseDate=ct,this.ymd=lt,this.base64ToString=ut,this.crc32=ft,this.packb=pt,this.urlencodeBase64=ht,this.httpProxyAgentModule=void 0,this.httpsProxyAgentModule=void 0,this.socksProxyAgentModule=void 0,this.socksProxyAgentModuleChecked=!1,this.proxyDictionaries={},this.proxiesModulesLoading=void 0,Object.assign(this,s),this.options=this.getDefaultOptions(),this.headers={},this.origin="*",this.minFundingAddressLength=1,this.substituteCommonCurrencyCodes=!0,this.quoteJsonNumbers=!0,this.number=Number,this.handleContentTypeApplicationZip=!1,this.reduceFees=!0,this.fetchImplementation=void 0,this.validateServerSsl=!0,this.validateClientSsl=!1,this.timeout=1e4,this.verbose=!1,this.twofa=void 0,this.apiKey=void 0,this.secret=void 0,this.uid=void 0,this.login=void 0,this.password=void 0,this.privateKey=void 0,this.walletAddress=void 0,this.token=void 0,this.balance={},this.orderbooks={},this.tickers={},this.liquidations={},this.orders=void 0,this.trades={},this.transactions={},this.ohlcvs={},this.myLiquidations={},this.myTrades=void 0,this.positions=void 0,this.requiresWeb3=!1,this.requiresEddsa=!1,this.lastRestRequestTimestamp=0,this.enableLastJsonResponse=!1,this.enableLastHttpResponse=!0,this.enableLastResponseHeaders=!0,this.last_http_response=void 0,this.last_json_response=void 0,this.last_response_headers=void 0,this.last_request_headers=void 0,this.last_request_body=void 0,this.last_request_url=void 0,this.last_request_path=void 0;const t=(e=this)=>{if(null!==e){const i=Object.getOwnPropertyNames(e);for(let e=0;ef&&(i=!1),c===f&&(l>p||l===p&&u>m)&&(i=!1),!i){if(t)throw new o.NotSupported("Your current version of CCXT is "+St.ccxtVersion+", a newer version "+e+" is required, please, upgrade your version of CCXT");return t}return i}throttle(e=void 0){return this.throttler.throttle(e)}initThrottler(){this.throttler=new V(this.tokenBucket)}defineRestApiEndpoint(e,t,i,s,r,a,o={}){const n=r.split(/[^a-zA-Z0-9]/),d=n.map(this.capitalize).join(""),h=n.map((e=>e.trim().toLowerCase())).filter((e=>e.length>0)).join("_"),c=[a[0]].concat(a.slice(1).map(this.capitalize)).join(""),l=[a[0]].concat(a.slice(1).map((e=>e.trim())).filter((e=>e.length>0))).join("_"),u=c+s+this.capitalize(d),f=l+"_"+i+"_"+h,p=a.length>1?a:a[0],m=async(i={},s={})=>this[e](r,p,t,i,void 0,void 0,o,s);this[u]=m,this[f]=m}defineRestApi(e,t,i=[]){const s=Object.keys(e);for(let r=0;r{try{this.httpProxyAgentModule=await import("../static_dependencies/proxies/http-proxy-agent/index.js"),this.httpsProxyAgentModule=await import("../static_dependencies/proxies/https-proxy-agent/index.js")}catch(e){try{this.httpProxyAgentModule=await import("http-proxy-agent"),this.httpsProxyAgentModule=await import("https-proxy-agent")}catch(e){}}if(!1===this.socksProxyAgentModuleChecked){try{this.socksProxyAgentModule=await import("socks-proxy-agent")}catch(e){}this.socksProxyAgentModuleChecked=!0}})()),await this.proxiesModulesLoading}setProxyAgents(e,t,i){let s;if(!O&&(e||t||i))throw new o.NotSupported(this.id+' - proxies in browser-side projects are not supported. You have several choices: [A] Use `exchange.proxyUrl` property to redirect requests through local/remote cors-proxy server (find sample file named "sample-local-proxy-server-with-cors" in https://github.com/ccxt/ccxt/tree/master/examples/ folder, which can be used for REST requests only) [B] override `exchange.fetch` && `exchange.watch` methods to send requests through your custom proxy');if(e){if(void 0===this.httpProxyAgentModule)throw new o.NotSupported(this.id+" you need to load JS proxy modules with `await instance.loadProxyModules()` method at first to use proxies");e in this.proxyDictionaries||(this.proxyDictionaries[e]=new this.httpProxyAgentModule.HttpProxyAgent(e)),s=this.proxyDictionaries[e]}else if(t){if(void 0===this.httpsProxyAgentModule)throw new o.NotSupported(this.id+" you need to load JS proxy modules with `await instance.loadProxyModules()` method at first to use proxies");t in this.proxyDictionaries||(this.proxyDictionaries[t]=new this.httpsProxyAgentModule.HttpsProxyAgent(t)),s=this.proxyDictionaries[t],s.keepAlive=!0}else if(i){if(void 0===this.socksProxyAgentModule)throw new o.NotSupported(this.id+' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" and then initialize proxies with `await instance.loadProxyModules()` method');i in this.proxyDictionaries||(this.proxyDictionaries[i]=new this.socksProxyAgentModule.SocksProxyAgent(i)),s=this.proxyDictionaries[i]}return s}async loadHttpProxyAgent(){if(!this.httpAgent){const e=await import("node:http");this.httpAgent=new e.Agent}return this.httpAgent}getHttpAgentIfNeeded(e){if(O&&"ws://"===e.substring(0,5)){if(void 0===this.httpAgent)throw new o.NotSupported(this.id+" to use proxy with non-ssl ws:// urls, at first run `await exchange.loadHttpProxyAgent()` method");return this.httpAgent}}async fetch(e,t="GET",i=void 0,s=void 0){if(O&&!this.nodeHttpModuleLoaded){this.nodeHttpModuleLoaded=!0;const e=await import("node:https");this.httpsAgent=new e.Agent({keepAlive:!0})}i=this.extend(this.headers,i);const r=this.checkProxyUrlSettings(e,t,i,s);let a=!1;void 0!==r&&(O&&(i=this.extend({Origin:this.origin},i),"http:"===r.substring(0,5)&&(await this.loadHttpProxyAgent(),a=this.httpAgent)),e=r+this.urlEncoderForProxyUrl(e));const[n,d,h]=this.checkProxySettings(e,t,i,s);this.checkConflictingProxies(n||d||h,r),O&&await this.loadProxyModules();const c=this.setProxyAgents(n,d,h),l=void 0!==this.userAgent?this.userAgent:this.user_agent;if(l&&O&&("string"==typeof l?i=this.extend({"User-Agent":l},i):"object"==typeof l&&"User-Agent"in l&&(i=this.extend(l,i))),i=this.setHeaders(i),this.verbose&&this.log("fetch Request:\n",this.id,t,e,"\nRequestHeaders:\n",i,"\nRequestBody:\n",s,"\n"),void 0===this.fetchImplementation)if(O){void 0===this.agent&&(this.agent=this.httpsAgent);try{const e=await import("../static_dependencies/node-fetch/index.js");this.AbortError=e.AbortError,this.fetchImplementation=e.default,this.FetchError=e.FetchError}catch(e){if("function"!=typeof fetch)throw new Error('Seems, "fetch" function is not available in your node-js version, please use latest node-js version');this.fetchImplementation=fetch,this.AbortError=DOMException,this.FetchError=TypeError}}else this.fetchImplementation=T()?self.fetch:fetch,this.AbortError=DOMException,this.FetchError=TypeError;const u=this.fetchImplementation,f={method:t,headers:i,body:s,timeout:this.timeout};this.agent&&(f.agent=this.agent),a?f.agent=a:c&&(f.agent=c);const p=new AbortController;f.signal=p.signal;const m=setTimeout((()=>{p.abort()}),this.timeout);try{const r=await u(e,f);return clearTimeout(m),this.handleRestResponse(r,e,t,i,s)}catch(i){if(i instanceof this.AbortError)throw new o.RequestTimeout(this.id+" "+t+" "+e+" request timed out ("+this.timeout+" ms)");if(i instanceof this.FetchError)throw new o.NetworkError(this.id+" "+t+" "+e+" fetch failed");throw i}}parseJson(e){try{if(this.isJsonEncodedObject(e))return JSON.parse(this.onJsonResponse(e))}catch(e){return}}getResponseHeaders(e){const t={};return e.headers.forEach(((e,i)=>{i=i.split("-").map((e=>this.capitalize(e))).join("-"),t[i]=e})),t}handleRestResponse(e,t,i="GET",s=void 0,r=void 0){const a=this.getResponseHeaders(e);if(this.handleContentTypeApplicationZip&&"application/zip"===a["Content-Type"]){const s=e.buffer();return this.enableLastResponseHeaders&&(this.last_response_headers=a),this.enableLastHttpResponse&&(this.last_http_response=s),this.verbose&&this.log("handleRestResponse:\n",this.id,i,t,e.status,e.statusText,"\nResponseHeaders:\n",a,"ZIP redacted","\n"),s}return e.text().then((o=>{const n=this.onRestResponse(e.status,e.statusText,t,i,a,o,s,r),d=this.parseJson(n);this.enableLastResponseHeaders&&(this.last_response_headers=a),this.enableLastHttpResponse&&(this.last_http_response=o),this.enableLastJsonResponse&&(this.last_json_response=d),this.verbose&&this.log("handleRestResponse:\n",this.id,i,t,e.status,e.statusText,"\nResponseHeaders:\n",a,"\nResponseBody:\n",o,"\n");return this.handleErrors(e.status,e.statusText,t,i,a,o,d,s,r)||this.handleHttpStatusCode(e.status,e.statusText,t,i,o),d||o}))}onRestResponse(e,t,i,s,r,a,o,n){return a.trim()}onJsonResponse(e){return this.quoteJsonNumbers?e.replace(/":([+.0-9eE-]+)([,}])/g,'":"$1"$2'):e}async loadMarketsHelper(e=!1,t={}){if(!e&&this.markets)return this.markets_by_id?this.markets:this.setMarkets(this.markets);let i;!0===this.has.fetchCurrencies&&(i=await this.fetchCurrencies(),this.options.cachedCurrencies=i);const s=await this.fetchMarkets(t);return"cachedCurrencies"in this.options&&delete this.options.cachedCurrencies,this.setMarkets(s,i)}async loadMarkets(e=!1,t={}){return(e&&!this.reloadingMarkets||!this.marketsLoading)&&(this.reloadingMarkets=!0,this.marketsLoading=this.loadMarketsHelper(e,t).then((e=>(this.reloadingMarkets=!1,e)),(e=>{throw this.reloadingMarkets=!1,e}))),this.marketsLoading}async fetchCurrencies(e={}){return new Promise(((e,t)=>e(this.currencies)))}async fetchCurrenciesWs(e={}){return new Promise(((e,t)=>e(this.currencies)))}async fetchMarkets(e={}){return new Promise(((e,t)=>e(Object.values(this.markets))))}async fetchMarketsWs(e={}){return new Promise(((e,t)=>e(Object.values(this.markets))))}checkRequiredDependencies(){}parseNumber(e,t=void 0){if(void 0===e)return t;try{const i=this.numberToString(e);if(i.indexOf("e-")>-1)return this.number(me(parseFloat(i)));const s=this.number(i);return isNaN(s)?t:s}catch(e){return t}}checkOrderArguments(e,t,i,s,r,a){if(void 0===r&&"limit"===t)throw new o.ArgumentsRequired(this.id+" createOrder() requires a price argument for a limit order");if(s<=0)throw new o.ArgumentsRequired(this.id+" createOrder() amount should be above 0")}handleHttpStatusCode(e,t,i,s,r){const a=e.toString();if(a in this.httpExceptions){throw new(0,this.httpExceptions[a])(this.id+" "+s+" "+i+" "+a+" "+t+" "+r)}}remove0xPrefix(e){return"0x"===e.slice(0,2)?e.slice(2):e}spawn(e,...t){const i=(0,h.K)();return setTimeout((()=>{e.apply(this,t).then(i.resolve).catch(i.reject)}),0),i}delay(e,t,...i){setTimeout((()=>{this.spawn(t,...i)}),e)}orderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.Mi(e,t)}indexedOrderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.nS(e,t)}countedOrderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.if(e,t)}handleMessage(e,t){}ping(e){}client(e){if(this.clients=this.clients||{},!this.clients[e]){const t=this.handleMessage.bind(this),i=this.onError.bind(this),s=this.onClose.bind(this),r=this.onConnected.bind(this),a=this.safeValue(this.options,"ws",{}),[o,n,h]=this.checkWsProxySettings(),c=this.setProxyAgents(o,n,h),l=this.getHttpAgentIfNeeded(e),u=c||(l||this.agent),f=this.deepExtend(this.streaming,{log:this.log?this.log.bind(this):this.log,ping:this.ping?this.ping.bind(this):this.ping,verbose:this.verbose,throttler:new V(this.tokenBucket),options:{agent:u}},a);this.clients[e]=new d.A(e,t,i,s,r,f)}return this.clients[e]}watchMultiple(e,t,i=void 0,s=void 0,r=void 0){const a=this.client(e),o=h.K.race(t.map((e=>a.future(e))));let n=[];if(void 0!==s)for(let e=0;e{const e=this.safeValue(this.options,"ws"),t=this.safeValue(e,"cost",1);i&&(this.enableRateLimit&&a.throttle?a.throttle(t).then((()=>{a.send(i)})).catch((e=>{for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=this.safeValue(this.options,"ws"),t=this.safeValue(e,"cost",1);i&&(this.enableRateLimit&&a.throttle?a.throttle(t).then((()=>{a.send(i)})).catch((e=>{a.onError(e)})):a.send(i).catch((e=>{a.onError(e)})))})).catch((e=>{delete a.subscriptions[s],o.reject(e)})),o}onConnected(e,t=void 0){}onError(e,t){e.url in this.clients&&this.clients[e.url].error&&delete this.clients[e.url]}onClose(e,t){e.error||this.clients[e.url]&&delete this.clients[e.url]}async close(){const e=Object.values(this.clients||{}),t=[];for(let i=0;i=0)return d.reset(o),this.handleDeltas(d,a.slice(h)),d.cache.length=0,void e.resolve(d,t);n++}e.reject(new o.ExchangeError(this.id+" nonce is behind the cache after "+a.toString()+" tries."),t),delete this.clients[e.url]}catch(a){e.reject(a,t),await this.loadOrderBook(e,t,i,s,r)}}convertToBigInt(e){return BigInt(e)}stringToCharsArray(e){return e.split("")}valueIsDefined(e){return null!=e}arraySlice(e,t,i=void 0){return void 0===i?e.slice(t):e.slice(t,i)}getProperty(e,t,i=void 0){return t in e?e[t]:i}setProperty(e,t,i=void 0){e[t]=i}axolotl(e,t,i){return(0,l.Sw)(e,t,i)}fixStringifiedJsonMembers(e){let t=e.replaceAll("\\","");return t=t.replaceAll('"{',"{"),t=t.replaceAll('}"',"}"),t}ethAbiEncode(e,t){return this.base16ToBinary(f.Ay.encode(e,t).slice(2))}ethEncodeStructuredData(e,t,i){return this.base16ToBinary(p.z.encode(e,t,i).slice(-132))}retrieveStarkAccount(e,t,i){const s=(0,g.b)(e),r=(0,g.$u)(s),a=y.fP.compile({implementation:t,selector:w.BK("initialize"),calldata:y.fP.compile({signer:r,guardian:"0"})});return{privateKey:s,publicKey:r,address:b.r4(r,i,a,0)}}starknetEncodeStructuredData(e,t,i,s){const r=Object.keys(t);if(r.length>1)throw new o.NotSupported(this.id+" starknetEncodeStructuredData only support single type");const a={domain:e,primaryType:r[0],types:this.extend({StarkNetDomain:[{name:"name",type:"felt"},{name:"chainId",type:"felt"},{name:"version",type:"felt"}]},t),message:i};return k.E(a,s)}starknetSign(e,t){const i=(0,g._S)(e.replace("0x",""),t.slice(-64));return this.json([i.r.toString(),i.s.toString()])}async getZKContractSignatureObj(e,t={}){const i=BigInt("0x"+this.remove0xPrefix(this.hash(this.encode(this.safeString(t,"slotId")),S.s,"hex"))).toString(),s=BigInt("0x"+this.remove0xPrefix(this.hash(this.encode(this.safeString(t,"nonce")),S.s,"hex"))).toString(),r="4294967295",a=parseInt(n.Y.stringMod(this.safeString(t,"accountId"),r),10),o=parseInt(n.Y.stringDiv(n.Y.stringMod(i,"18446744073709551615"),r),10),d=parseInt(n.Y.stringMod(s,r),10);await(0,v.Ay)();const h=v.$s({});await h.initZklinkSigner(e);let c=new v.KR(a,0,o,d,this.safeInteger(t,"pairId"),n.Y.stringMul(this.safeString(t,"size"),"1e18"),n.Y.stringMul(this.safeString(t,"price"),"1e18"),"BUY"===this.safeString(t,"direction"),parseInt(n.Y.stringMul(this.safeString(t,"makerFeeRate"),"10000")),parseInt(n.Y.stringMul(this.safeString(t,"takerFeeRate"),"10000")),!1),l=v.JF(c);l?.sign(h?.getZkLinkSigner());const u=l.jsValue(),f=u?.signature?.signature;return f}async getZKTransferSignatureObj(e,t={}){await(0,v.Ay)();const i=v.$s({});await i.initZklinkSigner(e);let s=this.safeString(t,"nonce","0");if(!0===this.safeBool(t,"isContract")){const e="4294967295",t=BigInt("0x"+this.remove0xPrefix(this.hash(this.encode(s),S.s,"hex"))).toString();s=n.Y.stringMod(t,e)}let r=new v.H3(this.safeNumber(t,"zkAccountId",0),this.safeString(t,"receiverAddress"),this.safeNumber(t,"subAccountId",0),this.safeNumber(t,"receiverSubAccountId",0),this.safeNumber(t,"tokenId",0),this.safeString(t,"fee","0"),this.safeString(t,"amount","0"),this.parseToInt(s),this.safeNumber(t,"timestampSeconds",0)),a=v.qj(r);a?.sign(i?.getZkLinkSigner());const o=a.jsValue(),d=o?.signature?.signature;return d}intToBase16(e){return e.toString(16)}extendExchangeOptions(e){this.options=this.extend(this.options,e)}createSafeDictionary(){return{}}convertToSafeDictionary(e){return e}randomBytes(e){const t=new m.D,i=[];return i.length=e,t.nextBytes(i),Buffer.from(i).toString("hex")}randNumber(e){let t="";for(let i=0;i1){const e=r.join(",");throw new o.InvalidProxySettings(this.id+" you have multiple conflicting proxy settings ("+e+"), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback")}return a}urlEncoderForProxyUrl(e){return e.indexOf("?")>=0?this.encodeURIComponent(e):e}checkProxySettings(e=void 0,t=void 0,i=void 0,s=void 0){const r=[];let a,n,d;const h=this.valueIsDefined(this.httpProxy),c=this.valueIsDefined(this.http_proxy);(h||c)&&(r.push("httpProxy"),a=h?this.httpProxy:this.http_proxy);const l=this.valueIsDefined(this.httpProxyCallback),u=this.valueIsDefined(this.http_proxy_callback);(l||u)&&(r.push("httpProxyCallback"),a=l?this.httpProxyCallback(e,t,i,s):this.http_proxy_callback(e,t,i,s));const f=this.valueIsDefined(this.httpsProxy),p=this.valueIsDefined(this.https_proxy);(f||p)&&(r.push("httpsProxy"),n=f?this.httpsProxy:this.https_proxy);const m=this.valueIsDefined(this.httpsProxyCallback),g=this.valueIsDefined(this.https_proxy_callback);(m||g)&&(r.push("httpsProxyCallback"),n=m?this.httpsProxyCallback(e,t,i,s):this.https_proxy_callback(e,t,i,s));const v=this.valueIsDefined(this.socksProxy),y=this.valueIsDefined(this.socks_proxy);(v||y)&&(r.push("socksProxy"),d=v?this.socksProxy:this.socks_proxy);const w=this.valueIsDefined(this.socksProxyCallback),b=this.valueIsDefined(this.socks_proxy_callback);(w||b)&&(r.push("socksProxyCallback"),d=w?this.socksProxyCallback(e,t,i,s):this.socks_proxy_callback(e,t,i,s));if(r.length>1){const e=r.join(",");throw new o.InvalidProxySettings(this.id+" you have multiple conflicting proxy settings ("+e+"), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback")}return[a,n,d]}checkWsProxySettings(){const e=[];let t,i,s;const r=this.valueIsDefined(this.wsProxy),a=this.valueIsDefined(this.ws_proxy);(r||a)&&(e.push("wsProxy"),t=r?this.wsProxy:this.ws_proxy);const n=this.valueIsDefined(this.wssProxy),d=this.valueIsDefined(this.wss_proxy);(n||d)&&(e.push("wssProxy"),i=n?this.wssProxy:this.wss_proxy);const h=this.valueIsDefined(this.wsSocksProxy),c=this.valueIsDefined(this.ws_socks_proxy);(h||c)&&(e.push("wsSocksProxy"),s=h?this.wsSocksProxy:this.ws_socks_proxy);if(e.length>1){const t=e.join(",");throw new o.InvalidProxySettings(this.id+" you have multiple conflicting proxy settings ("+t+"), please use only one from: wsProxy, wssProxy, wsSocksProxy")}return[t,i,s]}checkConflictingProxies(e,t){if(e&&t)throw new o.InvalidProxySettings(this.id+" you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy")}checkAddress(e=void 0){if(void 0===e)throw new o.InvalidAddress(this.id+" address is undefined");if(1===this.unique(this.stringToCharsArray(e)).length||e.length-1)throw new o.InvalidAddress(this.id+" address is invalid or has less than "+this.minFundingAddressLength.toString()+' characters: "'+e.toString()+'"');return e}findMessageHashes(e,t){const i=[],s=Object.keys(e.futures);for(let e=0;e=0&&i.push(r)}return i}filterByLimit(e,t=void 0,i="timestamp",s=!1){if(this.valueIsDefined(t)){const r=e.length;if(r>0){let a=!0;if(i in e[0]){const t=e[0][i],s=e[r-1][i];void 0!==t&&void 0!==s&&(a=t<=s)}s?(t>r&&(t=r),e=a?this.arraySlice(e,0,t):this.arraySlice(e,-t)):e=a?this.arraySlice(e,-t):this.arraySlice(e,0,t)}}return e}filterBySinceLimit(e,t=void 0,i=void 0,s="timestamp",r=!1){const a=this.valueIsDefined(t),o=this.toArray(e);let n=o;if(a){n=[];for(let e=0;e=t&&n.push(i)}}if(r&&void 0!==i)return this.arraySlice(n,-i);const d=!r&&a;return this.filterByLimit(n,i,s,d)}filterByValueSinceLimit(e,t,i=void 0,s=void 0,r=void 0,a="timestamp",o=!1){const n=this.valueIsDefined(i),d=this.valueIsDefined(s),h=this.toArray(e);let c=h;if(n||d){c=[];for(let e=0;e=s)&&c.push(r)}}return o&&void 0!==r?this.arraySlice(c,-r):this.filterByLimit(c,r,a,d)}setSandboxMode(e){if(e){if(!("test"in this.urls))throw new o.NotSupported(this.id+" does not have a sandbox URL");"string"==typeof this.urls.api?(this.urls.apiBackup=this.urls.api,this.urls.api=this.urls.test):(this.urls.apiBackup=this.clone(this.urls.api),this.urls.api=this.clone(this.urls.test)),this.isSandboxModeEnabled=!0}else if("apiBackup"in this.urls){"string"==typeof this.urls.api?this.urls.api=this.urls.apiBackup:this.urls.api=this.clone(this.urls.apiBackup);const e=this.omit(this.urls,"apiBackup");this.urls=e,this.isSandboxModeEnabled=!1}}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){return{}}async fetchAccounts(e={}){throw new o.NotSupported(this.id+" fetchAccounts() is not supported yet")}async fetchTrades(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchTrades() is not supported yet")}async fetchTradesWs(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchTradesWs() is not supported yet")}async watchLiquidations(e,t=void 0,i=void 0,s={}){if(this.has.watchLiquidationsForSymbols)return await this.watchLiquidationsForSymbols([e],t,i,s);throw new o.NotSupported(this.id+" watchLiquidations() is not supported yet")}async watchLiquidationsForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchLiquidationsForSymbols() is not supported yet")}async watchMyLiquidations(e,t=void 0,i=void 0,s={}){if(this.has.watchMyLiquidationsForSymbols)return this.watchMyLiquidationsForSymbols([e],t,i,s);throw new o.NotSupported(this.id+" watchMyLiquidations() is not supported yet")}async watchMyLiquidationsForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchMyLiquidationsForSymbols() is not supported yet")}async watchTrades(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchTrades() is not supported yet")}async unWatchTrades(e,t={}){throw new o.NotSupported(this.id+" unWatchTrades() is not supported yet")}async watchTradesForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchTradesForSymbols() is not supported yet")}async unWatchTradesForSymbols(e,t={}){throw new o.NotSupported(this.id+" unWatchTradesForSymbols() is not supported yet")}async watchMyTradesForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchMyTradesForSymbols() is not supported yet")}async watchOrdersForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchOrdersForSymbols() is not supported yet")}async watchOHLCVForSymbols(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchOHLCVForSymbols() is not supported yet")}async unWatchOHLCVForSymbols(e,t={}){throw new o.NotSupported(this.id+" unWatchOHLCVForSymbols() is not supported yet")}async watchOrderBookForSymbols(e,t=void 0,i={}){throw new o.NotSupported(this.id+" watchOrderBookForSymbols() is not supported yet")}async unWatchOrderBookForSymbols(e,t={}){throw new o.NotSupported(this.id+" unWatchOrderBookForSymbols() is not supported yet")}async fetchDepositAddresses(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchDepositAddresses() is not supported yet")}async fetchOrderBook(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrderBook() is not supported yet")}async fetchOrderBookWs(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrderBookWs() is not supported yet")}async fetchMarginMode(e,t={}){if(this.has.fetchMarginModes){const i=await this.fetchMarginModes([e],t);return this.safeDict(i,e)}throw new o.NotSupported(this.id+" fetchMarginMode() is not supported yet")}async fetchMarginModes(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchMarginModes () is not supported yet")}async fetchRestOrderBookSafe(e,t=void 0,i={}){const s=this.handleOption("watchOrderBook","maxRetries",3);for(let r=0;r=0?parseFloat(t):parseInt(t)}isRoundNumber(e){return 0===this.parseToNumeric(e%1)}safeNumberOmitZero(e,t,i=void 0){const s=this.safeString(e,t),r=this.parseNumber(this.omitZero(s));return void 0===r?i:r}safeIntegerOmitZero(e,t,i=void 0){const s=this.safeInteger(e,t,i);if(void 0!==s&&0!==s)return s}afterConstruct(){this.createNetworksByIdObject(),this.featuresGenerator(),this.markets&&this.setMarkets(this.markets),this.initRestRateLimiter();const e=this.safeBool2(this.options,"sandbox","testnet",!1);e&&this.setSandboxMode(e)}initRestRateLimiter(){if(void 0===this.rateLimit||void 0!==this.id&&-1===this.rateLimit)throw new o.ExchangeError(this.id+".rateLimit property is not configured");let e=this.MAX_VALUE;this.rateLimit>0&&(e=1/this.rateLimit);const t={delay:.001,capacity:1,cost:1,maxCapacity:1e3,refillRate:e},i=void 0===this.tokenBucket?{}:this.tokenBucket;this.tokenBucket=this.extend(t,i),this.initThrottler()}featuresGenerator(){if(void 0===this.features)return;const e=this.features;this.features={};const t=["spot","swap","future","option"],i=["linear","inverse"];for(let s=0;ss.precision?t:s}o.push(s)}const n=this.sortBy(o,"code");this.currencies=this.deepExtend(this.currencies,this.indexBy(n,"code"))}this.currencies_by_id=this.indexBySafe(this.currencies,"id");const o=this.keysort(this.currencies);return this.codes=Object.keys(o),this.markets}getDescribeForExtendedWsExchange(e,t,i){const s=this.deepExtend(t.describe(),e.describe());return this.deepExtend(s,i)}safeBalance(e){const t=this.omit(e,["info","timestamp","datetime","free","used","total"]),i=Object.keys(t);e.free={},e.used={},e.total={};const s={};for(let t=0;t0){void 0===e.symbol&&(e.symbol=O[0].symbol),void 0===e.side&&(e.side=O[0].side),void 0===e.type&&(e.type=O[0].type),void 0===e.id&&(e.id=O[0].order),f&&(r="0"),p&&(a="0");for(let e=0;e=this.sum(a[d][0],r)?a.push([n,s.price,s.price,s.price,s.price,s.amount,1]):(a[d][2]=Math.max(a[d][2],s.price),a[d][3]=Math.min(a[d][3],s.price),a[d][4]=s.price,a[d][5]=this.sum(a[d][5],s.amount),a[d][6]=this.sum(a[d][6],1))}return a}parseTradingViewOHLCV(e,t=void 0,i="1m",s=void 0,r=void 0){const a=this.convertTradingViewToOHLCV(e);return this.parseOHLCVs(a,t,i,s,r)}async editLimitBuyOrder(e,t,i,s=void 0,r={}){return await this.editLimitOrder(e,t,"buy",i,s,r)}async editLimitSellOrder(e,t,i,s=void 0,r={}){return await this.editLimitOrder(e,t,"sell",i,s,r)}async editLimitOrder(e,t,i,s,r=void 0,a={}){return await this.editOrder(e,t,"limit",i,s,r,a)}async editOrder(e,t,i,s,r=void 0,a=void 0,o={}){return await this.cancelOrder(e,t),await this.createOrder(t,i,s,r,a,o)}async editOrderWs(e,t,i,s,r=void 0,a=void 0,o={}){return await this.cancelOrderWs(e,t),await this.createOrderWs(t,i,s,r,a,o)}async fetchPosition(e,t={}){throw new o.NotSupported(this.id+" fetchPosition() is not supported yet")}async fetchPositionWs(e,t={}){throw new o.NotSupported(this.id+" fetchPositionWs() is not supported yet")}async watchPosition(e=void 0,t={}){throw new o.NotSupported(this.id+" watchPosition() is not supported yet")}async watchPositions(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchPositions() is not supported yet")}async watchPositionForSymbols(e=void 0,t=void 0,i=void 0,s={}){return await this.watchPositions(e,t,i,s)}async fetchPositionsForSymbol(e,t={}){throw new o.NotSupported(this.id+" fetchPositionsForSymbol() is not supported yet")}async fetchPositionsForSymbolWs(e,t={}){throw new o.NotSupported(this.id+" fetchPositionsForSymbol() is not supported yet")}async fetchPositions(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositions() is not supported yet")}async fetchPositionsWs(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositions() is not supported yet")}async fetchPositionsRisk(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositionsRisk() is not supported yet")}async fetchBidsAsks(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchBidsAsks() is not supported yet")}async fetchBorrowInterest(e=void 0,t=void 0,i=void 0,s=void 0,r={}){throw new o.NotSupported(this.id+" fetchBorrowInterest() is not supported yet")}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchLedger() is not supported yet")}async fetchLedgerEntry(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchLedgerEntry() is not supported yet")}parseBidAsk(e,t=0,i=1,s=2){const r=this.safeNumber(e,t),a=this.safeNumber(e,i),o=this.safeInteger(e,s),n=[r,a];return void 0!==o&&n.push(o),n}safeCurrency(e,t=void 0){if(void 0===e&&void 0!==t)return t;if(void 0!==this.currencies_by_id&&e in this.currencies_by_id&&void 0!==this.currencies_by_id[e])return this.currencies_by_id[e];let i=e;return void 0!==e&&(i=this.commonCurrencyCode(e.toUpperCase())),this.safeCurrencyStructure({id:e,code:i,precision:void 0})}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){const r=this.safeMarketStructure({symbol:e,marketId:e});if(void 0!==e)if(void 0!==this.markets_by_id&&e in this.markets_by_id){const i=this.markets_by_id[e];if(1===i.length)return i[0];if(void 0===s){if(void 0===t)throw new o.ArgumentsRequired(this.id+" safeMarket() requires a fourth argument for "+e+" to disambiguate between different markets with the same market id");s=t.type}for(let e=0;e=0)return s}}handleErrors(e,t,i,s,r,a,o,n,d){}calculateRateLimiterCost(e,t,i,s,r={}){return this.safeValue(r,"cost",1)}async fetchTicker(e,t={}){if(this.has.fetchTickers){await this.loadMarkets();e=this.market(e).symbol;const i=await this.fetchTickers([e],t),s=this.safeDict(i,e);if(void 0===s)throw new o.NullResponse(this.id+" fetchTickers() could not find a ticker for "+e);return s}throw new o.NotSupported(this.id+" fetchTicker() is not supported yet")}async fetchMarkPrice(e,t={}){if(this.has.fetchMarkPrices){await this.loadMarkets();e=this.market(e).symbol;const i=await this.fetchMarkPrices([e],t),s=this.safeDict(i,e);if(void 0===s)throw new o.NullResponse(this.id+" fetchMarkPrices() could not find a ticker for "+e);return s}throw new o.NotSupported(this.id+" fetchMarkPrices() is not supported yet")}async fetchTickerWs(e,t={}){if(this.has.fetchTickersWs){await this.loadMarkets();e=this.market(e).symbol;const i=await this.fetchTickersWs([e],t),s=this.safeDict(i,e);if(void 0===s)throw new o.NullResponse(this.id+" fetchTickerWs() could not find a ticker for "+e);return s}throw new o.NotSupported(this.id+" fetchTickerWs() is not supported yet")}async watchTicker(e,t={}){throw new o.NotSupported(this.id+" watchTicker() is not supported yet")}async fetchTickers(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchTickers() is not supported yet")}async fetchMarkPrices(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchMarkPrices() is not supported yet")}async fetchTickersWs(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchTickers() is not supported yet")}async fetchOrderBooks(e=void 0,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrderBooks() is not supported yet")}async watchBidsAsks(e=void 0,t={}){throw new o.NotSupported(this.id+" watchBidsAsks() is not supported yet")}async watchTickers(e=void 0,t={}){throw new o.NotSupported(this.id+" watchTickers() is not supported yet")}async unWatchTickers(e=void 0,t={}){throw new o.NotSupported(this.id+" unWatchTickers() is not supported yet")}async fetchOrder(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrder() is not supported yet")}async fetchOrderWs(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrderWs() is not supported yet")}async fetchOrderStatus(e,t=void 0,i={}){return(await this.fetchOrder(e,t,i)).status}async fetchUnifiedOrder(e,t={}){return await this.fetchOrder(this.safeString(e,"id"),this.safeString(e,"symbol"),t)}async createOrder(e,t,i,s,r=void 0,a={}){throw new o.NotSupported(this.id+" createOrder() is not supported yet")}async createConvertTrade(e,t,i,s=void 0,r={}){throw new o.NotSupported(this.id+" createConvertTrade() is not supported yet")}async fetchConvertTrade(e,t=void 0,i={}){throw new o.NotSupported(this.id+" fetchConvertTrade() is not supported yet")}async fetchConvertTradeHistory(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchConvertTradeHistory() is not supported yet")}async fetchPositionMode(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositionMode() is not supported yet")}async createTrailingAmountOrder(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingAmountOrder() requires a trailingAmount argument");if(d.trailingAmount=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingAmountOrder)return await this.createOrder(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createTrailingAmountOrder() is not supported yet")}async createTrailingAmountOrderWs(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingAmountOrderWs() requires a trailingAmount argument");if(d.trailingAmount=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingAmountOrderWs)return await this.createOrderWs(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createTrailingAmountOrderWs() is not supported yet")}async createTrailingPercentOrder(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingPercent argument");if(d.trailingPercent=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingPercentOrder)return await this.createOrder(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createTrailingPercentOrder() is not supported yet")}async createTrailingPercentOrderWs(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingPercentOrderWs() requires a trailingPercent argument");if(d.trailingPercent=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingPercentOrderWs)return await this.createOrderWs(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createTrailingPercentOrderWs() is not supported yet")}async createMarketOrderWithCost(e,t,i,s={}){if(this.has.createMarketOrderWithCost||this.has.createMarketBuyOrderWithCost&&this.has.createMarketSellOrderWithCost)return await this.createOrder(e,"market",t,i,1,s);throw new o.NotSupported(this.id+" createMarketOrderWithCost() is not supported yet")}async createMarketBuyOrderWithCost(e,t,i={}){if(this.options.createMarketBuyOrderRequiresPrice||this.has.createMarketBuyOrderWithCost)return await this.createOrder(e,"market","buy",t,1,i);throw new o.NotSupported(this.id+" createMarketBuyOrderWithCost() is not supported yet")}async createMarketSellOrderWithCost(e,t,i={}){if(this.options.createMarketSellOrderRequiresPrice||this.has.createMarketSellOrderWithCost)return await this.createOrder(e,"market","sell",t,1,i);throw new o.NotSupported(this.id+" createMarketSellOrderWithCost() is not supported yet")}async createMarketOrderWithCostWs(e,t,i,s={}){if(this.has.createMarketOrderWithCostWs||this.has.createMarketBuyOrderWithCostWs&&this.has.createMarketSellOrderWithCostWs)return await this.createOrderWs(e,"market",t,i,1,s);throw new o.NotSupported(this.id+" createMarketOrderWithCostWs() is not supported yet")}async createTriggerOrder(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTriggerOrder() requires a triggerPrice argument");if(n.triggerPrice=a,this.has.createTriggerOrder)return await this.createOrder(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createTriggerOrder() is not supported yet")}async createTriggerOrderWs(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTriggerOrderWs() requires a triggerPrice argument");if(n.triggerPrice=a,this.has.createTriggerOrderWs)return await this.createOrderWs(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createTriggerOrderWs() is not supported yet")}async createStopLossOrder(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createStopLossOrder() requires a stopLossPrice argument");if(n.stopLossPrice=a,this.has.createStopLossOrder)return await this.createOrder(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createStopLossOrder() is not supported yet")}async createStopLossOrderWs(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createStopLossOrderWs() requires a stopLossPrice argument");if(n.stopLossPrice=a,this.has.createStopLossOrderWs)return await this.createOrderWs(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createStopLossOrderWs() is not supported yet")}async createTakeProfitOrder(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTakeProfitOrder() requires a takeProfitPrice argument");if(n.takeProfitPrice=a,this.has.createTakeProfitOrder)return await this.createOrder(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createTakeProfitOrder() is not supported yet")}async createTakeProfitOrderWs(e,t,i,s,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTakeProfitOrderWs() requires a takeProfitPrice argument");if(n.takeProfitPrice=a,this.has.createTakeProfitOrderWs)return await this.createOrderWs(e,t,i,s,r,n);throw new o.NotSupported(this.id+" createTakeProfitOrderWs() is not supported yet")}async createOrderWithTakeProfitAndStopLoss(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(d=this.setTakeProfitAndStopLossParams(e,t,i,s,r,a,n,d),this.has.createOrderWithTakeProfitAndStopLoss)return await this.createOrder(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createOrderWithTakeProfitAndStopLoss() is not supported yet")}setTakeProfitAndStopLossParams(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a&&void 0===n)throw new o.ArgumentsRequired(this.id+" createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument");void 0!==a&&(d.takeProfit={triggerPrice:a}),void 0!==n&&(d.stopLoss={triggerPrice:n});const h=this.safeString(d,"takeProfitType"),c=this.safeString(d,"takeProfitPriceType"),l=this.safeString(d,"takeProfitLimitPrice"),u=this.safeString(d,"takeProfitAmount"),f=this.safeString(d,"stopLossType"),p=this.safeString(d,"stopLossPriceType"),m=this.safeString(d,"stopLossLimitPrice"),g=this.safeString(d,"stopLossAmount");return void 0!==h&&(d.takeProfit.type=h),void 0!==c&&(d.takeProfit.priceType=c),void 0!==l&&(d.takeProfit.price=this.parseToNumeric(l)),void 0!==u&&(d.takeProfit.amount=this.parseToNumeric(u)),void 0!==f&&(d.stopLoss.type=f),void 0!==p&&(d.stopLoss.priceType=p),void 0!==m&&(d.stopLoss.price=this.parseToNumeric(m)),void 0!==g&&(d.stopLoss.amount=this.parseToNumeric(g)),d=this.omit(d,["takeProfitType","takeProfitPriceType","takeProfitLimitPrice","takeProfitAmount","stopLossType","stopLossPriceType","stopLossLimitPrice","stopLossAmount"])}async createOrderWithTakeProfitAndStopLossWs(e,t,i,s,r=void 0,a=void 0,n=void 0,d={}){if(d=this.setTakeProfitAndStopLossParams(e,t,i,s,r,a,n,d),this.has.createOrderWithTakeProfitAndStopLossWs)return await this.createOrderWs(e,t,i,s,r,d);throw new o.NotSupported(this.id+" createOrderWithTakeProfitAndStopLossWs() is not supported yet")}async createOrders(e,t={}){throw new o.NotSupported(this.id+" createOrders() is not supported yet")}async editOrders(e,t={}){throw new o.NotSupported(this.id+" editOrders() is not supported yet")}async createOrderWs(e,t,i,s,r=void 0,a={}){throw new o.NotSupported(this.id+" createOrderWs() is not supported yet")}async cancelOrder(e,t=void 0,i={}){throw new o.NotSupported(this.id+" cancelOrder() is not supported yet")}async cancelOrderWs(e,t=void 0,i={}){throw new o.NotSupported(this.id+" cancelOrderWs() is not supported yet")}async cancelOrdersWs(e,t=void 0,i={}){throw new o.NotSupported(this.id+" cancelOrdersWs() is not supported yet")}async cancelAllOrders(e=void 0,t={}){throw new o.NotSupported(this.id+" cancelAllOrders() is not supported yet")}async cancelAllOrdersAfter(e,t={}){throw new o.NotSupported(this.id+" cancelAllOrdersAfter() is not supported yet")}async cancelOrdersForSymbols(e,t={}){throw new o.NotSupported(this.id+" cancelOrdersForSymbols() is not supported yet")}async cancelAllOrdersWs(e=void 0,t={}){throw new o.NotSupported(this.id+" cancelAllOrdersWs() is not supported yet")}async cancelUnifiedOrder(e,t={}){return this.cancelOrder(this.safeString(e,"id"),this.safeString(e,"symbol"),t)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){if(this.has.fetchOpenOrders&&this.has.fetchClosedOrders)throw new o.NotSupported(this.id+" fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead");throw new o.NotSupported(this.id+" fetchOrders() is not supported yet")}async fetchOrdersWs(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchOrdersWs() is not supported yet")}async fetchOrderTrades(e,t=void 0,i=void 0,s=void 0,r={}){throw new o.NotSupported(this.id+" fetchOrderTrades() is not supported yet")}async watchOrders(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchOrders() is not supported yet")}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){if(this.has.fetchOrders){const r=await this.fetchOrders(e,t,i,s);return this.filterBy(r,"status","open")}throw new o.NotSupported(this.id+" fetchOpenOrders() is not supported yet")}async fetchOpenOrdersWs(e=void 0,t=void 0,i=void 0,s={}){if(this.has.fetchOrdersWs){const r=await this.fetchOrdersWs(e,t,i,s);return this.filterBy(r,"status","open")}throw new o.NotSupported(this.id+" fetchOpenOrdersWs() is not supported yet")}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){if(this.has.fetchOrders){const r=await this.fetchOrders(e,t,i,s);return this.filterBy(r,"status","closed")}throw new o.NotSupported(this.id+" fetchClosedOrders() is not supported yet")}async fetchCanceledAndClosedOrders(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchCanceledAndClosedOrders() is not supported yet")}async fetchClosedOrdersWs(e=void 0,t=void 0,i=void 0,s={}){if(this.has.fetchOrdersWs){const r=await this.fetchOrdersWs(e,t,i,s);return this.filterBy(r,"status","closed")}throw new o.NotSupported(this.id+" fetchClosedOrdersWs() is not supported yet")}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchMyTrades() is not supported yet")}async fetchMyLiquidations(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchMyLiquidations() is not supported yet")}async fetchLiquidations(e,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchLiquidations() is not supported yet")}async fetchMyTradesWs(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchMyTradesWs() is not supported yet")}async watchMyTrades(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" watchMyTrades() is not supported yet")}async fetchGreeks(e,t={}){throw new o.NotSupported(this.id+" fetchGreeks() is not supported yet")}async fetchOptionChain(e,t={}){throw new o.NotSupported(this.id+" fetchOptionChain() is not supported yet")}async fetchOption(e,t={}){throw new o.NotSupported(this.id+" fetchOption() is not supported yet")}async fetchConvertQuote(e,t,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchConvertQuote() is not supported yet")}async fetchDepositsWithdrawals(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchDepositsWithdrawals() is not supported yet")}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchDeposits() is not supported yet")}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchWithdrawals() is not supported yet")}async fetchDepositsWs(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchDepositsWs() is not supported yet")}async fetchWithdrawalsWs(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchWithdrawalsWs() is not supported yet")}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchFundingRateHistory() is not supported yet")}async fetchFundingHistory(e=void 0,t=void 0,i=void 0,s={}){throw new o.NotSupported(this.id+" fetchFundingHistory() is not supported yet")}async closePosition(e,t=void 0,i={}){throw new o.NotSupported(this.id+" closePosition() is not supported yet")}async closeAllPositions(e={}){throw new o.NotSupported(this.id+" closeAllPositions() is not supported yet")}async fetchL3OrderBook(e,t=void 0,i={}){throw new o.BadRequest(this.id+" fetchL3OrderBook() is not supported yet")}parseLastPrice(e,t=void 0){throw new o.NotSupported(this.id+" parseLastPrice() is not supported yet")}async fetchDepositAddress(e,t={}){if(this.has.fetchDepositAddresses){const i=await this.fetchDepositAddresses([e],t),s=this.safeValue(i,e);if(void 0===s)throw new o.InvalidAddress(this.id+" fetchDepositAddress() could not find a deposit address for "+e+", make sure you have created a corresponding deposit address in your wallet on the exchange website");return s}if(this.has.fetchDepositAddressesByNetwork){const i=this.safeString(t,"network");t=this.omit(t,"network");const s=await this.fetchDepositAddressesByNetwork(e,t);if(void 0!==i)return this.safeDict(s,i);{const e=Object.keys(s),t=this.safeString(e,0);return this.safeDict(s,t)}}throw new o.NotSupported(this.id+" fetchDepositAddress() is not supported yet")}account(){return{free:void 0,used:void 0,total:void 0}}commonCurrencyCode(e){return this.substituteCommonCurrencyCodes?this.safeString(this.commonCurrencies,e,e):e}currency(e){if(void 0===this.currencies)throw new o.ExchangeError(this.id+" currencies not loaded");if("string"==typeof e){if(e in this.currencies)return this.currencies[e];if(e in this.currencies_by_id)return this.currencies_by_id[e]}throw new o.ExchangeError(this.id+" does not have currency code "+e)}market(e){if(void 0===this.markets)throw new o.ExchangeError(this.id+" markets not loaded");if(e in this.markets)return this.markets[e];if(e in this.markets_by_id){const t=this.markets_by_id[e],i=this.safeString2(this.options,"defaultType","defaultSubType","spot");for(let e=0;e0&&!this.inArray(t,s)){const t=s.join(", ");let r=this.id+" "+e+"() requires a "+i+" argument";throw""!==t&&(r+=", one of ("+t+")"),new o.ArgumentsRequired(r)}}checkRequiredMarginArgument(e,t,i){if("isolated"===i&&void 0===t)throw new o.ArgumentsRequired(this.id+" "+e+"() requires a symbol argument for isolated margin");if("cross"===i&&void 0!==t)throw new o.ArgumentsRequired(this.id+" "+e+"() cannot have a symbol argument for cross margin")}parseDepositWithdrawFees(e,t=void 0,i=void 0){const s={},r=Array.isArray(e);let a=e;r||(a=Object.keys(e));for(let o=0;o=g)break}}catch(e){if(m+=1,m>h)throw e}}let v=p;u&&(v=this.removeRepeatedElementsFromArray(p));const y="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(v,i,s,y)}async safeDeterministicCall(e,t=void 0,i=void 0,s=void 0,r=void 0,a={}){let n;[n,a]=this.handleOptionAndParams(a,e,"maxRetries",3);let d=0;for(;d<=n;)try{return r&&"fetchFundingRateHistory"!==e?await this[e](t,r,i,s,a):await this[e](t,i,s,a)}catch(e){if(e instanceof o.RateLimitExceeded)throw e;if(d+=1,d>n)throw e}return[]}async fetchPaginatedCallDeterministic(e,t=void 0,i=void 0,s=void 0,r=void 0,a={},n=void 0){let d;[d,a]=this.handleOptionAndParams(a,e,"paginationCalls",10),[n,a]=this.handleMaxEntriesPerRequestAndParams(e,n,a);const h=this.milliseconds(),c=[],l=1e3*this.parseTimeframe(r)*n;let u=h-d*l-1;u=void 0!==i?Math.max(u,i):Math.max(u,1241440531e3);const f=this.safeInteger2(a,"until","till");if(void 0!==f){const e=Math.ceil((f-i)/l);if(e>d)throw new o.BadRequest(this.id+" the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is "+d.toString()+" required calls is "+e.toString())}for(let i=0;i=f)&&!(u>=h);i++)c.push(this.safeDeterministicCall(e,t,u,n,r,a)),u=this.sum(u,l)-1;const p=await Promise.all(c);let m=[];for(let e=0;ec)throw e}u+=1}const g=this.sortCursorPaginatedResult(p),v="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(g,i,s,v)}async fetchPaginatedCallIncremental(e,t=void 0,i=void 0,s=void 0,r={},a=void 0,o=void 0){let n,d;[n,r]=this.handleOptionAndParams(r,e,"paginationCalls",10),[d,r]=this.handleOptionAndParams(r,e,"maxRetries",3),[o,r]=this.handleMaxEntriesPerRequestAndParams(e,o,r);let h=0,c=0,l=[];for(;hd)throw e}h+=1}const u=this.sortCursorPaginatedResult(l),f="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(u,i,s,f)}sortCursorPaginatedResult(e){const t=this.safeValue(e,0);if(void 0!==t){if("timestamp"in t)return this.sortBy(e,"timestamp",!0);if("id"in t)return this.sortBy(e,"id",!0)}return e}removeRepeatedElementsFromArray(e,t=!0){const i={},s=[];for(let r=0;r0?s:e}removeRepeatedTradesFromArray(e){const t={};for(let i=0;i0)for(let e=0;e{i.d(t,{A:()=>n,Y:()=>o});const s=BigInt(0),r=BigInt(-1),a=BigInt(10);class o{constructor(e,t=void 0){if(this.base=void 0,void 0===t){let t=0;if((e=e.toLowerCase()).indexOf("e")>-1){let i="0";[e,i]=e.split("e"),t=parseInt(i)}const i=e.indexOf(".");this.decimals=i>-1?e.length-i-1:0;const s=e.replace(".","");this.integer=BigInt(s),this.decimals=this.decimals-t}else this.integer=e,this.decimals=t}mul(e){const t=this.integer*e.integer;return new o(t,this.decimals+e.decimals)}div(e,t=18){const i=t-this.decimals+e.decimals;let s;if(0===i)s=this.integer;else if(i<0){const e=a**BigInt(-i);s=this.integer/e}else{const e=a**BigInt(i);s=this.integer*e}const r=s/e.integer;return new o(r,t)}add(e){if(this.decimals===e.decimals){const t=this.integer+e.integer;return new o(t,this.decimals)}{const[t,i]=this.decimals>e.decimals?[e,this]:[this,e],s=i.decimals-t.decimals,r=t.integer*a**BigInt(s)+i.integer;return new o(r,i.decimals)}}mod(e){const t=Math.max(-this.decimals+e.decimals,0),i=this.integer*a**BigInt(t),s=Math.max(-e.decimals+this.decimals,0),r=e.integer*a**BigInt(s);return new o(i%r,s+e.decimals)}sub(e){const t=new o(-e.integer,e.decimals);return this.add(t)}abs(){return new o(this.integer<0?this.integer*r:this.integer,this.decimals)}neg(){return new o(-this.integer,this.decimals)}or(e){const t=this.integer|e.integer;return new o(t,this.decimals)}min(e){return this.lt(e)?this:e}max(e){return this.gt(e)?this:e}gt(e){return this.sub(e).integer>0}ge(e){return this.sub(e).integer>=0}lt(e){return e.gt(this)}le(e){return e.ge(this)}reduce(){const e=this.integer.toString(),t=e.length-1;if(0===t)return"0"===e&&(this.decimals=0),this;let i;for(i=t;i>=0&&"0"===e.charAt(i);i--);const s=t-i;if(0===s)return this;this.decimals-=s,this.integer=BigInt(e.slice(0,i+1))}equals(e){return this.reduce(),e.reduce(),this.decimals===e.decimals&&this.integer===e.integer}toString(){let e,t;this.reduce(),this.integer<0?(e="-",t=-this.integer):(e="",t=this.integer);const i=Array.from(t.toString(Number(a)).padStart(this.decimals,"0")),s=i.length-this.decimals;let r;return r=0===s?"0.":this.decimals<0?"0".repeat(-this.decimals):0===this.decimals?"":".",i.splice(s,0,r),e+i.join("")}static stringMul(e,t){if(void 0!==e&&void 0!==t)return new o(e).mul(new o(t)).toString()}static stringDiv(e,t,i=18){if(void 0===e||void 0===t)return;const r=new o(t);return r.integer!==s?new o(e).div(r,i).toString():void 0}static stringAdd(e,t){if(void 0!==e||void 0!==t)return void 0===e?t:void 0===t?e:new o(e).add(new o(t)).toString()}static stringSub(e,t){if(void 0!==e&&void 0!==t)return new o(e).sub(new o(t)).toString()}static stringAbs(e){if(void 0!==e)return new o(e).abs().toString()}static stringNeg(e){if(void 0!==e)return new o(e).neg().toString()}static stringMod(e,t){if(void 0!==e&&void 0!==t)return new o(e).mod(new o(t)).toString()}static stringOr(e,t){if(void 0!==e&&void 0!==t)return new o(e).or(new o(t)).toString()}static stringEquals(e,t){if(void 0!==e&&void 0!==t)return new o(e).equals(new o(t))}static stringEq(e,t){if(void 0!==e&&void 0!==t)return new o(e).equals(new o(t))}static stringMin(e,t){if(void 0!==e&&void 0!==t)return new o(e).min(new o(t)).toString()}static stringMax(e,t){if(void 0!==e&&void 0!==t)return new o(e).max(new o(t)).toString()}static stringGt(e,t){if(void 0!==e&&void 0!==t)return new o(e).gt(new o(t))}static stringGe(e,t){if(void 0!==e&&void 0!==t)return new o(e).ge(new o(t))}static stringLt(e,t){if(void 0!==e&&void 0!==t)return new o(e).lt(new o(t))}static stringLe(e,t){if(void 0!==e&&void 0!==t)return new o(e).le(new o(t))}}const n=o},2079:(e,t,i)=>{i.r(t),i.d(t,{AccountNotEnabled:()=>n,AccountSuspended:()=>d,AddressPending:()=>w,ArgumentsRequired:()=>h,AuthenticationError:()=>a,BadRequest:()=>c,BadResponse:()=>V,BadSymbol:()=>l,BaseError:()=>s,CancelPending:()=>G,ChecksumError:()=>D,ContractUnavailable:()=>I,DDoSProtection:()=>B,DuplicateOrderId:()=>P,ExchangeClosedByUser:()=>_,ExchangeError:()=>r,ExchangeNotAvailable:()=>N,InsufficientFunds:()=>v,InvalidAddress:()=>y,InvalidNonce:()=>L,InvalidOrder:()=>b,InvalidProxySettings:()=>x,ManualInteractionNeeded:()=>g,MarginModeAlreadySet:()=>p,MarketClosed:()=>m,NetworkError:()=>C,NoChange:()=>f,NotSupported:()=>M,NullResponse:()=>F,OnMaintenance:()=>R,OperationFailed:()=>A,OperationRejected:()=>u,OrderImmediatelyFillable:()=>O,OrderNotCached:()=>S,OrderNotFillable:()=>T,OrderNotFound:()=>k,PermissionDenied:()=>o,RateLimitExceeded:()=>E,RequestTimeout:()=>q,UnsubscribeError:()=>H,default:()=>U});class s extends Error{constructor(e){super(e),this.name="BaseError"}}class r extends s{constructor(e){super(e),this.name="ExchangeError"}}class a extends r{constructor(e){super(e),this.name="AuthenticationError"}}class o extends a{constructor(e){super(e),this.name="PermissionDenied"}}class n extends o{constructor(e){super(e),this.name="AccountNotEnabled"}}class d extends a{constructor(e){super(e),this.name="AccountSuspended"}}class h extends r{constructor(e){super(e),this.name="ArgumentsRequired"}}class c extends r{constructor(e){super(e),this.name="BadRequest"}}class l extends c{constructor(e){super(e),this.name="BadSymbol"}}class u extends r{constructor(e){super(e),this.name="OperationRejected"}}class f extends u{constructor(e){super(e),this.name="NoChange"}}class p extends f{constructor(e){super(e),this.name="MarginModeAlreadySet"}}class m extends u{constructor(e){super(e),this.name="MarketClosed"}}class g extends u{constructor(e){super(e),this.name="ManualInteractionNeeded"}}class v extends r{constructor(e){super(e),this.name="InsufficientFunds"}}class y extends r{constructor(e){super(e),this.name="InvalidAddress"}}class w extends y{constructor(e){super(e),this.name="AddressPending"}}class b extends r{constructor(e){super(e),this.name="InvalidOrder"}}class k extends b{constructor(e){super(e),this.name="OrderNotFound"}}class S extends b{constructor(e){super(e),this.name="OrderNotCached"}}class O extends b{constructor(e){super(e),this.name="OrderImmediatelyFillable"}}class T extends b{constructor(e){super(e),this.name="OrderNotFillable"}}class P extends b{constructor(e){super(e),this.name="DuplicateOrderId"}}class I extends b{constructor(e){super(e),this.name="ContractUnavailable"}}class M extends r{constructor(e){super(e),this.name="NotSupported"}}class x extends r{constructor(e){super(e),this.name="InvalidProxySettings"}}class _ extends r{constructor(e){super(e),this.name="ExchangeClosedByUser"}}class A extends s{constructor(e){super(e),this.name="OperationFailed"}}class C extends A{constructor(e){super(e),this.name="NetworkError"}}class B extends C{constructor(e){super(e),this.name="DDoSProtection"}}class E extends C{constructor(e){super(e),this.name="RateLimitExceeded"}}class N extends C{constructor(e){super(e),this.name="ExchangeNotAvailable"}}class R extends N{constructor(e){super(e),this.name="OnMaintenance"}}class L extends C{constructor(e){super(e),this.name="InvalidNonce"}}class D extends L{constructor(e){super(e),this.name="ChecksumError"}}class q extends C{constructor(e){super(e),this.name="RequestTimeout"}}class V extends A{constructor(e){super(e),this.name="BadResponse"}}class F extends V{constructor(e){super(e),this.name="NullResponse"}}class G extends A{constructor(e){super(e),this.name="CancelPending"}}class H extends s{constructor(e){super(e),this.name="UnsubscribeError"}}const U={BaseError:s,ExchangeError:r,AuthenticationError:a,PermissionDenied:o,AccountNotEnabled:n,AccountSuspended:d,ArgumentsRequired:h,BadRequest:c,BadSymbol:l,OperationRejected:u,NoChange:f,MarginModeAlreadySet:p,MarketClosed:m,ManualInteractionNeeded:g,InsufficientFunds:v,InvalidAddress:y,AddressPending:w,InvalidOrder:b,OrderNotFound:k,OrderNotCached:S,OrderImmediatelyFillable:O,OrderNotFillable:T,DuplicateOrderId:P,ContractUnavailable:I,NotSupported:M,InvalidProxySettings:x,ExchangeClosedByUser:_,OperationFailed:A,NetworkError:C,DDoSProtection:B,RateLimitExceeded:E,ExchangeNotAvailable:N,OnMaintenance:R,InvalidNonce:L,ChecksumError:D,RequestTimeout:q,BadResponse:V,NullResponse:F,CancelPending:G,UnsubscribeError:H}},5095:(e,t,i)=>{i.r(t),i.d(t,{DECIMAL_PLACES:()=>n.fv,NO_PADDING:()=>n.w1,PAD_WITH_ZERO:()=>n.ex,ROUND:()=>n.D_,ROUND_DOWN:()=>n._g,ROUND_UP:()=>n.Tz,SIGNIFICANT_DIGITS:()=>n.v,TICK_SIZE:()=>n.kb,TRUNCATE:()=>n.R3,Throttler:()=>l.x,TimedOut:()=>c.GA,aggregate:()=>u.QD,arrayConcat:()=>r.ax,asFloat:()=>o.Pf,asInteger:()=>o.JU,axolotl:()=>h.Sw,base16ToBinary:()=>d.FF,base58ToBinary:()=>d.Ry,base64ToBinary:()=>d.cg,base64ToString:()=>d.QM,binaryConcat:()=>d.qo,binaryConcatArray:()=>d.Vw,binaryToBase16:()=>d.t7,binaryToBase58:()=>d.bj,binaryToBase64:()=>d.sQ,binaryToString:()=>d.kn,capitalize:()=>a.ZH,clone:()=>r.o8,crc32:()=>h.QR,decimalToPrecision:()=>n.fq,decode:()=>d.D4,deepExtend:()=>r.zw,ecdsa:()=>h.h1,eddsa:()=>h.q4,encode:()=>d.lF,extend:()=>r.X$,extractParams:()=>u.um,filterBy:()=>r.WP,flatten:()=>r.Bq,groupBy:()=>r.$z,hasProps:()=>o.dl,hash:()=>h.tW,hmac:()=>h.w8,implodeParams:()=>u.Hp,inArray:()=>r.RV,index:()=>r.Pe,indexBy:()=>r.wQ,isArray:()=>o.cy,isBrowser:()=>s.Bd,isDeno:()=>s.N6,isDictionary:()=>o.Hf,isElectron:()=>s.b8,isEmpty:()=>r.Im,isInteger:()=>o.Fq,isJsonEncodedObject:()=>d.mC,isNode:()=>s.Ll,isNumber:()=>o.Et,isObject:()=>o.Gv,isString:()=>o.Kg,isStringCoercible:()=>o.KL,isWebWorker:()=>s.p7,isWindows:()=>s.uF,iso8601:()=>c.LC,json:()=>d.Pq,keys:()=>r.HP,keysort:()=>r.CA,mdy:()=>c.rE,merge:()=>r.h1,microseconds:()=>c.EZ,milliseconds:()=>c.Rz,now:()=>c.tB,numberToBE:()=>d.qE,numberToLE:()=>d.aN,numberToString:()=>n.um,omit:()=>r.cJ,omitZero:()=>n.Ye,ordered:()=>r.Sj,packb:()=>d.Am,parse8601:()=>c.Dj,parseDate:()=>c._U,parseTimeframe:()=>u.ce,pluck:()=>r.Ey,precisionConstants:()=>n.S2,precisionFromString:()=>n.Iu,prop:()=>o._w,rawencode:()=>d.rO,rfc2616:()=>c.D9,roundTimeframe:()=>u.jG,safeFloat:()=>o.w,safeFloat2:()=>o.Cw,safeFloatN:()=>o.Q7,safeInteger:()=>o.Y2,safeInteger2:()=>o.mU,safeIntegerN:()=>o.At,safeIntegerProduct:()=>o.lu,safeIntegerProduct2:()=>o.J0,safeIntegerProductN:()=>o.hO,safeString:()=>o.nr,safeString2:()=>o.d0,safeStringLower:()=>o.gw,safeStringLower2:()=>o.uS,safeStringLowerN:()=>o.I9,safeStringN:()=>o.Rc,safeStringUpper:()=>o.RH,safeStringUpper2:()=>o.F7,safeStringUpperN:()=>o.fu,safeTimestamp:()=>o.q0,safeTimestamp2:()=>o.ww,safeTimestampN:()=>o.Y_,safeValue:()=>o.pI,safeValue2:()=>o.Dj,safeValueN:()=>o.DR,seconds:()=>c.YA,selfIsDefined:()=>u.Se,setTimeout_safe:()=>c.k4,sleep:()=>c.yy,sort:()=>r.di,sortBy:()=>r.Ul,sortBy2:()=>r.sy,stringToBase64:()=>d.q3,stringToBinary:()=>d.wN,strip:()=>a.bB,sum:()=>r.cz,timeout:()=>c.wR,toArray:()=>r.$r,truncate:()=>n.xv,truncate_to_string:()=>n.NZ,unCamelCase:()=>a.Qd,unique:()=>r.Am,urlencode:()=>d.mu,urlencodeBase64:()=>d.LI,urlencodeNested:()=>d.Dy,urlencodeWithArrayRepeat:()=>d.ev,uuid:()=>a.uR,uuid16:()=>a.tg,uuid22:()=>a._n,uuidv1:()=>c.nm,values:()=>r.zu,vwap:()=>u.ru,ymd:()=>c.Th,ymdhms:()=>c.RR,yymmdd:()=>c.x_,yyyymmdd:()=>c.Rn});var s=i(7597),r=i(7437),a=i(3503),o=i(6834),n=i(1579),d=i(9560),h=i(8283),c=i(8403),l=i(7618),u=i(6238)},8283:(e,t,i)=>{i.d(t,{QR:()=>v,Sw:()=>m,h1:()=>p,q4:()=>g,tW:()=>u,w8:()=>f});var s=i(712),r=i(4710),a=i(5268),o=i(890),n=i(987),d=i(8342),h=i(191);const c={binary:e=>e,hex:r.xn.encode,base64:r.K3.encode},l={"1.3.132.0.10":n.bI,"1.2.840.10045.3.1.7":d.Qj},u=(e,t,i="hex")=>{const s=t(e);return c[i](s)},f=(e,t,i,r="hex")=>{const a=(0,s.w)(i,t,e);return c[r](a)};function p(e,t,i,s=null,r=!1){if(s&&(e=u(e,s,"hex")),"string"==typeof t&&t.length>64){if(!t.startsWith("-----BEGIN EC PRIVATE KEY-----"))throw new Error("Unsupported key format");{const e=a.o.unarmor(t);let s=o.Ge.decode(e);if(4!==s.sub.length)throw new Error("Unsupported key format");if(null!==typeof s.sub[2].sub&&s.sub[2].sub.length>0){const e=s.sub[2].sub[0].content(void 0);if(void 0===l[e])throw new Error("Unsupported curve");i=l[e]}t=s.sub[1].getHexStringValue()}}let n=i.sign(e,t,{lowS:!0});const d=(BigInt(1)<c||n.r<=d||n.s<=d);)n=i.sign(e,t,{lowS:!0,extraEntropy:(0,h.z)(BigInt(f),32)}),f+=1;return{r:n.r.toString(16),s:n.s.toString(16),v:n.recovery}}function m(e,t,i){const s=i.signModified(e,t);return r.tw.encode(s)}function g(e,t,i){let s;32===t.length?s=t:"string"==typeof t&&(s=new Uint8Array(a.o.unarmor(t).slice(16)));const o=i.sign(e,s);return r.K3.encode(o)}function v(e,t=!1){void 0===v.table&&(v.table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".split(" ").map((e=>parseInt(e,16))));let i=-1;for(let t=0;t>>8^v.table[255&(i^e.charCodeAt(t))];const s=~i>>>0;return t&&s>=2147483648?s-4294967296:s}},9560:(e,t,i)=>{i.d(t,{Am:()=>C,D4:()=>M,Dy:()=>O,FF:()=>g,LI:()=>x,Pq:()=>d,QM:()=>f,Ry:()=>y,Vw:()=>k,aN:()=>_,bj:()=>w,cg:()=>p,ev:()=>T,kn:()=>c,lF:()=>I,mC:()=>h,mu:()=>S,q3:()=>u,qE:()=>A,qo:()=>b,rO:()=>P,sQ:()=>m,t7:()=>v,wN:()=>l});var s=i(4710),r=i(191),a=i(917),o=i(4580),n=i.n(o);const d=(e,t=void 0)=>JSON.stringify(e),h=e=>"string"==typeof e&&e.length>=2&&("{"===e[0]||"["===e[0]),c=s.As.encode,l=s.As.decode,u=e=>s.K3.encode(s.As.decode(e)),f=e=>s.As.encode(s.K3.decode(e)),p=s.K3.decode,m=s.K3.encode,g=s.xn.decode,v=s.xn.encode,y=s.tw.decode,w=s.tw.encode,b=r.Id,k=e=>(0,r.Id)(...e),S=(e,t=!1)=>n().stringify(e),O=e=>n().stringify(e),T=e=>n().stringify(e,{arrayFormat:"repeat"}),P=(e,t=!1)=>n().stringify(e,{encode:!1}),I=s.As.decode,M=s.As.encode,x=e=>("string"==typeof e?u(e):m(e)).replace(/[=]+$/,"").replace(/\+/g,"-").replace(/\//g,"_"),_=(e,t)=>(0,r.z)(BigInt(e),t),A=(e,t)=>(0,r.lq)(BigInt(e),t);function C(e){return(0,a.l)(e)}},7437:(e,t,i)=>{i.d(t,{$r:()=>f,$z:()=>v,Am:()=>c,Bq:()=>S,CA:()=>m,Ey:()=>O,HP:()=>r,Im:()=>p,Pe:()=>o,RV:()=>u,Sj:()=>h,Ul:()=>b,WP:()=>w,X$:()=>n,ax:()=>l,cJ:()=>T,cz:()=>P,di:()=>g,h1:()=>M,o8:()=>d,sy:()=>k,wQ:()=>y,zu:()=>a,zw:()=>I});var s=i(6834);const r=Object.keys,a=e=>(0,s.cy)(e)?e:Object.values(e),o=e=>new Set(a(e)),n=(...e)=>Object.assign({},...e),d=e=>(0,s.cy)(e)?Array.from(e):n(e),h=e=>e,c=e=>Array.from(o(e)),l=(e,t)=>e.concat(t),u=(e,t)=>t.includes(e),f=e=>Object.values(e),p=e=>!e||(Array.isArray(e)?e:Object.keys(e)).length<1,m=(e,t={})=>{for(const i of r(e).sort())t[i]=e[i];return t},g=e=>{const t=e.slice();return t.sort(),t},v=(e,t,i={})=>{for(const s of a(e))if(t in s){const e=s[t];i[e]=i[e]||[],i[e].push(s)}return i},y=(e,t,i={})=>{for(const s of a(e))t in s&&(i[s[t]]=s);return i},w=(e,t,i=void 0,s=[])=>{for(const r of a(e))r[t]===i&&s.push(r);return s},b=(e,t,i=!1,s=0,r=(i?-1:1))=>e.sort(((e,i)=>{const a=t in e?e[t]:s,o=t in i?i[t]:s;return ao?r:0})),k=(e,t,i,s=!1,r=(s?-1:1))=>e.sort(((e,s)=>e[t]s[t]?r:e[i]s[i]?r:0)),S=function e(t,i=[]){for(const r of t)(0,s.cy)(r)?e(r,i):i.push(r);return i},O=(e,t)=>a(e).filter((e=>t in e)).map((e=>e[t])),T=(e,...t)=>{if(!Array.isArray(e)){const i=d(e);for(const e of t)if((0,s.cy)(e))for(const t of e)delete i[t];else delete i[e];return i}return e},P=(...e)=>{const t=e.filter(s.Et);return t.length>0?t.reduce(((e,t)=>e+t),0):void 0},I=function e(...t){let i;for(const r of t)if((0,s.Hf)(r)){(0,s.Hf)(i)||(i={});for(const t in r)i[t]=e(i[t],r[t])}else i=r;return i},M=(e,...t)=>{const i={},s=Object.assign({},...t),r=Object.keys(s);for(let t=0;t{i.d(t,{Hp:()=>h,QD:()=>l,Se:()=>u,ce:()=>o,jG:()=>n,ru:()=>c,um:()=>d});var s=i(1579),r=i(6834),a=i(2079);const o=e=>{const t=(0,r.Pf)(e.slice(0,-1)),i=e.slice(-1);let s;if("y"===i)s=31536e3;else if("M"===i)s=2592e3;else if("w"===i)s=604800;else if("d"===i)s=86400;else if("h"===i)s=3600;else if("m"===i)s=60;else{if("s"!==i)throw new a.NotSupported("timeframe unit "+i+" is not supported");s=1}return t*s},n=(e,t,i=s._g)=>{const r=1e3*o(e);return t-t%r+(i===s.Tz?r:0)},d=e=>{const t=/{([\w-]+)}/g,i=[];let s=t.exec(e);for(;s;)i.push(s[1]),s=t.exec(e);return i},h=(e,t)=>{if(!Array.isArray(t)){const i=Object.keys(t);for(let s=0;s0?t/e:void 0}function l(e){const t={};for(let i=0;i0&&(t[s]=(t[s]||0)+r)}return Object.keys(t).map((e=>[parseFloat(e),parseFloat(t[e])]))}function u(){let e=!1;try{e=void 0!==self}catch(t){e=!1}return e}},1579:(e,t,i)=>{i.d(t,{D_:()=>r,Iu:()=>v,NZ:()=>m,R3:()=>s,S2:()=>u,Tz:()=>a,Ye:()=>b,_g:()=>o,ex:()=>l,fq:()=>y,fv:()=>n,kb:()=>h,um:()=>f,v:()=>d,w1:()=>c,xv:()=>g});const s=0,r=1,a=2,o=3,n=2,d=3,h=4,c=5,l=6,u={ROUND:r,TRUNCATE:s,ROUND_UP:a,ROUND_DOWN:o,DECIMAL_PLACES:n,SIGNIFICANT_DIGITS:d,TICK_SIZE:h,NO_PADDING:c,PAD_WITH_ZERO:l};function f(e){if(void 0===e)return;if("number"!=typeof e)return e.toString();const t=e.toString();if(Math.abs(e)<1){const i=t.split("e-"),s=i[0].replace(".",""),r=parseInt(i[1]),a="-"===t[0];if(r)return e=(a?"-":"")+"0."+new Array(r).join("0")+s.substring(a)}else{const e=t.split("e");if(e[1]){let t=parseInt(e[1]);const i=e[0].split(".");let s="";return i[1]&&(t-=i[1].length,s=i[1]),i[0]+s+new Array(t+1).join("0")}}return t}const p=[],m=(e,t=0)=>{if(e=f(e),t>0){const i=p[t]||(p[t]=new RegExp("([-]*\\d+\\.\\d{"+t+"})(\\d)")),[,s]=e.toString().match(i)||[null,e];return s.toString()}return parseInt(e).toString()},g=(e,t=0)=>parseFloat(m(e,t));function v(e){if(e.indexOf("e")>-1||e.indexOf("E")>-1){const t=e.replace(/\d\.?\d*[eE]/,"");return-1*parseInt(t)}const t=e.replace(/0+$/g,"").split(".");return t.length>1?t[1].length:0}const y=(e,t,i,s=n,r=c)=>w(e,t,i,s,r),w=(e,t,i,a=n,o=c)=>{if(a===h&&("string"==typeof i&&(i=parseFloat(i)),i<=0))throw new Error("TICK_SIZE cant be used with negative or zero numPrecisionDigits");if(i<0){const n=Math.pow(10,-i);if(t===r)return(n*w(e/n,t,0,a,o)).toString();if(t===s)return(e-e%n).toString()}if(a===h){const a=v(w(i,r,22,n,c));let d=e%i;d=Number(w(d,r,8,n,c));return 0!==v(w(d/i,r,Math.max(a,8),n,c))&&(t===r?e>0?d>=i/2?e=e-d+i:e-=d:e=d>=i/2?Number(e)-d:Number(e)-d-i:t===s&&(e-=d)),w(e,r,a,n,o)}const l=f(e),u="-"===l[0],p=u?1:0,m=l.length;for(var g=0;g57)throw new Error(`${l}: invalid number (contains an illegal character '${l[P-1]}')`);k[P]=e,e!==b&&O<0&&(O=P)}}O<0&&(O=1);let M=a===n?S:O,x=M+i;T=-1;let _=!0,A=u;for(let e=k.length-1,s=0;e>=0;e--){let a=k[e];if(0!==e){if(a+=s,e>=M+i){a=t===r&&a>=53&&!(53===a&&s)?58:b}a>57?(a=b,s=1):s=0}else s&&(a=49);k[e]=a,a!==b&&(_=!1,O=e,T=T<0?e+1:T)}a===d&&(M=O,x=M+i),_&&(A=!1);const C=O>=S||_?S-1:O,B=T{i.d(t,{Bd:()=>s,Ll:()=>d,N6:()=>n,b8:()=>r,p7:()=>a,uF:()=>o});const s="undefined"!=typeof window,r="undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.electron,a="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,o="undefined"!=typeof process&&"win32"===process.platform,n="undefined"!=typeof Deno,d=!(s||a||n)},5354:(e,t,i)=>{i.d(t,{a:()=>h,n:()=>d});var s=i(5944),r=i(4710),a=i(9560),o=i(8283),n=i(8342);function d(e,t,i){const a=new s.v;a.setPrivateKey(t);const o=i.create().constructor.name.toLowerCase();return a.sign(e,(e=>r.xn.encode(i(e))),o)}function h(e,t,i,s=!1,h={}){let c=(s?"RS":"HS")+8*i.outputLen;h.alg&&(c=h.alg.toUpperCase());const l=Object.assign({alg:c,typ:"JWT"},h);void 0!==l.iat&&(e.iat=l.iat,delete l.iat);const u=[(0,a.LI)(JSON.stringify(l)),(0,a.LI)(JSON.stringify(e))].join("."),f=c.slice(0,2);let p;if("HS"===f)p=(0,a.LI)((0,o.w8)(u,t,i,"binary"));else if(s||"RS"===f)p=(0,a.LI)((0,a.cg)(d(u,r.As.encode(t),i)));else if("ES"===f){const e=(0,o.h1)(u,r.As.encode(t),n.Qj,i),s=e.r.padStart(64,"0"),d=e.s.padStart(64,"0");p=(0,a.LI)((0,a.FF)(s+d))}return[u,p].join(".")}},3503:(e,t,i)=>{i.d(t,{Qd:()=>s,ZH:()=>r,_n:()=>d,bB:()=>a,tg:()=>n,uR:()=>o});const s=e=>{const t={fetchOHLCVWs:"fetch_ohlcv_ws"};return t[e]?t[e]:e.match(/[A-Z]/)?e.replace(/[a-z0-9][A-Z]/g,(e=>e[0]+"_"+e[1])).replace(/[A-Z0-9][A-Z0-9][a-z][^$]/g,(e=>e[0]+"_"+e[1]+e[2]+e[3])).replace(/[a-z][0-9]$/g,(e=>e[0]+"_"+e[1])).toLowerCase():e},r=e=>e.length?e.charAt(0).toUpperCase()+e.slice(1):e,a=e=>e.replace(/^\s+|\s+$/g,""),o=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,o),n=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e5]+100+400+8e3).replace(/[018]/g,n),d=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e7]+1e3+4e3+8e5).replace(/[018]/g,d)},7618:(e,t,i)=>{i.d(t,{x:()=>r});var s=i(8403);class r{constructor(e){this.config={refillRate:1,delay:.001,capacity:1,maxCapacity:2e3,tokens:0,cost:1},Object.assign(this.config,e),this.queue=[],this.running=!1}async loop(){let e=(0,s.tB)();for(;this.running;){const{resolver:t,cost:i}=this.queue[0];if(this.config.tokens>=0)this.config.tokens-=i,t(),this.queue.shift(),await Promise.resolve(),0===this.queue.length&&(this.running=!1);else{await(0,s.yy)(1e3*this.config.delay);const t=(0,s.tB)(),i=t-e;e=t;const r=this.config.tokens+this.config.refillRate*i;this.config.tokens=Math.min(r,this.config.capacity)}}}throttle(e=void 0){let t;const i=new Promise(((e,i)=>{t=e}));if(this.queue.length>this.config.maxCapacity)throw new Error("throttle queue is over maxCapacity ("+this.config.maxCapacity.toString()+"), see https://github.com/ccxt/ccxt/issues/11645#issuecomment-1195695526");return e=void 0===e?this.config.cost:e,this.queue.push({resolver:t,cost:e}),this.running||(this.running=!0,this.loop()),i}}},8403:(e,t,i)=>{i.d(t,{D9:()=>p,Dj:()=>u,EZ:()=>r,GA:()=>c,LC:()=>l,RR:()=>w,Rn:()=>y,Rz:()=>a,Th:()=>g,YA:()=>o,_U:()=>f,k4:()=>h,nm:()=>n,rE:()=>m,tB:()=>s,wR:()=>k,x_:()=>v,yy:()=>b});const s=Date.now,r=()=>1e3*s(),a=s,o=()=>Math.floor(s()/1e3),n=()=>{const e=(10*r()+122192928e9).toString(16);return e.slice(7,15)+e.slice(3,7)+"1"+e.slice(0,3)+"9696"+"ff".repeat(6)},d=setTimeout,h=(e,t,i=d,r=s()+t)=>{if(t>=2147483647)throw new Error("setTimeout() function was called with unrealistic value of "+t.toString());let a=()=>{},o=!0;const n=i((()=>{o=!0;const t=r-s();t>0?a=h(e,t,i,r):e()}),t);return function(){o&&(o=!1,clearTimeout(n)),a()}};class c extends Error{constructor(){const e="timed out";super(e),this.constructor=c,this.__proto__=c.prototype,this.message=e}}const l=e=>{let t;if(t="number"==typeof e?Math.floor(e):parseInt(e,10),!(Number.isNaN(t)||t<0))try{return new Date(t).toISOString()}catch(e){return}},u=e=>{if("string"==typeof e&&e&&!e.match(/^[0-9]+$/)&&!(e.indexOf("-")<0||e.indexOf(":")<0))try{const t=Date.parse(e.indexOf("+")>=0||"Z"===e.slice(-1)?e:(e+"Z").replace(/\s(\d\d):/,"T$1:"));if(Number.isNaN(t))return;return t}catch(e){return}},f=e=>{if("string"==typeof e&&e){if(e.indexOf("GMT")>=0)try{return Date.parse(e)}catch(e){return}return u(e)}},p=(e=void 0)=>new Date(e).toUTCString(),m=(e,t="-")=>{t=t||"";const i=new Date(e),s=i.getUTCFullYear().toString();let r=i.getUTCMonth()+1,a=i.getUTCDate();return r=r<10?"0"+r:r.toString(),a=a<10?"0"+a:a.toString(),r+t+a+t+s},g=(e,t,i=!0)=>{t=t||"";const s=new Date(e),r=s.getUTCFullYear(),a=(i?r:r-2e3).toString();let o=s.getUTCMonth()+1,n=s.getUTCDate();return o=o<10?"0"+o:o.toString(),n=n<10?"0"+n:n.toString(),a+t+o+t+n},v=(e,t="")=>g(e,t,!1),y=(e,t="-")=>g(e,t,!0),w=(e,t=" ")=>{const i=new Date(e),s=i.getUTCFullYear();let r=i.getUTCMonth()+1,a=i.getUTCDate(),o=i.getUTCHours(),n=i.getUTCMinutes(),d=i.getUTCSeconds();return r=r<10?"0"+r:r,a=a<10?"0"+a:a,o=o<10?"0"+o:o,n=n<10?"0"+n:n,d=d<10?"0"+d:d,s+"-"+r+"-"+a+t+o+":"+n+":"+d},b=e=>new Promise((t=>h(t,e))),k=async(e,t)=>{let i=()=>{};const s=new Promise((t=>i=h(t,e)));try{return await Promise.race([t,s.then((()=>{throw new c}))])}finally{i()}}},8995:(e,t,i)=>{i.d(t,{A:()=>n,O:()=>o});var s=i(4710),r=i(3466),a=i(8283);function o(e){const t=e=>parseInt(e,16);e=e.replace(" ","");const i=Math.round((new Date).getTime()/1e3),o=((e,t)=>(t+e).slice(-t.length))(((n=Math.floor(i/30))<15.5?"0":"")+Math.round(n).toString(16),"0000000000000000");var n;const d=(0,a.w8)(s.xn.decode(o),s.RG.decode(e),r.e,"hex"),h=t(d.substring(d.length-1));let c=(t(d.substr(2*h,8))&t("7fffffff"))+"";return c.substring(c.length-6,c.length)}const n=o},6834:(e,t,i)=>{i.d(t,{At:()=>E,Cw:()=>T,DR:()=>L,Dj:()=>x,Et:()=>s,F7:()=>C,Fq:()=>r,Gv:()=>d,Hf:()=>h,I9:()=>q,J0:()=>I,JU:()=>m,KL:()=>c,Kg:()=>n,Pf:()=>p,Q7:()=>B,RH:()=>O,Rc:()=>D,Y2:()=>v,Y_:()=>R,_w:()=>l,cy:()=>a,d0:()=>_,dl:()=>o,fu:()=>V,gw:()=>S,hO:()=>N,lu:()=>y,mU:()=>P,nr:()=>k,pI:()=>b,q0:()=>w,uS:()=>A,w:()=>g,ww:()=>M});const s=Number.isFinite,r=Number.isInteger,a=Array.isArray,o=e=>null!=e,n=e=>"string"==typeof e,d=e=>null!==e&&"object"==typeof e,h=e=>d(e)&&Object.getPrototypeOf(e)===Object.prototype&&!a(e)&&!(e=>e instanceof RegExp)(e),c=e=>o(e)&&e.toString||s(e),l=(e,t)=>d(e)&&""!==e[t]&&null!==e[t]?e[t]:void 0,u=(e,t,i)=>d(e)?void 0!==e[t]&&""!==e[t]&&null!==e[t]?e[t]:""!==e[i]&&null!==e[i]?e[i]:void 0:void 0,f=(e,t)=>d(e)?e[t.find((t=>void 0!==l(e,t)))]:void 0,p=e=>s(e)||n(e)&&0!==e.length?parseFloat(e):NaN,m=e=>s(e)||n(e)&&0!==e.length?Math.trunc(Number(e)):NaN,g=(e,t,i)=>{const r=p(l(e,t));return s(r)?r:i},v=(e,t,i)=>{const r=m(l(e,t));return s(r)?r:i},y=(e,t,i,r)=>{const a=p(l(e,t));return s(a)?parseInt(a*i):r},w=(e,t,i)=>{const r=p(l(e,t));return s(r)?parseInt(1e3*r):i},b=(e,t,i)=>{const s=l(e,t);return o(s)?s:i},k=(e,t,i)=>{const s=l(e,t);return c(s)?String(s):i},S=(e,t,i)=>{const s=l(e,t);return c(s)?String(s).toLowerCase():c(i)?String(i).toLowerCase():i},O=(e,t,i)=>{const s=l(e,t);return c(s)?String(s).toUpperCase():c(i)?String(i).toUpperCase():i},T=(e,t,i,r)=>{const a=p(u(e,t,i));return s(a)?a:r},P=(e,t,i,r)=>{const a=m(u(e,t,i));return s(a)?a:r},I=(e,t,i,r,a)=>{const o=p(u(e,t,i));return s(o)?parseInt(o*r):a},M=(e,t,i,r)=>{const a=p(u(e,t,i));return s(a)?parseInt(1e3*a):r},x=(e,t,i,s)=>{const r=u(e,t,i);return o(r)?r:s},_=(e,t,i,s)=>{const r=u(e,t,i);return c(r)?String(r):s},A=(e,t,i,s)=>{const r=u(e,t,i);return c(r)?String(r).toLowerCase():c(s)?String(s).toLowerCase():s},C=(e,t,i,s)=>{const r=u(e,t,i);return c(r)?String(r).toUpperCase():c(s)?String(s).toUpperCase():s},B=(e,t,i)=>{const r=p(f(e,t));return s(r)?r:i},E=(e,t,i)=>{if(void 0===e)return i;const r=m(f(e,t));return s(r)?r:i},N=(e,t,i,r)=>{const a=p(f(e,t));return s(a)?parseInt(a*i):r},R=(e,t,i)=>{const r=p(f(e,t));return s(r)?parseInt(1e3*r):i},L=(e,t,i)=>{if(void 0===e)return i;const s=f(e,t);return o(s)?s:i},D=(e,t,i)=>{if(void 0===e)return i;const s=f(e,t);return c(s)?String(s):i},q=(e,t,i)=>{const s=f(e,t);return c(s)?String(s).toLowerCase():c(i)?String(i).toLowerCase():i},V=(e,t,i)=>{const s=f(e,t);return c(s)?String(s).toUpperCase():c(i)?String(i).toUpperCase():i}},2931:(e,t,i)=>{i.d(t,{Hk:()=>n,I3:()=>r,Pt:()=>o,TG:()=>a});class s extends Array{constructor(e=void 0){super(),Object.defineProperty(this,"maxSize",{__proto__:null,value:e,writable:!0})}clear(){this.length=0}}class r extends s{constructor(e=void 0){super(e),this.hashmap={},Object.defineProperty(this,"nestedNewUpdatesBySymbol",{__proto__:null,value:!1,writable:!0}),Object.defineProperty(this,"newUpdatesBySymbol",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"clearUpdatesBySymbol",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"allNewUpdates",{__proto__:null,value:0,writable:!0}),Object.defineProperty(this,"clearAllUpdates",{__proto__:null,value:!1,writable:!0}),Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0,enumerable:!1})}getLimit(e,t){let i;return void 0===e?(i=this.allNewUpdates,this.clearAllUpdates=!0):(i=this.newUpdatesBySymbol[e],void 0!==i&&this.nestedNewUpdatesBySymbol&&(i=i.size),this.clearUpdatesBySymbol[e]=!0),void 0===i?t:void 0!==t?Math.min(i,t):i}append(e){this.maxSize&&this.length===this.maxSize&&this.shift(),this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol]=0),this.newUpdatesBySymbol[e.symbol]=(this.newUpdatesBySymbol[e.symbol]||0)+1,this.allNewUpdates=(this.allNewUpdates||0)+1}}class a extends s{constructor(e=void 0){super(e),Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"sizeTracker",{__proto__:null,value:new Set,writable:!0}),Object.defineProperty(this,"newUpdates",{__proto__:null,value:0,writable:!0}),Object.defineProperty(this,"clearUpdates",{__proto__:null,value:!1,writable:!0})}getLimit(e,t){return this.clearUpdates=!0,void 0===t?this.newUpdates:Math.min(this.newUpdates,t)}append(e){if(e[0]in this.hashmap){const t=this.hashmap[e[0]];if(t!==e)for(const i in e)t[i]=e[i]}else{if(this.hashmap[e[0]]=e,this.maxSize&&this.length===this.maxSize){const e=this.shift();delete this.hashmap[e[0]]}this.push(e)}this.clearUpdates&&(this.clearUpdates=!1,this.sizeTracker.clear()),this.sizeTracker.add(e[0]),this.newUpdates=this.sizeTracker.size}}class o extends r{constructor(e=void 0){super(e),this.nestedNewUpdatesBySymbol=!0}append(e){const t=this.hashmap[e.symbol]=this.hashmap[e.symbol]||{};if(e.id in t){const i=t[e.id];if(i!==e)for(const t in e)i[t]=e[t];e=i;const s=this.findIndex((t=>t.id===e.id));this.splice(s,1)}else t[e.id]=e;if(this.maxSize&&this.length===this.maxSize){const e=this.shift();delete this.hashmap[e.symbol][e.id]}this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),void 0===this.newUpdatesBySymbol[e.symbol]&&(this.newUpdatesBySymbol[e.symbol]=new Set),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol].clear());const i=this.newUpdatesBySymbol[e.symbol],s=i.size;i.add(e.id);const r=i.size;this.allNewUpdates=(this.allNewUpdates||0)+(r-s)}}class n extends r{constructor(){super(),this.nestedNewUpdatesBySymbol=!0,Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0})}append(e){const t=this.hashmap[e.symbol]=this.hashmap[e.symbol]||{};if(e.side in t){const i=t[e.side];if(i!==e)for(const t in e)i[t]=e[t];e=i;const s=this.findIndex((t=>t.symbol===e.symbol&&t.side===e.side));this.splice(s,1)}else t[e.side]=e;this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),void 0===this.newUpdatesBySymbol[e.symbol]&&(this.newUpdatesBySymbol[e.symbol]=new Set),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol].clear());const i=this.newUpdatesBySymbol[e.symbol],s=i.size;i.add(e.side);const r=i.size;this.allNewUpdates=(this.allNewUpdates||0)+(r-s)}}},934:(e,t,i)=>{i.d(t,{A:()=>l});var s=i(2079),r=i(4350),a=i(3206),o=i(7437),n=i(8403),d=i(7597),h=i(9560),c=i(4710);class l{constructor(e,t,i,s,r,n={}){this.useMessageQueue=!1,this.verbose=!1;const d={url:e,onMessageCallback:t,onErrorCallback:i,onCloseCallback:s,onConnectedCallback:r,verbose:!1,protocols:void 0,options:void 0,futures:{},subscriptions:{},rejections:{},messageQueue:{},useMessageQueue:!1,connected:void 0,error:void 0,connectionStarted:void 0,connectionEstablished:void 0,isConnected:!1,connectionTimer:void 0,connectionTimeout:1e4,pingInterval:void 0,ping:void 0,keepAlive:3e4,maxPingPongMisses:2,connection:void 0,startedConnecting:!1,gunzip:!1,inflate:!1};Object.assign(this,(0,o.zw)(d,n)),this.connected=(0,a.K)()}future(e){e in this.futures||(this.futures[e]=(0,a.K)());const t=this.futures[e];if(e in this.rejections)return t.reject(this.rejections[e]),delete this.rejections[e],delete this.messageQueue[e],t;if(this.useMessageQueue){const i=this.messageQueue[e];i&&i.length&&(t.resolve(i.shift()),delete this.futures[e])}return t}resolve(e,t){if(this.verbose&&void 0===t&&this.log(new Date,"resolve received undefined messageHash"),!0===this.useMessageQueue){t in this.messageQueue||(this.messageQueue[t]=[]);const i=this.messageQueue[t];for(i.push(e);i.length>10;)i.shift();if(void 0!==t&&t in this.futures){this.futures[t].resolve(i.shift()),delete this.futures[t]}}else if(t in this.futures){this.futures[t].resolve(e),delete this.futures[t]}return e}reject(e,t=void 0){if(t)if(t in this.futures){this.futures[t].reject(e),delete this.futures[t]}else this.rejections[t]=e;else{const t=Object.keys(this.futures);for(let i=0;i{this.onError(e)})):d.Ll?this.connection.ping():this.lastPong=e}}}onOpen(){this.verbose&&this.log(new Date,"onOpen"),this.connectionEstablished=(0,n.Rz)(),this.isConnected=!0,this.connected.resolve(this.url),this.clearConnectionTimeout(),this.setPingInterval(),this.onConnectedCallback(this)}onPing(){this.verbose&&this.log(new Date,"onPing")}onPong(){this.lastPong=(0,n.Rz)(),this.verbose&&this.log(new Date,"onPong")}onError(e){this.verbose&&this.log(new Date,"onError",e.message),e instanceof s.BaseError||(e=new s.NetworkError(e.message)),this.error=e,this.reset(this.error),this.onErrorCallback(this,this.error)}onClose(e){this.verbose&&this.log(new Date,"onClose",e),this.error||this.reset(new s.NetworkError("connection closed by remote server, closing code "+String(e.code))),this.error instanceof s.ExchangeClosedByUser&&this.reset(this.error),void 0!==this.disconnected&&this.disconnected.resolve(!0),this.onCloseCallback(this,e)}onUpgrade(e){this.verbose&&this.log(new Date,"onUpgrade")}async send(e){this.verbose&&this.log(new Date,"sending",e),e="string"==typeof e?e:JSON.stringify(e);const t=(0,a.K)();if(d.Ll){function i(e){e?t.reject(e):t.resolve(null)}this.connection.send(e,{},i)}else this.connection.send(e),t.resolve(null);return t}close(){throw new s.NotSupported("close() not implemented yet")}onMessage(e){let t,i=e.data;"string"!=typeof i&&(this.gunzip||this.inflate?(t=new Uint8Array(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)),this.gunzip?t=(0,r.Wt)(t):this.inflate&&(t=(0,r.HM)(t)),i=c.As.encode(t)):i=i.toString());try{(0,h.mC)(i)&&(i=JSON.parse(i.replace(/:(\d{15,}),/g,':"$1",'))),this.verbose&&this.log(new Date,"onMessage",i)}catch(e){this.log(new Date,"onMessage JSON.parse",e)}try{this.onMessageCallback(this,i)}catch(e){this.reject(e)}}}},3206:(e,t,i)=>{i.d(t,{K:()=>r});var s=i(2634);function r(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.resolve=function(){setTimeout((()=>{e.apply(this,arguments)}))},i.reject=function(){setTimeout((()=>{t.apply(this,arguments)}))},i}r.race=e=>function(e){const t=r();return e.then(t.resolve,t.reject),t}(s.V.race(e))},3828:(e,t,i)=>{i.d(t,{Mi:()=>o,if:()=>n,nS:()=>d});var s=i(8403),r=i(7437),a=i(975);class o{constructor(e={},t=void 0){this.cache=[],Object.defineProperty(this,"cache",{__proto__:null,value:[],writable:!0,enumerable:!1}),t=t||Number.MAX_SAFE_INTEGER;const i={bids:[],asks:[],timestamp:void 0,datetime:void 0,nonce:void 0,symbol:void 0},o=Object.entries((0,r.X$)(i,e));for(let e=0;e{function s(e,t){let i=0,s=e.length-1;for(;i<=s;){const r=i+s>>>1;e[r]-t<0?i=r+1:s=r-1}return i}i.d(t,{$w:()=>d,PB:()=>h,eB:()=>f,f_:()=>c,jR:()=>l,o5:()=>u});const r=new Float64Array(new Array(1024).fill(Number.MAX_VALUE));class a extends Array{constructor(e=[],t=void 0){super(),Object.defineProperty(this,"index",{__proto__:null,value:new Float64Array(r),writable:!0}),Object.defineProperty(this,"depth",{__proto__:null,value:t||Number.MAX_SAFE_INTEGER,writable:!0}),this.length=0;for(let t=0;tthis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else this.index[a]===r&&(this.index.copyWithin(a,a+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(a,a+1,this.length),this.length--)}store(e,t){this.storeArray([e,t])}limit(){if(this.length>this.depth){for(let e=this.depth;ethis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else this.index[o]===a&&(this.index.copyWithin(o,o+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(o,o+1,this.length),this.length--)}}class n extends Array{constructor(e=[],t=Number.MAX_SAFE_INTEGER){super(e.length),Object.defineProperty(this,"hashmap",{__proto__:null,value:new Map,writable:!0}),Object.defineProperty(this,"index",{__proto__:null,value:new Float64Array(r),writable:!0}),Object.defineProperty(this,"depth",{__proto__:null,value:t||Number.MAX_SAFE_INTEGER,writable:!0});for(let t=0;tthis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else if(this.hashmap.has(r)){const e=this.hashmap.get(r);let t=s(this.index,e);for(;this[t][2]!==r;)t++;this.index.copyWithin(t,t+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(t,t+1,this.length),this.length--,this.hashmap.delete(r)}}limit(){if(this.length>this.depth){for(let e=this.depth;e{i.d(t,{A:()=>l});var s=i(1591),r=i.n(s),a=i(934),o=i(7597),n=i(6238),d=i(8403),h=i(3206);const c=o.Ll||!(0,n.Se)()?r():self.WebSocket;class l extends a.A{constructor(){super(...arguments),this.startedConnecting=!1}createConnection(){this.verbose&&this.log(new Date,"connecting to",this.url),this.connectionStarted=(0,d.Rz)(),this.setConnectionTimeout(),o.Ll?this.connection=new c(this.url,this.protocols,this.options):this.connection=new c(this.url,this.protocols),this.connection.onopen=this.onOpen.bind(this),this.connection.onmessage=this.onMessage.bind(this),this.connection.onerror=this.onError.bind(this),this.connection.onclose=this.onClose.bind(this),o.Ll&&this.connection.on("ping",this.onPing.bind(this)).on("pong",this.onPong.bind(this)).on("upgrade",this.onUpgrade.bind(this))}connect(e=0){return this.startedConnecting||(this.startedConnecting=!0,e?(0,d.yy)(e).then(this.createConnection.bind(this)):this.createConnection()),this.connected}isOpen(){return this.connection.readyState===c.OPEN}close(){return this.connection instanceof c&&(void 0===this.disconnected&&(this.disconnected=(0,h.K)()),this.connection.close()),this.disconnected}}},9002:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(7996);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bequant",name:"Bequant",pro:!0,countries:["MT"],urls:{logo:"https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867",api:{public:"https://api.bequant.io/api/3",private:"https://api.bequant.io/api/3"},www:"https://bequant.io",doc:["https://api.bequant.io/"],fees:["https://bequant.io/fees-and-limits"],referral:"https://bequant.io/referral/dd104e3bee7634ec"}})}}},8698:(e,t,i)=>{i.d(t,{A:()=>h});var s=i(3971),r=i(2079),a=i(1579),o=i(5354),n=i(4852),d=i(5147);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bigone",name:"BigONE",countries:["CN"],version:"v3",rateLimit:20,has:{CORS:void 0,spot:!0,margin:!1,swap:void 0,future:void 0,option:!1,cancelAllOrders:!0,cancelOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchWithdrawals:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"min1","5m":"min5","15m":"min15","30m":"min30","1h":"hour1","3h":"hour3","4h":"hour4","6h":"hour6","12h":"hour12","1d":"day1","1w":"week1","1M":"month1"},hostname:"big.one",urls:{logo:"https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1",api:{public:"https://{hostname}/api/v3",private:"https://{hostname}/api/v3/viewer",contractPublic:"https://{hostname}/api/contract/v2",contractPrivate:"https://{hostname}/api/contract/v2",webExchange:"https://{hostname}/api/"},www:"https://big.one",doc:"https://open.big.one/docs/api.html",fees:"https://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policy",referral:"https://b1.run/users/new?code=D3LLBVFT"},api:{public:{get:["ping","asset_pairs","asset_pairs/{asset_pair_name}/depth","asset_pairs/{asset_pair_name}/trades","asset_pairs/{asset_pair_name}/ticker","asset_pairs/{asset_pair_name}/candles","asset_pairs/tickers"]},private:{get:["accounts","fund/accounts","assets/{asset_symbol}/address","orders","orders/{id}","orders/multi","trades","withdrawals","deposits"],post:["orders","orders/{id}/cancel","orders/cancel","withdrawals","transfer"]},contractPublic:{get:["symbols","instruments","depth@{symbol}/snapshot","instruments/difference","instruments/prices"]},contractPrivate:{get:["accounts","orders/{id}","orders","orders/opening","orders/count","orders/opening/count","trades","trades/count"],post:["orders","orders/batch"],put:["positions/{symbol}/margin","positions/{symbol}/risk-limit"],delete:["orders/{id}","orders/batch"]},webExchange:{get:["v3/assets"]}},fees:{trading:{maker:this.parseNumber("0.001"),taker:this.parseNumber("0.001")},funding:{withdraw:{}}},options:{createMarketBuyOrderRequiresPrice:!0,accountsByType:{spot:"SPOT",fund:"FUND",funding:"FUND",future:"CONTRACT",swap:"CONTRACT"},transfer:{fillResponseFromRequest:!0},exchangeMillisecondsCorrection:-100,fetchCurrencies:{webApiEnable:!0,webApiRetries:5,webApiMuteFailure:!0},defaultNetwork:"ERC20",defaultNetworks:{USDT:"TRC20"},networks:{ABBC:"ABBC",ACA:"Acala",AE:"Aeternity",ALGO:"Algorand",APT:"Aptos",AR:"Arweave",ASTR:"Astar",AVAXC:"Avax",AVAXX:"AvaxChain",BEAM:"Beam",BEP20:"BinanceSmartChain",BITCI:"BitciChain",BTC:"Bitcoin",BCH:"BitcoinCash",BSV:"BitcoinSV",CELO:"Celo",CKKB:"CKB",ATOM:"Cosmos",CRC20:"CRO",DASH:"Dash",DOGE:"Dogecoin",XEC:"ECash",EOS:"EOS",ETH:"Ethereum",ETC:"EthereumClassic",ETHW:"EthereumPow",FTM:"Fantom",FIL:"Filecoin",FSN:"Fusion",GRIN:"Grin",ONE:"Harmony",HRC20:"Hecochain",HBAR:"Hedera",HNT:"Helium",ZEN:"Horizen",IOST:"IOST",IRIS:"IRIS",KLAY:"Klaytn",KSM:"Kusama",LTC:"Litecoin",XMR:"Monero",GLMR:"Moonbeam",NEAR:"Near",NEO:"Neo",NEON3:"NeoN3",OASIS:"Oasis",OKC:"Okexchain",ONT:"Ontology",OPTIMISM:"Optimism",DOT:"Polkadot",MATIC:"Polygon",QTUM:"Qtum",REI:"REI",XRP:"Ripple",SGB:"SGB",SDN:"Shiden",SOL:"Solana",XLM:"Stellar",TERA:"Tera",XTZ:"Tezos",TRC20:"Tron",VET:"Vechain",VSYS:"VSystems",WAX:"WAX",ZEC:"Zcash"}},features:{default:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!0,marketBuyByCost:!0,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:200,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:200,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:200,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!1,limit:200,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:500}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrder:{triggerPriceType:{mark:!0,index:!0,last:!0}},fetchOrders:{daysBack:1e5,untilDays:1e5},fetchClosedOrders:{daysBack:1e5,untilDays:1e5}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}},precisionMode:a.kb,exceptions:{exact:{10001:r.BadRequest,10005:r.ExchangeError,"Amount's scale must greater than AssetPair's base scale":r.InvalidOrder,"Price mulit with amount should larger than AssetPair's min_quote_value":r.InvalidOrder,10007:r.BadRequest,10011:r.ExchangeError,10013:r.BadSymbol,10014:r.InsufficientFunds,10403:r.PermissionDenied,10429:r.RateLimitExceeded,40004:r.AuthenticationError,40103:r.AuthenticationError,40104:r.AuthenticationError,40301:r.PermissionDenied,40302:r.ExchangeError,40601:r.ExchangeError,40602:r.ExchangeError,40603:r.InsufficientFunds,40604:r.InvalidOrder,40605:r.InvalidOrder,40120:r.InvalidOrder,40121:r.InvalidOrder,60100:r.BadSymbol},broad:{}},commonCurrencies:{CRE:"Cybereits",FXT:"FXTTOKEN",FREE:"FreeRossDAO",MBN:"Mobilian Coin",ONE:"BigONE Token"}})}async fetchCurrencies(e={}){const t=await this.fetchWebEndpoint("fetchCurrencies","webExchangeGetV3Assets",!0);if(void 0===t)return;const i=this.safeList(t,"data",[]),s={};for(let e=0;e{i.d(t,{A:()=>l});var s=i(335),r=i(2079),a=i(5147),o=i(1579),n=i(4852),d=i(5354),h=i(8283),c=i(6414);class l extends s.A{describe(){return this.deepExtend(super.describe(),{id:"binance",name:"Binance",countries:[],rateLimit:50,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createConvertTrade:!0,createDepositAddress:!1,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrder:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!1,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,editOrder:!0,editOrders:!0,fetchAccounts:void 0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!0,fetchCanceledAndClosedOrders:"emulated",fetchCanceledOrders:"emulated",fetchClosedOrder:!1,fetchClosedOrders:"emulated",fetchConvertCurrencies:!0,fetchConvertQuote:!0,fetchConvertTrade:!0,fetchConvertTradeHistory:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingInterval:"emulated",fetchFundingIntervals:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:"emulated",fetchIsolatedBorrowRates:!0,fetchL3OrderBook:!1,fetchLastPrices:!0,fetchLedger:!0,fetchLedgerEntry:!0,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!0,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!0,fetchMarginAdjustmentHistory:!0,fetchMarginMode:!0,fetchMarginModes:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMarkPrice:!0,fetchMarkPrices:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!0,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTradingLimits:"emulated",fetchTransactionFee:"emulated",fetchTransactionFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawAddresses:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,sandbox:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1s":"1s","1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},urls:{logo:"https://github.com/user-attachments/assets/e9419b93-ccb0-46aa-9bff-c883f096274b",test:{dapiPublic:"https://testnet.binancefuture.com/dapi/v1",dapiPrivate:"https://testnet.binancefuture.com/dapi/v1",dapiPrivateV2:"https://testnet.binancefuture.com/dapi/v2",fapiPublic:"https://testnet.binancefuture.com/fapi/v1",fapiPublicV2:"https://testnet.binancefuture.com/fapi/v2",fapiPublicV3:"https://testnet.binancefuture.com/fapi/v3",fapiPrivate:"https://testnet.binancefuture.com/fapi/v1",fapiPrivateV2:"https://testnet.binancefuture.com/fapi/v2",fapiPrivateV3:"https://testnet.binancefuture.com/fapi/v3",public:"https://testnet.binance.vision/api/v3",private:"https://testnet.binance.vision/api/v3",v1:"https://testnet.binance.vision/api/v1"},api:{sapi:"https://api.binance.com/sapi/v1",sapiV2:"https://api.binance.com/sapi/v2",sapiV3:"https://api.binance.com/sapi/v3",sapiV4:"https://api.binance.com/sapi/v4",dapiPublic:"https://dapi.binance.com/dapi/v1",dapiPrivate:"https://dapi.binance.com/dapi/v1",eapiPublic:"https://eapi.binance.com/eapi/v1",eapiPrivate:"https://eapi.binance.com/eapi/v1",dapiPrivateV2:"https://dapi.binance.com/dapi/v2",dapiData:"https://dapi.binance.com/futures/data",fapiPublic:"https://fapi.binance.com/fapi/v1",fapiPublicV2:"https://fapi.binance.com/fapi/v2",fapiPublicV3:"https://fapi.binance.com/fapi/v3",fapiPrivate:"https://fapi.binance.com/fapi/v1",fapiPrivateV2:"https://fapi.binance.com/fapi/v2",fapiPrivateV3:"https://fapi.binance.com/fapi/v3",fapiData:"https://fapi.binance.com/futures/data",public:"https://api.binance.com/api/v3",private:"https://api.binance.com/api/v3",v1:"https://api.binance.com/api/v1",papi:"https://papi.binance.com/papi/v1"},www:"https://www.binance.com",referral:{url:"https://accounts.binance.com/en/register?ref=D7YA7CLY",discount:.1},doc:["https://developers.binance.com/en"],api_management:"https://www.binance.com/en/usercenter/settings/api-management",fees:"https://www.binance.com/en/fee/schedule"},api:{sapi:{get:{"copyTrading/futures/userStatus":2,"copyTrading/futures/leadSymbol":2,"system/status":.1,accountSnapshot:240,"account/info":.1,"margin/asset":1,"margin/pair":1,"margin/allAssets":.1,"margin/allPairs":.1,"margin/priceIndex":1,"spot/delist-schedule":10,"asset/assetDividend":1,"asset/dribblet":.1,"asset/transfer":.1,"asset/assetDetail":.1,"asset/tradeFee":.1,"asset/ledger-transfer/cloud-mining/queryByPage":4.0002,"asset/convert-transfer/queryByPage":.033335,"asset/wallet/balance":6,"asset/custody/transfer-history":6,"margin/borrow-repay":1,"margin/loan":1,"margin/repay":1,"margin/account":1,"margin/transfer":.1,"margin/interestHistory":.1,"margin/forceLiquidationRec":.1,"margin/order":1,"margin/openOrders":1,"margin/allOrders":20,"margin/myTrades":1,"margin/maxBorrowable":5,"margin/maxTransferable":5,"margin/tradeCoeff":1,"margin/isolated/transfer":.1,"margin/isolated/account":1,"margin/isolated/pair":1,"margin/isolated/allPairs":1,"margin/isolated/accountLimit":.1,"margin/interestRateHistory":.1,"margin/orderList":1,"margin/allOrderList":20,"margin/openOrderList":1,"margin/crossMarginData":{cost:.1,noCoin:.5},"margin/isolatedMarginData":{cost:.1,noCoin:1},"margin/isolatedMarginTier":.1,"margin/rateLimit/order":2,"margin/dribblet":.1,"margin/dust":20.001,"margin/crossMarginCollateralRatio":10,"margin/exchange-small-liability":.6667,"margin/exchange-small-liability-history":.6667,"margin/next-hourly-interest-rate":.6667,"margin/capital-flow":10,"margin/delist-schedule":10,"margin/available-inventory":.3334,"margin/leverageBracket":.1,"loan/vip/loanable/data":40,"loan/vip/collateral/data":40,"loan/vip/request/data":2.6668,"loan/vip/request/interestRate":2.6668,"loan/income":40.002,"loan/ongoing/orders":40,"loan/ltv/adjustment/history":40,"loan/borrow/history":40,"loan/repay/history":40,"loan/loanable/data":40,"loan/collateral/data":40,"loan/repay/collateral/rate":600,"loan/flexible/ongoing/orders":30,"loan/flexible/borrow/history":40,"loan/flexible/repay/history":40,"loan/flexible/ltv/adjustment/history":40,"loan/vip/ongoing/orders":40,"loan/vip/repay/history":40,"loan/vip/collateral/account":600,"fiat/orders":600.03,"fiat/payments":.1,"futures/transfer":1,"futures/histDataLink":.1,"rebate/taxQuery":80.004,"capital/config/getall":1,"capital/deposit/address":1,"capital/deposit/address/list":1,"capital/deposit/hisrec":.1,"capital/deposit/subAddress":.1,"capital/deposit/subHisrec":.1,"capital/withdraw/history":2,"capital/withdraw/address/list":10,"capital/contract/convertible-coins":4.0002,"convert/tradeFlow":20.001,"convert/exchangeInfo":50,"convert/assetInfo":10,"convert/orderStatus":.6667,"convert/limit/queryOpenOrders":20.001,"account/status":.1,"account/apiTradingStatus":.1,"account/apiRestrictions/ipRestriction":.1,bnbBurn:.1,"sub-account/futures/account":1,"sub-account/futures/accountSummary":.1,"sub-account/futures/positionRisk":1,"sub-account/futures/internalTransfer":.1,"sub-account/list":.1,"sub-account/margin/account":1,"sub-account/margin/accountSummary":1,"sub-account/spotSummary":.1,"sub-account/status":1,"sub-account/sub/transfer/history":.1,"sub-account/transfer/subUserHistory":.1,"sub-account/universalTransfer":.1,"sub-account/apiRestrictions/ipRestriction/thirdPartyList":1,"sub-account/transaction-statistics":.40002,"sub-account/subAccountApi/ipRestriction":20.001,"managed-subaccount/asset":.1,"managed-subaccount/accountSnapshot":240,"managed-subaccount/queryTransLogForInvestor":.1,"managed-subaccount/queryTransLogForTradeParent":.40002,"managed-subaccount/fetch-future-asset":.40002,"managed-subaccount/marginAsset":.1,"managed-subaccount/info":.40002,"managed-subaccount/deposit/address":.006667,"managed-subaccount/query-trans-log":.40002,"lending/daily/product/list":.1,"lending/daily/userLeftQuota":.1,"lending/daily/userRedemptionQuota":.1,"lending/daily/token/position":.1,"lending/union/account":.1,"lending/union/purchaseRecord":.1,"lending/union/redemptionRecord":.1,"lending/union/interestHistory":.1,"lending/project/list":.1,"lending/project/position/list":.1,"eth-staking/eth/history/stakingHistory":15,"eth-staking/eth/history/redemptionHistory":15,"eth-staking/eth/history/rewardsHistory":15,"eth-staking/eth/quota":15,"eth-staking/eth/history/rateHistory":15,"eth-staking/account":15,"eth-staking/wbeth/history/wrapHistory":15,"eth-staking/wbeth/history/unwrapHistory":15,"eth-staking/eth/history/wbethRewardsHistory":15,"sol-staking/sol/history/stakingHistory":15,"sol-staking/sol/history/redemptionHistory":15,"sol-staking/sol/history/bnsolRewardsHistory":15,"sol-staking/sol/history/rateHistory":15,"sol-staking/account":15,"sol-staking/sol/quota":15,"mining/pub/algoList":.1,"mining/pub/coinList":.1,"mining/worker/detail":.5,"mining/worker/list":.5,"mining/payment/list":.5,"mining/statistics/user/status":.5,"mining/statistics/user/list":.5,"mining/payment/uid":.5,"bswap/pools":.1,"bswap/liquidity":{cost:.1,noPoolId:1},"bswap/liquidityOps":20.001,"bswap/quote":1.00005,"bswap/swap":20.001,"bswap/poolConfigure":1.00005,"bswap/addLiquidityPreview":1.00005,"bswap/removeLiquidityPreview":1.00005,"bswap/unclaimedRewards":6.667,"bswap/claimedHistory":6.667,"blvt/tokenInfo":.1,"blvt/subscribe/record":.1,"blvt/redeem/record":.1,"blvt/userLimit":.1,"apiReferral/ifNewUser":1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/rebate/recentRecord":1,"apiReferral/rebate/historicalRecord":1,"apiReferral/kickback/recentRecord":1,"apiReferral/kickback/historicalRecord":1,"broker/subAccountApi":1,"broker/subAccount":1,"broker/subAccountApi/commission/futures":1,"broker/subAccountApi/commission/coinFutures":1,"broker/info":1,"broker/transfer":1,"broker/transfer/futures":1,"broker/rebate/recentRecord":1,"broker/rebate/historicalRecord":1,"broker/subAccount/bnbBurn/status":1,"broker/subAccount/depositHist":1,"broker/subAccount/spotSummary":1,"broker/subAccount/marginSummary":1,"broker/subAccount/futuresSummary":1,"broker/rebate/futures/recentRecord":1,"broker/subAccountApi/ipRestriction":1,"broker/universalTransfer":1,"account/apiRestrictions":.1,"c2c/orderMatch/listUserOrderHistory":.1,"nft/history/transactions":20.001,"nft/history/deposit":20.001,"nft/history/withdraw":20.001,"nft/user/getAsset":20.001,"pay/transactions":20.001,"giftcard/verify":.1,"giftcard/cryptography/rsa-public-key":.1,"giftcard/buyCode/token-limit":.1,"algo/spot/openOrders":.1,"algo/spot/historicalOrders":.1,"algo/spot/subOrders":.1,"algo/futures/openOrders":.1,"algo/futures/historicalOrders":.1,"algo/futures/subOrders":.1,"portfolio/account":.1,"portfolio/collateralRate":5,"portfolio/pmLoan":3.3335,"portfolio/interest-history":.6667,"portfolio/asset-index-price":.1,"portfolio/repay-futures-switch":3,"portfolio/margin-asset-leverage":5,"portfolio/balance":2,"portfolio/negative-balance-exchange-record":2,"portfolio/pmloan-history":5,"staking/productList":.1,"staking/position":.1,"staking/stakingRecord":.1,"staking/personalLeftQuota":.1,"lending/auto-invest/target-asset/list":.1,"lending/auto-invest/target-asset/roi/list":.1,"lending/auto-invest/all/asset":.1,"lending/auto-invest/source-asset/list":.1,"lending/auto-invest/plan/list":.1,"lending/auto-invest/plan/id":.1,"lending/auto-invest/history/list":.1,"lending/auto-invest/index/info":.1,"lending/auto-invest/index/user-summary":.1,"lending/auto-invest/one-off/status":.1,"lending/auto-invest/redeem/history":.1,"lending/auto-invest/rebalance/history":.1,"simple-earn/flexible/list":15,"simple-earn/locked/list":15,"simple-earn/flexible/personalLeftQuota":15,"simple-earn/locked/personalLeftQuota":15,"simple-earn/flexible/subscriptionPreview":15,"simple-earn/locked/subscriptionPreview":15,"simple-earn/flexible/history/rateHistory":15,"simple-earn/flexible/position":15,"simple-earn/locked/position":15,"simple-earn/account":15,"simple-earn/flexible/history/subscriptionRecord":15,"simple-earn/locked/history/subscriptionRecord":15,"simple-earn/flexible/history/redemptionRecord":15,"simple-earn/locked/history/redemptionRecord":15,"simple-earn/flexible/history/rewardsRecord":15,"simple-earn/locked/history/rewardsRecord":15,"simple-earn/flexible/history/collateralRecord":.1,"dci/product/list":.1,"dci/product/positions":.1,"dci/product/accounts":.1},post:{"asset/dust":.06667,"asset/dust-btc":.1,"asset/transfer":6.0003,"asset/get-funding-asset":.1,"asset/convert-transfer":.033335,"account/disableFastWithdrawSwitch":.1,"account/enableFastWithdrawSwitch":.1,"capital/withdraw/apply":4.0002,"capital/contract/convertible-coins":4.0002,"capital/deposit/credit-apply":.1,"margin/borrow-repay":20.001,"margin/transfer":4.0002,"margin/loan":20.001,"margin/repay":20.001,"margin/order":.040002,"margin/order/oco":.040002,"margin/dust":20.001,"margin/exchange-small-liability":20.001,"margin/isolated/transfer":4.0002,"margin/isolated/account":2.0001,"margin/max-leverage":300,bnbBurn:.1,"sub-account/virtualSubAccount":.1,"sub-account/margin/transfer":4.0002,"sub-account/margin/enable":.1,"sub-account/futures/enable":.1,"sub-account/futures/transfer":.1,"sub-account/futures/internalTransfer":.1,"sub-account/transfer/subToSub":.1,"sub-account/transfer/subToMaster":.1,"sub-account/universalTransfer":.1,"sub-account/options/enable":.1,"managed-subaccount/deposit":.1,"managed-subaccount/withdraw":.1,userDataStream:.1,"userDataStream/isolated":.1,"futures/transfer":.1,"lending/customizedFixed/purchase":.1,"lending/daily/purchase":.1,"lending/daily/redeem":.1,"bswap/liquidityAdd":60,"bswap/liquidityRemove":60,"bswap/swap":60,"bswap/claimRewards":6.667,"blvt/subscribe":.1,"blvt/redeem":.1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/rebate/historicalRecord":1,"apiReferral/kickback/historicalRecord":1,"broker/subAccount":1,"broker/subAccount/margin":1,"broker/subAccount/futures":1,"broker/subAccountApi":1,"broker/subAccountApi/permission":1,"broker/subAccountApi/commission":1,"broker/subAccountApi/commission/futures":1,"broker/subAccountApi/commission/coinFutures":1,"broker/transfer":1,"broker/transfer/futures":1,"broker/rebate/historicalRecord":1,"broker/subAccount/bnbBurn/spot":1,"broker/subAccount/bnbBurn/marginInterest":1,"broker/subAccount/blvt":1,"broker/subAccountApi/ipRestriction":1,"broker/subAccountApi/ipRestriction/ipList":1,"broker/universalTransfer":1,"broker/subAccountApi/permission/universalTransfer":1,"broker/subAccountApi/permission/vanillaOptions":1,"giftcard/createCode":.1,"giftcard/redeemCode":.1,"giftcard/buyCode":.1,"algo/spot/newOrderTwap":20.001,"algo/futures/newOrderVp":20.001,"algo/futures/newOrderTwap":20.001,"staking/purchase":.1,"staking/redeem":.1,"staking/setAutoStaking":.1,"eth-staking/eth/stake":15,"eth-staking/eth/redeem":15,"eth-staking/wbeth/wrap":15,"sol-staking/sol/stake":15,"sol-staking/sol/redeem":15,"mining/hash-transfer/config":.5,"mining/hash-transfer/config/cancel":.5,"portfolio/repay":20.001,"loan/vip/renew":40.002,"loan/vip/borrow":40.002,"loan/borrow":40.002,"loan/repay":40.002,"loan/adjust/ltv":40.002,"loan/customize/margin_call":40.002,"loan/flexible/repay":40.002,"loan/flexible/adjust/ltv":40.002,"loan/vip/repay":40.002,"convert/getQuote":1.3334,"convert/acceptQuote":3.3335,"convert/limit/placeOrder":3.3335,"convert/limit/cancelOrder":1.3334,"portfolio/auto-collection":150,"portfolio/asset-collection":6,"portfolio/bnb-transfer":150,"portfolio/repay-futures-switch":150,"portfolio/repay-futures-negative-balance":150,"portfolio/mint":20,"portfolio/redeem":20,"lending/auto-invest/plan/add":.1,"lending/auto-invest/plan/edit":.1,"lending/auto-invest/plan/edit-status":.1,"lending/auto-invest/one-off":.1,"lending/auto-invest/redeem":.1,"simple-earn/flexible/subscribe":.1,"simple-earn/locked/subscribe":.1,"simple-earn/flexible/redeem":.1,"simple-earn/locked/redeem":.1,"simple-earn/flexible/setAutoSubscribe":15,"simple-earn/locked/setAutoSubscribe":15,"simple-earn/locked/setRedeemOption":5,"dci/product/subscribe":.1,"dci/product/auto_compound/edit":.1},put:{userDataStream:.1,"userDataStream/isolated":.1},delete:{"margin/openOrders":.1,"margin/order":.006667,"margin/orderList":.006667,"margin/isolated/account":2.0001,userDataStream:.1,"userDataStream/isolated":.1,"broker/subAccountApi":1,"broker/subAccountApi/ipRestriction/ipList":1,"algo/spot/order":.1,"algo/futures/order":.1,"sub-account/subAccountApi/ipRestriction/ipList":20.001}},sapiV2:{get:{"eth-staking/account":15,"sub-account/futures/account":.1,"sub-account/futures/accountSummary":1,"sub-account/futures/positionRisk":.1,"loan/flexible/ongoing/orders":30,"loan/flexible/borrow/history":40,"loan/flexible/repay/history":40,"loan/flexible/ltv/adjustment/history":40,"loan/flexible/loanable/data":40,"loan/flexible/collateral/data":40,"portfolio/account":2},post:{"eth-staking/eth/stake":15,"sub-account/subAccountApi/ipRestriction":20.001,"loan/flexible/borrow":40.002,"loan/flexible/repay":40.002,"loan/flexible/adjust/ltv":40.002}},sapiV3:{get:{"sub-account/assets":.40002},post:{"asset/getUserAsset":.5}},sapiV4:{get:{"sub-account/assets":.40002}},dapiPublic:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:2,byLimit:[[50,2],[100,5],[500,10],[1e3,20]]},trades:5,historicalTrades:20,aggTrades:20,premiumIndex:10,fundingRate:1,klines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},continuousKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},indexPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},markPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},premiumIndexKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:2,noSymbol:5},constituents:2,openInterest:1,fundingInfo:1}},dapiData:{get:{"delivery-price":1,openInterestHist:1,topLongShortAccountRatio:1,topLongShortPositionRatio:1,globalLongShortAccountRatio:1,takerBuySellVol:1,basis:1}},dapiPrivate:{get:{"positionSide/dual":30,orderAmendment:1,order:1,openOrder:1,openOrders:{cost:1,noSymbol:5},allOrders:{cost:20,noSymbol:40},balance:1,account:5,"positionMargin/history":1,positionRisk:1,userTrades:{cost:20,noSymbol:40},income:20,leverageBracket:1,forceOrders:{cost:20,noSymbol:50},adlQuantile:5,commissionRate:20,"income/asyn":5,"income/asyn/id":5,"trade/asyn":.5,"trade/asyn/id":.5,"order/asyn":.5,"order/asyn/id":.5,pmExchangeInfo:.5,pmAccountInfo:.5},post:{"positionSide/dual":1,order:4,batchOrders:5,countdownCancelAll:10,leverage:1,marginType:1,positionMargin:1,listenKey:1},put:{listenKey:1,order:1,batchOrders:5},delete:{order:1,allOpenOrders:1,batchOrders:5,listenKey:1}},dapiPrivateV2:{get:{leverageBracket:1}},fapiPublic:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:2,byLimit:[[50,2],[100,5],[500,10],[1e3,20]]},trades:5,historicalTrades:20,aggTrades:20,klines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},continuousKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},markPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},indexPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},premiumIndexKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},fundingRate:1,fundingInfo:1,premiumIndex:1,"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:1,noSymbol:2},openInterest:1,indexInfo:1,assetIndex:{cost:1,noSymbol:10},constituents:2,apiTradingStatus:{cost:1,noSymbol:10},lvtKlines:1,"convert/exchangeInfo":4}},fapiData:{get:{"delivery-price":1,openInterestHist:1,topLongShortAccountRatio:1,topLongShortPositionRatio:1,globalLongShortAccountRatio:1,takerlongshortRatio:1,basis:1}},fapiPrivate:{get:{forceOrders:{cost:20,noSymbol:50},allOrders:5,openOrder:1,openOrders:{cost:1,noSymbol:40},order:1,account:5,balance:5,leverageBracket:1,"positionMargin/history":1,positionRisk:5,"positionSide/dual":30,userTrades:5,income:30,commissionRate:20,"rateLimit/order":1,apiTradingStatus:1,multiAssetsMargin:30,"apiReferral/ifNewUser":1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/traderNum":1,"apiReferral/overview":1,"apiReferral/tradeVol":1,"apiReferral/rebateVol":1,"apiReferral/traderSummary":1,adlQuantile:5,pmAccountInfo:5,orderAmendment:1,"income/asyn":1e3,"income/asyn/id":10,"order/asyn":1e3,"order/asyn/id":10,"trade/asyn":1e3,"trade/asyn/id":10,feeBurn:1,symbolConfig:5,accountConfig:5,"convert/orderStatus":5},post:{batchOrders:5,"positionSide/dual":1,positionMargin:1,marginType:1,order:4,leverage:1,listenKey:1,countdownCancelAll:10,multiAssetsMargin:1,"apiReferral/customization":1,"apiReferral/userCustomization":1,feeBurn:1,"convert/getQuote":200,"convert/acceptQuote":20},put:{listenKey:1,order:1,batchOrders:5},delete:{batchOrders:1,order:1,allOpenOrders:1,listenKey:1}},fapiPublicV2:{get:{"ticker/price":0}},fapiPrivateV2:{get:{account:1,balance:1,positionRisk:1}},fapiPublicV3:{get:{}},fapiPrivateV3:{get:{account:1,balance:1,positionRisk:1}},eapiPublic:{get:{ping:1,time:1,exchangeInfo:1,index:1,ticker:5,mark:5,depth:1,klines:1,trades:5,historicalTrades:20,exerciseHistory:3,openInterest:3}},eapiPrivate:{get:{account:3,position:5,openOrders:{cost:1,noSymbol:40},historyOrders:3,userTrades:5,exerciseRecord:5,bill:1,"income/asyn":5,"income/asyn/id":5,marginAccount:3,mmp:1,countdownCancelAll:1,order:1,"block/order/orders":5,"block/order/execute":5,"block/user-trades":5,blockTrades:5},post:{order:1,batchOrders:5,listenKey:1,mmpSet:1,mmpReset:1,countdownCancelAll:1,countdownCancelAllHeartBeat:10,"block/order/create":5,"block/order/execute":5},put:{listenKey:1,"block/order/create":5},delete:{order:1,batchOrders:1,allOpenOrders:1,allOpenOrdersByUnderlying:1,listenKey:1,"block/order/create":5}},public:{get:{ping:.2,time:.2,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10],[5e3,50]]},trades:2,aggTrades:.4,historicalTrades:2,klines:.4,uiKlines:.4,"ticker/24hr":{cost:.4,noSymbol:16},ticker:{cost:.4,noSymbol:16},"ticker/tradingDay":.8,"ticker/price":{cost:.4,noSymbol:.8},"ticker/bookTicker":{cost:.4,noSymbol:.8},exchangeInfo:4,avgPrice:.4},put:{userDataStream:.4},post:{userDataStream:.4},delete:{userDataStream:.4}},private:{get:{allOrderList:4,openOrderList:1.2,orderList:.8,order:.8,openOrders:{cost:1.2,noSymbol:16},allOrders:4,account:4,myTrades:4,"rateLimit/order":8,myPreventedMatches:4,myAllocations:4,"account/commission":4},post:{"order/oco":.2,"orderList/oco":.2,"orderList/oto":.2,"orderList/otoco":.2,"sor/order":.2,"sor/order/test":.2,order:.2,"order/cancelReplace":.2,"order/test":.2},delete:{openOrders:.2,orderList:.2,order:.2}},papi:{get:{ping:.2,"um/order":1,"um/openOrder":1,"um/openOrders":{cost:1,noSymbol:40},"um/allOrders":5,"cm/order":1,"cm/openOrder":1,"cm/openOrders":{cost:1,noSymbol:40},"cm/allOrders":20,"um/conditional/openOrder":1,"um/conditional/openOrders":{cost:1,noSymbol:40},"um/conditional/orderHistory":1,"um/conditional/allOrders":{cost:1,noSymbol:40},"cm/conditional/openOrder":1,"cm/conditional/openOrders":{cost:1,noSymbol:40},"cm/conditional/orderHistory":1,"cm/conditional/allOrders":40,"margin/order":10,"margin/openOrders":5,"margin/allOrders":100,"margin/orderList":5,"margin/allOrderList":100,"margin/openOrderList":5,"margin/myTrades":5,balance:4,account:4,"margin/maxBorrowable":1,"margin/maxWithdraw":1,"um/positionRisk":1,"cm/positionRisk":.2,"um/positionSide/dual":6,"cm/positionSide/dual":6,"um/userTrades":5,"cm/userTrades":20,"um/leverageBracket":.2,"cm/leverageBracket":.2,"margin/forceOrders":1,"um/forceOrders":{cost:20,noSymbol:50},"cm/forceOrders":{cost:20,noSymbol:50},"um/apiTradingStatus":{cost:.2,noSymbol:2},"um/commissionRate":4,"cm/commissionRate":4,"margin/marginLoan":2,"margin/repayLoan":2,"margin/marginInterestHistory":.2,"portfolio/interest-history":10,"um/income":6,"cm/income":6,"um/account":1,"cm/account":1,"repay-futures-switch":6,"um/adlQuantile":5,"cm/adlQuantile":5,"um/trade/asyn":300,"um/trade/asyn/id":2,"um/order/asyn":300,"um/order/asyn/id":2,"um/income/asyn":300,"um/income/asyn/id":2,"um/orderAmendment":1,"cm/orderAmendment":1,"um/feeBurn":30,"um/accountConfig":1,"um/symbolConfig":1,"cm/accountConfig":1,"cm/symbolConfig":1,"rateLimit/order":1},post:{"um/order":1,"um/conditional/order":1,"cm/order":1,"cm/conditional/order":1,"margin/order":1,marginLoan:100,repayLoan:100,"margin/order/oco":1,"um/leverage":.2,"cm/leverage":.2,"um/positionSide/dual":.2,"cm/positionSide/dual":.2,"auto-collection":150,"bnb-transfer":150,"repay-futures-switch":150,"repay-futures-negative-balance":150,listenKey:.2,"asset-collection":6,"margin/repay-debt":3e3,"um/feeBurn":1},put:{listenKey:.2,"um/order":1,"cm/order":1},delete:{"um/order":1,"um/conditional/order":1,"um/allOpenOrders":1,"um/conditional/allOpenOrders":1,"cm/order":1,"cm/conditional/order":1,"cm/allOpenOrders":1,"cm/conditional/allOpenOrders":1,"margin/order":2,"margin/allOpenOrders":5,"margin/orderList":2,listenKey:.2}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001")},linear:{trading:{feeSide:"quote",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000200"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000400")],[this.parseNumber("250"),this.parseNumber("0.000400")],[this.parseNumber("2500"),this.parseNumber("0.000350")],[this.parseNumber("7500"),this.parseNumber("0.000320")],[this.parseNumber("22500"),this.parseNumber("0.000300")],[this.parseNumber("50000"),this.parseNumber("0.000270")],[this.parseNumber("100000"),this.parseNumber("0.000250")],[this.parseNumber("200000"),this.parseNumber("0.000220")],[this.parseNumber("400000"),this.parseNumber("0.000200")],[this.parseNumber("750000"),this.parseNumber("0.000170")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000200")],[this.parseNumber("250"),this.parseNumber("0.000160")],[this.parseNumber("2500"),this.parseNumber("0.000140")],[this.parseNumber("7500"),this.parseNumber("0.000120")],[this.parseNumber("22500"),this.parseNumber("0.000100")],[this.parseNumber("50000"),this.parseNumber("0.000080")],[this.parseNumber("100000"),this.parseNumber("0.000060")],[this.parseNumber("200000"),this.parseNumber("0.000040")],[this.parseNumber("400000"),this.parseNumber("0.000020")],[this.parseNumber("750000"),this.parseNumber("0")]]}}},inverse:{trading:{feeSide:"base",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000100"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000500")],[this.parseNumber("250"),this.parseNumber("0.000450")],[this.parseNumber("2500"),this.parseNumber("0.000400")],[this.parseNumber("7500"),this.parseNumber("0.000300")],[this.parseNumber("22500"),this.parseNumber("0.000250")],[this.parseNumber("50000"),this.parseNumber("0.000240")],[this.parseNumber("100000"),this.parseNumber("0.000240")],[this.parseNumber("200000"),this.parseNumber("0.000240")],[this.parseNumber("400000"),this.parseNumber("0.000240")],[this.parseNumber("750000"),this.parseNumber("0.000240")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000100")],[this.parseNumber("250"),this.parseNumber("0.000080")],[this.parseNumber("2500"),this.parseNumber("0.000050")],[this.parseNumber("7500"),this.parseNumber("0.0000030")],[this.parseNumber("22500"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.000050")],[this.parseNumber("100000"),this.parseNumber("-0.000060")],[this.parseNumber("200000"),this.parseNumber("-0.000070")],[this.parseNumber("400000"),this.parseNumber("-0.000080")],[this.parseNumber("750000"),this.parseNumber("-0.000090")]]}}},option:{}},currencies:{BNFCR:this.safeCurrencyStructure({id:"BNFCR",code:"BNFCR",precision:this.parseNumber("0.001")})},commonCurrencies:{BCC:"BCC",YOYO:"YOYOW"},precisionMode:o.kb,options:{sandboxMode:!1,fetchMargins:!0,fetchMarkets:["spot","linear","inverse"],loadAllOptions:!1,fetchCurrencies:!0,defaultTimeInForce:"GTC",defaultType:"spot",defaultSubType:void 0,hasAlreadyAuthenticatedSuccessfully:!1,warnOnFetchOpenOrdersWithoutSymbol:!0,throwMarginModeAlreadySet:!1,fetchPositions:"positionRisk",recvWindow:1e4,timeDifference:0,adjustForTimeDifference:!1,newOrderRespType:{market:"FULL",limit:"FULL"},quoteOrderQty:!0,broker:{spot:"x-TKT5PX2F",margin:"x-TKT5PX2F",future:"x-cvBPrNm9",delivery:"x-xcKtGhcu",swap:"x-cvBPrNm9",option:"x-xcKtGhcu",inverse:"x-xcKtGhcu"},accountsByType:{main:"MAIN",spot:"MAIN",funding:"FUNDING",margin:"MARGIN",cross:"MARGIN",future:"UMFUTURE",delivery:"CMFUTURE",linear:"UMFUTURE",swap:"UMFUTURE",inverse:"CMFUTURE",option:"OPTION"},accountsById:{MAIN:"spot",FUNDING:"funding",MARGIN:"margin",UMFUTURE:"linear",CMFUTURE:"inverse",OPTION:"option"},networks:{ERC20:"ETH",TRC20:"TRX",BEP2:"BNB",BEP20:"BSC",OMNI:"OMNI",EOS:"EOS",SPL:"SOL",SOL:"SOL"},networksById:{SOL:"SOL"},impliedNetworks:{ETH:{ERC20:"ETH"},TRX:{TRC20:"TRX"}},legalMoney:{MXN:!0,UGX:!0,SEK:!0,CHF:!0,VND:!0,AED:!0,DKK:!0,KZT:!0,HUF:!0,PEN:!0,PHP:!0,USD:!0,TRY:!0,EUR:!0,NGN:!0,PLN:!0,BRL:!0,ZAR:!0,KES:!0,ARS:!0,RUB:!0,AUD:!0,NOK:!0,CZK:!0,GBP:!0,UAH:!0,GHS:!0,HKD:!0,CAD:!0,INR:!0,JPY:!0,NZD:!0},legalMoneyCurrenciesById:{BUSD:"USD"},defaultWithdrawPrecision:1e-8},features:{spot:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!0,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:{expire_maker:!0,expire_taker:!0,expire_both:!0,none:!0},trailing:!1,icebergAmount:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:void 0,untilDays:1,symbolRequired:!0},fetchOrder:{marginMode:!0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!0,limit:1e3,daysBack:void 0,untilDays:1e4,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!0,limit:1e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:1e4,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1e3}},forDerivatives:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{mark:!0,last:!0,index:!1},stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!0,selfTradePrevention:!0,trailing:!0,iceberg:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0},createOrders:{max:5},fetchMyTrades:{marginMode:!1,daysBack:void 0,limit:1e3,untilDays:7,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:500,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!0,limit:1e3,daysBack:90,untilDays:7,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!0,limit:1e3,daysBack:90,daysBackCanceled:3,untilDays:7,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1500}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}}},exceptions:{spot:{exact:{"-1004":r.OperationFailed,"-1008":r.OperationFailed,"-1099":r.AuthenticationError,"-1108":r.BadRequest,"-1131":r.BadRequest,"-1134":r.BadRequest,"-1135":r.BadRequest,"-1145":r.BadRequest,"-1151":r.BadSymbol,"-2008":r.AuthenticationError,"-2016":r.OperationRejected,"-2021":r.BadResponse,"-2022":r.BadResponse,"-2026":r.InvalidOrder,"-3000":r.OperationFailed,"-3001":r.AuthenticationError,"-3002":r.BadSymbol,"-3003":r.BadRequest,"-3004":r.OperationRejected,"-3005":r.BadRequest,"-3006":r.BadRequest,"-3007":r.OperationFailed,"-3008":r.BadRequest,"-3009":r.OperationRejected,"-3010":r.BadRequest,"-3011":r.BadRequest,"-3012":r.OperationRejected,"-3013":r.BadRequest,"-3014":r.AccountSuspended,"-3015":r.BadRequest,"-3016":r.BadRequest,"-3017":r.OperationRejected,"-3018":r.AccountSuspended,"-3019":r.AccountSuspended,"-3020":r.BadRequest,"-3021":r.BadRequest,"-3022":r.AccountSuspended,"-3023":r.OperationRejected,"-3024":r.OperationRejected,"-3025":r.BadRequest,"-3026":r.BadRequest,"-3027":r.BadSymbol,"-3028":r.BadSymbol,"-3029":r.OperationFailed,"-3036":r.AccountSuspended,"-3037":r.OperationFailed,"-3038":r.BadRequest,"-3041":r.InsufficientFunds,"-3042":r.BadRequest,"-3043":r.PermissionDenied,"-3044":r.OperationFailed,"-3045":r.OperationRejected,"-3999":r.PermissionDenied,"-4000":r.ExchangeError,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.BadRequest,"-4004":r.AuthenticationError,"-4005":r.RateLimitExceeded,"-4006":r.BadRequest,"-4007":r.PermissionDenied,"-4008":r.PermissionDenied,"-4009":r.ExchangeError,"-4010":r.PermissionDenied,"-4011":r.BadRequest,"-4012":r.PermissionDenied,"-4013":r.AuthenticationError,"-4014":r.OperationRejected,"-4015":r.PermissionDenied,"-4016":r.PermissionDenied,"-4017":r.PermissionDenied,"-4018":r.BadSymbol,"-4019":r.BadRequest,"-4020":r.ExchangeError,"-4021":r.BadRequest,"-4022":r.BadRequest,"-4023":r.OperationRejected,"-4024":r.InsufficientFunds,"-4025":r.InsufficientFunds,"-4026":r.InsufficientFunds,"-4027":r.OperationFailed,"-4028":r.BadRequest,"-4029":r.BadRequest,"-4030":r.BadResponse,"-4031":r.OperationFailed,"-4032":r.OperationRejected,"-4033":r.BadRequest,"-4034":r.OperationRejected,"-4035":r.PermissionDenied,"-4036":r.PermissionDenied,"-4037":r.OperationFailed,"-4038":r.OperationFailed,"-4039":r.PermissionDenied,"-4040":r.OperationRejected,"-4041":r.OperationFailed,"-4042":r.OperationRejected,"-4043":r.OperationRejected,"-4044":r.PermissionDenied,"-4045":r.OperationFailed,"-4046":r.AuthenticationError,"-4047":r.BadRequest,"-4048":r.ExchangeError,"-4049":r.ExchangeError,"-4050":r.ExchangeError,"-4051":r.ExchangeError,"-4052":r.ExchangeError,"-4053":r.ExchangeError,"-4054":r.ExchangeError,"-4055":r.ExchangeError,"-4056":r.ExchangeError,"-4057":r.ExchangeError,"-4058":r.ExchangeError,"-4059":r.ExchangeError,"-4060":r.OperationFailed,"-4061":r.ExchangeError,"-4062":r.ExchangeError,"-4063":r.ExchangeError,"-4064":r.ExchangeError,"-4065":r.ExchangeError,"-4066":r.ExchangeError,"-4067":r.ExchangeError,"-4068":r.ExchangeError,"-4069":r.ExchangeError,"-4070":r.ExchangeError,"-4071":r.ExchangeError,"-4072":r.ExchangeError,"-4073":r.ExchangeError,"-4074":r.ExchangeError,"-4075":r.ExchangeError,"-4076":r.ExchangeError,"-4077":r.ExchangeError,"-4078":r.ExchangeError,"-4079":r.ExchangeError,"-4080":r.ExchangeError,"-4081":r.ExchangeError,"-4082":r.ExchangeError,"-4083":r.ExchangeError,"-4084":r.ExchangeError,"-4085":r.ExchangeError,"-4086":r.ExchangeError,"-4087":r.ExchangeError,"-4088":r.ExchangeError,"-4089":r.ExchangeError,"-4091":r.ExchangeError,"-4092":r.ExchangeError,"-4093":r.ExchangeError,"-4094":r.ExchangeError,"-4095":r.ExchangeError,"-4096":r.ExchangeError,"-4097":r.ExchangeError,"-4098":r.ExchangeError,"-4099":r.ExchangeError,"-4101":r.ExchangeError,"-4102":r.ExchangeError,"-4103":r.ExchangeError,"-4104":r.ExchangeError,"-4105":r.ExchangeError,"-4106":r.ExchangeError,"-4107":r.ExchangeError,"-4108":r.ExchangeError,"-4109":r.ExchangeError,"-4110":r.ExchangeError,"-4112":r.ExchangeError,"-4113":r.ExchangeError,"-4114":r.ExchangeError,"-4115":r.ExchangeError,"-4116":r.ExchangeError,"-4117":r.ExchangeError,"-4118":r.ExchangeError,"-4119":r.ExchangeError,"-4120":r.ExchangeError,"-4121":r.ExchangeError,"-4122":r.ExchangeError,"-4123":r.ExchangeError,"-4124":r.ExchangeError,"-4125":r.ExchangeError,"-4126":r.ExchangeError,"-4127":r.ExchangeError,"-4128":r.ExchangeError,"-4129":r.ExchangeError,"-4130":r.ExchangeError,"-4131":r.ExchangeError,"-4132":r.ExchangeError,"-4133":r.ExchangeError,"-4134":r.ExchangeError,"-4135":r.ExchangeError,"-4136":r.ExchangeError,"-4137":r.ExchangeError,"-4138":r.ExchangeError,"-4139":r.ExchangeError,"-4141":r.ExchangeError,"-4142":r.ExchangeError,"-4143":r.ExchangeError,"-4144":r.ExchangeError,"-4145":r.ExchangeError,"-4146":r.ExchangeError,"-4147":r.ExchangeError,"-4148":r.ExchangeError,"-4149":r.ExchangeError,"-4150":r.ExchangeError,"-5001":r.BadRequest,"-5002":r.InsufficientFunds,"-5003":r.InsufficientFunds,"-5004":r.OperationRejected,"-5005":r.OperationRejected,"-5006":r.OperationRejected,"-5007":r.BadRequest,"-5008":r.OperationRejected,"-5009":r.BadSymbol,"-5010":r.OperationFailed,"-5011":r.BadRequest,"-5012":r.OperationFailed,"-5013":r.InsufficientFunds,"-5021":r.BadRequest,"-5022":r.BadRequest,"-6001":r.BadSymbol,"-6003":r.PermissionDenied,"-6004":r.BadRequest,"-6005":r.BadRequest,"-6006":r.BadRequest,"-6007":r.OperationRejected,"-6008":r.OperationRejected,"-6009":r.RateLimitExceeded,"-6011":r.OperationRejected,"-6012":r.InsufficientFunds,"-6013":r.BadResponse,"-6014":r.OperationRejected,"-6015":r.BadRequest,"-6016":r.BadRequest,"-6017":r.PermissionDenied,"-6018":r.InsufficientFunds,"-6019":r.OperationRejected,"-6020":r.BadRequest,"-7001":r.BadRequest,"-7002":r.BadRequest,"-10001":r.OperationFailed,"-10002":r.BadRequest,"-10005":r.BadResponse,"-10007":r.BadRequest,"-10008":r.BadRequest,"-10009":r.BadRequest,"-10010":r.BadRequest,"-10011":r.InsufficientFunds,"-10012":r.BadRequest,"-10013":r.InsufficientFunds,"-10015":r.OperationFailed,"-10016":r.OperationFailed,"-10017":r.OperationRejected,"-10018":r.BadRequest,"-10019":r.BadRequest,"-10020":r.BadRequest,"-10021":r.InvalidOrder,"-10022":r.BadRequest,"-10023":r.OperationFailed,"-10024":r.BadRequest,"-10025":r.OperationFailed,"-10026":r.BadRequest,"-10028":r.BadRequest,"-10029":r.OperationRejected,"-10030":r.OperationRejected,"-10031":r.OperationRejected,"-10032":r.OperationFailed,"-10034":r.OperationRejected,"-10039":r.OperationRejected,"-10040":r.OperationRejected,"-10041":r.OperationFailed,"-10042":r.BadSymbol,"-10043":r.OperationRejected,"-10044":r.OperationRejected,"-10045":r.OperationRejected,"-10046":r.OperationRejected,"-10047":r.PermissionDenied,"-11008":r.OperationRejected,"-12014":r.RateLimitExceeded,"-13000":r.OperationRejected,"-13001":r.OperationRejected,"-13002":r.OperationRejected,"-13003":r.PermissionDenied,"-13004":r.OperationRejected,"-13005":r.OperationRejected,"-13006":r.OperationRejected,"-13007":r.PermissionDenied,"-18002":r.OperationRejected,"-18003":r.OperationRejected,"-18004":r.OperationRejected,"-18005":r.PermissionDenied,"-18006":r.OperationRejected,"-18007":r.OperationRejected,"-21001":r.BadRequest,"-21002":r.BadRequest,"-21003":r.BadResponse,"-21004":r.OperationRejected,"-21005":r.InsufficientFunds,"-21006":r.OperationFailed,"-21007":r.OperationFailed,"-32603":r.BadRequest,400002:r.BadRequest,100001003:r.AuthenticationError,200003903:r.AuthenticationError}},linear:{exact:{"-1005":r.PermissionDenied,"-1008":r.OperationFailed,"-1011":r.PermissionDenied,"-1023":r.BadRequest,"-1099":r.AuthenticationError,"-1109":r.PermissionDenied,"-1110":r.BadRequest,"-1113":r.BadRequest,"-1122":r.BadRequest,"-1126":r.BadSymbol,"-1136":r.BadRequest,"-2012":r.OperationFailed,"-2016":r.OperationRejected,"-2017":r.PermissionDenied,"-2018":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-2020":r.OperationFailed,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.InsufficientFunds,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4063":r.BadRequest,"-4064":r.BadRequest,"-4065":r.BadRequest,"-4066":r.BadRequest,"-4069":r.BadRequest,"-4070":r.BadRequest,"-4071":r.BadRequest,"-4072":r.OperationRejected,"-4073":r.BadRequest,"-4074":r.OperationRejected,"-4075":r.BadRequest,"-4076":r.OperationRejected,"-4077":r.OperationRejected,"-4078":r.OperationFailed,"-4079":r.BadRequest,"-4080":r.PermissionDenied,"-4081":r.BadRequest,"-4085":r.BadRequest,"-4087":r.PermissionDenied,"-4088":r.PermissionDenied,"-4114":r.BadRequest,"-4115":r.BadRequest,"-4116":r.InvalidOrder,"-4117":r.OperationRejected,"-4118":r.OperationRejected,"-4131":r.OperationRejected,"-4140":r.BadRequest,"-4141":r.OperationRejected,"-4144":r.BadSymbol,"-4164":r.InvalidOrder,"-4136":r.InvalidOrder,"-4165":r.BadRequest,"-4167":r.BadRequest,"-4168":r.BadRequest,"-4169":r.OperationRejected,"-4170":r.OperationRejected,"-4171":r.OperationRejected,"-4172":r.OperationRejected,"-4183":r.BadRequest,"-4184":r.BadRequest,"-4192":r.PermissionDenied,"-4202":r.PermissionDenied,"-4203":r.PermissionDenied,"-4205":r.PermissionDenied,"-4206":r.PermissionDenied,"-4208":r.OperationRejected,"-4209":r.OperationRejected,"-4210":r.BadRequest,"-4211":r.BadRequest,"-4400":r.PermissionDenied,"-4401":r.PermissionDenied,"-4402":r.PermissionDenied,"-4403":r.PermissionDenied,"-5021":r.OrderNotFillable,"-5022":r.OrderNotFillable,"-5024":r.OperationRejected,"-5025":r.OperationRejected,"-5026":r.OperationRejected,"-5027":r.OperationRejected,"-5028":r.BadRequest,"-5037":r.BadRequest,"-5038":r.BadRequest,"-5039":r.BadRequest,"-5040":r.BadRequest,"-5041":r.OperationFailed}},inverse:{exact:{"-1005":r.PermissionDenied,"-1011":r.PermissionDenied,"-1023":r.BadRequest,"-1109":r.AuthenticationError,"-1110":r.BadSymbol,"-1113":r.BadRequest,"-1128":r.BadRequest,"-1136":r.BadRequest,"-2016":r.OperationRejected,"-2018":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-2020":r.OperationFailed,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.BadRequest,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4086":r.BadRequest,"-4087":r.BadSymbol,"-4088":r.BadRequest,"-4089":r.PermissionDenied,"-4090":r.PermissionDenied,"-4110":r.BadRequest,"-4111":r.BadRequest,"-4112":r.OperationRejected,"-4113":r.OperationRejected,"-4150":r.OperationRejected,"-4151":r.BadRequest,"-4152":r.BadRequest,"-4154":r.BadRequest,"-4155":r.BadRequest,"-4178":r.BadRequest,"-4188":r.BadRequest,"-4192":r.PermissionDenied,"-4194":r.PermissionDenied,"-4195":r.PermissionDenied,"-4196":r.BadRequest,"-4197":r.OperationRejected,"-4198":r.OperationRejected,"-4199":r.BadRequest,"-4200":r.PermissionDenied,"-4201":r.PermissionDenied,"-4202":r.OperationRejected}},option:{exact:{"-1003":r.ExchangeError,"-1004":r.ExchangeError,"-1006":r.ExchangeError,"-1007":r.ExchangeError,"-1008":r.RateLimitExceeded,"-1010":r.ExchangeError,"-1013":r.ExchangeError,"-1108":r.ExchangeError,"-1112":r.ExchangeError,"-1114":r.ExchangeError,"-1128":r.BadSymbol,"-1129":r.BadSymbol,"-1131":r.BadRequest,"-2011":r.ExchangeError,"-2018":r.InsufficientFunds,"-2027":r.InsufficientFunds,"-3029":r.OperationFailed,"-4006":r.ExchangeError,"-4007":r.ExchangeError,"-4008":r.ExchangeError,"-4009":r.ExchangeError,"-4010":r.ExchangeError,"-4011":r.ExchangeError,"-4012":r.ExchangeError,"-4014":r.ExchangeError,"-4015":r.ExchangeError,"-4016":r.ExchangeError,"-4017":r.ExchangeError,"-4018":r.ExchangeError,"-4019":r.ExchangeError,"-4020":r.ExchangeError,"-4021":r.ExchangeError,"-4022":r.ExchangeError,"-4023":r.ExchangeError,"-4024":r.ExchangeError,"-4025":r.ExchangeError,"-4026":r.ExchangeError,"-4027":r.ExchangeError,"-4028":r.ExchangeError,"-4031":r.ExchangeError,"-4032":r.ExchangeError,"-4033":r.ExchangeError,"-4034":r.ExchangeError,"-4035":r.ExchangeError,"-4036":r.ExchangeError,"-4037":r.ExchangeError,"-4038":r.ExchangeError,"-4039":r.ExchangeError,"-4040":r.ExchangeError,"-4041":r.ExchangeError,"-4042":r.ExchangeError,"-4043":r.ExchangeError,"-4044":r.ExchangeError,"-4045":r.ExchangeError,"-4046":r.ExchangeError,"-4047":r.ExchangeError,"-4048":r.ExchangeError,"-4049":r.ExchangeError,"-4050":r.ExchangeError,"-4051":r.ExchangeError,"-4052":r.ExchangeError,"-4053":r.ExchangeError,"-4054":r.ExchangeError,"-4056":r.ExchangeError,"-4057":r.ExchangeError,"-4058":r.ExchangeError,"-4059":r.ExchangeError,"-4060":r.ExchangeError,"-4061":r.ExchangeError,"-4062":r.ExchangeError,"-4063":r.ExchangeError,"-4064":r.ExchangeError,"-4065":r.ExchangeError,"-4066":r.ExchangeError,"-4067":r.ExchangeError,"-4068":r.ExchangeError,"-4069":r.ExchangeError,"-4070":r.ExchangeError,"-4071":r.ExchangeError,"-4072":r.ExchangeError,"-4073":r.ExchangeError,"-4074":r.ExchangeError,"-4075":r.ExchangeError,"-4076":r.ExchangeError,"-4077":r.ExchangeError,"-4078":r.ExchangeError,"-4079":r.ExchangeError,"-4080":r.ExchangeError,"-4081":r.ExchangeError,"-4082":r.ExchangeError,"-4083":r.ExchangeError,"-4084":r.ExchangeError,"-4085":r.ExchangeError,"-4086":r.ExchangeError,"-4087":r.ExchangeError,"-4088":r.ExchangeError,"-4089":r.ExchangeError,"-4091":r.ExchangeError,"-4092":r.ExchangeError,"-4093":r.ExchangeError,"-4094":r.ExchangeError,"-4095":r.ExchangeError,"-4096":r.ExchangeError,"-4097":r.ExchangeError,"-4098":r.ExchangeError,"-4099":r.ExchangeError,"-4101":r.ExchangeError,"-4102":r.ExchangeError,"-4103":r.ExchangeError,"-4104":r.ExchangeError,"-4105":r.ExchangeError,"-4106":r.ExchangeError,"-4107":r.ExchangeError,"-4108":r.ExchangeError,"-4109":r.ExchangeError,"-4110":r.ExchangeError,"-4112":r.ExchangeError,"-4113":r.ExchangeError,"-4114":r.ExchangeError,"-4115":r.ExchangeError,"-4116":r.ExchangeError,"-4117":r.ExchangeError,"-4118":r.ExchangeError,"-4119":r.ExchangeError,"-4120":r.ExchangeError,"-4121":r.ExchangeError,"-4122":r.ExchangeError,"-4123":r.ExchangeError,"-4124":r.ExchangeError,"-4125":r.ExchangeError,"-4126":r.ExchangeError,"-4127":r.ExchangeError,"-4128":r.ExchangeError,"-4129":r.ExchangeError,"-4130":r.ExchangeError,"-4131":r.ExchangeError,"-4132":r.ExchangeError,"-4133":r.ExchangeError,"-4134":r.ExchangeError,"-4135":r.ExchangeError,"-4136":r.ExchangeError,"-4137":r.ExchangeError,"-4138":r.ExchangeError,"-4139":r.ExchangeError,"-4141":r.ExchangeError,"-4142":r.ExchangeError,"-4143":r.ExchangeError,"-4144":r.ExchangeError,"-4145":r.ExchangeError,"-4146":r.ExchangeError,"-4147":r.ExchangeError,"-4148":r.ExchangeError,"-4149":r.ExchangeError,"-4150":r.ExchangeError,"-20121":r.ExchangeError,"-20124":r.ExchangeError,"-20130":r.ExchangeError,"-20132":r.ExchangeError,"-20194":r.ExchangeError,"-20195":r.ExchangeError,"-20196":r.ExchangeError,"-20198":r.ExchangeError,"-20204":r.ExchangeError}},portfolioMargin:{exact:{"-1000":r.OperationFailed,"-1001":r.ExchangeError,"-1002":r.PermissionDenied,"-1003":r.RateLimitExceeded,"-1004":r.BadRequest,"-1005":r.PermissionDenied,"-1006":r.BadResponse,"-1007":r.BadResponse,"-1008":r.OperationFailed,"-1010":r.ExchangeError,"-1011":r.PermissionDenied,"-1013":r.ExchangeError,"-1014":r.InvalidOrder,"-1015":r.InvalidOrder,"-1016":r.NotSupported,"-1020":r.NotSupported,"-1021":r.BadRequest,"-1022":r.BadRequest,"-1023":r.BadRequest,"-1099":r.OperationFailed,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1108":r.BadRequest,"-1109":r.BadRequest,"-1110":r.BadSymbol,"-1111":r.BadRequest,"-1112":r.BadRequest,"-1113":r.BadRequest,"-1114":r.BadRequest,"-1115":r.BadRequest,"-1116":r.BadRequest,"-1117":r.BadRequest,"-1118":r.BadRequest,"-1119":r.BadRequest,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1125":r.BadRequest,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-1131":r.BadRequest,"-1134":r.BadRequest,"-1136":r.BadRequest,"-1145":r.BadRequest,"-1151":r.BadRequest,"-2010":r.InvalidOrder,"-2011":r.OperationRejected,"-2013":r.OrderNotFound,"-2014":r.OperationRejected,"-2015":r.OperationRejected,"-2016":r.OperationFailed,"-2018":r.OperationFailed,"-2019":r.OperationFailed,"-2020":r.OrderNotFillable,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.OperationRejected,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4000":r.BadRequest,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.BadRequest,"-4004":r.BadRequest,"-4005":r.BadRequest,"-4006":r.BadRequest,"-4007":r.BadRequest,"-4008":r.BadRequest,"-4009":r.BadRequest,"-4010":r.BadRequest,"-4011":r.BadRequest,"-4012":r.BadRequest,"-4013":r.BadRequest,"-4014":r.BadRequest,"-4015":r.BadRequest,"-4016":r.BadRequest,"-4017":r.BadRequest,"-4018":r.BadRequest,"-4019":r.BadRequest,"-4020":r.BadRequest,"-4021":r.BadRequest,"-4022":r.BadRequest,"-4023":r.BadRequest,"-4024":r.BadRequest,"-4025":r.BadRequest,"-4026":r.BadRequest,"-4027":r.BadRequest,"-4028":r.BadRequest,"-4029":r.BadRequest,"-4030":r.BadRequest,"-4031":r.BadRequest,"-4032":r.BadRequest,"-4033":r.BadRequest,"-4044":r.BadRequest,"-4045":r.BadRequest,"-4046":r.BadRequest,"-4047":r.BadRequest,"-4048":r.BadRequest,"-4049":r.BadRequest,"-4050":r.BadRequest,"-4051":r.BadRequest,"-4052":r.BadRequest,"-4053":r.BadRequest,"-4054":r.BadRequest,"-4055":r.BadRequest,"-4056":r.PermissionDenied,"-4057":r.PermissionDenied,"-4058":r.BadRequest,"-4059":r.BadRequest,"-4060":r.BadRequest,"-4061":r.InvalidOrder,"-4062":r.BadRequest,"-4063":r.BadRequest,"-4064":r.BadRequest,"-4065":r.BadRequest,"-4066":r.BadRequest,"-4067":r.BadRequest,"-4068":r.BadRequest,"-4069":r.BadRequest,"-4070":r.BadRequest,"-4071":r.BadRequest,"-4072":r.OperationRejected,"-4073":r.BadRequest,"-4074":r.BadRequest,"-4075":r.BadRequest,"-4076":r.OperationRejected,"-4077":r.OperationRejected,"-4078":r.OperationFailed,"-4079":r.BadRequest,"-4080":r.PermissionDenied,"-4081":r.BadRequest,"-4082":r.BadRequest,"-4083":r.BadRequest,"-4084":r.NotSupported,"-4085":r.BadRequest,"-4086":r.BadRequest,"-4087":r.PermissionDenied,"-4088":r.PermissionDenied,"-4104":r.BadRequest,"-4114":r.BadRequest,"-4115":r.BadRequest,"-4118":r.OperationRejected,"-4131":r.OperationRejected,"-4135":r.BadRequest,"-4137":r.BadRequest,"-4138":r.BadRequest,"-4139":r.BadRequest,"-4140":r.OrderImmediatelyFillable,"-4141":r.BadRequest,"-4142":r.OrderImmediatelyFillable,"-4144":r.BadSymbol,"-4161":r.OperationRejected,"-4164":r.InvalidOrder,"-4165":r.BadRequest,"-4183":r.InvalidOrder,"-4184":r.InvalidOrder,"-4408":r.InvalidOrder,"-5021":r.OrderNotFillable,"-5022":r.OrderNotFillable,"-5028":r.OperationFailed,"-5041":r.RateLimitExceeded}},exact:{"-1000":r.OperationFailed,"-1001":r.OperationFailed,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1004":r.OperationRejected,"-1006":r.OperationFailed,"-1007":r.RequestTimeout,"-1010":r.OperationFailed,"-1013":r.BadRequest,"-1014":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.BadRequest,"-1020":r.BadRequest,"-1021":r.InvalidNonce,"-1022":r.AuthenticationError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1108":r.BadSymbol,"-1111":r.BadRequest,"-1112":r.OperationFailed,"-1114":r.BadRequest,"-1115":r.BadRequest,"-1116":r.BadRequest,"-1117":r.BadRequest,"-1118":r.BadRequest,"-1119":r.BadRequest,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1125":r.AuthenticationError,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-2010":r.InvalidOrder,"-2011":r.OrderNotFound,"-2013":r.OrderNotFound,"-2014":r.AuthenticationError,"-2015":r.AuthenticationError,"-4000":r.InvalidOrder,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.BadRequest,"-4004":r.BadRequest,"-4005":r.BadRequest,"-4006":r.BadRequest,"-4007":r.BadRequest,"-4008":r.BadRequest,"-4009":r.BadRequest,"-4010":r.BadRequest,"-4011":r.BadRequest,"-4012":r.BadRequest,"-4013":r.BadRequest,"-4014":r.BadRequest,"-4015":r.BadRequest,"-4016":r.BadRequest,"-4017":r.BadRequest,"-4018":r.BadRequest,"-4019":r.OperationRejected,"-4020":r.BadRequest,"-4021":r.BadRequest,"-4022":r.BadRequest,"-4023":r.BadRequest,"-4024":r.BadRequest,"-4025":r.BadRequest,"-4026":r.BadRequest,"-4027":r.BadRequest,"-4028":r.BadRequest,"-4029":r.BadRequest,"-4030":r.BadRequest,"-4031":r.BadRequest,"-4032":r.OperationRejected,"-4033":r.BadRequest,"-4044":r.BadRequest,"-4045":r.OperationRejected,"-4046":r.OperationRejected,"-4047":r.OperationRejected,"-4048":r.OperationRejected,"-4049":r.BadRequest,"-4050":r.InsufficientFunds,"-4051":r.InsufficientFunds,"-4052":r.OperationRejected,"-4053":r.BadRequest,"-4054":r.OperationRejected,"-4055":r.BadRequest,"-4056":r.AuthenticationError,"-4057":r.AuthenticationError,"-4058":r.BadRequest,"-4059":r.OperationRejected,"-4060":r.BadRequest,"-4061":r.OperationRejected,"-4062":r.BadRequest,"-4067":r.OperationRejected,"-4068":r.OperationRejected,"-4082":r.BadRequest,"-4083":r.OperationRejected,"-4084":r.BadRequest,"-4086":r.BadRequest,"-4104":r.BadRequest,"-4135":r.BadRequest,"-4137":r.BadRequest,"-4138":r.BadRequest,"-4139":r.BadRequest,"-4142":r.OrderImmediatelyFillable,"-20121":r.BadSymbol,"-20124":r.BadRequest,"-20130":r.BadRequest,"-20132":r.BadRequest,"-20194":r.BadRequest,"-20195":r.BadRequest,"-20196":r.BadRequest,"-20198":r.OperationRejected,"-20204":r.BadRequest,"System is under maintenance.":r.OnMaintenance,"System abnormality":r.OperationFailed,"You are not authorized to execute this request.":r.PermissionDenied,"API key does not exist":r.AuthenticationError,"Order would trigger immediately.":r.OrderImmediatelyFillable,"Stop price would trigger immediately.":r.OrderImmediatelyFillable,"Order would immediately match and take.":r.OrderImmediatelyFillable,"Account has insufficient balance for requested action.":r.InsufficientFunds,"Rest API trading is not enabled.":r.PermissionDenied,"This account may not place or cancel orders.":r.PermissionDenied,"You don't have permission.":r.PermissionDenied,"Market is closed.":r.MarketClosed,"Too many requests. Please try again later.":r.RateLimitExceeded,"This action is disabled on this account.":r.AccountSuspended,"Limit orders require GTC for this phase.":r.BadRequest,"This order type is not possible in this trading phase.":r.BadRequest,"This type of sub-account exceeds the maximum number limit":r.OperationRejected,"This symbol is restricted for this account.":r.PermissionDenied,"This symbol is not permitted for this account.":r.PermissionDenied},broad:{"has no operation privilege":r.PermissionDenied,MAX_POSITION:r.BadRequest}}})}isInverse(e,t=void 0){return void 0===t?"delivery"===e:"inverse"===t}isLinear(e,t=void 0){return void 0===t?"future"===e||"swap"===e:"linear"===t}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}createExpiredOptionMarket(e){const t="USDT",i=e.split("-"),s=e.split("/");let r;r=e.indexOf("/")>-1?this.safeString(s,0):this.safeString(i,0);const a=this.safeString(i,1),o=this.safeInteger(i,2),n=this.safeString(i,2),d=this.safeString(i,3),h=this.convertExpireDate(a);return{id:r+"-"+a+"-"+n+"-"+d,symbol:r+"/"+t+":"+t+"-"+a+"-"+n+"-"+d,base:r,quote:t,baseId:r,quoteId:t,active:void 0,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:void 0,expiry:this.parse8601(h),expiryDatetime:h,optionType:"C"===d?"call":"put",strike:o,settle:t,settleId:t,precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}market(e){if(void 0===this.markets)throw new r.ExchangeError(this.id+" markets not loaded");let t=this.safeString(this.options,"defaultType");const i=this.safeString(this.options,"defaultSubType"),s="future"===t,a="delivery"===t,o=s||a;if("string"==typeof e)if(e in this.markets){const t=this.markets[e];if(!o||!t.spot)return t;{const i=e+":"+(s?t.quote:t.base);if(i in this.markets)return this.markets[i]}}else{if(e in this.markets_by_id){const r=this.markets_by_id[e];s?t="linear":a?t="inverse":void 0===t&&(t=i);for(let e=0;e-1&&e.indexOf(":")<0){const[t,i]=e.split("/"),s=e+":"+("USD"===i?t:i);if(s in this.markets)return this.markets[s]}else if(e.indexOf("-C")>-1||e.indexOf("-P")>-1)return this.createExpiredOptionMarket(e)}throw new r.BadSymbol(this.id+" does not have market symbol "+e)}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,i,s)}costToPrecision(e,t){return this.decimalToPrecision(t,o.R3,this.markets[e].precision.quote,this.precisionMode,this.paddingMode)}currencyToPrecision(e,t,i=void 0){return void 0!==this.safeValue(this.currencies[e],"precision")?this.decimalToPrecision(t,o.R3,this.currencies[e].precision,this.precisionMode,this.paddingMode):this.numberToString(t)}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=this.safeString2(this.options,"fetchTime","defaultType","spot"),i=this.safeString(e,"type",t),s=this.omit(e,"type");let r,a;return[r,e]=this.handleSubTypeAndParams("fetchTime",void 0,e),a=this.isLinear(i,r)?await this.fapiPublicGetTime(s):this.isInverse(i,r)?await this.dapiPublicGetTime(s):await this.publicGetTime(s),this.safeInteger(a,"serverTime")}async fetchCurrencies(e={}){if(!this.safeBool(this.options,"fetchCurrencies"))return;if(!this.checkRequiredCredentials(!1))return;if(void 0!==this.safeValue(this.urls,"apiBackup"))return;const t=[this.sapiGetCapitalConfigGetall(e)],i=this.safeBool(this.options,"fetchMargins",!1);i&&t.push(this.sapiGetMarginAllPairs(e));const s=await Promise.all(t),r=s[0];let o;if(i){const e=s[1];o=this.indexBy(e,"assetName")}const n={};for(let e=0;e0)){const e=this.parseTimeframe(t),r=this.sum(i,s*e*1e3-1),a=this.milliseconds();h.endTime=Math.min(a,r)}let l;void 0!==d&&(h.endTime=d),l=o.option?await this.eapiPublicGetKlines(this.extend(h,r)):"mark"===n?o.inverse?await this.dapiPublicGetMarkPriceKlines(this.extend(h,r)):await this.fapiPublicGetMarkPriceKlines(this.extend(h,r)):"index"===n?o.inverse?await this.dapiPublicGetIndexPriceKlines(this.extend(h,r)):await this.fapiPublicGetIndexPriceKlines(this.extend(h,r)):"premiumIndex"===n?o.inverse?await this.dapiPublicGetPremiumIndexKlines(this.extend(h,r)):await this.fapiPublicGetPremiumIndexKlines(this.extend(h,r)):o.linear?await this.fapiPublicGetKlines(this.extend(h,r)):o.inverse?await this.dapiPublicGetKlines(this.extend(h,r)):await this.publicGetKlines(this.extend(h,r));return this.parseOHLCVs(l,o,t,i,s)}parseTrade(e,t=void 0){if("isDustTrade"in e)return this.parseDustTrade(e,t);const i=this.safeInteger2(e,"T","time");let s=this.safeString2(e,"q","qty");s=this.safeString(e,"quantity",s);const r=this.safeString(e,"symbol"),o="isIsolated"in e||"M"in e||"orderListId"in e||"isMaker"in e?"spot":"contract",n=(t=this.safeMarket(r,t,void 0,o)).symbol;let d;const h=this.safeBool2(e,"m","isBuyerMaker");let c,l;if(void 0!==h?d=h?"sell":"buy":"side"in e?d=this.safeStringLower(e,"side"):"isBuyer"in e&&(d=e.isBuyer?"buy":"sell"),"commission"in e&&(l={cost:this.safeString(e,"commission"),currency:this.safeCurrencyCode(this.safeString(e,"commissionAsset"))}),"isMaker"in e&&(c=e.isMaker?"maker":"taker"),"maker"in e&&(c=e.maker?"maker":"taker"),"optionSide"in e||t.option){const t=this.safeCurrencyCode(this.safeString(e,"quoteAsset","USDT"));c=this.safeStringLower(e,"liquidity"),"fee"in e&&(l={cost:this.safeString(e,"fee"),currency:t}),"buy"!==d&&"sell"!==d&&(d="1"===d?"buy":"sell"),"optionSide"in e&&"buy"!==d&&(s=a.Y.stringMul("-1",s))}return this.safeTrade({info:e,timestamp:i,datetime:this.iso8601(i),symbol:n,id:this.safeStringN(e,["t","a","tradeId","id"]),order:this.safeString(e,"orderId"),type:this.safeStringLower(e,"type"),side:d,takerOrMaker:c,price:this.safeString2(e,"p","price"),amount:s,cost:this.safeString2(e,"quoteQty","baseQty"),fee:l},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,i,s);const a=this.market(e),o={symbol:a.id};if(!a.option){void 0!==t&&(o.startTime=t,o.endTime=this.sum(t,36e5));const e=this.safeInteger(s,"until");void 0!==e&&(o.endTime=e)}let n,d=this.safeString(this.options,"fetchTradesMethod");if(d=this.safeString2(s,"fetchTradesMethod","method",d),void 0!==i){const e=a.swap||a.future,t=void 0!==d&&d.indexOf("GetHistoricalTrades")>=0?500:1e3;o.limit=e?Math.min(i,t):i}return s=this.omit(s,["until","fetchTradesMethod"]),n=a.option||"eapiPublicGetTrades"===d?await this.eapiPublicGetTrades(this.extend(o,s)):a.linear||"fapiPublicGetAggTrades"===d?await this.fapiPublicGetAggTrades(this.extend(o,s)):a.inverse||"dapiPublicGetAggTrades"===d?await this.dapiPublicGetAggTrades(this.extend(o,s)):await this.publicGetAggTrades(this.extend(o,s)),this.parseTrades(n,a,t,i)}async editSpotOrder(e,t,i,s,a,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);if(!d.spot)throw new r.NotSupported(this.id+" editSpotOrder() does not support "+d.type+" orders");const h=this.editSpotOrderRequest(e,t,i,s,a,o,n),c=await this.privatePostOrderCancelReplace(h),l=this.safeDict(c,"newOrderResponse");return this.parseOrder(l,d)}editSpotOrderRequest(e,t,i,s,n,d=void 0,h={}){const c=this.market(t),l=this.safeStringN(h,["newClientOrderId","clientOrderId","origClientOrderId"]),u={symbol:c.id,side:s.toUpperCase()},f=i.toUpperCase();let p=f;this.isPostOnly("MARKET"===f,"LIMIT_MAKER"===f,h)&&(p="LIMIT_MAKER");const m=this.safeNumber2(h,"stopPrice","triggerPrice");void 0!==m&&("MARKET"===p?p="STOP_LOSS":"LIMIT"===p&&(p="STOP_LOSS_LIMIT")),u.type=p;const g=this.safeList(c.info,"orderTypes");if(!this.inArray(p,g))throw f!==p?new r.InvalidOrder(this.id+" triggerPrice parameter is not allowed for "+t+" "+i+" orders"):new r.InvalidOrder(this.id+" "+i+" is not a valid order type for the "+t+" market");if(void 0===l){const e=this.safeDict(this.options,"broker");if(void 0!==e){const t=this.safeString(e,"spot");void 0!==t&&(u.newClientOrderId=t+this.uuid22())}}else u.newClientOrderId=l;u.newOrderRespType=this.safeValue(this.options.newOrderRespType,i,"RESULT");let v=!1,y=!1,w=!1,b=!1;if("MARKET"===p){if(this.safeBool(this.options,"quoteOrderQty",!0)){const e=this.safeValue2(h,"quoteOrderQty","cost"),t=c.precision.price;if(void 0!==e)u.quoteOrderQty=this.decimalToPrecision(e,o.R3,t,this.precisionMode);else if(void 0!==d){const e=this.numberToString(n),i=this.numberToString(d),s=a.Y.stringMul(e,i);u.quoteOrderQty=this.decimalToPrecision(s,o.R3,t,this.precisionMode)}else b=!0}else b=!0}else"LIMIT"===p?(y=!0,v=!0,b=!0):"STOP_LOSS"===p||"TAKE_PROFIT"===p?(w=!0,b=!0):"STOP_LOSS_LIMIT"===p||"TAKE_PROFIT_LIMIT"===p?(b=!0,w=!0,y=!0,v=!0):"LIMIT_MAKER"===p&&(y=!0,b=!0);if(b&&(u.quantity=this.amountToPrecision(t,n)),y){if(void 0===d)throw new r.InvalidOrder(this.id+" editOrder() requires a price argument for a "+i+" order");u.price=this.priceToPrecision(t,d)}if(v&&void 0===this.safeString(h,"timeInForce")&&(u.timeInForce=this.options.defaultTimeInForce),w){if(void 0===m)throw new r.InvalidOrder(this.id+" editOrder() requires a triggerPrice extra param for a "+i+" order");u.stopPrice=this.priceToPrecision(t,m)}u.cancelReplaceMode="STOP_ON_FAILURE";return void 0===this.safeString2(h,"cancelNewClientOrderId","cancelOrigClientOrderId")&&(u.cancelOrderId=e),"PO"===this.safeString(h,"timeInForce")&&(h=this.omit(h,["timeInForce"])),h=this.omit(h,["quoteOrderQty","cost","stopPrice","newClientOrderId","clientOrderId","postOnly"]),this.extend(u,h)}editContractOrderRequest(e,t,i,s,a,o=void 0,n={}){const d=this.market(t);if(!d.contract)throw new r.NotSupported(this.id+" editContractOrder() does not support "+d.type+" orders");const h={symbol:d.id,side:s.toUpperCase(),orderId:e,quantity:this.amountToPrecision(t,a)},c=this.safeStringN(n,["newClientOrderId","clientOrderId","origClientOrderId"]);return void 0!==o&&(h.price=this.priceToPrecision(t,o)),void 0!==c&&(h.origClientOrderId=c),n=this.omit(n,["clientOrderId","newClientOrderId"]),h}async editContractOrder(e,t,i,s,a,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);let h;if([h,n]=this.handleOptionAndParams2(n,"editContractOrder","papi","portfolioMargin",!1),(d.linear||h)&&void 0===o&&!("priceMatch"in n))throw new r.ArgumentsRequired(this.id+" editOrder() requires a price argument for portfolio margin and linear orders");const c=this.editContractOrderRequest(e,t,i,s,a,o,n);let l;return d.linear?l=h?await this.papiPutUmOrder(this.extend(c,n)):await this.fapiPrivatePutOrder(this.extend(c,n)):d.inverse&&(l=h?await this.papiPutCmOrder(this.extend(c,n)):await this.dapiPrivatePutOrder(this.extend(c,n))),this.parseOrder(l,d)}async editOrder(e,t,i,s,a=void 0,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);if(d.option)throw new r.NotSupported(this.id+" editOrder() does not support "+d.type+" orders");return d.spot?await this.editSpotOrder(e,t,i,s,a,o,n):await this.editContractOrder(e,t,i,s,a,o,n)}async editOrders(e,t={}){await this.loadMarkets();const i=[];let s=[];for(let t=0;t=s&&void 0===l&&n.linear&&(l=this.sum(e,s),l=Math.min(l,i))}if(void 0!==l&&(o.endTime=l,s=this.omit(s,["endTime","until"])),void 0!==i&&(("option"===d||n.contract)&&(i=Math.min(i,1e3)),o.limit=i),"option"===d)c=await this.eapiPrivateGetUserTrades(this.extend(o,s));else{if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");let t;[h,s]=this.handleMarginModeAndParams("fetchMyTrades",s),[t,s]=this.handleOptionAndParams2(s,"fetchMyTrades","papi","portfolioMargin",!1),"spot"===d||"margin"===d?t?c=await this.papiGetMarginMyTrades(this.extend(o,s)):"margin"===d||void 0!==h?("isolated"===h&&(o.isIsolated=!0),c=await this.sapiGetMarginMyTrades(this.extend(o,s))):c=await this.privateGetMyTrades(this.extend(o,s)):n.linear?c=t?await this.papiGetUmUserTrades(this.extend(o,s)):await this.fapiPrivateGetUserTrades(this.extend(o,s)):n.inverse&&(c=t?await this.papiGetCmUserTrades(this.extend(o,s)):await this.dapiPrivateGetUserTrades(this.extend(o,s)))}return this.parseTrades(c,n,t,i)}async fetchMyDustTrades(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};void 0!==t&&(r.startTime=t,r.endTime=this.sum(t,7776e6));const a=this.safeStringUpper(s,"type");s=this.omit(s,"type"),void 0!==a&&(r.accountType=a);const o=await this.sapiGetAssetDribblet(this.extend(r,s)),n=this.safeList(o,"userAssetDribblets",[]),d=this.safeInteger(o,"total",0),h=[];for(let e=0;e=0&&(a=a.slice(18));const o=this.safeString2(e,"coin","fiatCurrency");let n,d=this.safeCurrencyCode(o,t);n=this.safeInteger2(e,"insertTime","createTime"),void 0===n&&(n=this.parse8601(this.safeString(e,"applyTime")));const h=this.safeInteger2(e,"successTime","updateTime");let c=this.safeString(e,"type");if(void 0===c){const t=this.safeString(e,"transactionType");void 0!==t&&(c="0"===t?"deposit":"withdrawal");const i=this.safeDict(this.options,"legalMoneyCurrenciesById");d=this.safeString(i,d,d)}const l=this.parseTransactionStatusByType(this.safeString(e,"status"),c),u=this.safeNumber(e,"amount"),f=this.safeNumber2(e,"transactionFee","totalFee");let p;void 0!==f&&(p={currency:d,cost:f});const m=this.safeInteger(e,"transferType");let g;void 0!==m&&(g=0!==m);const v=this.safeString(e,"network");return{info:e,id:i,txid:a,timestamp:n,datetime:this.iso8601(n),network:v,address:s,addressTo:s,addressFrom:void 0,tag:r,tagTo:r,tagFrom:void 0,type:c,amount:u,currency:d,status:l,updated:h,internal:g,comment:void 0,fee:p}}parseTransferStatus(e){return this.safeString({CONFIRMED:"ok"},e,e)}parseTransfer(e,t=void 0){const i=this.safeString2(e,"tranId","transactionId"),s=this.safeString2(e,"asset","currency"),r=this.safeCurrencyCode(s,t),a=this.safeNumber(e,"amount"),o=this.safeString(e,"type");let n,d;const h=this.safeDict(this.options,"accountsById",{});if(void 0!==o){const e=o.split("_");n=this.safeValue(e,0),d=this.safeValue(e,1),n=this.safeString(h,n,n),d=this.safeString(h,d,d)}if(void 0!==this.safeInteger(e,"walletType")){const t=this.safeDict(e,"payerInfo",{}),i=this.safeDict(e,"receiverInfo",{});n=this.safeString(t,"accountId"),d=this.safeString(i,"accountId")}const c=this.safeInteger2(e,"timestamp","transactionTime"),l=this.parseTransferStatus(this.safeString(e,"status"));return{info:e,id:i,timestamp:c,datetime:this.iso8601(c),currency:r,amount:a,fromAccount:n,toAccount:d,status:l}}parseIncome(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeString(e,"asset"),r=this.safeInteger(e,"time");return{info:e,symbol:this.safeSymbol(i,t,void 0,"swap"),code:this.safeCurrencyCode(s),timestamp:r,datetime:this.iso8601(r),id:this.safeString(e,"tranId"),amount:this.safeNumber(e,"income")}}async transfer(e,t,i,s,a={}){await this.loadMarkets();const o=this.currency(e),n={asset:o.id,amount:this.currencyToPrecision(e,t)};if(n.type=this.safeString(a,"type"),a=this.omit(a,"type"),void 0===n.type){const e=this.safeString(a,"symbol");let t;void 0!==e&&(t=this.market(e),a=this.omit(a,"symbol"));let o,d=this.convertTypeToAccount(i).toUpperCase(),h=this.convertTypeToAccount(s).toUpperCase();if(void 0!==t&&(o=t.id),"ISOLATED"===d&&void 0===e)throw new r.ArgumentsRequired(this.id+' transfer () requires params["symbol"] when fromAccount is '+i);if("ISOLATED"===h&&void 0===e)throw new r.ArgumentsRequired(this.id+' transfer () requires params["symbol"] when toAccount is '+s);const c=this.safeDict(this.options,"accountsById",{}),l=!(d in c),u=!(h in c);if(l&&void 0===t&&(o=d),u&&void 0===t&&(o=h),l||u){const e="MAIN"===d,t="MAIN"===h;if((l||u)&&("UMFUTURE"===d||"CMFUTURE"===d||("UMFUTURE"===h||"CMFUTURE"===h)||("FUNDING"===d||"FUNDING"===h)||("OPTION"===d||"OPTION"===h)))throw new r.BadRequest(this.id+" transfer () does not allow transfers between "+i+" and "+s);t&&l?(d="ISOLATED_MARGIN",n.fromSymbol=o):e&&u?(h="ISOLATED_MARGIN",n.toSymbol=o):l&&u?(n.fromSymbol=d,n.toSymbol=h,d="ISOLATEDMARGIN",h="ISOLATEDMARGIN"):(l&&(n.fromSymbol=o,d="ISOLATEDMARGIN"),u&&(n.toSymbol=o,h="ISOLATEDMARGIN")),n.type=d+"_"+h}else n.type=d+"_"+h}const d=await this.sapiPostAssetTransfer(this.extend(n,a));return this.parseTransfer(d,o)}async fetchTransfers(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const a=this.safeBool(s,"internal");s=this.omit(s,"internal");let o,n=!1;if([n,s]=this.handleOptionAndParams(s,"fetchTransfers","paginate"),n&&!a)return await this.fetchPaginatedCallDynamic("fetchTransfers",e,t,i,s);void 0!==e&&(o=this.currency(e));const d={};let h="limit";if(!a){const e=this.safeString2(this.options,"fetchTransfers","defaultType","spot"),t=this.safeString(s,"fromAccount",e),i="future"===t?"spot":"future",a=this.safeString(s,"toAccount",i);let o=this.safeString(s,"type");const n=this.safeDict(this.options,"accountsByType",{}),c=this.safeString(n,t),l=this.safeString(n,a);if(void 0===o){if(void 0===c){const e=Object.keys(n);throw new r.ExchangeError(this.id+" fromAccount parameter must be one of "+e.join(", "))}if(void 0===l){const e=Object.keys(n);throw new r.ExchangeError(this.id+" toAccount parameter must be one of "+e.join(", "))}o=c+"_"+l}d.type=o,h="size"}void 0!==i&&(d[h]=i),void 0!==t&&(d.startTime=t);const c=this.safeInteger(s,"until");let l;void 0!==c&&(s=this.omit(s,"until"),d.endTime=c),l=a?await this.sapiGetPayTransactions(this.extend(d,s)):await this.sapiGetAssetTransfer(this.extend(d,s));const u=this.safeList2(l,"rows","data",[]);return this.parseTransfers(u,o,t,i)}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e),s={coin:i.id},r=this.safeDict(this.options,"networks",{});let a=this.safeStringUpper(t,"network");a=this.safeString(r,a,a),void 0!==a&&(s.network=a,t=this.omit(t,"network"));const o=await this.sapiGetCapitalDepositAddress(this.extend(s,t));return this.parseDepositAddress(o,i)}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"url"),s=this.safeString(e,"address"),r=this.safeString(e,"currency"),a=this.safeCurrencyCode(r,t),o=this.getNetworkCodeByNetworkUrl(a,i);let n=this.safeString(e,"tag","");return 0===n.length&&(n=void 0),this.checkAddress(s),{info:e,currency:a,network:o,address:s,tag:n}}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const i=await this.sapiGetCapitalConfigGetall(t),s={};for(let e=0;e4)throw new r.ArgumentsRequired(this.id+" type must be between 1 and 4");await this.loadMarkets();const a=this.currency(e),o={asset:a.id,amount:t,type:i},n=await this.sapiPostFuturesTransfer(this.extend(o,s));return this.parseTransfer(n,a)}async fetchFundingRate(e,t={}){await this.loadMarkets();const i=this.market(e),s={symbol:i.id};let a;if(i.linear)a=await this.fapiPublicGetPremiumIndex(this.extend(s,t));else{if(!i.inverse)throw new r.NotSupported(this.id+" fetchFundingRate() supports linear and inverse contracts only");a=await this.dapiPublicGetPremiumIndex(this.extend(s,t))}return i.inverse&&(a=a[0]),this.parseFundingRate(a,i)}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const a={};let o=!1;if([o,s]=this.handleOptionAndParams(s,"fetchFundingRateHistory","paginate"),o)return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory",e,t,i,"8h",s);const n=this.safeString2(this.options,"fetchFundingRateHistory","defaultType","future"),d=this.safeString(s,"type",n);let h,c;void 0!==e&&(h=this.market(e),e=h.symbol,a.symbol=h.id),[c,s]=this.handleSubTypeAndParams("fetchFundingRateHistory",h,s,"linear"),s=this.omit(s,"type"),void 0!==t&&(a.startTime=t);const l=this.safeInteger(s,"until"),u=this.safeInteger(s,"endTime",l);let f;if(s=this.omit(s,["endTime","until"]),void 0!==u&&(a.endTime=u),void 0!==i&&(a.limit=i),this.isLinear(d,c))f=await this.fapiPublicGetFundingRate(this.extend(a,s));else{if(!this.isInverse(d,c))throw new r.NotSupported(this.id+" fetchFundingRateHistory() is not supported for "+d+" markets");f=await this.dapiPublicGetFundingRate(this.extend(a,s))}return this.parseFundingRateHistories(f,h,t,i)}parseFundingRateHistory(e,t=void 0){const i=this.safeInteger(e,"fundingTime");return{info:e,symbol:this.safeSymbol(this.safeString(e,"symbol"),void 0,void 0,"swap"),fundingRate:this.safeNumber(e,"fundingRate"),timestamp:i,datetime:this.iso8601(i)}}async fetchFundingRates(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e);const i=this.safeString2(this.options,"fetchFundingRates","defaultType","future"),s=this.safeString(t,"type",i);let a;[a,t]=this.handleSubTypeAndParams("fetchFundingRates",void 0,t,"linear");const o=this.omit(t,"type");let n;if(this.isLinear(s,a))n=await this.fapiPublicGetPremiumIndex(o);else{if(!this.isInverse(s,a))throw new r.NotSupported(this.id+" fetchFundingRates() supports linear and inverse contracts only");n=await this.dapiPublicGetPremiumIndex(o)}return this.parseFundingRates(n,e)}parseFundingRate(e,t=void 0){const i=this.safeInteger(e,"time"),s=this.safeString(e,"symbol"),r=this.safeSymbol(s,t,void 0,"contract"),a=this.safeNumber(e,"markPrice"),o=this.safeNumber(e,"indexPrice"),n=this.safeNumber(e,"interestRate"),d=this.safeNumber(e,"estimatedSettlePrice"),h=this.safeNumber(e,"lastFundingRate"),c=this.safeInteger(e,"nextFundingTime"),l=this.safeString(e,"fundingIntervalHours");let u;return void 0!==l&&(u=l+"h"),{info:e,symbol:r,markPrice:a,indexPrice:o,interestRate:n,estimatedSettlePrice:d,timestamp:i,datetime:this.iso8601(i),fundingRate:h,fundingTimestamp:c,fundingDatetime:this.iso8601(c),nextFundingRate:void 0,nextFundingTimestamp:void 0,nextFundingDatetime:void 0,previousFundingRate:void 0,previousFundingTimestamp:void 0,previousFundingDatetime:void 0,interval:u}}parseAccountPositions(e,t=!1){const i=this.safeList(e,"positions"),s=this.safeList(e,"assets",[]),r={};for(let e=0;e1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;s=this.market(t),i.symbol=s.id}const a=await this.eapiPrivateGetPosition(this.extend(i,t)),o=[];for(let e=0;e125)throw new r.BadRequest(this.id+" leverage should be between 1 and 125");await this.loadMarkets();const s=this.market(t),a={symbol:s.id,leverage:e};let o,n;if([o,i]=this.handleOptionAndParams2(i,"setLeverage","papi","portfolioMargin",!1),s.linear)n=o?await this.papiPostUmLeverage(this.extend(a,i)):await this.fapiPrivatePostLeverage(this.extend(a,i));else{if(!s.inverse)throw new r.NotSupported(this.id+" setLeverage() supports linear and inverse contracts only");n=o?await this.papiPostCmLeverage(this.extend(a,i)):await this.dapiPrivatePostLeverage(this.extend(a,i))}return n}async setMarginMode(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("CROSS"===(e=e.toUpperCase())&&(e="CROSSED"),"ISOLATED"!==e&&"CROSSED"!==e)throw new r.BadRequest(this.id+" marginMode must be either isolated or cross");await this.loadMarkets();const s=this.market(t),a={symbol:s.id,marginType:e};let o;try{if(s.linear)o=await this.fapiPrivatePostMarginType(this.extend(a,i));else{if(!s.inverse)throw new r.NotSupported(this.id+" setMarginMode() supports linear and inverse contracts only");o=await this.dapiPrivatePostMarginType(this.extend(a,i))}}catch(e){if(!(e instanceof r.MarginModeAlreadySet))throw e;if(this.safeBool(this.options,"throwMarginModeAlreadySet",!1))throw e;o={code:-4046,msg:"No need to change margin type."}}return o}async setPositionMode(e,t=void 0,i={}){const s=this.safeString(this.options,"defaultType","future"),a=this.safeString(i,"type",s);let o,n,d;i=this.omit(i,["type"]),[o,i]=this.handleSubTypeAndParams("setPositionMode",void 0,i),[n,i]=this.handleOptionAndParams2(i,"setPositionMode","papi","portfolioMargin",!1),d=e?"true":"false";const h={dualSidePosition:d};let c;if(this.isInverse(a,o))c=n?await this.papiPostCmPositionSideDual(this.extend(h,i)):await this.dapiPrivatePostPositionSideDual(this.extend(h,i));else{if(!this.isLinear(a,o))throw new r.BadRequest(this.id+" setPositionMode() supports linear and inverse contracts only");c=n?await this.papiPostUmPositionSideDual(this.extend(h,i)):await this.fapiPrivatePostPositionSideDual(this.extend(h,i))}return c}async fetchLeverages(e=void 0,t={}){let i,s,a,o;if(await this.loadMarkets(),await this.loadLeverageBrackets(!1,t),[i,t]=this.handleMarketTypeAndParams("fetchLeverages",void 0,t),[s,t]=this.handleSubTypeAndParams("fetchLeverages",void 0,t,"linear"),[a,t]=this.handleOptionAndParams2(t,"fetchLeverages","papi","portfolioMargin",!1),this.isLinear(i,s))o=a?await this.papiGetUmAccount(t):await this.fapiPrivateGetSymbolConfig(t);else{if(!this.isInverse(i,s))throw new r.NotSupported(this.id+" fetchLeverages() supports linear and inverse contracts only");o=a?await this.papiGetCmAccount(t):await this.dapiPrivateGetAccount(t)}let n=this.safeList(o,"positions",[]);return Array.isArray(o)&&(n=o),this.parseLeverages(n,e,"symbol")}parseLeverage(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeBool(e,"isolated");let r;void 0!==s&&(r=s?"isolated":"cross");const a=this.safeStringLower(e,"marginType");void 0!==a&&(r="crossed"===a?"cross":"isolated");const o=this.safeStringLower(e,"positionSide");let n,d;const h=this.safeInteger(e,"leverage");return void 0===o||"both"===o?(n=h,d=h):"long"===o?n=h:"short"===o&&(d=h),{info:e,symbol:this.safeSymbol(i,t),marginMode:r,longLeverage:n,shortLeverage:d}}async fetchSettlementHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const a=void 0===e?void 0:this.market(e);let o;if([o,s]=this.handleMarketTypeAndParams("fetchSettlementHistory",a,s),"option"!==o)throw new r.NotSupported(this.id+" fetchSettlementHistory() supports option markets only");const n={};void 0!==e&&(e=a.symbol,n.underlying=a.baseId+a.quoteId),void 0!==t&&(n.startTime=t),void 0!==i&&(n.limit=i);const d=await this.eapiPublicGetExerciseHistory(this.extend(n,s)),h=this.parseSettlements(d,a),c=this.sortBy(h,"timestamp");return this.filterBySymbolSinceLimit(c,e,t,i)}async fetchMySettlementHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const a=void 0===e?void 0:this.market(e);let o;if([o,s]=this.handleMarketTypeAndParams("fetchMySettlementHistory",a,s),"option"!==o)throw new r.NotSupported(this.id+" fetchMySettlementHistory() supports option markets only");const n={};void 0!==e&&(n.symbol=a.id),void 0!==t&&(n.startTime=t),void 0!==i&&(n.limit=i);const d=await this.eapiPrivateGetExerciseRecord(this.extend(n,s)),h=this.parseSettlements(d,a),c=this.sortBy(h,"timestamp");return this.filterBySymbolSinceLimit(c,a.symbol,t,i)}parseSettlement(e,t){const i=this.safeInteger2(e,"expiryDate","createDate"),s=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(s,t),price:this.safeNumber2(e,"realStrikePrice","exercisePrice"),timestamp:i,datetime:this.iso8601(i)}}parseSettlements(e,t){const i=[];for(let s=0;s-1||"private"===t,i=e?"spot":"future",r=e?"x-TKT5PX2F":"x-xcKtGhcu",a=this.safeDict(this.options,"broker",{}),o=this.safeString(a,i,r);s.newClientOrderId=o+this.uuid22()}}let r;if("batchOrders"===e&&("POST"===i||"PUT"===i)){const e=this.safeList(s,"batchOrders");let r=e;if("POST"===i&&"fapiPrivate"===t){r=[];for(let t=0;t=0||"capital/withdraw/apply"===e||e.indexOf("staking")>=0||e.indexOf("simple-earn")>=0)if("DELETE"===i&&"batchOrders"===e){const e=this.safeList(f,"orderidlist",[]),t=this.safeList(f,"origclientorderidlist",[]);f=this.omit(f,["orderidlist","origclientorderidlist"]),r=this.rawencode(f);const i=e.length,s=t.length;i>0&&(r=r+"&orderidlist=%5B"+e.join("%2C")+"%5D"),s>0&&(r=r+"&origclientorderidlist=%5B"+t.join("%2C")+"%5D")}else r=this.rawencode(f);else r=this.urlencode(f);let m;m=this.secret.indexOf("PRIVATE KEY")>-1?this.secret.length>120?this.encodeURIComponent((0,d.n)(r,this.secret,n.s)):this.encodeURIComponent((0,h.q4)(this.encode(r),this.secret,c.ev)):this.hmac(this.encode(r),this.encode(this.secret),n.s),r+="&signature="+m,a={"X-MBX-APIKEY":this.apiKey},"GET"===i||"DELETE"===i?l+="?"+r:(o=r,a["Content-Type"]="application/x-www-form-urlencoded")}else Object.keys(s).length&&(l+="?"+this.urlencode(s));return{url:l,method:i,body:o,headers:a}}getExceptionsByUrl(e,t){let i;const s=void 0!==this.hostname?this.hostname:"binance.com";if(e.startsWith("https://api."+s+"/")||e.startsWith("https://testnet.binance.vision")?i="spot":e.startsWith("https://dapi."+s+"/")||e.startsWith("https://testnet.binancefuture.com/dapi")?i="inverse":e.startsWith("https://fapi."+s+"/")||e.startsWith("https://testnet.binancefuture.com/fapi")?i="linear":e.startsWith("https://eapi."+s+"/")?i="option":e.startsWith("https://papi."+s+"/")&&(i="portfolioMargin"),void 0!==i){const e=this.safeDict(this.exceptions,i,{});return this.safeDict(e,t,{})}return{}}handleErrors(e,t,i,s,o,n,d,h,c){if(418===e||429===e)throw new r.DDoSProtection(this.id+" "+e.toString()+" "+t+" "+n);if(e>=400){if(n.indexOf("Price * QTY is zero or less")>=0)throw new r.InvalidOrder(this.id+" order cost = amount * price is zero or less "+n);if(n.indexOf("LOT_SIZE")>=0)throw new r.InvalidOrder(this.id+" order amount should be evenly divisible by lot size "+n);if(n.indexOf("PRICE_FILTER")>=0)throw new r.InvalidOrder(this.id+" order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid value in general, use this.priceToPrecision (symbol, amount) "+n)}if(void 0===d)return;const l=this.safeBool(d,"success",!0);if(!l){const e=this.safeString(d,"msg");let t;if(void 0!==e){try{t=JSON.parse(e)}catch(e){t=void 0}void 0!==t&&(d=t)}}const u=this.safeString(d,"msg");void 0!==u&&(this.throwExactlyMatchedException(this.getExceptionsByUrl(i,"exact"),u,this.id+" "+u),this.throwExactlyMatchedException(this.exceptions.exact,u,this.id+" "+u),this.throwBroadlyMatchedException(this.getExceptionsByUrl(i,"broad"),u,this.id+" "+u),this.throwBroadlyMatchedException(this.exceptions.broad,u,this.id+" "+u));const f=this.safeString(d,"code");if(void 0!==f){if("200"===f||a.Y.stringEquals(f,"0"))return;if("-2015"===f&&this.options.hasAlreadyAuthenticatedSuccessfully)throw new r.DDoSProtection(this.id+" "+n);const e=this.id+" "+n;if("No need to change margin type."===u)throw new r.MarginModeAlreadySet(e);throw this.throwExactlyMatchedException(this.getExceptionsByUrl(i,"exact"),f,e),this.throwExactlyMatchedException(this.exceptions.exact,f,e),new r.ExchangeError(e)}if(!l)throw new r.ExchangeError(this.id+" "+n);if(Array.isArray(d)){if(1===d.length){const e=d[0],t=this.safeString(e,"code");void 0!==t&&(this.throwExactlyMatchedException(this.getExceptionsByUrl(i,"exact"),t,this.id+" "+n),this.throwExactlyMatchedException(this.exceptions.exact,t,this.id+" "+n))}}}calculateRateLimiterCost(e,t,i,s,r={}){if("noCoin"in r&&!("coin"in s))return r.noCoin;if("noSymbol"in r&&!("symbol"in s))return r.noSymbol;if("noPoolId"in r&&!("poolId"in s))return r.noPoolId;if("byLimit"in r&&"limit"in s){const e=s.limit,t=r.byLimit;for(let i=0;i93)throw new r.BadRequest(this.id+" fetchBorrowRateHistory() limit parameter cannot exceed 92");const a={asset:this.currency(e).id,limit:i};if(void 0!==t){a.startTime=t;const e=this.sum(t,864e5*i)-1,s=this.milliseconds();a.endTime=Math.min(e,s)}const o=await this.sapiGetMarginInterestRateHistory(this.extend(a,s));return this.parseBorrowRateHistory(o,e,t,i)}parseBorrowRate(e,t=void 0){const i=this.safeInteger(e,"timestamp"),s=this.safeString(e,"asset");return{currency:this.safeCurrencyCode(s,t),rate:this.safeNumber(e,"dailyInterestRate"),period:864e5,timestamp:i,datetime:this.iso8601(i),info:e}}parseIsolatedBorrowRate(e,t=void 0){const i=this.safeString(e,"symbol");t=this.safeMarket(i,t,void 0,"spot");const s=this.safeList(e,"data"),r=this.safeDict(s,0),a=this.safeDict(s,1);return{info:e,symbol:this.safeString(t,"symbol"),base:this.safeString(r,"coin"),baseRate:this.safeNumber(r,"dailyInterest"),quote:this.safeString(a,"coin"),quoteRate:this.safeNumber(a,"dailyInterest"),period:864e5,timestamp:void 0,datetime:void 0}}async createGiftCode(e,t,i={}){await this.loadMarkets();const s={token:this.currency(e).id,amount:t},r=await this.sapiPostGiftcardCreateCode(this.extend(s,i)),a=this.safeDict(r,"data"),o=this.safeString(a,"code");return{info:r,id:this.safeString(a,"referenceNo"),code:o,currency:e,amount:t}}async redeemGiftCode(e,t={}){const i={code:e};return await this.sapiPostGiftcardRedeemCode(this.extend(i,t))}async verifyGiftCode(e,t={}){const i={referenceNo:e};return await this.sapiGetGiftcardVerify(this.extend(i,t))}async fetchBorrowInterest(e=void 0,t=void 0,i=void 0,s=void 0,r={}){let a;await this.loadMarkets(),[a,r]=this.handleOptionAndParams2(r,"fetchBorrowInterest","papi","portfolioMargin",!1);let o,n,d={};if(void 0!==e){const t=this.currency(e);d.asset=t.id}void 0!==i&&(d.startTime=i),void 0!==s&&(d.size=s),[d,r]=this.handleUntilOption("endTime",d,r),a?n=await this.papiGetMarginMarginInterestHistory(this.extend(d,r)):(void 0!==t&&(o=this.market(t),d.isolatedSymbol=o.id),n=await this.sapiGetMarginInterestHistory(this.extend(d,r)));const h=this.safeList(n,"rows"),c=this.parseBorrowInterests(h,o);return this.filterByCurrencySinceLimit(c,e,i,s)}parseBorrowInterest(e,t=void 0){const i=this.safeString(e,"isolatedSymbol"),s=this.safeInteger(e,"interestAccuredTime"),r=void 0===i?"cross":"isolated";return{info:e,symbol:i,currency:this.safeCurrencyCode(this.safeString(e,"asset")),interest:this.safeNumber(e,"interest"),interestRate:this.safeNumber(e,"interestRate"),amountBorrowed:this.safeNumber(e,"principal"),marginMode:r,timestamp:s,datetime:this.iso8601(s)}}async repayCrossMargin(e,t,i={}){await this.loadMarkets();const s=this.currency(e),r={asset:s.id,amount:this.currencyToPrecision(e,t)};let a,o;if([o,i]=this.handleOptionAndParams2(i,"repayCrossMargin","papi","portfolioMargin",!1),o){let e;[e,i]=this.handleOptionAndParams2(i,"repayCrossMargin","repayCrossMarginMethod","method"),a="papiPostMarginRepayDebt"===e?await this.papiPostMarginRepayDebt(this.extend(r,i)):await this.papiPostRepayLoan(this.extend(r,i))}else r.isIsolated="FALSE",r.type="REPAY",a=await this.sapiPostMarginBorrowRepay(this.extend(r,i));return this.parseMarginLoan(a,s)}async repayIsolatedMargin(e,t,i,s={}){await this.loadMarkets();const r=this.currency(t),a=this.market(e),o={asset:r.id,amount:this.currencyToPrecision(t,i),symbol:a.id,isIsolated:"TRUE",type:"REPAY"},n=await this.sapiPostMarginBorrowRepay(this.extend(o,s));return this.parseMarginLoan(n,r)}async borrowCrossMargin(e,t,i={}){await this.loadMarkets();const s=this.currency(e),r={asset:s.id,amount:this.currencyToPrecision(e,t)};let a,o;return[o,i]=this.handleOptionAndParams2(i,"borrowCrossMargin","papi","portfolioMargin",!1),o?a=await this.papiPostMarginLoan(this.extend(r,i)):(r.isIsolated="FALSE",r.type="BORROW",a=await this.sapiPostMarginBorrowRepay(this.extend(r,i))),this.parseMarginLoan(a,s)}async borrowIsolatedMargin(e,t,i,s={}){await this.loadMarkets();const r=this.currency(t),a=this.market(e),o={asset:r.id,amount:this.currencyToPrecision(t,i),symbol:a.id,isIsolated:"TRUE",type:"BORROW"},n=await this.sapiPostMarginBorrowRepay(this.extend(o,s));return this.parseMarginLoan(n,r)}parseMarginLoan(e,t=void 0){const i=this.safeString(e,"asset"),s=this.safeInteger(e,"updateTime");return{id:this.safeInteger(e,"tranId"),currency:this.safeCurrencyCode(i,t),amount:this.safeNumber(e,"amount"),symbol:void 0,timestamp:s,datetime:this.iso8601(s),info:e}}async fetchOpenInterestHistory(e,t="5m",i=void 0,s=void 0,a={}){if("1m"===t)throw new r.BadRequest(this.id+" fetchOpenInterestHistory cannot use the 1m timeframe");await this.loadMarkets();let o=!1;if([o,a]=this.handleOptionAndParams(a,"fetchOpenInterestHistory","paginate",!1),o)return await this.fetchPaginatedCallDeterministic("fetchOpenInterestHistory",e,i,s,t,a,500);const n=this.market(e),d={period:this.safeString(this.timeframes,t,t)};void 0!==s&&(d.limit=s);d[n.linear?"symbol":"pair"]=n.id,n.inverse&&(d.contractType=this.safeString(a,"contractType","CURRENT_QUARTER")),void 0!==i&&(d.startTime=i);const h=this.safeInteger(a,"until"),c=this.safeInteger(a,"endTime",h);if(a=this.omit(a,["endTime","until"]),c)d.endTime=c;else if(i){void 0===s&&(s=30);const e=this.parseTimeframe(t);d.endTime=this.sum(i,e*s*1e3)}let l;return l=n.inverse?await this.dapiDataGetOpenInterestHist(this.extend(d,a)):await this.fapiDataGetOpenInterestHist(this.extend(d,a)),this.parseOpenInterestsHistory(l,n,i,s)}async fetchOpenInterest(e,t={}){await this.loadMarkets();const i=this.market(e),s={};if(i.option){if(s.underlyingAsset=i.baseId,void 0===i.expiry)throw new r.NotSupported(this.id+" fetchOpenInterest does not support "+e);s.expiration=this.yymmdd(i.expiry)}else s.symbol=i.id;let a;if(a=i.option?await this.eapiPublicGetOpenInterest(this.extend(s,t)):i.inverse?await this.dapiPublicGetOpenInterest(this.extend(s,t)):await this.fapiPublicGetOpenInterest(this.extend(s,t)),!i.option)return this.parseOpenInterest(a,i);{e=i.symbol;const t=this.parseOpenInterestsHistory(a,i);for(let i=0;io)throw new r.BadRequest(this.id+" fetchConvertTradeHistory () the max interval between startTime and endTime is 30 days.");void 0!==i&&(a.limit=i),l="fromAsset",u="toAsset",c="list",h=await this.sapiGetConvertTradeFlow(this.extend(a,s))}const f=this.safeList(h,c,[]);return this.parseConversions(f,e,l,u,t,i)}parseConversion(e,t=void 0,i=void 0){const s=this.safeIntegerN(e,["time","validTimestamp","createTime"]),r=this.safeString2(e,"deductedAsset","fromAsset"),a=this.safeCurrencyCode(r,t),o=this.safeString2(e,"targetAsset","toAsset"),n=this.safeCurrencyCode(o,i);return{info:e,timestamp:s,datetime:this.iso8601(s),id:this.safeStringN(e,["tranId","orderId","quoteId"]),fromCurrency:a,fromAmount:this.safeNumber2(e,"deductedAmount","fromAmount"),toCurrency:n,toAmount:this.safeNumber2(e,"targetAmount","toAmount"),price:void 0,fee:void 0}}async fetchFundingIntervals(e=void 0,t={}){let i;await this.loadMarkets(),void 0!==e&&(e=this.marketSymbols(e),i=this.market(e[0]));const s="swap";let a,o;if([a,t]=this.handleSubTypeAndParams("fetchFundingIntervals",i,t,"linear"),this.isLinear(s,a))o=await this.fapiPublicGetFundingInfo(t);else{if(!this.isInverse(s,a))throw new r.NotSupported(this.id+" fetchFundingIntervals() supports linear and inverse swap contracts only");o=await this.dapiPublicGetFundingInfo(t)}return this.parseFundingRates(o,e)}async fetchLongShortRatioHistory(e=void 0,t=void 0,i=void 0,s=void 0,a={}){await this.loadMarkets();const o=this.market(e);void 0===t&&(t="1d");let n,d,h={period:t};if([h,a]=this.handleUntilOption("endTime",h,a),void 0!==i&&(h.startTime=i),void 0!==s&&(h.limit=s),[n,a]=this.handleSubTypeAndParams("fetchLongShortRatioHistory",o,a),"linear"===n)h.symbol=o.id,d=await this.fapiDataGetGlobalLongShortAccountRatio(this.extend(h,a));else{if("inverse"!==n)throw new r.BadRequest(this.id+" fetchLongShortRatioHistory() supports linear and inverse subTypes only");h.pair=o.info.pair,d=await this.dapiDataGetGlobalLongShortAccountRatio(this.extend(h,a))}return this.parseLongShortRatioHistory(d,o)}parseLongShortRatio(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeIntegerOmitZero(e,"timestamp");return{info:e,symbol:this.safeSymbol(i,t,void 0,"contract"),timestamp:s,datetime:this.iso8601(s),timeframe:void 0,longShortRatio:this.safeNumber(e,"longShortRatio")}}}},1510:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(3192);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"binancecoinm",name:"Binance COIN-M",urls:{logo:"https://github.com/user-attachments/assets/387cfc4e-5f33-48cd-8f5c-cd4854dabf0c",doc:["https://binance-docs.github.io/apidocs/delivery/en/","https://binance-docs.github.io/apidocs/spot/en","https://developers.binance.com/en"]},has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:void 0,createStopMarketOrder:!0},options:{fetchMarkets:["inverse"],defaultSubType:"inverse",leverageBrackets:void 0}})}async transferIn(e,t,i={}){return await this.futuresTransfer(e,t,3,i)}async transferOut(e,t,i={}){return await this.futuresTransfer(e,t,4,i)}}},8228:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(3192);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"binanceus",name:"Binance US",countries:["US"],hostname:"binance.us",rateLimit:50,certified:!1,pro:!0,urls:{logo:"https://github.com/user-attachments/assets/a9667919-b632-4d52-a832-df89f8a35e8c",api:{web:"https://www.binance.us",public:"https://api.binance.us/api/v3",private:"https://api.binance.us/api/v3",sapi:"https://api.binance.us/sapi/v1",sapiV2:"https://api.binance.us/sapi/v2",sapiV3:"https://api.binance.us/sapi/v3"},www:"https://www.binance.us",referral:"https://www.binance.us/?ref=35005074",doc:"https://github.com/binance-us/binance-official-api-docs",fees:"https://www.binance.us/en/fee/schedule"},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001")}},options:{fetchMarkets:["spot"],defaultType:"spot",fetchMargins:!1,quoteOrderQty:!1},has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:void 0,option:!1,addMargin:!1,closeAllPositions:!1,closePosition:!1,createReduceOnlyOrder:!1,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchPosition:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,reduceMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1},api:{public:{get:{ping:1,time:1,exchangeInfo:10,trades:1,historicalTrades:5,aggTrades:1,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10],[5e3,50]]},klines:1,"ticker/price":{cost:1,noSymbol:2},avgPrice:1,"ticker/bookTicker":{cost:1,noSymbol:2},"ticker/24hr":{cost:1,noSymbol:40},ticker:{cost:2,noSymbol:100}}},private:{get:{account:10,"rateLimit/order":20,order:2,openOrders:{cost:3,noSymbol:40},myTrades:10,myPreventedMatches:10,allOrders:10,orderList:2,allOrderList:10,openOrderList:3},post:{order:1,"order/test":1,"order/cancelReplace":1,"order/oco":1},delete:{order:1,openOrders:1,orderList:1}},sapi:{get:{"system/status":1,"asset/assetDistributionHistory":1,"asset/query/trading-fee":1,"asset/query/trading-volume":1,"sub-account/spotSummary":1,"sub-account/status":1,"otc/coinPairs":1,"otc/orders/{orderId}":1,"otc/orders":1,"ocbs/orders":1,"capital/config/getall":1,"capital/withdraw/history":1,"fiatpayment/query/withdraw/history":1,"capital/deposit/address":1,"capital/deposit/hisrec":1,"fiatpayment/query/deposit/history":1,"capital/sub-account/deposit/address":1,"capital/sub-account/deposit/history":1,"asset/query/dust-logs":1,"asset/query/dust-assets":1,"marketing/referral/reward/history":1,"staking/asset":1,"staking/stakingBalance":1,"staking/history":1,"staking/stakingRewardsHistory":1,"custodian/balance":1,"custodian/supportedAssetList":1,"custodian/walletTransferHistory":1,"custodian/custodianTransferHistory":1,"custodian/openOrders":1,"custodian/order":1,"custodian/orderHistory":1,"custodian/tradeHistory":1,"custodian/settlementSetting":1,"custodian/settlementHistory":1,"cl/transferHistory":1,"apipartner/checkEligibility":1,"apipartner/rebateHistory":1},post:{"otc/quotes":1,"otc/orders":1,"fiatpayment/withdraw/apply":1,"capital/withdraw/apply":1,"asset/dust":10,"staking/stake":1,"staking/unstake":1,"custodian/walletTransfer":1,"custodian/custodianTransfer":1,"custodian/undoTransfer":1,"custodian/order":1,"custodian/ocoOrder":1,"cl/transfer":1},delete:{"custodian/cancelOrder":1,"custodian/cancelOrdersBySymbol":1,"custodian/cancelOcoOrder":1}},sapiV2:{get:{"cl/account":10,"cl/alertHistory":1}},sapiV3:{get:{accountStatus:1,apiTradingStatus:1,"sub-account/list":1,"sub-account/transfer/history":1,"sub-account/assets":1},post:{"sub-account/transfer":1}}},features:{swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}}})}}},2171:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(3192),r=i(2079);class a extends s.A{describe(){return this.deepExtend(super.describe(),{id:"binanceusdm",name:"Binance USDⓈ-M",urls:{logo:"https://github.com/user-attachments/assets/871cbea7-eebb-4b28-b260-c1c91df0487a",doc:["https://binance-docs.github.io/apidocs/futures/en/","https://binance-docs.github.io/apidocs/spot/en","https://developers.binance.com/en"]},has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:void 0,createStopMarketOrder:!0},options:{fetchMarkets:["linear"],defaultSubType:"linear",leverageBrackets:void 0,marginTypes:{},marginModes:{}},exceptions:{exact:{"-5021":r.InvalidOrder,"-5022":r.InvalidOrder,"-5028":r.InvalidOrder}}})}async transferIn(e,t,i={}){return await this.futuresTransfer(e,t,1,i)}async transferOut(e,t,i={}){return await this.futuresTransfer(e,t,2,i)}}},2480:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(4619),r=i(2079),a=i(5147),o=i(4852),n=i(1579);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bingx",name:"BingX",countries:["US"],rateLimit:100,version:"v1",certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!0,closePosition:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createReduceOnlyOrder:!0,createStopLossOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchLeverage:!0,fetchLiquidations:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMarkPrice:!0,fetchMarkPrices:!0,fetchMyLiquidations:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsHistory:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTransfers:!0,fetchWithdrawals:!0,reduceMargin:!0,sandbox:!0,setLeverage:!0,setMargin:!0,setMarginMode:!0,setPositionMode:!0,transfer:!0},hostname:"bingx.com",urls:{logo:"https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg",api:{spot:"https://open-api.{hostname}/openApi",swap:"https://open-api.{hostname}/openApi",contract:"https://open-api.{hostname}/openApi",wallets:"https://open-api.{hostname}/openApi",user:"https://open-api.{hostname}/openApi",subAccount:"https://open-api.{hostname}/openApi",account:"https://open-api.{hostname}/openApi",copyTrading:"https://open-api.{hostname}/openApi",cswap:"https://open-api.{hostname}/openApi"},test:{swap:"https://open-api-vst.{hostname}/openApi"},www:"https://bingx.com/",doc:"https://bingx-api.github.io/docs/",referral:"https://bingx.com/invite/OHETOM"},fees:{tierBased:!0,spot:{feeSide:"get",maker:this.parseNumber("0.001"),taker:this.parseNumber("0.001")},swap:{feeSide:"quote",maker:this.parseNumber("0.0002"),taker:this.parseNumber("0.0005")}},requiredCredentials:{apiKey:!0,secret:!0},api:{spot:{v1:{public:{get:{"server/time":1,"common/symbols":1,"market/trades":1,"market/depth":1,"market/kline":1,"ticker/24hr":1,"ticker/price":1,"ticker/bookTicker":1}},private:{get:{"trade/query":1,"trade/openOrders":1,"trade/historyOrders":1,"trade/myTrades":2,"user/commissionRate":5,"account/balance":2},post:{"trade/order":2,"trade/cancel":2,"trade/batchOrders":5,"trade/order/cancelReplace":5,"trade/cancelOrders":5,"trade/cancelOpenOrders":5,"trade/cancelAllAfter":5}}},v2:{public:{get:{"market/depth":1,"market/kline":1}}},v3:{private:{get:{"get/asset/transfer":1,"asset/transfer":1,"capital/deposit/hisrec":1,"capital/withdraw/history":1},post:{"post/asset/transfer":5}}}},swap:{v1:{public:{get:{"ticker/price":1,"market/historicalTrades":1,"market/markPriceKlines":1,"trade/multiAssetsRules":1}},private:{get:{"positionSide/dual":5,"trade/batchCancelReplace":5,"trade/fullOrder":2,maintMarginRatio:2,"trade/positionHistory":2,"positionMargin/history":2,"twap/openOrders":5,"twap/historyOrders":5,"twap/orderDetail":5,"trade/assetMode":5,"user/marginAssets":5},post:{"trade/cancelReplace":2,"positionSide/dual":5,"trade/batchCancelReplace":5,"trade/closePosition":2,"trade/getVst":5,"twap/order":5,"twap/cancelOrder":5,"trade/assetMode":5}}},v2:{public:{get:{"server/time":1,"quote/contracts":1,"quote/price":1,"quote/depth":1,"quote/trades":1,"quote/premiumIndex":1,"quote/fundingRate":1,"quote/klines":1,"quote/openInterest":1,"quote/ticker":1,"quote/bookTicker":1}},private:{get:{"user/balance":2,"user/positions":2,"user/income":2,"trade/openOrders":2,"trade/openOrder":2,"trade/order":2,"trade/marginType":5,"trade/leverage":2,"trade/forceOrders":1,"trade/allOrders":2,"trade/allFillOrders":2,"trade/fillHistory":2,"user/income/export":2,"user/commissionRate":2,"quote/bookTicker":1},post:{"trade/order":2,"trade/batchOrders":2,"trade/closeAllPositions":2,"trade/cancelAllAfter":5,"trade/marginType":5,"trade/leverage":5,"trade/positionMargin":5,"trade/order/test":2},delete:{"trade/order":2,"trade/batchOrders":2,"trade/allOpenOrders":2}}},v3:{public:{get:{"quote/klines":1}}}},cswap:{v1:{public:{get:{"market/contracts":1,"market/premiumIndex":1,"market/openInterest":1,"market/klines":1,"market/depth":1,"market/ticker":1}},private:{get:{"trade/leverage":2,"trade/forceOrders":2,"trade/allFillOrders":2,"trade/openOrders":2,"trade/orderDetail":2,"trade/orderHistory":2,"trade/marginType":2,"user/commissionRate":2,"user/positions":2,"user/balance":2},post:{"trade/order":2,"trade/leverage":2,"trade/allOpenOrders":2,"trade/closeAllPositions":2,"trade/marginType":2,"trade/positionMargin":2},delete:{"trade/allOpenOrders":2,"trade/cancelOrder":2}}}},contract:{v1:{private:{get:{allPosition:2,allOrders:2,balance:2}}}},wallets:{v1:{private:{get:{"capital/config/getall":5,"capital/deposit/address":5,"capital/innerTransfer/records":1,"capital/subAccount/deposit/address":5,"capital/deposit/subHisrec":2,"capital/subAccount/innerTransfer/records":1,"capital/deposit/riskRecords":5},post:{"capital/withdraw/apply":5,"capital/innerTransfer/apply":5,"capital/subAccountInnerTransfer/apply":2,"capital/deposit/createSubAddress":2}}}},subAccount:{v1:{private:{get:{list:10,assets:2,allAccountBalance:2},post:{create:10,"apiKey/create":2,"apiKey/edit":2,"apiKey/del":2,updateStatus:10}}}},account:{v1:{private:{get:{uid:1,"apiKey/query":2,"account/apiPermissions":5,allAccountBalance:2},post:{"innerTransfer/authorizeSubAccount":1}}},transfer:{v1:{private:{get:{"subAccount/asset/transferHistory":1},post:{"subAccount/transferAsset/supportCoins":1,"subAccount/transferAsset":1}}}}},user:{auth:{private:{post:{userDataStream:2},put:{userDataStream:2},delete:{userDataStream:2}}}},copyTrading:{v1:{private:{get:{"swap/trace/currentTrack":2},post:{"swap/trace/closeTrackOrder":2,"swap/trace/setTPSL":2,"spot/trader/sellOrder":10}}}},api:{v3:{private:{get:{"asset/transfer":1,"capital/deposit/hisrec":1,"capital/withdraw/history":1},post:{"post/asset/transfer":1}}}}},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},precisionMode:n.kb,exceptions:{exact:{400:r.BadRequest,401:r.AuthenticationError,403:r.PermissionDenied,404:r.BadRequest,429:r.DDoSProtection,418:r.PermissionDenied,500:r.ExchangeError,504:r.ExchangeError,100001:r.AuthenticationError,100412:r.AuthenticationError,100202:r.InsufficientFunds,100204:r.BadRequest,100400:r.BadRequest,100410:r.OperationFailed,100421:r.BadSymbol,100440:r.ExchangeError,100500:r.OperationFailed,100503:r.ExchangeError,80001:r.BadRequest,80012:r.InsufficientFunds,80014:r.BadRequest,80016:r.OrderNotFound,80017:r.OrderNotFound,100414:r.AccountSuspended,100419:r.PermissionDenied,100437:r.BadRequest,101204:r.InsufficientFunds,110425:r.InvalidOrder,"Insufficient assets":r.InsufficientFunds,"illegal transferType":r.BadRequest},broad:{}},commonCurrencies:{SNOW:"Snowman",OMNI:"OmniCat",NAP:"$NAP",TRUMP:"TRUMPMAGA",TRUMPSOL:"TRUMP"},options:{defaultType:"spot",accountsByType:{funding:"FUND",spot:"SPOT",swap:"PFUTURES",future:"SFUTURES"},accountsById:{FUND:"funding",SPOT:"spot",PFUTURES:"swap",SFUTURES:"future"},recvWindow:5e3,broker:"CCXT",defaultNetworks:{ETH:"ETH",USDT:"ERC20",USDC:"ERC20",BTC:"BTC",LTC:"LTC"},networks:{ARB:"ARBITRUM",MATIC:"POLYGON"}},features:{defaultForLinear:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!0,index:!0},price:!0},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!0,trailing:!0,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0,selfTradePrevention:!1,iceberg:!1},createOrders:{max:5},fetchMyTrades:{marginMode:!1,limit:512,daysBack:30,untilDays:30,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:1e3,daysBack:2e4,untilDays:7,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:7,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1440}},defaultForInverse:{extends:"defaultForLinear",fetchMyTrades:{limit:1e3,daysBack:void 0,untilDays:void 0},fetchOrders:void 0},spot:{extends:"defaultForLinear",createOrder:{triggerPriceType:void 0,attachedStopLossTakeProfit:void 0,trailing:!1},fetchMyTrades:{limit:1e3,daysBack:1,untilDays:1},fetchOrders:void 0,fetchClosedOrders:{limit:100,untilDays:void 0}},swap:{linear:{extends:"defaultForLinear"},inverse:{extends:"defaultForInverse"}},defaultForFuture:{extends:"defaultForLinear",fetchOrders:void 0},future:{linear:{extends:"defaultForFuture"},inverse:{extends:"defaultForFuture"}}}})}async fetchTime(e={}){const t=await this.swapV2PublicGetServerTime(e),i=this.safeDict(t,"data");return this.safeInteger(i,"serverTime")}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;if(this.safeBool(this.options,"sandboxMode",!1))return;const t=await this.walletsV1PrivateGetCapitalConfigGetall(e),i=this.safeList(t,"data",[]),s={};for(let e=0;e5)throw new r.InvalidOrder(this.id+" createOrders() can not create more than 5 orders at once for swap markets");d.batchOrders=this.json(i),h=await this.swapV2PrivatePostTradeBatchOrders(d)}else{this.safeBool(t,"sync",!1)&&(d.sync=!0),d.data=this.json(i),h=await this.spotV1PrivatePostTradeBatchOrders(d)}"string"==typeof h&&(h=this.fixStringifiedJsonMembers(h),h=this.parseJson(h));const c=this.safeDict(h,"data",{}),l=this.safeList(c,"orders",[]);return this.parseOrders(l,n)}parseOrderSide(e){return this.safeString({BUY:"buy",SELL:"sell",SHORT:"sell",LONG:"buy",ask:"sell",bid:"buy"},e,e)}parseOrderType(e){return this.safeString({trigger_market:"market",trigger_limit:"limit",stop_limit:"limit",stop_market:"market",take_profit_market:"market",stop:"limit"},e,e)}parseOrder(e,t=void 0){const i=e,s=this.safeDict2(e,"newOrderResponse","orderOpenResponse");void 0!==s&&(e=s);const r=void 0===this.safeString2(e,"positionSide","ps")?"spot":"swap",o=this.safeString2(e,"symbol","s");void 0===t&&(t=this.safeMarket(o,void 0,void 0,r));const n=this.safeStringLower2(e,"side","S"),d=this.safeIntegerN(e,["time","transactTime","E","createdTime"]),h=this.safeInteger2(e,"updateTime","T"),c=this.safeStringUpperN(e,["status","X","orderStatus"]);let l=this.safeString2(e,"feeAsset","N");const u=this.safeStringN(e,["fee","commission","n"]);void 0===l&&(l=t.spot&&"buy"===n?t.base:t.quote);let f,p=this.safeValue(e,"stopLoss");void 0!==p&&""!==p&&(f=this.omitZero(this.safeString(p,"stopLoss"))),void 0!==p&&"number"!=typeof p&&""!==p&&("string"==typeof p&&(p=this.parseJson(p)),f=this.omitZero(this.safeString(p,"stopPrice")));let m,g=this.safeValue(e,"takeProfit");void 0!==g&&""!==g&&(m=this.omitZero(this.safeString(g,"takeProfit"))),void 0!==g&&"number"!=typeof g&&""!==g&&("string"==typeof g&&(g=this.parseJson(g)),m=this.omitZero(this.safeString(g,"stopPrice")));const v=this.safeStringLower2(e,"type","o"),y=this.omitZero(this.safeString2(e,"StopPrice","stopPrice"));let w=y;return void 0!==y&&(v.indexOf("stop")>-1&&void 0===f&&(f=y,w=void 0),v.indexOf("take")>-1&&void 0===m&&(m=y,w=void 0)),this.safeOrder({info:i,id:this.safeStringN(e,["orderId","i","mainOrderId"]),clientOrderId:this.safeStringN(e,["clientOrderID","clientOrderId","origClientOrderId","c"]),symbol:this.safeSymbol(o,t,"-",r),timestamp:d,datetime:this.iso8601(d),lastTradeTimestamp:h,lastUpdateTimestamp:this.safeInteger(e,"updateTime"),type:this.parseOrderType(v),timeInForce:this.safeString(e,"timeInForce"),postOnly:void 0,side:this.parseOrderSide(n),price:this.safeString2(e,"price","p"),triggerPrice:w,stopLossPrice:f,takeProfitPrice:m,average:this.safeString2(e,"avgPrice","ap"),cost:this.safeString(e,"cummulativeQuoteQty"),amount:this.safeStringN(e,["origQty","q","quantity","totalAmount"]),filled:this.safeString2(e,"executedQty","z"),remaining:void 0,status:this.parseOrderStatus(c),fee:{currency:l,cost:a.Y.stringAbs(u)},trades:void 0,reduceOnly:this.safeBool2(e,"reduceOnly","ro")},t)}parseOrderStatus(e){return this.safeString({NEW:"open",PENDING:"open",PARTIALLY_FILLED:"open",RUNNING:"open",FILLED:"closed",CANCELED:"canceled",CANCELLED:"canceled",FAILED:"canceled"},e,e)}async cancelOrder(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeBool(i,"twap",!1);let a,o;if(i=this.omit(i,"twap"),s){const t={mainOrderId:e};a=await this.swapV1PrivatePostTwapCancelOrder(this.extend(t,i))}else{if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");o=this.market(t);const s={symbol:o.id},n=this.safeString2(i,"clientOrderId","clientOrderID");let d,h;i=this.omit(i,["clientOrderId"]),void 0!==n?s.clientOrderID=n:s.orderId=e,[d,i]=this.handleMarketTypeAndParams("cancelOrder",o,i),[h,i]=this.handleSubTypeAndParams("cancelOrder",o,i),a="spot"===d?await this.spotV1PrivatePostTradeCancel(this.extend(s,i)):"inverse"===h?await this.cswapV1PrivateDeleteTradeCancelOrder(this.extend(s,i)):await this.swapV2PrivateDeleteTradeOrder(this.extend(s,i))}const n=this.safeDict(a,"data",{}),d=this.safeDict(n,"order",n);return this.parseOrder(d,o)}async cancelAllOrders(e=void 0,t={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" cancelAllOrders() requires a symbol argument");await this.loadMarkets();const i=this.market(e),s={symbol:i.id};let a;if(i.spot)a=await this.spotV1PrivatePostTradeCancelOpenOrders(this.extend(s,t));else{if(!i.swap)throw new r.BadRequest(this.id+" cancelAllOrders is only supported for spot and swap markets.");a=i.inverse?await this.cswapV1PrivateDeleteTradeAllOpenOrders(this.extend(s,t)):await this.swapV2PrivateDeleteTradeAllOpenOrders(this.extend(s,t))}const o=this.safeDict(a,"data",{}),n=this.safeList2(o,"success","orders",[]);return this.parseOrders(n)}async cancelOrders(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrders() requires a symbol argument");await this.loadMarkets();const s=this.market(t),a={symbol:s.id},o=this.safeValue(i,"clientOrderIds");i=this.omit(i,"clientOrderIds");let n=e;const d=void 0!==o;d&&(n=o);const h=[];for(let e=0;e0,s={type:i?"ACTIVATE":"CLOSE",timeOut:i?this.parseToInt(e/1e3):0};let a,o;if([o,t]=this.handleMarketTypeAndParams("cancelAllOrdersAfter",void 0,t),"spot"===o)a=await this.spotV1PrivatePostTradeCancelAllAfter(this.extend(s,t));else{if("swap"!==o)throw new r.NotSupported(this.id+" cancelAllOrdersAfter() is not supported for "+o+" markets");a=await this.swapV2PrivatePostTradeCancelAllAfter(this.extend(s,t))}return a}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeBool(i,"twap",!1);let a,o;if(i=this.omit(i,"twap"),s){const t={mainOrderId:e};a=await this.swapV1PrivateGetTwapOrderDetail(this.extend(t,i))}else{if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");o=this.market(t);const s={symbol:o.id,orderId:e};let n,d;[n,i]=this.handleMarketTypeAndParams("fetchOrder",o,i),[d,i]=this.handleSubTypeAndParams("fetchOrder",o,i),a="spot"===n?await this.spotV1PrivateGetTradeQuery(this.extend(s,i)):"inverse"===d?await this.cswapV1PrivateGetTradeOrderDetail(this.extend(s,i)):await this.swapV2PrivateGetTradeOrder(this.extend(s,i))}const n=this.safeDict(a,"data",{}),d=this.safeDict(n,"order",n);return this.parseOrder(d,o)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let a,o,n={};if(void 0!==e&&(a=this.market(e),n.symbol=a.id),[o,s]=this.handleMarketTypeAndParams("fetchOrders",a,s),"swap"!==o)throw new r.NotSupported(this.id+" fetchOrders() is only supported for swap markets");void 0!==i&&(n.limit=i),void 0!==t&&(n.startTime=t),[n,s]=this.handleUntilOption("endTime",n,s);const d=await this.swapV1PrivateGetTradeFullOrder(this.extend(n,s)),h=this.safeDict(d,"data",{}),c=this.safeList(h,"orders",[]);return this.parseOrders(c,a,t,i)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();const a={};let o,n,d;if(void 0!==e&&(r=this.market(e),a.symbol=r.id),[o,s]=this.handleMarketTypeAndParams("fetchOpenOrders",r,s),[n,s]=this.handleSubTypeAndParams("fetchOpenOrders",r,s),"spot"===o)d=await this.spotV1PrivateGetTradeOpenOrders(this.extend(a,s));else{const e=this.safeBool(s,"twap",!1);s=this.omit(s,"twap"),d=e?await this.swapV1PrivateGetTwapOpenOrders(this.extend(a,s)):"inverse"===n?await this.cswapV1PrivateGetTradeOpenOrders(this.extend(a,s)):await this.swapV2PrivateGetTradeOpenOrders(this.extend(a,s))}const h=this.safeDict(d,"data",{}),c=this.safeList2(h,"orders","list",[]);return this.parseOrders(c,r,t,i)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=await this.fetchCanceledAndClosedOrders(e,t,i,s);return this.filterBy(r,"status","closed")}async fetchCanceledOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=await this.fetchCanceledAndClosedOrders(e,t,i,s);return this.filterBy(r,"status","canceled")}async fetchCanceledAndClosedOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();const a={};let o,n,d,h;if(void 0!==e&&(r=this.market(e),a.symbol=r.id),[o,s]=this.handleMarketTypeAndParams("fetchClosedOrders",r,s),[n,s]=this.handleSubTypeAndParams("fetchClosedOrders",r,s),[d,s]=this.handleOptionAndParams(s,"fetchClosedOrders","standard",!1),d)h=await this.contractV1PrivateGetAllOrders(this.extend(a,s));else if("spot"===o)void 0!==i&&(a.pageSize=i),h=await this.spotV1PrivateGetTradeHistoryOrders(this.extend(a,s));else{const e=this.safeBool(s,"twap",!1);if(s=this.omit(s,"twap"),e){a.pageIndex=1,a.pageSize=void 0===i?100:i,a.startTime=void 0===t?1:t;const e=this.safeInteger(s,"until",this.milliseconds());s=this.omit(s,"until"),a.endTime=e,h=await this.swapV1PrivateGetTwapHistoryOrders(this.extend(a,s))}else h="inverse"===n?await this.cswapV1PrivateGetTradeOrderHistory(this.extend(a,s)):await this.swapV2PrivateGetTradeAllOrders(this.extend(a,s))}const c=this.safeDict(h,"data",{}),l=this.safeList2(c,"orders","list",[]);return this.parseOrders(l,r,t,i)}async transfer(e,t,i,s,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeDict(this.options,"accountsByType",{}),n=this.safeString(o,i,i),d=this.safeString(o,s,s),h={asset:a.id,amount:this.currencyToPrecision(e,t),type:n+"_"+d},c=await this.spotV3PrivateGetGetAssetTransfer(this.extend(h,r));return{info:c,id:this.safeString(c,"tranId"),timestamp:void 0,datetime:void 0,currency:e,amount:t,fromAccount:i,toAccount:s,status:void 0}}async fetchTransfers(e=void 0,t=void 0,i=void 0,s={}){let a;await this.loadMarkets(),void 0!==e&&(a=this.currency(e));const o=this.safeDict(this.options,"accountsByType",{}),n=this.safeString(s,"fromAccount"),d=this.safeString(s,"toAccount"),h=this.safeString(o,n,n),c=this.safeString(o,d,d);if(void 0===h||void 0===c)throw new r.ExchangeError(this.id+" fromAccount & toAccount parameter are required");s=this.omit(s,["fromAccount","toAccount"]);let l=!1;if([l,s]=this.handleOptionAndParams(s,"fetchTransfers","paginate",!1),l)return await this.fetchPaginatedCallDynamic("fetchTransfers",void 0,t,i,s,100);let u={type:h+"_"+c};void 0!==t&&(u.startTime=t),void 0!==i&&(u.size=i),[u,s]=this.handleUntilOption("endTime",u,s);const f=await this.spotV3PrivateGetAssetTransfer(this.extend(u,s)),p=this.safeList(f,"rows",[]);return this.parseTransfers(p,a,t,i)}parseTransfer(e,t=void 0){const i=this.safeString(e,"tranId"),s=this.safeInteger(e,"timestamp"),r=this.safeCurrencyCode(void 0,t),a=this.safeString(e,"status"),o=this.safeDict(this.options,"accountsById",{}),n=this.safeString(e,"type").split("_"),d=this.safeString(n,0),h=this.safeString(n,1),c=this.safeString(o,d,d),l=this.safeString(o,h,h);return{info:e,id:i,timestamp:s,datetime:this.iso8601(s),currency:r,amount:this.safeNumber(e,"amount"),fromAccount:c,toAccount:l,status:this.parseTransferStatus(a)}}parseTransferStatus(e){return this.safeString({CONFIRMED:"ok"},e,e)}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const i=this.currency(e),s=this.safeInteger(this.options,"recvWindow"),r=this.safeInteger(this.parseParams,"recvWindow",s),a={coin:i.id,offset:0,limit:1e3,recvWindow:r},o=await this.walletsV1PrivateGetCapitalDepositAddress(this.extend(a,t)),n=this.safeList(this.safeDict(o,"data"),"data"),d=this.parseDepositAddresses(n,[i.code],!1);return this.indexBy(d,"network")}async fetchDepositAddress(e,t={}){const i=this.safeString(t,"network");t=this.omit(t,["network"]);const s=await this.fetchDepositAddressesByNetwork(e,t);if(void 0!==i)return this.safeDict(s,i);{const t=this.safeDict(this.options,"defaultNetworks"),i=this.safeString(t,e);if(void 0!==i)return this.safeDict(s,i);{const e=Object.keys(s),t=this.safeString(e,0);return this.safeDict(s,t)}}}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"tag"),s=this.safeString(e,"coin"),r=(t=this.safeCurrency(s,t)).code,a=this.safeString(e,"addressWithPrefix"),o=this.safeString(e,"network"),n=this.networkIdToCode(o,r);return this.checkAddress(a),{info:e,currency:r,network:n,address:a,tag:i}}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.coin=a.id),void 0!==t&&(r.startTime=t),void 0!==i&&(r.limit=i);const o=await this.spotV3PrivateGetCapitalDepositHisrec(this.extend(r,s));return this.parseTransactions(o,a,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.coin=a.id),void 0!==t&&(r.startTime=t),void 0!==i&&(r.limit=i);const o=await this.spotV3PrivateGetCapitalWithdrawHistory(this.extend(r,s));return this.parseTransactions(o,a,t,i)}parseTransaction(e,t=void 0){const i=this.safeValue(e,"data"),s=void 0===i?void 0:this.safeString(i,"id"),r=this.safeString(e,"id",s),a=this.safeString(e,"address"),o=this.safeString(e,"addressTag");let n=this.safeInteger(e,"insertTime"),d=this.iso8601(n);void 0===n&&(d=this.safeString(e,"applyTime"),n=this.parse8601(d));const h=this.safeString(e,"network"),c=this.safeString(e,"coin");let l=this.safeCurrencyCode(c,t);void 0!==l&&l!==h&&l.indexOf(h)>=0&&void 0!==h&&(l=l.replace(h,""));const u="0"===this.safeString(e,"transferType")?"deposit":"withdrawal";return{info:e,id:r,txid:this.safeString(e,"txId"),type:u,currency:l,network:this.networkIdToCode(h),amount:this.safeNumber(e,"amount"),status:this.parseTransactionStatus(this.safeString(e,"status")),timestamp:n,datetime:d,address:a,addressFrom:void 0,addressTo:a,tag:o,tagFrom:o,tagTo:void 0,updated:void 0,comment:this.safeString(e,"info"),fee:{currency:l,cost:this.safeNumber(e,"transactionFee"),rate:void 0},internal:void 0}}parseTransactionStatus(e){return this.safeString({0:"pending",1:"ok",10:"pending",20:"rejected",30:"ok",40:"rejected",50:"ok",60:"pending",70:"rejected",2:"pending",3:"rejected",4:"pending",5:"rejected",6:"ok"},e,e)}async setMarginMode(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");await this.loadMarkets();const s=this.market(t);if("swap"!==s.type)throw new r.BadSymbol(this.id+" setMarginMode() supports swap contracts only");if("CROSS"===(e=e.toUpperCase())&&(e="CROSSED"),"ISOLATED"!==e&&"CROSSED"!==e)throw new r.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");const a={symbol:s.id,marginType:e};let o;return[o,i]=this.handleSubTypeAndParams("setMarginMode",s,i),"inverse"===o?await this.cswapV1PrivatePostTradeMarginType(this.extend(a,i)):await this.swapV2PrivatePostTradeMarginType(this.extend(a,i))}async addMargin(e,t,i={}){return await this.setMargin(e,t,this.extend({type:1},i))}async reduceMargin(e,t,i={}){return await this.setMargin(e,t,this.extend({type:2},i))}async setMargin(e,t,i={}){const s=this.safeInteger(i,"type");if(void 0===s)throw new r.ArgumentsRequired(this.id+" setMargin() requires a type parameter either 1 (increase margin) or 2 (decrease margin)");if(!this.inArray(s,[1,2]))throw new r.ArgumentsRequired(this.id+" setMargin() requires a type parameter either 1 (increase margin) or 2 (decrease margin)");await this.loadMarkets();const a=this.market(e),o={symbol:a.id,amount:this.amountToPrecision(a.symbol,t),type:s},n=await this.swapV2PrivatePostTradePositionMargin(this.extend(o,i));return this.parseMarginModification(n,a)}parseMarginModification(e,t=void 0){const i=this.safeString(e,"type");return{info:e,symbol:this.safeString(t,"symbol"),type:"1"===i?"add":"reduce",marginMode:"isolated",amount:this.safeNumber(e,"amount"),total:this.safeNumber(e,"margin"),code:this.safeString(t,"settle"),status:void 0,timestamp:void 0,datetime:void 0}}async fetchLeverage(e,t={}){await this.loadMarkets();const i=this.market(e),s={symbol:i.id};let r;r=i.inverse?await this.cswapV1PrivateGetTradeLeverage(this.extend(s,t)):await this.swapV2PrivateGetTradeLeverage(this.extend(s,t));const a=this.safeDict(r,"data",{});return this.parseLeverage(a,i)}parseLeverage(e,t=void 0){const i=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(i,t),marginMode:void 0,longLeverage:this.safeInteger(e,"longLeverage"),shortLeverage:this.safeInteger(e,"shortLeverage")}}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");const s=this.safeStringUpper(i,"side");this.checkRequiredArgument("setLeverage",s,"side",["LONG","SHORT","BOTH"]),await this.loadMarkets();const a=this.market(t),o={symbol:a.id,side:s,leverage:e};return a.inverse?await this.cswapV1PrivatePostTradeLeverage(this.extend(o,i)):await this.swapV2PrivatePostTradeLeverage(this.extend(o,i))}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={};let n,d,h;if([h,s]=this.handleSubTypeAndParams("fetchMyTrades",a,s),"inverse"===h){if(void 0===this.safeString(s,"orderId"))throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires an orderId argument for inverse swap trades");d=await this.cswapV1PrivateGetTradeAllFillOrders(this.extend(o,s)),n=this.safeList(d,"data",[])}else{o.symbol=a.id;const e=this.milliseconds();if(void 0!==t){o[a.spot?"startTime":"startTs"]=t}else a.swap&&(o.startTs=e-2592e6);const r=this.safeInteger(s,"until");if(s=this.omit(s,"until"),void 0!==r){o[a.spot?"endTime":"endTs"]=r}else a.swap&&(o.endTs=e);if(a.spot){void 0!==i&&(o.limit=i),d=await this.spotV1PrivateGetTradeMyTrades(this.extend(o,s));const e=this.safeDict(d,"data",{});n=this.safeList(e,"fills",[])}else{const e=this.safeStringUpper(s,"tradingUnit","CONT");s=this.omit(s,"tradingUnit"),o.tradingUnit=e,d=await this.swapV2PrivateGetTradeAllFillOrders(this.extend(o,s));const t=this.safeDict(d,"data",{});n=this.safeList(t,"fill_orders",[])}}return this.parseTrades(n,a,t,i,s)}parseDepositWithdrawFee(e,t=void 0){const i=this.safeList(e,"networkList",[]),s=i.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==s)for(let e=0;e0&&(t+=","),t+=r[e].toString()}t+="]",e[s]=t}}return e}async fetchMyLiquidations(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r,a,o,n,d={autoCloseType:"LIQUIDATION"};if([d,s]=this.handleUntilOption("endTime",d,s),void 0!==e&&(r=this.market(e),d.symbol=r.id),void 0!==t&&(d.startTime=t),void 0!==i&&(d.limit=i),[a,s]=this.handleSubTypeAndParams("fetchMyLiquidations",r,s),"inverse"===a)o=await this.cswapV1PrivateGetTradeForceOrders(this.extend(d,s)),n=this.safeList(o,"data",[]);else{o=await this.swapV2PrivateGetTradeForceOrders(this.extend(d,s));const e=this.safeDict(o,"data",{});n=this.safeList(e,"orders",[])}return this.parseLiquidations(n,r,t,i)}parseLiquidation(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeInteger(e,"time"),r=this.safeString(e,"executedQty"),o=this.safeString(t,"contractSize"),n=this.safeString(e,"avgPrice"),d=a.Y.stringMul(r,o),h=a.Y.stringMul(d,n);return this.safeLiquidation({info:e,symbol:this.safeSymbol(i,t),contracts:this.parseNumber(r),contractSize:this.parseNumber(o),price:this.parseNumber(n),baseValue:this.parseNumber(d),quoteValue:this.parseNumber(h),timestamp:s,datetime:this.iso8601(s)})}async closePosition(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r={};let a;void 0!==this.safeString(i,"positionId")?a=await this.swapV1PrivatePostTradeClosePosition(this.extend(r,i)):(r.symbol=s.id,a=s.inverse?await this.cswapV1PrivatePostTradeCloseAllPositions(this.extend(r,i)):await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(r,i)));const o=this.safeDict(a,"data");return this.parseOrder(o,s)}async closeAllPositions(e={}){await this.loadMarkets();const t=this.safeInteger(this.options,"recvWindow"),i=this.safeInteger(this.parseParams,"recvWindow",t);let s,a;if([s,e]=this.handleMarketTypeAndParams("closeAllPositions",void 0,e),[a,e]=this.handleSubTypeAndParams("closeAllPositions",void 0,e),"margin"===s)throw new r.BadRequest(this.id+" closePositions () cannot be used for "+s+" markets");const o={recvWindow:i};let n;n="inverse"===a?await this.cswapV1PrivatePostTradeCloseAllPositions(this.extend(o,e)):await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(o,e));const d=this.safeDict(n,"data",{}),h=this.safeList(d,"success",[]),c=[];for(let e=0;e0?e+=',"'+i.toString()+'"':e='"'+i.toString()+'"':t>0?e+=","+i.toString():e=i.toString()}s="["+e+"]",o=s}0===t?r=a+"="+o:r+="&"+a+"="+o}return r}sign(e,t="public",i="GET",s={},a=void 0,n=void 0){let d=t[0],h=t[1],c=t[2];if(this.safeBool(this.options,"sandboxMode",!1)&&"swap"!==d)throw new r.NotSupported(this.id+" does not have a testnet/sandbox URL for "+d+" endpoints");let l=this.implodeHostname(this.urls.api[d]);if(e=this.implodeParams(e,s),"transfer"===h&&(d="account/transfer",h=t[2],c=t[3]),"account/apiPermissions"!==e&&(l+="spot"===d&&"v3"===h?"/api":"/"+d),l+="/"+h+"/"+e,(s=this.omit(s,this.extractParams(e))).timestamp=this.nonce(),s=this.keysort(s),"public"===c)Object.keys(s).length&&(l+="?"+this.urlencode(s));else if("private"===c){this.checkRequiredCredentials();const e=("subAccount"===d||"account/transfer"===d)&&"POST"===i;let t,r;e?r=this.customEncode(s):(t=this.parseParams(s),r=this.rawencode(t,!0));const h=this.hmac(this.encode(r),this.encode(this.secret),o.s);if(a={"X-BX-APIKEY":this.apiKey,"X-SOURCE-KEY":this.safeString(this.options,"broker","CCXT")},e)a["Content-Type"]="application/json",s.signature=h,n=this.json(s);else{l+="?"+this.urlencode(t,!0)+"&signature="+h}}return{url:l,method:i,body:n,headers:a}}nonce(){return this.milliseconds()}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code");let l=this.safeString(n,"msg");const u=this.safeString(n,"transferErrorMsg");if(void 0!==u||void 0!==c&&"0"!==c){void 0!==u&&(l=u);const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,l,e),this.throwExactlyMatchedException(this.exceptions.exact,c,e),this.throwBroadlyMatchedException(this.exceptions.broad,l,e),new r.ExchangeError(e)}}}},2342:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(3885),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bit2c",name:"Bit2C",countries:["IL"],rateLimit:3e3,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,ws:!1},urls:{logo:"https://github.com/user-attachments/assets/db0bce50-6842-4c09-a1d5-0c87d22118aa",api:{rest:"https://bit2c.co.il"},www:"https://www.bit2c.co.il",referral:"https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf",doc:["https://www.bit2c.co.il/home/api","https://github.com/OferE/bit2c"]},api:{public:{get:["Exchanges/{pair}/Ticker","Exchanges/{pair}/orderbook","Exchanges/{pair}/trades","Exchanges/{pair}/lasttrades"]},private:{post:["Merchant/CreateCheckout","Funds/AddCoinFundsRequest","Order/AddFund","Order/AddOrder","Order/GetById","Order/AddOrderMarketPriceBuy","Order/AddOrderMarketPriceSell","Order/CancelOrder","Order/AddCoinFundsRequest","Order/AddStopOrder","Payment/GetMyId","Payment/Send","Payment/Pay"],get:["Account/Balance","Account/Balance/v2","Order/MyOrders","Order/GetById","Order/AccountHistory","Order/OrderHistory"]}},markets:{"BTC/NIS":this.safeMarketStructure({id:"BtcNis",symbol:"BTC/NIS",base:"BTC",quote:"NIS",baseId:"Btc",quoteId:"Nis",type:"spot",spot:!0}),"ETH/NIS":this.safeMarketStructure({id:"EthNis",symbol:"ETH/NIS",base:"ETH",quote:"NIS",baseId:"Eth",quoteId:"Nis",type:"spot",spot:!0}),"LTC/NIS":this.safeMarketStructure({id:"LtcNis",symbol:"LTC/NIS",base:"LTC",quote:"NIS",baseId:"Ltc",quoteId:"Nis",type:"spot",spot:!0}),"USDC/NIS":this.safeMarketStructure({id:"UsdcNis",symbol:"USDC/NIS",base:"USDC",quote:"NIS",baseId:"Usdc",quoteId:"Nis",type:"spot",spot:!0})},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.025"),taker:this.parseNumber("0.03"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.03")],[this.parseNumber("20000"),this.parseNumber("0.0275")],[this.parseNumber("50000"),this.parseNumber("0.025")],[this.parseNumber("75000"),this.parseNumber("0.0225")],[this.parseNumber("100000"),this.parseNumber("0.02")],[this.parseNumber("250000"),this.parseNumber("0.015")],[this.parseNumber("500000"),this.parseNumber("0.0125")],[this.parseNumber("750000"),this.parseNumber("0.01")],[this.parseNumber("1000000"),this.parseNumber("0.008")],[this.parseNumber("2000000"),this.parseNumber("0.006")],[this.parseNumber("3000000"),this.parseNumber("0.004")],[this.parseNumber("4000000"),this.parseNumber("0.002")]],maker:[[this.parseNumber("0"),this.parseNumber("0.025")],[this.parseNumber("20000"),this.parseNumber("0.0225")],[this.parseNumber("50000"),this.parseNumber("0.02")],[this.parseNumber("75000"),this.parseNumber("0.0175")],[this.parseNumber("100000"),this.parseNumber("0.015")],[this.parseNumber("250000"),this.parseNumber("0.01")],[this.parseNumber("500000"),this.parseNumber("0.0075")],[this.parseNumber("750000"),this.parseNumber("0.005")],[this.parseNumber("1000000"),this.parseNumber("0.004")],[this.parseNumber("2000000"),this.parseNumber("0.003")],[this.parseNumber("3000000"),this.parseNumber("0.002")],[this.parseNumber("4000000"),this.parseNumber("0.001")]]}}},options:{fetchTradesMethod:"public_get_exchanges_pair_trades"},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:30,untilDays:30,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{"Please provide valid APIkey":r.AuthenticationError,"No order found.":r.OrderNotFound},broad:{"Please provide valid nonce":r.InvalidNonce,"please approve new terms of use on site":r.PermissionDenied}}})}parseBalance(e){const t={info:e,timestamp:void 0,datetime:void 0},i=Object.keys(this.currencies);for(let s=0;s{i.d(t,{A:()=>n});var s=i(2308),r=i(2079),a=i(1579),o=i(4852);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitbank",name:"bitbank",countries:["JP"],version:"v1",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","4h":"4hour","8h":"8hour","12h":"12hour","1d":"1day","1w":"1week"},hostname:"bitbank.cc",urls:{logo:"https://github.com/user-attachments/assets/9d616de0-8a88-4468-8e38-d269acab0348",api:{public:"https://public.{hostname}",private:"https://api.{hostname}",markets:"https://api.{hostname}"},www:"https://bitbank.cc/",doc:"https://docs.bitbank.cc/",fees:"https://bitbank.cc/docs/fees/"},api:{public:{get:["{pair}/ticker","tickers","tickers_jpy","{pair}/depth","{pair}/transactions","{pair}/transactions/{yyyymmdd}","{pair}/candlestick/{candletype}/{yyyymmdd}","{pair}/circuit_break_info"]},private:{get:["user/assets","user/spot/order","user/spot/active_orders","user/margin/positions","user/spot/trade_history","user/deposit_history","user/unconfirmed_deposits","user/deposit_originators","user/withdrawal_account","user/withdrawal_history","spot/status","spot/pairs"],post:["user/spot/order","user/spot/cancel_order","user/spot/cancel_orders","user/spot/orders_info","user/confirm_deposits","user/confirm_deposits_all","user/request_withdrawal"]},markets:{get:["spot/pairs"]}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:void 0,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:a.kb,exceptions:{exact:{20001:r.AuthenticationError,20002:r.AuthenticationError,20003:r.AuthenticationError,20005:r.AuthenticationError,20004:r.InvalidNonce,40020:r.InvalidOrder,40021:r.InvalidOrder,40025:r.ExchangeError,40013:r.OrderNotFound,40014:r.OrderNotFound,50008:r.PermissionDenied,50009:r.OrderNotFound,50010:r.OrderNotFound,60001:r.InsufficientFunds,60005:r.InvalidOrder}}})}async fetchMarkets(e={}){const t=await this.marketsGetSpotPairs(e),i=this.safeValue(t,"data"),s=this.safeValue(i,"pairs",[]);return this.parseMarkets(s)}parseMarket(e){const t=this.safeString(e,"name"),i=this.safeString(e,"base_asset"),s=this.safeString(e,"quote_asset"),r=this.safeCurrencyCode(i),a=this.safeCurrencyCode(s);return{id:t,symbol:r+"/"+a,base:r,quote:a,settle:void 0,baseId:i,quoteId:s,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:this.safeValue(e,"is_enabled"),contract:!1,linear:void 0,inverse:void 0,taker:this.safeNumber(e,"taker_fee_rate_quote"),maker:this.safeNumber(e,"maker_fee_rate_quote"),contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amount_digits"))),price:this.parseNumber(this.parsePrecision(this.safeString(e,"price_digits")))},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.safeNumber(e,"unit_amount"),max:this.safeNumber(e,"limit_max_amount")},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}parseTicker(e,t=void 0){const i=this.safeSymbol(void 0,t),s=this.safeInteger(e,"timestamp"),r=this.safeString(e,"last");return this.safeTicker({symbol:i,timestamp:s,datetime:this.iso8601(s),high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:r,last:r,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:this.safeString(e,"vol"),quoteVolume:void 0,info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={pair:i.id},r=await this.publicGetPairTicker(this.extend(s,t)),a=this.safeDict(r,"data",{});return this.parseTicker(a,i)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r={pair:s.id},a=await this.publicGetPairDepth(this.extend(r,i)),o=this.safeValue(a,"data",{}),n=this.safeInteger(o,"timestamp");return this.parseOrderBook(o,s.symbol,n)}parseTrade(e,t=void 0){const i=this.safeInteger(e,"executed_at");t=this.safeMarket(void 0,t);const s=this.safeString(e,"price"),r=this.safeString(e,"amount"),a=this.safeString2(e,"transaction_id","trade_id"),o=this.safeString(e,"maker_taker");let n;const d=this.safeString(e,"fee_amount_quote");void 0!==d&&(n={currency:t.quote,cost:d});const h=this.safeString(e,"order_id"),c=this.safeString(e,"type"),l=this.safeString(e,"side");return this.safeTrade({timestamp:i,datetime:this.iso8601(i),symbol:t.symbol,id:a,order:h,type:c,side:l,takerOrMaker:o,price:s,amount:r,cost:void 0,fee:n,info:e},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={pair:r.id},o=await this.publicGetPairTransactions(this.extend(a,s)),n=this.safeValue(o,"data",{}),d=this.safeList(n,"transactions",[]);return this.parseTrades(d,r,t,i)}async fetchTradingFees(e={}){await this.loadMarkets();const t=await this.marketsGetSpotPairs(e),i=this.safeValue(t,"data",{}),s=this.safeValue(i,"pairs",[]),r={};for(let e=0;e{i.d(t,{A:()=>d});var s=i(5625),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitbns",name:"Bitbns",countries:["IN"],rateLimit:1e3,certified:!1,version:"v2",has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:void 0,cancelAllOrders:!1,cancelOrder:!0,createOrder:!0,createStopOrder:!0,createTriggerOrder:!0,fetchBalance:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPositionMode:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:"emulated",fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,transfer:!1,withdraw:!1},hostname:"bitbns.com",urls:{logo:"https://github.com/user-attachments/assets/a5b9a562-cdd8-4bea-9fa7-fd24c1dad3d9",api:{www:"https://{hostname}",v1:"https://api.{hostname}/api/trade/v1",v2:"https://api.{hostname}/api/trade/v2"},www:"https://bitbns.com",referral:"https://ref.bitbns.com/1090961",doc:["https://bitbns.com/trade/#/api-trading/"],fees:"https://bitbns.com/fees"},api:{www:{get:["order/fetchMarkets","order/fetchTickers","order/fetchOrderbook","order/getTickerWithVolume","exchangeData/ohlc","exchangeData/orderBook","exchangeData/tradedetails"]},v1:{get:["platform/status","tickers","orderbook/sell/{symbol}","orderbook/buy/{symbol}"],post:["currentCoinBalance/EVERYTHING","getApiUsageStatus/USAGE","getOrderSocketToken/USAGE","currentCoinBalance/{symbol}","orderStatus/{symbol}","depositHistory/{symbol}","withdrawHistory/{symbol}","withdrawHistoryAll/{symbol}","depositHistoryAll/{symbol}","listOpenOrders/{symbol}","listOpenStopOrders/{symbol}","getCoinAddress/{symbol}","placeSellOrder/{symbol}","placeBuyOrder/{symbol}","buyStopLoss/{symbol}","sellStopLoss/{symbol}","cancelOrder/{symbol}","cancelStopLossOrder/{symbol}","listExecutedOrders/{symbol}","placeMarketOrder/{symbol}","placeMarketOrderQnty/{symbol}"]},v2:{post:["orders","cancel","getordersnew","marginOrders"]}},fees:{trading:{feeSide:"quote",tierBased:!1,percentage:!0,taker:this.parseNumber("0.0025"),maker:this.parseNumber("0.0025")}},precisionMode:o.kb,features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!0,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:100}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{400:r.BadRequest,409:r.BadSymbol,416:r.InsufficientFunds,417:r.OrderNotFound},broad:{}}})}async fetchStatus(e={}){const t=await this.v1GetPlatformStatus(e),i=this.safeString(t,"status");return{status:this.safeString({1:"ok"},i,i),updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=await this.wwwGetOrderFetchMarkets(e),i=[];for(let e=0;e1){let e=this.safeString(a,1);const r=this.account();r.free=this.safeString(s,t),r.used=this.safeString(s,"inorder"+e),"Money"===e&&(e="INR");i[this.safeCurrencyCode(e)]=r}}return this.safeBalance(i)}async fetchBalance(e={}){await this.loadMarkets();const t=await this.v1PostCurrentCoinBalanceEVERYTHING(e);return this.parseBalance(t)}parseStatus(e){return this.safeString({"-1":"cancelled",0:"open",1:"open",2:"done"},e,e)}parseOrder(e,t=void 0){const i=this.safeString2(e,"id","entry_id"),s=this.safeString(e,"time"),r=this.safeString(e,"t_rate");let a=this.safeString(e,"type");"0"===a?a="buy":"1"===a&&(a="sell");const o=this.safeString(e,"data");let n=this.safeString(e,"status");return n="Successfully cancelled the order"===o?"cancelled":this.parseStatus(n),this.safeOrder({info:e,id:i,clientOrderId:void 0,timestamp:this.parse8601(s),datetime:s,lastTradeTimestamp:void 0,symbol:this.safeString(t,"symbol"),timeInForce:void 0,postOnly:void 0,side:a,price:this.safeString(e,"rate"),triggerPrice:r,amount:this.safeString(e,"btc"),cost:void 0,average:void 0,filled:void 0,remaining:void 0,status:n,fee:{cost:void 0,currency:void 0,rate:void 0},trades:void 0},t)}async createOrder(e,t,i,s,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeStringN(a,["triggerPrice","stopPrice","t_rate"]),d=this.safeString(a,"target_rate"),h=this.safeString(a,"trail_rate");a=this.omit(a,["triggerPrice","stopPrice","trail_rate","target_rate","t_rate"]);const c={side:i.toUpperCase(),symbol:o.uppercaseId,quantity:this.amountToPrecision(e,s)};let l="v2PostOrders";"limit"===t?c.rate=this.priceToPrecision(e,r):(l="v1PostPlaceMarketOrderQntySymbol",c.market=o.quoteId),void 0!==n&&(c.t_rate=this.priceToPrecision(e,n)),void 0!==d&&(c.target_rate=this.priceToPrecision(e,d)),void 0!==h&&(c.trail_rate=this.priceToPrecision(e,h));const u=await this[l](this.extend(c,a));return this.parseOrder(u,o)}async cancelOrder(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");await this.loadMarkets();const s=this.market(t),a=this.safeBool2(i,"trigger","stop");i=this.omit(i,["trigger","stop"]);const o={entry_id:e,symbol:s.uppercaseId};let n;const d=a?"StopLossOrder":"Order";let h="USDT"===s.quoteId?"usdtcancel":"cancel";return h+=d,o.side=h,n=await this.v2PostCancel(this.extend(o,i)),this.parseOrder(n,s)}async fetchOrder(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");await this.loadMarkets();const s=this.market(t),a={symbol:s.id,entry_id:e};if(this.safeBool2(i,"trigger","stop"))throw new r.BadRequest(this.id+" fetchOrder cannot fetch stop orders");const o=await this.v1PostOrderStatusSymbol(this.extend(a,i)),n=this.safeList(o,"data",[]),d=this.safeDict(n,0);return this.parseOrder(d,s)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchOpenOrders() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o=this.safeBool2(s,"trigger","stop");s=this.omit(s,["trigger","stop"]);const n="USDT"===a.quoteId?"usdtListOpen":"listOpen",d={symbol:a.uppercaseId,page:0,side:o?n+"StopOrders":n+"Orders"},h=await this.v2PostGetordersnew(this.extend(d,s)),c=this.safeList(h,"data",[]);return this.parseOrders(c,a,t,i)}parseTrade(e,t=void 0){t=this.safeMarket(void 0,t);const i=this.safeString2(e,"id","tradeId");let s=this.parse8601(this.safeString(e,"date"));s=this.safeInteger(e,"timestamp",s);const r=this.safeString2(e,"rate","price");let o=this.safeString(e,"amount"),n=this.safeStringLower(e,"type");void 0!==n&&(n.indexOf("buy")>=0?n="buy":n.indexOf("sell")>=0&&(n="sell"));const d=this.safeString(e,"factor");let h;void 0!==d?o=a.Y.stringDiv(o,d):(o=this.safeString(e,"base_volume"),h=this.safeString(e,"quote_volume"));const c=t.symbol;let l;const u=this.safeString(e,"fee");if(void 0!==u){l={cost:u,currency:t.quote}}return this.safeTrade({info:e,timestamp:s,datetime:this.iso8601(s),symbol:c,id:i,order:i,type:void 0,side:n,takerOrMaker:void 0,price:r,amount:o,cost:h,fee:l},t)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={symbol:a.id,page:0};void 0!==t&&(o.since=this.iso8601(t));const n=await this.v1PostListExecutedOrdersSymbol(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseTrades(d,a,t,i)}async fetchTrades(e,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={coin:a.baseId,market:a.quoteId},n=await this.wwwGetExchangeDataTradedetails(this.extend(o,s));return this.parseTrades(n,a,t,i)}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchDeposits() requires a currency code argument");await this.loadMarkets();const a=this.currency(e),o={symbol:a.id,page:0},n=await this.v1PostDepositHistorySymbol(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchWithdrawals() requires a currency code argument");await this.loadMarkets();const a=this.currency(e),o={symbol:a.id,page:0},n=await this.v1PostWithdrawHistorySymbol(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,i)}parseTransactionStatusByType(e,t=void 0){const i=this.safeDict({deposit:{0:"pending",1:"ok"},withdrawal:{0:"pending",1:"canceled",2:"pending",3:"failed",4:"pending",5:"failed",6:"ok"}},t,{});return this.safeString(i,e,e)}parseTransaction(e,t=void 0){const i=this.safeString(e,"unit"),s=this.safeCurrencyCode(i,t),r=this.parse8601(this.safeString2(e,"date","timestamp"));let a=this.safeString(e,"type");const o=this.safeString(e,"expTime","");let n;void 0!==a&&(a.indexOf("deposit")>=0?(a="deposit",n="ok"):(a.indexOf("withdraw")>=0||o.indexOf("withdraw")>=0)&&(a="withdrawal"));const d=this.safeNumber(e,"amount"),h=this.safeNumber(e,"fee");let c;return void 0!==h&&(c={currency:s,cost:h}),{info:e,id:void 0,txid:void 0,timestamp:r,datetime:this.iso8601(r),network:void 0,address:void 0,addressTo:void 0,addressFrom:void 0,tag:void 0,tagTo:void 0,tagFrom:void 0,type:a,amount:d,currency:s,status:n,updated:void 0,comment:void 0,internal:void 0,fee:c}}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i={symbol:this.currency(e).id},s=await this.v1PostGetCoinAddressSymbol(this.extend(i,t)),r=this.safeDict(s,"data",{}),a=this.safeString(r,"token"),o=this.safeString(r,"tag");return this.checkAddress(a),{info:s,currency:e,network:void 0,address:a,tag:o}}nonce(){return this.milliseconds()}sign(e,t="www",i="GET",s={},a=void 0,o=void 0){if(!(t in this.urls.api))throw new r.ExchangeError(this.id+" does not have a testnet/sandbox URL for "+t+" endpoints");"www"!==t&&(this.checkRequiredCredentials(),a={"X-BITBNS-APIKEY":this.apiKey});let d=this.implodeHostname(this.urls.api[t])+"/"+this.implodeParams(e,s);const h=this.omit(s,this.extractParams(e)),c=this.nonce().toString();if("GET"===i)Object.keys(h).length&&(d+="?"+this.urlencode(h));else if("POST"===i){const e={timeStamp_nonce:c,body:o=Object.keys(h).length?this.json(h):"{}"},t=this.stringToBase64(this.json(e)),i=this.hmac(this.encode(t),this.encode(this.secret),n.Zf);a["X-BITBNS-PAYLOAD"]=t,a["X-BITBNS-SIGNATURE"]=i,a["Content-Type"]="application/x-www-form-urlencoded"}return{url:d,method:i,body:o,headers:a}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"msg");if(void 0!==c&&"200"!==c&&"204"!==c||void 0!==l){const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,c,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),this.throwBroadlyMatchedException(this.exceptions.broad,l,e),new r.ExchangeError(e)}}}},8657:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(2079),r=i(5147),a=i(9332),o=i(1579),n=i(7481);class d extends a.A{describe(){return this.deepExtend(super.describe(),{id:"bitfinex",name:"Bitfinex",countries:["VG"],version:"v2",certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:!0,createLimitOrder:!0,createMarketOrder:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,createTrailingPercentOrder:!1,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrder:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:"emulated",fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenInterests:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTickers:!0,fetchTime:!1,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:void 0,fetchTransactions:"emulated",reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!0,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","3h":"3h","4h":"4h","6h":"6h","12h":"12h","1d":"1D","1w":"7D","2w":"14D","1M":"1M"},rateLimit:250,urls:{logo:"https://github.com/user-attachments/assets/4a8e947f-ab46-481a-a8ae-8b20e9b03178",api:{v1:"https://api.bitfinex.com",public:"https://api-pub.bitfinex.com",private:"https://api.bitfinex.com"},www:"https://www.bitfinex.com",doc:["https://docs.bitfinex.com/v2/docs/","https://github.com/bitfinexcom/bitfinex-api-node"],fees:"https://www.bitfinex.com/fees"},api:{public:{get:{"conf/{config}":2.7,"conf/pub:{action}:{object}":2.7,"conf/pub:{action}:{object}:{detail}":2.7,"conf/pub:map:{object}":2.7,"conf/pub:map:{object}:{detail}":2.7,"conf/pub:map:currency:{detail}":2.7,"conf/pub:map:currency:sym":2.7,"conf/pub:map:currency:label":2.7,"conf/pub:map:currency:unit":2.7,"conf/pub:map:currency:undl":2.7,"conf/pub:map:currency:pool":2.7,"conf/pub:map:currency:explorer":2.7,"conf/pub:map:currency:tx:fee":2.7,"conf/pub:map:tx:method":2.7,"conf/pub:list:{object}":2.7,"conf/pub:list:{object}:{detail}":2.7,"conf/pub:list:currency":2.7,"conf/pub:list:pair:exchange":2.7,"conf/pub:list:pair:margin":2.7,"conf/pub:list:pair:futures":2.7,"conf/pub:list:competitions":2.7,"conf/pub:info:{object}":2.7,"conf/pub:info:{object}:{detail}":2.7,"conf/pub:info:pair":2.7,"conf/pub:info:pair:futures":2.7,"conf/pub:info:tx:status":2.7,"conf/pub:fees":2.7,"platform/status":8,tickers:2.7,"ticker/{symbol}":2.7,"tickers/hist":2.7,"trades/{symbol}/hist":2.7,"book/{symbol}/{precision}":1,"book/{symbol}/P0":1,"book/{symbol}/P1":1,"book/{symbol}/P2":1,"book/{symbol}/P3":1,"book/{symbol}/R0":1,"stats1/{key}:{size}:{symbol}:{side}/{section}":2.7,"stats1/{key}:{size}:{symbol}:{side}/last":2.7,"stats1/{key}:{size}:{symbol}:{side}/hist":2.7,"stats1/{key}:{size}:{symbol}/{section}":2.7,"stats1/{key}:{size}:{symbol}/last":2.7,"stats1/{key}:{size}:{symbol}/hist":2.7,"stats1/{key}:{size}:{symbol}:long/last":2.7,"stats1/{key}:{size}:{symbol}:long/hist":2.7,"stats1/{key}:{size}:{symbol}:short/last":2.7,"stats1/{key}:{size}:{symbol}:short/hist":2.7,"candles/trade:{timeframe}:{symbol}:{period}/{section}":2.7,"candles/trade:{timeframe}:{symbol}/{section}":2.7,"candles/trade:{timeframe}:{symbol}/last":2.7,"candles/trade:{timeframe}:{symbol}/hist":2.7,"status/{type}":2.7,"status/deriv":2.7,"status/deriv/{symbol}/hist":2.7,"liquidations/hist":80,"rankings/{key}:{timeframe}:{symbol}/{section}":2.7,"rankings/{key}:{timeframe}:{symbol}/hist":2.7,"pulse/hist":2.7,"pulse/profile/{nickname}":2.7,"funding/stats/{symbol}/hist":10,"ext/vasps":1},post:{"calc/trade/avg":2.7,"calc/fx":2.7}},private:{post:{"auth/r/wallets":2.7,"auth/r/wallets/hist":2.7,"auth/r/orders":2.7,"auth/r/orders/{symbol}":2.7,"auth/w/order/submit":2.7,"auth/w/order/update":2.7,"auth/w/order/cancel":2.7,"auth/w/order/multi":2.7,"auth/w/order/cancel/multi":2.7,"auth/r/orders/{symbol}/hist":2.7,"auth/r/orders/hist":2.7,"auth/r/order/{symbol}:{id}/trades":2.7,"auth/r/trades/{symbol}/hist":2.7,"auth/r/trades/hist":2.7,"auth/r/ledgers/{currency}/hist":2.7,"auth/r/ledgers/hist":2.7,"auth/r/info/margin/{key}":2.7,"auth/r/info/margin/base":2.7,"auth/r/info/margin/sym_all":2.7,"auth/r/positions":2.7,"auth/w/position/claim":2.7,"auth/w/position/increase:":2.7,"auth/r/position/increase/info":2.7,"auth/r/positions/hist":2.7,"auth/r/positions/audit":2.7,"auth/r/positions/snap":2.7,"auth/w/deriv/collateral/set":2.7,"auth/w/deriv/collateral/limits":2.7,"auth/r/funding/offers":2.7,"auth/r/funding/offers/{symbol}":2.7,"auth/w/funding/offer/submit":2.7,"auth/w/funding/offer/cancel":2.7,"auth/w/funding/offer/cancel/all":2.7,"auth/w/funding/close":2.7,"auth/w/funding/auto":2.7,"auth/w/funding/keep":2.7,"auth/r/funding/offers/{symbol}/hist":2.7,"auth/r/funding/offers/hist":2.7,"auth/r/funding/loans":2.7,"auth/r/funding/loans/hist":2.7,"auth/r/funding/loans/{symbol}":2.7,"auth/r/funding/loans/{symbol}/hist":2.7,"auth/r/funding/credits":2.7,"auth/r/funding/credits/hist":2.7,"auth/r/funding/credits/{symbol}":2.7,"auth/r/funding/credits/{symbol}/hist":2.7,"auth/r/funding/trades/{symbol}/hist":2.7,"auth/r/funding/trades/hist":2.7,"auth/r/info/funding/{key}":2.7,"auth/r/info/user":2.7,"auth/r/summary":2.7,"auth/r/logins/hist":2.7,"auth/r/permissions":2.7,"auth/w/token":2.7,"auth/r/audit/hist":2.7,"auth/w/transfer":2.7,"auth/w/deposit/address":24,"auth/w/deposit/invoice":24,"auth/w/withdraw":24,"auth/r/movements/{currency}/hist":2.7,"auth/r/movements/hist":2.7,"auth/r/alerts":5.34,"auth/w/alert/set":2.7,"auth/w/alert/price:{symbol}:{price}/del":2.7,"auth/w/alert/{type}:{symbol}:{price}/del":2.7,"auth/calc/order/avail":2.7,"auth/w/settings/set":2.7,"auth/r/settings":2.7,"auth/w/settings/del":2.7,"auth/r/pulse/hist":2.7,"auth/w/pulse/add":16,"auth/w/pulse/del":2.7}}},fees:{trading:{feeSide:"get",percentage:!0,tierBased:!0,maker:this.parseNumber("0.001"),taker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.002")],[this.parseNumber("2500000"),this.parseNumber("0.002")],[this.parseNumber("5000000"),this.parseNumber("0.002")],[this.parseNumber("7500000"),this.parseNumber("0.002")],[this.parseNumber("10000000"),this.parseNumber("0.0018")],[this.parseNumber("15000000"),this.parseNumber("0.0016")],[this.parseNumber("20000000"),this.parseNumber("0.0014")],[this.parseNumber("25000000"),this.parseNumber("0.0012")],[this.parseNumber("30000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0002")],[this.parseNumber("7500000"),this.parseNumber("0")],[this.parseNumber("10000000"),this.parseNumber("0")],[this.parseNumber("15000000"),this.parseNumber("0")],[this.parseNumber("20000000"),this.parseNumber("0")],[this.parseNumber("25000000"),this.parseNumber("0")],[this.parseNumber("30000000"),this.parseNumber("0")]]}},funding:{withdraw:{}}},precisionMode:o.v,options:{precision:"R0",exchangeTypes:{MARKET:"market","EXCHANGE MARKET":"market",LIMIT:"limit","EXCHANGE LIMIT":"limit","EXCHANGE STOP":"market","EXCHANGE FOK":"limit","EXCHANGE STOP LIMIT":"limit","EXCHANGE IOC":"limit"},orderTypes:{market:"EXCHANGE MARKET",limit:"EXCHANGE LIMIT"},fiat:{USD:"USD",EUR:"EUR",JPY:"JPY",GBP:"GBP",CHN:"CHN"},v2AccountsByType:{spot:"exchange",exchange:"exchange",funding:"funding",margin:"margin",derivatives:"margin",future:"margin",swap:"margin"},withdraw:{includeFee:!1},networks:{BTC:"BITCOIN",LTC:"LITECOIN",ERC20:"ETHEREUM",OMNI:"TETHERUSO",LIQUID:"TETHERUSL",TRC20:"TETHERUSX",EOS:"TETHERUSS",AVAX:"TETHERUSDTAVAX",SOL:"TETHERUSDTSOL",ALGO:"TETHERUSDTALG",BCH:"TETHERUSDTBCH",KSM:"TETHERUSDTKSM",DVF:"TETHERUSDTDVF",OMG:"TETHERUSDTOMG"},networksById:{TETHERUSE:"ERC20"}},features:{default:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!0,leverage:!0,marketBuyRequiresPrice:!1,marketBuyByCost:!0,selfTradePrevention:!1,iceberg:!1},createOrders:{max:75},fetchMyTrades:{marginMode:!1,limit:2500,daysBack:void 0,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:void 0,daysBack:void 0,daysBackCanceled:void 0,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e4}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{11010:s.RateLimitExceeded,10001:s.PermissionDenied,10020:s.BadRequest,10100:s.AuthenticationError,10114:s.InvalidNonce,20060:s.OnMaintenance,temporarily_unavailable:s.ExchangeNotAvailable},broad:{"available balance is only":s.InsufficientFunds,"not enough exchange balance":s.InsufficientFunds,"Order not found":s.OrderNotFound,"symbol: invalid":s.BadSymbol}},commonCurrencies:{UST:"USDT",EUTF0:"EURT",USTF0:"USDT",ALG:"ALGO",AMP:"AMPL",ATO:"ATOM",BCHABC:"XEC",BCHN:"BCH",DAT:"DATA",DOG:"MDOGE",DSH:"DASH",EDO:"PNT",EUS:"EURS",EUT:"EURT",HTX:"HT",IDX:"ID",IOT:"IOTA",IQX:"IQ",LUNA:"LUNC",LUNA2:"LUNA",MNA:"MANA",ORS:"ORS Group",PAS:"PASS",QSH:"QASH",QTM:"QTUM",RBT:"RBTC",SNG:"SNGLS",STJ:"STORJ",TERRAUST:"USTC",TSD:"TUSD",YGG:"YEED",YYW:"YOYOW",UDC:"USDC",VSY:"VSYS",WAX:"WAXP",XCH:"XCHF",ZBT:"ZB"}})}isFiat(e){return e in this.options.fiat}getCurrencyId(e){return"f"+e}getCurrencyName(e){if(e in this.options.currencyNames)return this.options.currencyNames[e];throw new s.NotSupported(this.id+" "+e+" not supported for withdrawal")}amountToPrecision(e,t){return e=this.safeSymbol(e),this.decimalToPrecision(t,o.R3,this.markets[e].precision.amount,o.fv)}priceToPrecision(e,t){return e=this.safeSymbol(e),t=this.decimalToPrecision(t,o.D_,this.markets[e].precision.price,this.precisionMode),this.decimalToPrecision(t,o.R3,8,o.fv)}async fetchStatus(e={}){const t=await this.publicGetPlatformStatus(e),i=this.safeString(t,0);return{status:this.safeString({0:"maintenance",1:"ok"},i,i),updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=this.publicGetConfPubInfoPair(e),i=this.publicGetConfPubInfoPairFutures(e),s=this.publicGetConfPubListPairMargin(e);let[r,a,o]=await Promise.all([t,i,s]);r=this.safeList(r,0,[]),a=this.safeList(a,0,[]);const n=this.arrayConcat(r,a);o=this.safeValue(o,0,[]);const d=[];for(let e=0;e=0&&(r=!1);const a=!r;let h,c;if(i.indexOf(":")>=0){const e=i.split(":");h=e[0],c=e[1]}else h=i.slice(0,3),c=i.slice(3,6);let l=this.safeCurrencyCode(h),u=this.safeCurrencyCode(c);const f=l.split("F0"),p=u.split("F0");l=this.safeString(f,0),u=this.safeString(p,0);let m,g,v=l+"/"+u;h=this.getCurrencyId(h),c=this.getCurrencyId(c),a&&(m=u,g=u,v=v+":"+m);const y=this.safeString(s,3),w=this.safeString(s,4);let b=!1;r&&this.inArray(i,o)&&(b=!0),d.push({id:"t"+i,symbol:v,base:l,quote:u,settle:m,baseId:h,quoteId:c,settleId:g,type:r?"spot":"swap",spot:r,margin:b,swap:a,future:!1,option:!1,active:!0,contract:a,linear:!!a||void 0,inverse:!a&&void 0,contractSize:a?this.parseNumber("1"):void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:parseInt("8"),price:parseInt("5")},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.parseNumber(y),max:this.parseNumber(w)},price:{min:this.parseNumber("1e-8"),max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:s})}return d}async fetchCurrencies(e={}){const t={config:["pub:list:currency","pub:map:currency:sym","pub:map:currency:label","pub:map:currency:unit","pub:map:currency:undl","pub:map:currency:pool","pub:map:currency:explorer","pub:map:currency:tx:fee","pub:map:tx:method","pub:info:tx:status"].join(",")},i=await this.publicGetConfConfig(this.extend(t,e)),s={sym:this.indexBy(this.safeList(i,1,[]),0),label:this.indexBy(this.safeList(i,2,[]),0),unit:this.indexBy(this.safeList(i,3,[]),0),undl:this.indexBy(this.safeList(i,4,[]),0),pool:this.indexBy(this.safeList(i,5,[]),0),explorer:this.indexBy(this.safeList(i,6,[]),0),fees:this.indexBy(this.safeList(i,7,[]),0),networks:this.safeList(i,8,[]),statuses:this.indexBy(this.safeList(i,9,[]),0)},r={};for(let e=0;e5,a=this.safeString(i,0),o=s?4:2;let n,d=this.safeString(i,o);const h=s?5:3,c=this.safeString(i,h);let l,u,f,p;"-"===d[0]?(n="sell",d=r.Y.stringAbs(d)):n="buy";let m=this.safeSymbol(void 0,t);const g=s?2:1,v=this.safeInteger(i,g);if(s){const e=i[1];m=this.safeSymbol(e),l=this.safeString(i,3);u=1===this.safeInteger(i,8)?"maker":"taker";let t=this.safeString(i,9);t=r.Y.stringNeg(t);const s=this.safeString(i,10);p={cost:t,currency:this.safeCurrencyCode(s)};const a=i[6];f=this.safeString(this.options.exchangeTypes,a)}return this.safeTrade({id:a,timestamp:v,datetime:this.iso8601(v),symbol:m,order:l,side:n,type:f,takerOrMaker:u,price:c,amount:d,cost:void 0,fee:p,info:i},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,i,s,1e4);const a=this.market(e);let o="-1",n={symbol:a.id};void 0!==t&&(n.start=t,o="1"),void 0!==i&&(n.limit=Math.min(i,1e4)),n.sort=o,[n,s]=this.handleUntilOption("end",n,s);const d=await this.publicGetTradesSymbolHist(this.extend(n,s)),h=this.sortBy(d,1),c=[];for(let e=0;e=0||e.indexOf("charged")>=0?"fee":e.indexOf("rebate")>=0?"rebate":e.indexOf("deposit")>=0||e.indexOf("withdrawal")>=0?"transaction":e.indexOf("transfer")>=0?"transfer":e.indexOf("payment")>=0?"payout":e.indexOf("exchange")>=0||e.indexOf("position")>=0?"trade":e}parseLedgerEntry(e,t=void 0){const i=this.safeList(e,"result",[]);let s;const r=this.safeString(i,0),a=this.safeString(i,1),o=this.safeCurrencyCode(a,t);t=this.safeCurrency(a,t);const n=this.safeInteger(i,3),d=this.safeNumber(i,5),h=this.safeNumber(i,6),c=this.safeString(i,8);if(void 0!==c){const e=c.split(" @ "),t=this.safeStringLower(e,0);s=this.parseLedgerEntryType(t)}return this.safeLedgerEntry({info:e,id:r,direction:void 0,account:void 0,referenceId:r,referenceAccount:void 0,type:s,currency:o,amount:d,timestamp:n,datetime:this.iso8601(n),before:void 0,after:h,status:void 0,fee:void 0},t)}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r,a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchLedger","paginate"),a)return await this.fetchPaginatedCallDynamic("fetchLedger",e,t,i,s,2500);let o,n={};void 0!==t&&(n.start=t),void 0!==i&&(n.limit=i),[n,s]=this.handleUntilOption("end",n,s),void 0!==e?(r=this.currency(e),n.currency=r.uppercaseId,o=await this.privatePostAuthRLedgersCurrencyHist(this.extend(n,s))):o=await this.privatePostAuthRLedgersHist(this.extend(n,s));const d=[];for(let e=0;e{i.d(t,{A:()=>d});var s=i(1578),r=i(2079),a=i(1579),o=i(4852),n=i(5147);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitflyer",name:"bitFlyer",countries:["JP"],version:"v1",rateLimit:1e3,hostname:"bitflyer.com",has:{CORS:void 0,spot:!0,margin:!1,swap:void 0,future:void 0,option:!1,cancelAllOrders:void 0,cancelOrder:!0,createOrder:!0,fetchBalance:!0,fetchClosedOrders:"emulated",fetchDeposits:!0,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOpenOrders:"emulated",fetchOrder:"emulated",fetchOrderBook:!0,fetchOrders:!0,fetchPositionMode:!1,fetchPositions:!0,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawals:!0,transfer:!1,withdraw:!0},urls:{logo:"https://github.com/user-attachments/assets/d0217747-e54d-4533-8416-0d553dca74bb",api:{rest:"https://api.{hostname}"},www:"https://bitflyer.com",doc:"https://lightning.bitflyer.com/docs?lang=en"},api:{public:{get:["getmarkets/usa","getmarkets/eu","getmarkets","getboard","getticker","getexecutions","gethealth","getboardstate","getchats","getfundingrate"]},private:{get:["getpermissions","getbalance","getbalancehistory","getcollateral","getcollateralhistory","getcollateralaccounts","getaddresses","getcoinins","getcoinouts","getbankaccounts","getdeposits","getwithdrawals","getchildorders","getparentorders","getparentorder","getexecutions","getpositions","gettradingcommission"],post:["sendcoin","withdraw","sendchildorder","cancelchildorder","sendparentorder","cancelparentorder","cancelallchildorders"]}},fees:{trading:{maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},precisionMode:a.kb,features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"-2":r.OnMaintenance}}})}parseExpiryDate(e){const t=e.slice(0,2),i=e.slice(2,5),s=e.slice(5,9),r=this.safeString({JAN:"01",FEB:"02",MAR:"03",APR:"04",MAY:"05",JUN:"06",JUL:"07",AUG:"08",SEP:"09",OCT:"10",NOV:"11",DEC:"12"},i);return this.parse8601(s+"-"+r+"-"+t+"T00:00:00Z")}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return super.safeMarket(e,t,i,"spot")}async fetchMarkets(e={}){const t=await this.publicGetGetmarkets(e),i=await this.publicGetGetmarketsUsa(e),s=await this.publicGetGetmarketsEu(e);let r=this.arrayConcat(t,i);r=this.arrayConcat(r,s);const a=[];for(let e=0;e{i.d(t,{A:()=>d});var s=i(9152),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitget",name:"Bitget",countries:["SG"],version:"v2",rateLimit:50,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!1,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!0,closePosition:!0,createConvertTrade:!0,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!1,createTrailingPercentOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchConvertCurrencies:!0,fetchConvertQuote:!0,fetchConvertTrade:!1,fetchConvertTradeHistory:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingInterval:!0,fetchFundingIntervals:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!0,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMarkPrice:!0,fetchMyLiquidations:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawAddresses:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1m"},hostname:"bitget.com",urls:{logo:"https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658",api:{spot:"https://api.{hostname}",mix:"https://api.{hostname}",user:"https://api.{hostname}",p2p:"https://api.{hostname}",broker:"https://api.{hostname}",margin:"https://api.{hostname}",common:"https://api.{hostname}",tax:"https://api.{hostname}",convert:"https://api.{hostname}",copy:"https://api.{hostname}",earn:"https://api.{hostname}",uta:"https://api.{hostname}"},www:"https://www.bitget.com",doc:["https://www.bitget.com/api-doc/common/intro","https://www.bitget.com/api-doc/spot/intro","https://www.bitget.com/api-doc/contract/intro","https://www.bitget.com/api-doc/broker/intro","https://www.bitget.com/api-doc/margin/intro","https://www.bitget.com/api-doc/copytrading/intro","https://www.bitget.com/api-doc/earn/intro","https://bitgetlimited.github.io/apidoc/en/mix","https://bitgetlimited.github.io/apidoc/en/spot","https://bitgetlimited.github.io/apidoc/en/broker","https://bitgetlimited.github.io/apidoc/en/margin"],fees:"https://www.bitget.cc/zh-CN/rate?tab=1",referral:"https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j"},api:{public:{common:{get:{"v2/public/annoucements":1,"v2/public/time":1}},spot:{get:{"spot/v1/notice/queryAllNotices":1,"spot/v1/public/time":1,"spot/v1/public/currencies":6.6667,"spot/v1/public/products":1,"spot/v1/public/product":1,"spot/v1/market/ticker":1,"spot/v1/market/tickers":1,"spot/v1/market/fills":2,"spot/v1/market/fills-history":2,"spot/v1/market/candles":1,"spot/v1/market/depth":1,"spot/v1/market/spot-vip-level":2,"spot/v1/market/merge-depth":1,"spot/v1/market/history-candles":1,"spot/v1/public/loan/coinInfos":2,"spot/v1/public/loan/hour-interest":2,"v2/spot/public/coins":6.6667,"v2/spot/public/symbols":1,"v2/spot/market/vip-fee-rate":2,"v2/spot/market/tickers":1,"v2/spot/market/merge-depth":1,"v2/spot/market/orderbook":1,"v2/spot/market/candles":1,"v2/spot/market/history-candles":1,"v2/spot/market/fills":2,"v2/spot/market/fills-history":2}},mix:{get:{"mix/v1/market/contracts":1,"mix/v1/market/depth":1,"mix/v1/market/ticker":1,"mix/v1/market/tickers":1,"mix/v1/market/contract-vip-level":2,"mix/v1/market/fills":1,"mix/v1/market/fills-history":2,"mix/v1/market/candles":1,"mix/v1/market/index":1,"mix/v1/market/funding-time":1,"mix/v1/market/history-fundRate":1,"mix/v1/market/current-fundRate":1,"mix/v1/market/open-interest":1,"mix/v1/market/mark-price":1,"mix/v1/market/symbol-leverage":1,"mix/v1/market/queryPositionLever":1,"mix/v1/market/open-limit":1,"mix/v1/market/history-candles":1,"mix/v1/market/history-index-candles":1,"mix/v1/market/history-mark-candles":1,"mix/v1/market/merge-depth":1,"v2/mix/market/vip-fee-rate":2,"v2/mix/market/merge-depth":1,"v2/mix/market/ticker":1,"v2/mix/market/tickers":1,"v2/mix/market/fills":1,"v2/mix/market/fills-history":2,"v2/mix/market/candles":1,"v2/mix/market/history-candles":1,"v2/mix/market/history-index-candles":1,"v2/mix/market/history-mark-candles":1,"v2/mix/market/open-interest":1,"v2/mix/market/funding-time":1,"v2/mix/market/symbol-price":1,"v2/mix/market/history-fund-rate":1,"v2/mix/market/current-fund-rate":1,"v2/mix/market/contracts":1,"v2/mix/market/query-position-lever":2,"v2/mix/market/account-long-short":20}},margin:{get:{"margin/v1/cross/public/interestRateAndLimit":2,"margin/v1/isolated/public/interestRateAndLimit":2,"margin/v1/cross/public/tierData":2,"margin/v1/isolated/public/tierData":2,"margin/v1/public/currencies":1,"v2/margin/currencies":2,"v2/margin/market/long-short-ratio":20}},earn:{get:{"v2/earn/loan/public/coinInfos":2,"v2/earn/loan/public/hour-interest":2}},uta:{get:{"v3/market/instruments":1,"v3/market/tickers":1,"v3/market/orderbook":1,"v3/market/fills":1,"v3/market/open-interest":1,"v3/market/candles":1,"v3/market/history-candles":1,"v3/market/current-fund-rate":1,"v3/market/history-fund-rate":1,"v3/market/risk-reserve":1,"v3/market/discount-rate":1,"v3/market/margin-loans":1,"v3/market/position-tier":1,"v3/market/oi-limit":2}}},private:{spot:{get:{"spot/v1/wallet/deposit-address":4,"spot/v1/wallet/withdrawal-list":1,"spot/v1/wallet/deposit-list":1,"spot/v1/account/getInfo":20,"spot/v1/account/assets":2,"spot/v1/account/assets-lite":2,"spot/v1/account/transferRecords":1,"spot/v1/convert/currencies":2,"spot/v1/convert/convert-record":2,"spot/v1/loan/ongoing-orders":2,"spot/v1/loan/repay-history":2,"spot/v1/loan/revise-history":2,"spot/v1/loan/borrow-history":2,"spot/v1/loan/debts":2,"v2/spot/trade/orderInfo":1,"v2/spot/trade/unfilled-orders":1,"v2/spot/trade/history-orders":1,"v2/spot/trade/fills":2,"v2/spot/trade/current-plan-order":1,"v2/spot/trade/history-plan-order":1,"v2/spot/account/info":20,"v2/spot/account/assets":2,"v2/spot/account/subaccount-assets":2,"v2/spot/account/bills":2,"v2/spot/account/transferRecords":1,"v2/account/funding-assets":2,"v2/account/bot-assets":2,"v2/account/all-account-balance":20,"v2/spot/wallet/deposit-address":2,"v2/spot/wallet/deposit-records":2,"v2/spot/wallet/withdrawal-records":2},post:{"spot/v1/wallet/transfer":4,"spot/v1/wallet/transfer-v2":4,"spot/v1/wallet/subTransfer":10,"spot/v1/wallet/withdrawal":4,"spot/v1/wallet/withdrawal-v2":4,"spot/v1/wallet/withdrawal-inner":4,"spot/v1/wallet/withdrawal-inner-v2":4,"spot/v1/account/sub-account-spot-assets":200,"spot/v1/account/bills":2,"spot/v1/trade/orders":2,"spot/v1/trade/batch-orders":4,"spot/v1/trade/cancel-order":2,"spot/v1/trade/cancel-order-v2":2,"spot/v1/trade/cancel-symbol-order":2,"spot/v1/trade/cancel-batch-orders":4,"spot/v1/trade/cancel-batch-orders-v2":4,"spot/v1/trade/orderInfo":1,"spot/v1/trade/open-orders":1,"spot/v1/trade/history":1,"spot/v1/trade/fills":1,"spot/v1/plan/placePlan":1,"spot/v1/plan/modifyPlan":1,"spot/v1/plan/cancelPlan":1,"spot/v1/plan/currentPlan":1,"spot/v1/plan/historyPlan":1,"spot/v1/plan/batchCancelPlan":2,"spot/v1/convert/quoted-price":4,"spot/v1/convert/trade":4,"spot/v1/loan/borrow":2,"spot/v1/loan/repay":2,"spot/v1/loan/revise-pledge":2,"spot/v1/trace/order/orderCurrentList":2,"spot/v1/trace/order/orderHistoryList":2,"spot/v1/trace/order/closeTrackingOrder":2,"spot/v1/trace/order/updateTpsl":2,"spot/v1/trace/order/followerEndOrder":2,"spot/v1/trace/order/spotInfoList":2,"spot/v1/trace/config/getTraderSettings":2,"spot/v1/trace/config/getFollowerSettings":2,"spot/v1/trace/user/myTraders":2,"spot/v1/trace/config/setFollowerConfig":2,"spot/v1/trace/user/myFollowers":2,"spot/v1/trace/config/setProductCode":2,"spot/v1/trace/user/removeTrader":2,"spot/v1/trace/getRemovableFollower":2,"spot/v1/trace/user/removeFollower":2,"spot/v1/trace/profit/totalProfitInfo":2,"spot/v1/trace/profit/totalProfitList":2,"spot/v1/trace/profit/profitHisList":2,"spot/v1/trace/profit/profitHisDetailList":2,"spot/v1/trace/profit/waitProfitDetailList":2,"spot/v1/trace/user/getTraderInfo":2,"v2/spot/trade/place-order":2,"v2/spot/trade/cancel-order":2,"v2/spot/trade/batch-orders":20,"v2/spot/trade/batch-cancel-order":2,"v2/spot/trade/cancel-symbol-order":4,"v2/spot/trade/place-plan-order":1,"v2/spot/trade/modify-plan-order":1,"v2/spot/trade/cancel-plan-order":1,"v2/spot/trade/batch-cancel-plan-order":2,"v2/spot/wallet/transfer":2,"v2/spot/wallet/subaccount-transfer":2,"v2/spot/wallet/withdrawal":2,"v2/spot/wallet/cancel-withdrawal":2,"v2/spot/wallet/modify-deposit-account":2}},mix:{get:{"mix/v1/account/account":2,"mix/v1/account/accounts":2,"mix/v1/position/singlePosition":2,"mix/v1/position/singlePosition-v2":2,"mix/v1/position/allPosition":4,"mix/v1/position/allPosition-v2":4,"mix/v1/position/history-position":1,"mix/v1/account/accountBill":2,"mix/v1/account/accountBusinessBill":4,"mix/v1/order/current":1,"mix/v1/order/marginCoinCurrent":1,"mix/v1/order/history":2,"mix/v1/order/historyProductType":4,"mix/v1/order/detail":2,"mix/v1/order/fills":2,"mix/v1/order/allFills":2,"mix/v1/plan/currentPlan":1,"mix/v1/plan/historyPlan":2,"mix/v1/trace/currentTrack":2,"mix/v1/trace/followerOrder":2,"mix/v1/trace/followerHistoryOrders":2,"mix/v1/trace/historyTrack":2,"mix/v1/trace/summary":1,"mix/v1/trace/profitSettleTokenIdGroup":1,"mix/v1/trace/profitDateGroupList":1,"mix/v1/trade/profitDateList":2,"mix/v1/trace/waitProfitDateList":1,"mix/v1/trace/traderSymbols":1,"mix/v1/trace/traderList":2,"mix/v1/trace/traderDetail":2,"mix/v1/trace/queryTraceConfig":2,"v2/mix/account/account":2,"v2/mix/account/accounts":2,"v2/mix/account/sub-account-assets":200,"v2/mix/account/open-count":2,"v2/mix/account/bill":2,"v2/mix/market/query-position-lever":2,"v2/mix/position/single-position":2,"v2/mix/position/all-position":4,"v2/mix/position/history-position":1,"v2/mix/order/detail":2,"v2/mix/order/fills":2,"v2/mix/order/fill-history":2,"v2/mix/order/orders-pending":2,"v2/mix/order/orders-history":2,"v2/mix/order/orders-plan-pending":2,"v2/mix/order/orders-plan-history":2,"v2/mix/market/position-long-short":20},post:{"mix/v1/account/sub-account-contract-assets":200,"mix/v1/account/open-count":1,"mix/v1/account/setLeverage":4,"mix/v1/account/setMargin":4,"mix/v1/account/setMarginMode":4,"mix/v1/account/setPositionMode":4,"mix/v1/order/placeOrder":2,"mix/v1/order/batch-orders":2,"mix/v1/order/cancel-order":2,"mix/v1/order/cancel-batch-orders":2,"mix/v1/order/modifyOrder":2,"mix/v1/order/cancel-symbol-orders":2,"mix/v1/order/cancel-all-orders":2,"mix/v1/order/close-all-positions":20,"mix/v1/plan/placePlan":2,"mix/v1/plan/modifyPlan":2,"mix/v1/plan/modifyPlanPreset":2,"mix/v1/plan/placeTPSL":2,"mix/v1/plan/placeTrailStop":2,"mix/v1/plan/placePositionsTPSL":2,"mix/v1/plan/modifyTPSLPlan":2,"mix/v1/plan/cancelPlan":2,"mix/v1/plan/cancelSymbolPlan":2,"mix/v1/plan/cancelAllPlan":2,"mix/v1/trace/closeTrackOrder":2,"mix/v1/trace/modifyTPSL":2,"mix/v1/trace/closeTrackOrderBySymbol":2,"mix/v1/trace/setUpCopySymbols":2,"mix/v1/trace/followerSetBatchTraceConfig":2,"mix/v1/trace/followerCloseByTrackingNo":2,"mix/v1/trace/followerCloseByAll":2,"mix/v1/trace/followerSetTpsl":2,"mix/v1/trace/cancelCopyTrader":4,"mix/v1/trace/traderUpdateConfig":2,"mix/v1/trace/myTraderList":2,"mix/v1/trace/myFollowerList":2,"mix/v1/trace/removeFollower":2,"mix/v1/trace/public/getFollowerConfig":2,"mix/v1/trace/report/order/historyList":2,"mix/v1/trace/report/order/currentList":2,"mix/v1/trace/queryTraderTpslRatioConfig":2,"mix/v1/trace/traderUpdateTpslRatioConfig":2,"v2/mix/account/set-leverage":4,"v2/mix/account/set-margin":4,"v2/mix/account/set-margin-mode":4,"v2/mix/account/set-position-mode":4,"v2/mix/order/place-order":2,"v2/mix/order/click-backhand":20,"v2/mix/order/batch-place-order":20,"v2/mix/order/modify-order":2,"v2/mix/order/cancel-order":2,"v2/mix/order/batch-cancel-orders":2,"v2/mix/order/close-positions":20,"v2/mix/order/place-tpsl-order":2,"v2/mix/order/place-plan-order":2,"v2/mix/order/modify-tpsl-order":2,"v2/mix/order/modify-plan-order":2,"v2/mix/order/cancel-plan-order":2}},user:{get:{"user/v1/fee/query":2,"user/v1/sub/virtual-list":2,"user/v1/sub/virtual-api-list":2,"user/v1/tax/spot-record":1,"user/v1/tax/future-record":1,"user/v1/tax/margin-record":1,"user/v1/tax/p2p-record":1,"v2/user/virtual-subaccount-list":2,"v2/user/virtual-subaccount-apikey-list":2},post:{"user/v1/sub/virtual-create":4,"user/v1/sub/virtual-modify":4,"user/v1/sub/virtual-api-batch-create":20,"user/v1/sub/virtual-api-create":4,"user/v1/sub/virtual-api-modify":4,"v2/user/create-virtual-subaccount":4,"v2/user/modify-virtual-subaccount":4,"v2/user/batch-create-subaccount-and-apikey":20,"v2/user/create-virtual-subaccount-apikey":4,"v2/user/modify-virtual-subaccount-apikey":4}},p2p:{get:{"p2p/v1/merchant/merchantList":2,"p2p/v1/merchant/merchantInfo":2,"p2p/v1/merchant/advList":2,"p2p/v1/merchant/orderList":2,"v2/p2p/merchantList":2,"v2/p2p/merchantInfo":2,"v2/p2p/orderList":2,"v2/p2p/advList":2}},broker:{get:{"broker/v1/account/info":2,"broker/v1/account/sub-list":20,"broker/v1/account/sub-email":20,"broker/v1/account/sub-spot-assets":2,"broker/v1/account/sub-future-assets":2,"broker/v1/account/subaccount-transfer":1,"broker/v1/account/subaccount-deposit":1,"broker/v1/account/subaccount-withdrawal":1,"broker/v1/account/sub-api-list":2,"v2/broker/account/info":2,"v2/broker/account/subaccount-list":20,"v2/broker/account/subaccount-email":2,"v2/broker/account/subaccount-spot-assets":2,"v2/broker/account/subaccount-future-assets":2,"v2/broker/manage/subaccount-apikey-list":2},post:{"broker/v1/account/sub-create":20,"broker/v1/account/sub-modify":20,"broker/v1/account/sub-modify-email":20,"broker/v1/account/sub-address":2,"broker/v1/account/sub-withdrawal":2,"broker/v1/account/sub-auto-transfer":4,"broker/v1/account/sub-api-create":2,"broker/v1/account/sub-api-modify":2,"v2/broker/account/modify-subaccount-email":2,"v2/broker/account/create-subaccount":20,"v2/broker/account/modify-subaccount":20,"v2/broker/account/subaccount-address":2,"v2/broker/account/subaccount-withdrawal":2,"v2/broker/account/set-subaccount-autotransfer":2,"v2/broker/manage/create-subaccount-apikey":2,"v2/broker/manage/modify-subaccount-apikey":2}},margin:{get:{"margin/v1/cross/account/riskRate":2,"margin/v1/cross/account/maxTransferOutAmount":2,"margin/v1/isolated/account/maxTransferOutAmount":2,"margin/v1/isolated/order/openOrders":2,"margin/v1/isolated/order/history":2,"margin/v1/isolated/order/fills":2,"margin/v1/isolated/loan/list":2,"margin/v1/isolated/repay/list":2,"margin/v1/isolated/interest/list":2,"margin/v1/isolated/liquidation/list":2,"margin/v1/isolated/fin/list":2,"margin/v1/cross/order/openOrders":2,"margin/v1/cross/order/history":2,"margin/v1/cross/order/fills":2,"margin/v1/cross/loan/list":2,"margin/v1/cross/repay/list":2,"margin/v1/cross/interest/list":2,"margin/v1/cross/liquidation/list":2,"margin/v1/cross/fin/list":2,"margin/v1/cross/account/assets":2,"margin/v1/isolated/account/assets":2,"v2/margin/crossed/borrow-history":2,"v2/margin/crossed/repay-history":2,"v2/margin/crossed/interest-history":2,"v2/margin/crossed/liquidation-history":2,"v2/margin/crossed/financial-records":2,"v2/margin/crossed/account/assets":2,"v2/margin/crossed/account/risk-rate":2,"v2/margin/crossed/account/max-borrowable-amount":2,"v2/margin/crossed/account/max-transfer-out-amount":2,"v2/margin/crossed/interest-rate-and-limit":2,"v2/margin/crossed/tier-data":2,"v2/margin/crossed/open-orders":2,"v2/margin/crossed/history-orders":2,"v2/margin/crossed/fills":2,"v2/margin/isolated/borrow-history":2,"v2/margin/isolated/repay-history":2,"v2/margin/isolated/interest-history":2,"v2/margin/isolated/liquidation-history":2,"v2/margin/isolated/financial-records":2,"v2/margin/isolated/account/assets":2,"v2/margin/isolated/account/risk-rate":2,"v2/margin/isolated/account/max-borrowable-amount":2,"v2/margin/isolated/account/max-transfer-out-amount":2,"v2/margin/isolated/interest-rate-and-limit":2,"v2/margin/isolated/tier-data":2,"v2/margin/isolated/open-orders":2,"v2/margin/isolated/history-orders":2,"v2/margin/isolated/fills":2},post:{"margin/v1/cross/account/borrow":2,"margin/v1/isolated/account/borrow":2,"margin/v1/cross/account/repay":2,"margin/v1/isolated/account/repay":2,"margin/v1/isolated/account/riskRate":2,"margin/v1/cross/account/maxBorrowableAmount":2,"margin/v1/isolated/account/maxBorrowableAmount":2,"margin/v1/isolated/account/flashRepay":2,"margin/v1/isolated/account/queryFlashRepayStatus":2,"margin/v1/cross/account/flashRepay":2,"margin/v1/cross/account/queryFlashRepayStatus":2,"margin/v1/isolated/order/placeOrder":4,"margin/v1/isolated/order/batchPlaceOrder":4,"margin/v1/isolated/order/cancelOrder":2,"margin/v1/isolated/order/batchCancelOrder":2,"margin/v1/cross/order/placeOrder":2,"margin/v1/cross/order/batchPlaceOrder":2,"margin/v1/cross/order/cancelOrder":2,"margin/v1/cross/order/batchCancelOrder":2,"v2/margin/crossed/account/borrow":2,"v2/margin/crossed/account/repay":2,"v2/margin/crossed/account/flash-repay":2,"v2/margin/crossed/account/query-flash-repay-status":2,"v2/margin/crossed/place-order":2,"v2/margin/crossed/batch-place-order":2,"v2/margin/crossed/cancel-order":2,"v2/margin/crossed/batch-cancel-order":2,"v2/margin/isolated/account/borrow":2,"v2/margin/isolated/account/repay":2,"v2/margin/isolated/account/flash-repay":2,"v2/margin/isolated/account/query-flash-repay-status":2,"v2/margin/isolated/place-order":2,"v2/margin/isolated/batch-place-order":2,"v2/margin/isolated/cancel-order":2,"v2/margin/isolated/batch-cancel-order":2}},copy:{get:{"v2/copy/mix-trader/order-current-track":2,"v2/copy/mix-trader/order-history-track":2,"v2/copy/mix-trader/order-total-detail":2,"v2/copy/mix-trader/profit-history-summarys":1,"v2/copy/mix-trader/profit-history-details":1,"v2/copy/mix-trader/profit-details":1,"v2/copy/mix-trader/profits-group-coin-date":1,"v2/copy/mix-trader/config-query-symbols":1,"v2/copy/mix-trader/config-query-followers":2,"v2/copy/mix-follower/query-current-orders":2,"v2/copy/mix-follower/query-history-orders":1,"v2/copy/mix-follower/query-settings":2,"v2/copy/mix-follower/query-traders":2,"v2/copy/mix-follower/query-quantity-limit":2,"v2/copy/mix-broker/query-traders":2,"v2/copy/mix-broker/query-history-traces":2,"v2/copy/mix-broker/query-current-traces":2,"v2/copy/spot-trader/profit-summarys":2,"v2/copy/spot-trader/profit-history-details":2,"v2/copy/spot-trader/profit-details":2,"v2/copy/spot-trader/order-total-detail":2,"v2/copy/spot-trader/order-history-track":2,"v2/copy/spot-trader/order-current-track":2,"v2/copy/spot-trader/config-query-settings":2,"v2/copy/spot-trader/config-query-followers":2,"v2/copy/spot-follower/query-traders":2,"v2/copy/spot-follower/query-trader-symbols":2,"v2/copy/spot-follower/query-settings":2,"v2/copy/spot-follower/query-history-orders":2,"v2/copy/spot-follower/query-current-orders":2},post:{"v2/copy/mix-trader/order-modify-tpsl":2,"v2/copy/mix-trader/order-close-positions":2,"v2/copy/mix-trader/config-setting-symbols":2,"v2/copy/mix-trader/config-setting-base":2,"v2/copy/mix-trader/config-remove-follower":2,"v2/copy/mix-follower/setting-tpsl":1,"v2/copy/mix-follower/settings":2,"v2/copy/mix-follower/close-positions":2,"v2/copy/mix-follower/cancel-trader":4,"v2/copy/spot-trader/order-modify-tpsl":2,"v2/copy/spot-trader/order-close-tracking":2,"v2/copy/spot-trader/config-setting-symbols":2,"v2/copy/spot-trader/config-remove-follower":2,"v2/copy/spot-follower/stop-order":2,"v2/copy/spot-follower/settings":2,"v2/copy/spot-follower/setting-tpsl":2,"v2/copy/spot-follower/order-close-tracking":2,"v2/copy/spot-follower/cancel-trader":2}},tax:{get:{"v2/tax/spot-record":20,"v2/tax/future-record":20,"v2/tax/margin-record":20,"v2/tax/p2p-record":20}},convert:{get:{"v2/convert/currencies":2,"v2/convert/quoted-price":2,"v2/convert/convert-record":2,"v2/convert/bgb-convert-coin-list":2,"v2/convert/bgb-convert-records":2},post:{"v2/convert/trade":2,"v2/convert/bgb-convert":2}},earn:{get:{"v2/earn/savings/product":2,"v2/earn/savings/account":2,"v2/earn/savings/assets":2,"v2/earn/savings/records":2,"v2/earn/savings/subscribe-info":2,"v2/earn/savings/subscribe-result":2,"v2/earn/savings/redeem-result":2,"v2/earn/sharkfin/product":2,"v2/earn/sharkfin/account":2,"v2/earn/sharkfin/assets":2,"v2/earn/sharkfin/records":2,"v2/earn/sharkfin/subscribe-info":2,"v2/earn/sharkfin/subscribe-result":4,"v2/earn/loan/ongoing-orders":2,"v2/earn/loan/repay-history":2,"v2/earn/loan/revise-history":2,"v2/earn/loan/borrow-history":2,"v2/earn/loan/debts":2,"v2/earn/loan/reduces":2,"v2/earn/account/assets":2},post:{"v2/earn/savings/subscribe":2,"v2/earn/savings/redeem":2,"v2/earn/sharkfin/subscribe":2,"v2/earn/loan/borrow":2,"v2/earn/loan/repay":2,"v2/earn/loan/revise-pledge":2}},common:{get:{"v2/common/trade-rate":2}},uta:{get:{"v3/account/assets":1,"v3/account/settings":1,"v3/account/financial-records":1,"v3/account/repayable-coins":2,"v3/account/payment-coins":2,"v3/account/convert-records":1,"v3/account/transferable-coins":2,"v3/account/sub-transfer-record":4,"v3/ins-loan/transfered":6.6667,"v3/ins-loan/symbols":6.6667,"v3/ins-loan/risk-unit":6.6667,"v3/ins-loan/repaid-history":6.6667,"v3/ins-loan/product-infos":6.6667,"v3/ins-loan/loan-order":6.6667,"v3/ins-loan/ltv-convert":6.6667,"v3/ins-loan/ensure-coins-convert":6.6667,"v3/position/current-position":1,"v3/position/history-position":1,"v3/trade/order-info":1,"v3/trade/unfilled-orders":1,"v3/trade/history-orders":1,"v3/trade/fills":1,"v3/user/sub-list":2,"v3/user/sub-api-list":2},post:{"v3/account/set-leverage":2,"v3/account/set-hold-mode":2,"v3/account/repay":4,"v3/account/transfer":4,"v3/account/sub-transfer":4,"v3/account/max-open-available":4,"v3/ins-loan/bind-uid":6.6667,"v3/trade/place-order":2,"v3/trade/modify-order":2,"v3/trade/cancel-order":2,"v3/trade/place-batch":4,"v3/trade/batch-modify-order":2,"v3/trade/cancel-batch":4,"v3/trade/cancel-symbol-order":4,"v3/trade/close-positions":4,"v3/user/create-sub":2,"v3/user/freeze-sub":2,"v3/user/create-sub-api":2,"v3/user/update-sub-api":2,"v3/user/delete-sub-api":2}}}},fees:{spot:{taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")},swap:{taker:this.parseNumber("0.0006"),maker:this.parseNumber("0.0004")}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},exceptions:{exact:{1:r.ExchangeError,"failure to get a peer from the ring-balancer":r.ExchangeNotAvailable,4010:r.PermissionDenied,4001:r.ExchangeError,4002:r.ExchangeError,30001:r.AuthenticationError,30002:r.AuthenticationError,30003:r.AuthenticationError,30004:r.AuthenticationError,30005:r.InvalidNonce,30006:r.AuthenticationError,30007:r.BadRequest,30008:r.RequestTimeout,30009:r.ExchangeError,30010:r.AuthenticationError,30011:r.PermissionDenied,30012:r.AuthenticationError,30013:r.AuthenticationError,30014:r.DDoSProtection,30015:r.AuthenticationError,30016:r.ExchangeError,30017:r.ExchangeError,30018:r.ExchangeError,30019:r.ExchangeNotAvailable,30020:r.BadRequest,30021:r.BadRequest,30022:r.PermissionDenied,30023:r.BadRequest,30024:r.BadSymbol,30025:r.BadRequest,30026:r.DDoSProtection,30027:r.AuthenticationError,30028:r.PermissionDenied,30029:r.AccountSuspended,30030:r.ExchangeError,30031:r.BadRequest,30032:r.BadSymbol,30033:r.BadRequest,30034:r.ExchangeError,30035:r.ExchangeError,30036:r.ExchangeError,30037:r.ExchangeNotAvailable,30038:r.OnMaintenance,32001:r.AccountSuspended,32002:r.PermissionDenied,32003:r.CancelPending,32004:r.ExchangeError,32005:r.InvalidOrder,32006:r.InvalidOrder,32007:r.InvalidOrder,32008:r.InvalidOrder,32009:r.InvalidOrder,32010:r.ExchangeError,32011:r.ExchangeError,32012:r.ExchangeError,32013:r.ExchangeError,32014:r.ExchangeError,32015:r.ExchangeError,32016:r.ExchangeError,32017:r.ExchangeError,32018:r.ExchangeError,32019:r.ExchangeError,32020:r.ExchangeError,32021:r.ExchangeError,32022:r.ExchangeError,32023:r.ExchangeError,32024:r.ExchangeError,32025:r.ExchangeError,32026:r.ExchangeError,32027:r.ExchangeError,32028:r.AccountSuspended,32029:r.ExchangeError,32030:r.InvalidOrder,32031:r.ArgumentsRequired,32038:r.AuthenticationError,32040:r.ExchangeError,32044:r.ExchangeError,32045:r.ExchangeError,32046:r.ExchangeError,32047:r.ExchangeError,32048:r.InvalidOrder,32049:r.ExchangeError,32050:r.InvalidOrder,32051:r.InvalidOrder,32052:r.ExchangeError,32053:r.ExchangeError,32057:r.ExchangeError,32054:r.ExchangeError,32055:r.InvalidOrder,32056:r.ExchangeError,32058:r.ExchangeError,32059:r.InvalidOrder,32060:r.InvalidOrder,32061:r.InvalidOrder,32062:r.InvalidOrder,32063:r.InvalidOrder,32064:r.ExchangeError,32065:r.ExchangeError,32066:r.ExchangeError,32067:r.ExchangeError,32068:r.ExchangeError,32069:r.ExchangeError,32070:r.ExchangeError,32071:r.ExchangeError,32072:r.ExchangeError,32073:r.ExchangeError,32074:r.ExchangeError,32075:r.ExchangeError,32076:r.ExchangeError,32077:r.ExchangeError,32078:r.ExchangeError,32079:r.ExchangeError,32080:r.ExchangeError,32083:r.ExchangeError,33001:r.PermissionDenied,33002:r.AccountSuspended,33003:r.InsufficientFunds,33004:r.ExchangeError,33005:r.ExchangeError,33006:r.ExchangeError,33007:r.ExchangeError,33008:r.InsufficientFunds,33009:r.ExchangeError,33010:r.ExchangeError,33011:r.ExchangeError,33012:r.ExchangeError,33013:r.InvalidOrder,33014:r.OrderNotFound,33015:r.InvalidOrder,33016:r.ExchangeError,33017:r.InsufficientFunds,33018:r.ExchangeError,33020:r.ExchangeError,33021:r.BadRequest,33022:r.InvalidOrder,33023:r.ExchangeError,33024:r.InvalidOrder,33025:r.InvalidOrder,33026:r.ExchangeError,33027:r.InvalidOrder,33028:r.InvalidOrder,33029:r.InvalidOrder,33034:r.ExchangeError,33035:r.ExchangeError,33036:r.ExchangeError,33037:r.ExchangeError,33038:r.ExchangeError,33039:r.ExchangeError,33040:r.ExchangeError,33041:r.ExchangeError,33042:r.ExchangeError,33043:r.ExchangeError,33044:r.ExchangeError,33045:r.ExchangeError,33046:r.ExchangeError,33047:r.ExchangeError,33048:r.ExchangeError,33049:r.ExchangeError,33050:r.ExchangeError,33051:r.ExchangeError,33059:r.BadRequest,33060:r.BadRequest,33061:r.ExchangeError,33062:r.ExchangeError,33063:r.ExchangeError,33064:r.ExchangeError,33065:r.ExchangeError,21009:r.ExchangeError,34001:r.PermissionDenied,34002:r.InvalidAddress,34003:r.ExchangeError,34004:r.ExchangeError,34005:r.ExchangeError,34006:r.ExchangeError,34007:r.ExchangeError,34008:r.InsufficientFunds,34009:r.ExchangeError,34010:r.ExchangeError,34011:r.ExchangeError,34012:r.ExchangeError,34013:r.ExchangeError,34014:r.ExchangeError,34015:r.ExchangeError,34016:r.PermissionDenied,34017:r.AccountSuspended,34018:r.AuthenticationError,34019:r.PermissionDenied,34020:r.PermissionDenied,34021:r.InvalidAddress,34022:r.ExchangeError,34023:r.PermissionDenied,34026:r.ExchangeError,34036:r.ExchangeError,34037:r.ExchangeError,34038:r.ExchangeError,34039:r.ExchangeError,35001:r.ExchangeError,35002:r.ExchangeError,35003:r.ExchangeError,35004:r.ExchangeError,35005:r.AuthenticationError,35008:r.InvalidOrder,35010:r.InvalidOrder,35012:r.InvalidOrder,35014:r.InvalidOrder,35015:r.InvalidOrder,35017:r.ExchangeError,35019:r.InvalidOrder,35020:r.InvalidOrder,35021:r.InvalidOrder,35022:r.ExchangeError,35024:r.ExchangeError,35025:r.InsufficientFunds,35026:r.ExchangeError,35029:r.OrderNotFound,35030:r.InvalidOrder,35031:r.InvalidOrder,35032:r.ExchangeError,35037:r.ExchangeError,35039:r.ExchangeError,35040:r.InvalidOrder,35044:r.ExchangeError,35046:r.InsufficientFunds,35047:r.InsufficientFunds,35048:r.ExchangeError,35049:r.InvalidOrder,35050:r.InvalidOrder,35052:r.InsufficientFunds,35053:r.ExchangeError,35055:r.InsufficientFunds,35057:r.ExchangeError,35058:r.ExchangeError,35059:r.BadRequest,35060:r.BadRequest,35061:r.BadRequest,35062:r.InvalidOrder,35063:r.InvalidOrder,35064:r.InvalidOrder,35066:r.InvalidOrder,35067:r.InvalidOrder,35068:r.InvalidOrder,35069:r.InvalidOrder,35070:r.InvalidOrder,35071:r.InvalidOrder,35072:r.InvalidOrder,35073:r.InvalidOrder,35074:r.InvalidOrder,35075:r.InvalidOrder,35076:r.InvalidOrder,35077:r.InvalidOrder,35078:r.InvalidOrder,35079:r.InvalidOrder,35080:r.InvalidOrder,35081:r.InvalidOrder,35082:r.InvalidOrder,35083:r.InvalidOrder,35084:r.InvalidOrder,35085:r.InvalidOrder,35086:r.InvalidOrder,35087:r.InvalidOrder,35088:r.InvalidOrder,35089:r.InvalidOrder,35090:r.ExchangeError,35091:r.ExchangeError,35092:r.ExchangeError,35093:r.ExchangeError,35094:r.ExchangeError,35095:r.BadRequest,35096:r.ExchangeError,35097:r.ExchangeError,35098:r.ExchangeError,35099:r.ExchangeError,36001:r.BadRequest,36002:r.BadRequest,36005:r.ExchangeError,36101:r.AuthenticationError,36102:r.PermissionDenied,36103:r.AccountSuspended,36104:r.PermissionDenied,36105:r.PermissionDenied,36106:r.AccountSuspended,36107:r.PermissionDenied,36108:r.InsufficientFunds,36109:r.PermissionDenied,36201:r.PermissionDenied,36202:r.PermissionDenied,36203:r.InvalidOrder,36204:r.ExchangeError,36205:r.BadRequest,36206:r.BadRequest,36207:r.InvalidOrder,36208:r.InvalidOrder,36209:r.InvalidOrder,36210:r.InvalidOrder,36211:r.InvalidOrder,36212:r.InvalidOrder,36213:r.InvalidOrder,36214:r.ExchangeError,36216:r.OrderNotFound,36217:r.InvalidOrder,36218:r.InvalidOrder,36219:r.InvalidOrder,36220:r.InvalidOrder,36221:r.InvalidOrder,36222:r.InvalidOrder,36223:r.InvalidOrder,36224:r.InvalidOrder,36225:r.InvalidOrder,36226:r.InvalidOrder,36227:r.InvalidOrder,36228:r.InvalidOrder,36229:r.InvalidOrder,36230:r.InvalidOrder,400:r.BadRequest,401:r.AuthenticationError,403:r.PermissionDenied,404:r.BadRequest,405:r.BadRequest,415:r.BadRequest,429:r.DDoSProtection,500:r.ExchangeNotAvailable,1001:r.RateLimitExceeded,1002:r.ExchangeError,1003:r.ExchangeError,40001:r.AuthenticationError,40002:r.AuthenticationError,40003:r.AuthenticationError,40004:r.InvalidNonce,40005:r.InvalidNonce,40006:r.AuthenticationError,40007:r.BadRequest,40008:r.InvalidNonce,40009:r.AuthenticationError,40010:r.AuthenticationError,40011:r.AuthenticationError,40012:r.AuthenticationError,40013:r.ExchangeError,40014:r.PermissionDenied,40015:r.ExchangeError,40016:r.PermissionDenied,40017:r.ExchangeError,40018:r.PermissionDenied,40019:r.BadRequest,40031:r.AccountSuspended,40037:r.AuthenticationError,40102:r.BadRequest,40103:r.BadRequest,40104:r.ExchangeError,40105:r.ExchangeError,40106:r.ExchangeError,40107:r.ExchangeError,40108:r.InvalidOrder,40109:r.OrderNotFound,40200:r.OnMaintenance,40201:r.InvalidOrder,40202:r.ExchangeError,40203:r.BadRequest,40204:r.BadRequest,40205:r.BadRequest,40206:r.BadRequest,40207:r.BadRequest,40208:r.BadRequest,40209:r.BadRequest,40300:r.ExchangeError,40301:r.PermissionDenied,40302:r.BadRequest,40303:r.BadRequest,40304:r.BadRequest,40305:r.BadRequest,40306:r.ExchangeError,40308:r.OnMaintenance,40309:r.BadSymbol,40400:r.ExchangeError,40401:r.ExchangeError,40402:r.BadRequest,40403:r.BadRequest,40404:r.BadRequest,40405:r.BadRequest,40406:r.BadRequest,40407:r.ExchangeError,40408:r.ExchangeError,40409:r.ExchangeError,40500:r.InvalidOrder,40501:r.ExchangeError,40502:r.ExchangeError,40503:r.ExchangeError,40504:r.ExchangeError,40505:r.ExchangeError,40506:r.AuthenticationError,40507:r.AuthenticationError,40508:r.ExchangeError,40509:r.ExchangeError,40600:r.ExchangeError,40601:r.ExchangeError,40602:r.ExchangeError,40603:r.ExchangeError,40604:r.ExchangeNotAvailable,40605:r.ExchangeError,40606:r.ExchangeError,40607:r.ExchangeError,40608:r.ExchangeError,40609:r.ExchangeError,40700:r.BadRequest,40701:r.ExchangeError,40702:r.ExchangeError,40703:r.ExchangeError,40704:r.ExchangeError,40705:r.BadRequest,40706:r.InvalidOrder,40707:r.BadRequest,40708:r.BadRequest,40709:r.ExchangeError,40710:r.ExchangeError,40711:r.InsufficientFunds,40712:r.InsufficientFunds,40713:r.ExchangeError,40714:r.ExchangeError,40762:r.InsufficientFunds,40768:r.OrderNotFound,40808:r.InvalidOrder,41103:r.InvalidOrder,41114:r.OnMaintenance,43011:r.InvalidOrder,43001:r.OrderNotFound,43012:r.InsufficientFunds,43025:r.InvalidOrder,43115:r.OnMaintenance,45110:r.InvalidOrder,"invalid sign":r.AuthenticationError,"invalid currency":r.BadSymbol,"invalid symbol":r.BadSymbol,"invalid period":r.BadRequest,"invalid user":r.ExchangeError,"invalid amount":r.InvalidOrder,"invalid type":r.InvalidOrder,"invalid orderId":r.InvalidOrder,"invalid record":r.ExchangeError,"invalid accountId":r.BadRequest,"invalid address":r.BadRequest,"accesskey not null":r.AuthenticationError,"illegal accesskey":r.AuthenticationError,"sign not null":r.AuthenticationError,"req_time is too much difference from server time":r.InvalidNonce,"permissions not right":r.PermissionDenied,"illegal sign invalid":r.AuthenticationError,"user locked":r.AccountSuspended,"Request Frequency Is Too High":r.RateLimitExceeded,"more than a daily rate of cash":r.BadRequest,"more than the maximum daily withdrawal amount":r.BadRequest,"need to bind email or mobile":r.ExchangeError,"user forbid":r.PermissionDenied,"User Prohibited Cash Withdrawal":r.PermissionDenied,"Cash Withdrawal Is Less Than The Minimum Value":r.BadRequest,"Cash Withdrawal Is More Than The Maximum Value":r.BadRequest,"the account with in 24 hours ban coin":r.PermissionDenied,"order cancel fail":r.BadRequest,"base symbol error":r.BadSymbol,"base date error":r.ExchangeError,"api signature not valid":r.AuthenticationError,"gateway internal error":r.ExchangeError,"audit failed":r.ExchangeError,"order queryorder invalid":r.BadRequest,"market no need price":r.InvalidOrder,"limit need price":r.InvalidOrder,"userid not equal to account_id":r.ExchangeError,"your balance is low":r.InsufficientFunds,"address invalid cointype":r.ExchangeError,"system exception":r.ExchangeError,50003:r.ExchangeError,50004:r.BadSymbol,50006:r.PermissionDenied,50007:r.PermissionDenied,50008:r.RequestTimeout,50009:r.RateLimitExceeded,50010:r.ExchangeError,50014:r.InvalidOrder,50015:r.InvalidOrder,50016:r.InvalidOrder,50017:r.InvalidOrder,50018:r.InvalidOrder,50019:r.InvalidOrder,50020:r.InsufficientFunds,50021:r.InvalidOrder,50026:r.InvalidOrder,"invalid order query time":r.ExchangeError,"invalid start time":r.BadRequest,"invalid end time":r.BadRequest,20003:r.ExchangeError,"01001":r.ExchangeError,43111:r.PermissionDenied},broad:{"invalid size, valid range":r.ExchangeError}},precisionMode:o.kb,commonCurrencies:{APX:"AstroPepeX",DEGEN:"DegenReborn",JADE:"Jade Protocol",OMNI:"omni",TONCOIN:"TON"},options:{uta:!1,timeDifference:0,adjustForTimeDifference:!1,timeframes:{spot:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1h","4h":"4h","6h":"6Hutc","12h":"12Hutc","1d":"1Dutc","3d":"3Dutc","1w":"1Wutc","1M":"1Mutc"},swap:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6Hutc","12h":"12Hutc","1d":"1Dutc","3d":"3Dutc","1w":"1Wutc","1M":"1Mutc"}},fetchMarkets:{types:["spot","swap"]},defaultType:"spot",defaultSubType:"linear",createMarketBuyOrderRequiresPrice:!0,broker:"p4sve",withdraw:{fillResponseFromRequest:!0},fetchOHLCV:{maxRecentDaysPerTimeframe:{"1m":30,"3m":30,"5m":30,"15m":30,"30m":30,"1h":60,"4h":240,"6h":360,"12h":720,"1d":1440,"3d":4320,"1w":10080,"1M":43200},spot:{maxLimitPerTimeframe:{"1d":300,"3d":100,"1w":100,"1M":100},method:"publicSpotGetV2SpotMarketCandles"},swap:{maxLimitPerTimeframe:{"4h":540,"6h":360,"12h":180,"1d":90,"3d":30,"1w":13,"1M":4},method:"publicMixGetV2MixMarketCandles"}},fetchTrades:{spot:{method:"publicSpotGetV2SpotMarketFillsHistory"},swap:{method:"publicMixGetV2MixMarketFillsHistory"}},fetchFundingRate:{method:"publicMixGetV2MixMarketCurrentFundRate"},accountsByType:{spot:"spot",cross:"crossed_margin",isolated:"isolated_margin",swap:"usdt_futures",usdc_swap:"usdc_futures",future:"coin_futures",p2p:"p2p"},accountsById:{spot:"spot",crossed_margin:"cross",isolated_margin:"isolated",usdt_futures:"swap",usdc_futures:"usdc_swap",coin_futures:"future",p2p:"p2p"},sandboxMode:!1,networks:{TRC20:"TRC20",ERC20:"ERC20",BEP20:"BSC",BSC:"BEP20",ATOM:"ATOM",ACA:"AcalaToken",APT:"Aptos",ARBONE:"ArbitrumOne",ARBNOVA:"ArbitrumNova",AVAXC:"C-Chain",AVAXX:"X-Chain",AR:"Arweave",BCH:"BCH",BCHA:"BCHA",BITCI:"BITCI",BTC:"BTC",CELO:"CELO",CSPR:"CSPR",ADA:"Cardano",CHZ:"ChilizChain",CRC20:"CronosChain",DOGE:"DOGE",DOT:"DOT",EOS:"EOS",ETHF:"ETHFAIR",ETHW:"ETHW",ETC:"ETC",EGLD:"Elrond",FIL:"FIL",FIO:"FIO",FTM:"Fantom",HRC20:"HECO",ONE:"Harmony",HNT:"Helium",ICP:"ICP",IOTX:"IoTeX",KARDIA:"KAI",KAVA:"KAVA",KDA:"KDA",KLAY:"Klaytn",KSM:"Kusama",LAT:"LAT",LTC:"LTC",MINA:"MINA",MOVR:"MOVR",METIS:"MetisToken",GLMR:"Moonbeam",NEAR:"NEARProtocol",NULS:"NULS",OASYS:"OASYS",OASIS:"ROSE",OMNI:"OMNI",ONT:"Ontology",OPTIMISM:"Optimism",OSMO:"Osmosis",POKT:"PocketNetwork",MATIC:"Polygon",QTUM:"QTUM",REEF:"REEF",SOL:"SOL",SYS:"SYS",SXP:"Solar",XYM:"Symbol",TON:"TON",TT:"TT",TLOS:"Telos",THETA:"ThetaToken",VITE:"VITE",WAVES:"WAVES",WAX:"WAXP",WEMIX:"WEMIXMainnet",XDC:"XDCNetworkXDC",XRP:"XRP",FET:"FETCH",NEM:"NEM",REI:"REINetwork",ZIL:"ZIL",ABBC:"ABBCCoin",RSK:"RSK",AZERO:"AZERO",TRC10:"TRC10",JUNO:"JUNO",ZKSYNC:"zkSyncEra",STARKNET:"Starknet",VIC:"VICTION"},networksById:{},fetchPositions:{method:"privateMixGetV2MixPositionAllPosition"},defaultTimeInForce:"GTC",fiatCurrencies:["EUR","VND","PLN","CZK","HUF","DKK","AUD","CAD","NOK","SEK","CHF","MXN","COP","ARS","GBP","BRL","UAH","ZAR"]},features:{spot:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!1},triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:{last:!1,mark:!1,index:!1},price:!0},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,marketBuyRequiresPrice:!0,marketBuyByCost:!0},createOrders:{max:50},fetchMyTrades:{marginMode:!0,limit:100,daysBack:void 0,untilDays:90,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:100,trigger:!0,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,limit:100,daysBack:void 0,daysBackCanceled:void 0,untilDays:90,trigger:!0,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:200}},forPerps:{extends:"spot",createOrder:{triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!1},triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!0,index:!0},price:!1},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!0,trailing:!0,marketBuyRequiresPrice:!1,marketBuyByCost:!1},fetchMyTrades:{untilDays:7},fetchClosedOrders:{trailing:!0}},swap:{linear:{extends:"forPerps"},inverse:{extends:"forPerps"}},future:{linear:{extends:"forPerps"},inverse:{extends:"forPerps"}}}})}setSandboxMode(e){this.options.sandboxMode=e}handleProductTypeAndParams(e=void 0,t={}){let i,s;[i,t]=this.handleSubTypeAndParams("handleProductTypeAndParams",void 0,t),void 0!==i&&void 0===e&&(s="linear"===i?"USDT-FUTURES":"COIN-FUTURES");let a=this.safeString(t,"productType",s);if(void 0===a&&void 0!==e){const t=e.settle;a="USDT"===t?"USDT-FUTURES":"USDC"===t?"USDC-FUTURES":"SUSDT"===t?"SUSDT-FUTURES":"SUSDC"===t?"SUSDC-FUTURES":"SBTC"===t||"SETH"===t||"SEOS"===t?"SCOIN-FUTURES":"COIN-FUTURES"}if(void 0===a)throw new r.ArgumentsRequired(this.id+' requires a productType param, one of "USDT-FUTURES", "USDC-FUTURES", "COIN-FUTURES", "SUSDT-FUTURES", "SUSDC-FUTURES" or "SCOIN-FUTURES"');return[a,t=this.omit(t,"productType")]}async fetchTime(e={}){const t=await this.publicCommonGetV2PublicTime(e),i=this.safeValue(t,"data",{});return this.safeInteger(i,"serverTime")}async fetchMarkets(e={}){let t;return this.options.adjustForTimeDifference&&await this.loadTimeDifference(),[t,e]=this.handleOptionAndParams(e,"fetchMarkets","uta",!1),t?await this.fetchUtaMarkets(e):await this.fetchDefaultMarkets(e)}async fetchDefaultMarkets(e){let t;const i=this.safeDict(this.options,"fetchMarkets"),s=["spot","swap"];t=void 0!==i?this.safeList(i,"types",s):this.safeList(this.options,"fetchMarkets",s);const o=[];let n=!1;for(let i=0;ie*u&&(I=this.sum(P,e*u),l.endTime=I)}if(l.limit=s,d.spot)x=_?await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(l,r)):await this.publicSpotGetV2SpotMarketCandles(this.extend(l,r));else{let e,t;[e,r]=this.handleParamString(r,"price"),[t,r]=this.handleProductTypeAndParams(d,r),l.productType=t;const i=this.extend(l,r);x="mark"===e?await this.publicMixGetV2MixMarketHistoryMarkCandles(i):"index"===e?await this.publicMixGetV2MixMarketHistoryIndexCandles(i):_?await this.publicMixGetV2MixMarketHistoryCandles(i):await this.publicMixGetV2MixMarketCandles(i)}if(""===x)return[];const A=this.safeList(x,"data",x);return this.parseOHLCVs(A,d,t,i,s)}async fetchBalance(e={}){await this.loadMarkets();const t={};let i,s,a;if([i,e]=this.handleMarketTypeAndParams("fetchBalance",void 0,e),[s,e]=this.handleMarginModeAndParams("fetchBalance",e),"swap"===i||"future"===i){let i;[i,e]=this.handleProductTypeAndParams(void 0,e),t.productType=i,a=await this.privateMixGetV2MixAccountAccounts(this.extend(t,e))}else if("isolated"===s)a=await this.privateMarginGetMarginV1IsolatedAccountAssets(this.extend(t,e));else if("cross"===s)a=await this.privateMarginGetMarginV1CrossAccountAssets(this.extend(t,e));else{if("spot"!==i)throw new r.NotSupported(this.id+" fetchBalance() does not support "+i+" accounts");a=await this.privateSpotGetV2SpotAccountAssets(this.extend(t,e))}const o=this.safeValue(a,"data",[]);return this.parseBalance(o)}parseBalance(e){const t={info:e};for(let i=0;i1)throw new r.ExchangeError(this.id+" createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent");"limit"===t&&(l.price=this.priceToPrecision(e,o));const x=this.safeString2(n,"triggerPriceType","triggerType","mark_price"),_=this.safeBool(n,"reduceOnly",!1),A=this.safeString2(n,"clientOid","clientOrderId"),C=this.safeString2(n,"force","timeInForce");let B;[B,n]=this.handlePostOnly(u,"post_only"===C,n);const E=this.safeStringUpper(this.options,"defaultTimeInForce"),N=this.safeStringUpper(n,"timeInForce",E);if(B?l.force="post_only":"GTC"===N?l.force="GTC":"FOK"===N?l.force="FOK":"IOC"===N&&(l.force="IOC"),n=this.omit(n,["stopPrice","triggerType","stopLossPrice","takeProfitPrice","stopLoss","takeProfit","postOnly","reduceOnly","clientOrderId","trailingPercent","trailingTriggerPrice"]),"swap"===h||"future"===h){let t;if(l.marginCoin=d.settleId,l.size=this.amountToPrecision(e,s),[t,n]=this.handleProductTypeAndParams(d,n),l.productType=t,void 0!==A&&(l.clientOid=A),(y||O||M)&&(l.triggerType=x),M){if(!u)throw new r.BadRequest(this.id+" createOrder() bitget trailing orders must be market orders");if(void 0===P)throw new r.ArgumentsRequired(this.id+" createOrder() bitget trailing orders must have a trailingTriggerPrice param");l.planType="track_plan",l.triggerPrice=this.priceToPrecision(e,P),l.callbackRatio=I}else if(y){if(l.planType="normal_plan",l.triggerPrice=this.priceToPrecision(e,f),void 0!==o&&(l.executePrice=this.priceToPrecision(e,o)),k){const t=this.safeNumber2(g,"triggerPrice","stopPrice");l.stopLossTriggerPrice=this.priceToPrecision(e,t);const i=this.safeNumber(g,"price");l.stopLossExecutePrice=this.priceToPrecision(e,i);const s=this.safeString(g,"type","mark_price");l.stopLossTriggerType=s}if(S){const t=this.safeNumber2(v,"triggerPrice","stopPrice");l.stopSurplusTriggerPrice=this.priceToPrecision(e,t);const i=this.safeNumber(v,"price");l.stopSurplusExecutePrice=this.priceToPrecision(e,i);const s=this.safeString(v,"type","mark_price");l.stopSurplusTriggerType=s}}else if(O){if(!u)throw new r.ExchangeError(this.id+" createOrder() bitget stopLoss or takeProfit orders must be market orders");l.holdSide="buy"===i?"long":"short",w?(l.triggerPrice=this.priceToPrecision(e,p),l.planType="pos_loss"):b&&(l.triggerPrice=this.priceToPrecision(e,m),l.planType="pos_profit")}else{if(k){const t=this.safeValue2(g,"triggerPrice","stopPrice");l.presetStopLossPrice=this.priceToPrecision(e,t)}if(S){const t=this.safeValue2(v,"triggerPrice","stopPrice");l.presetStopSurplusPrice=this.priceToPrecision(e,t)}}if(!O){void 0===c&&(c="cross");const e="cross"===c?"crossed":"isolated";let t,s;l.marginMode=e,[t,n]=this.handleParamBool(n,"hedged",!1),[s,n]=this.handleParamBool(n,"oneWayMode"),void 0!==s&&(t=!s);let r=i;_?t?(r="buy"===i?"sell":"buy",l.tradeSide="Close"):l.reduceOnly="YES":t&&(l.tradeSide="Open"),l.side=r}}else{if("spot"!==h)throw new r.NotSupported(this.id+" createOrder() does not support "+h+" orders");{if(O||T)throw new r.InvalidOrder(this.id+" createOrder() does not support stop loss/take profit orders on spot markets, only swap markets");let t,d;l.side=i;let h=!0;if([h,n]=this.handleOptionAndParams(n,"createOrder","createMarketBuyOrderRequiresPrice",!0),u&&"buy"===i){d="total";const i=this.safeNumber(n,"cost");if(n=this.omit(n,"cost"),void 0!==i)t=this.costToPrecision(e,i);else if(h){if(void 0===o)throw new r.InvalidOrder(this.id+" createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument");{const i=this.numberToString(s),r=this.numberToString(o),n=a.Y.stringMul(i,r);t=this.costToPrecision(e,n)}}else t=this.costToPrecision(e,s)}else d="amount",t=this.amountToPrecision(e,s);void 0!==A&&(l.clientOid=A),void 0!==c?(l.loanType="normal",u&&"buy"===i?l.quoteSize=t:l.baseSize=t):(void 0!==t&&(l.size=t),void 0!==f&&(l.planType=d,l.triggerType=x,l.triggerPrice=this.priceToPrecision(e,f),void 0!==o&&(l.executePrice=this.priceToPrecision(e,o))))}}return this.extend(l,n)}async createOrders(e,t={}){await this.loadMarkets();const i=[];let s,a;for(let t=0;t1)throw new r.ExchangeError(this.id+" editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent");const P=this.safeString2(d,"clientOid","clientOrderId");let I;if(void 0!==P&&(c.clientOid=P),d=this.omit(d,["stopPrice","triggerType","stopLossPrice","takeProfitPrice","stopLoss","takeProfit","clientOrderId","trailingTriggerPrice","trailingPercent"]),h.spot){if(void 0===u)throw new r.NotSupported(this.id+" editOrder() only supports plan/trigger spot orders");if(this.safeBool(this.options,"editMarketBuyOrderRequiresPrice",!0)&&l&&"buy"===s){if(void 0===n)throw new r.InvalidOrder(this.id+" editOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the editMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter");{const e=this.numberToString(o),i=this.numberToString(n),s=this.parseNumber(a.Y.stringMul(e,i));c.size=this.priceToPrecision(t,s)}}else c.size=this.amountToPrecision(t,o);c.orderType=i,c.triggerPrice=this.priceToPrecision(t,u),c.executePrice=this.priceToPrecision(t,n),I=await this.privateSpotPostV2SpotTradeModifyPlanOrder(this.extend(c,d))}else{if(!h.swap&&!h.future)throw new r.NotSupported(this.id+" editOrder() does not support "+h.type+" orders");let e;if(c.symbol=h.id,[e,d]=this.handleProductTypeAndParams(h,d),c.productType=e,v||m||(c.newSize=this.amountToPrecision(t,o),void 0===n||T||(c.newPrice=this.priceToPrecision(t,n))),T){if(!l)throw new r.BadRequest(this.id+" editOrder() bitget trailing orders must be market orders");void 0!==S&&(c.newTriggerPrice=this.priceToPrecision(t,S)),c.newCallbackRatio=O,I=await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(c,d))}else if(v||m)c.marginCoin=h.settleId,c.size=this.amountToPrecision(t,o),void 0!==n&&(c.executePrice=this.priceToPrecision(t,n)),m?c.triggerPrice=this.priceToPrecision(t,p):v&&(c.triggerPrice=this.priceToPrecision(t,g)),I=await this.privateMixPostV2MixOrderModifyTpslOrder(this.extend(c,d));else if(f){if(c.newTriggerPrice=this.priceToPrecision(t,u),b){const e=this.safeNumber2(y,"triggerPrice","stopPrice");c.newStopLossTriggerPrice=this.priceToPrecision(t,e);const i=this.safeNumber(y,"price");c.newStopLossExecutePrice=this.priceToPrecision(t,i);const s=this.safeString(y,"type","mark_price");c.newStopLossTriggerType=s}if(k){const e=this.safeNumber2(w,"triggerPrice","stopPrice");c.newSurplusTriggerPrice=this.priceToPrecision(t,e);const i=this.safeNumber(w,"price");c.newStopSurplusExecutePrice=this.priceToPrecision(t,i);const s=this.safeString(w,"type","mark_price");c.newStopSurplusTriggerType=s}I=await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(c,d))}else{const e=this.uuid(),i=this.safeString2(d,"newClientOid","newClientOrderId",e);if(d=this.omit(d,"newClientOrderId"),c.newClientOid=i,b){const e=this.safeValue2(y,"triggerPrice","stopPrice");c.newPresetStopLossPrice=this.priceToPrecision(t,e)}if(k){const e=this.safeValue2(w,"triggerPrice","stopPrice");c.newPresetStopSurplusPrice=this.priceToPrecision(t,e)}I=await this.privateMixPostV2MixOrderModifyOrder(this.extend(c,d))}}const M=this.safeDict(I,"data",{});return this.parseOrder(M,h)}async cancelOrder(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");await this.loadMarkets();const s=this.market(t);let a,o;[a,i]=this.handleMarginModeAndParams("cancelOrder",i);const n={},d=this.safeValue(i,"trailing"),h=this.safeValue2(i,"stop","trigger");if(i=this.omit(i,["stop","trigger","trailing"]),s.spot&&h||(n.symbol=s.id),(s.swap||s.future)&&h||(n.orderId=e),s.swap||s.future){let t;if([t,i]=this.handleProductTypeAndParams(s,i),n.productType=t,h||d){const t=[],i={orderId:e};t.push(i),n.orderIdList=t}if(d){const e=this.safeString(i,"planType","track_plan");n.planType=e,o=await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(n,i))}else o=h?await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(n,i)):await this.privateMixPostV2MixOrderCancelOrder(this.extend(n,i))}else{if(!s.spot)throw new r.NotSupported(this.id+" cancelOrder() does not support "+s.type+" orders");void 0!==a?"isolated"===a?o=await this.privateMarginPostV2MarginIsolatedCancelOrder(this.extend(n,i)):"cross"===a&&(o=await this.privateMarginPostV2MarginCrossedCancelOrder(this.extend(n,i))):o=h?await this.privateSpotPostV2SpotTradeCancelPlanOrder(this.extend(n,i)):await this.privateSpotPostV2SpotTradeCancelOrder(this.extend(n,i))}const c=this.safeValue(o,"data",{});let l;if((s.swap||s.future)&&h){l=this.safeValue(c,"successList",[])[0]}else l=c;return this.parseOrder(l,s)}async cancelOrders(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrders() requires a symbol argument");await this.loadMarkets();const s=this.market(t);let a;[a,i]=this.handleMarginModeAndParams("cancelOrders",i);const o=this.safeValue2(i,"stop","trigger");i=this.omit(i,["stop","trigger"]);const n=[];for(let t=0;t=0&&(c="out"),this.safeLedgerEntry({info:e,id:this.safeString(e,"billId"),timestamp:r,datetime:this.iso8601(r),direction:c,account:void 0,referenceId:void 0,referenceAccount:void 0,type:this.parseLedgerType(this.safeString(e,"businessType")),currency:s,amount:h,before:void 0,after:o,status:void 0,fee:{currency:s,cost:n}},t)}parseLedgerType(e){return this.safeString({trans_to_cross:"transfer",trans_from_cross:"transfer",trans_to_exchange:"transfer",trans_from_exchange:"transfer",trans_to_isolated:"transfer",trans_from_isolated:"transfer",trans_to_contract:"transfer",trans_from_contract:"transfer",trans_to_otc:"transfer",trans_from_otc:"transfer",open_long:"trade",close_long:"trade",open_short:"trade",close_short:"trade",force_close_long:"trade",force_close_short:"trade",burst_long_loss_query:"trade",burst_short_loss_query:"trade",force_buy:"trade",force_sell:"trade",burst_buy:"trade",burst_sell:"trade",delivery_long:"settlement",delivery_short:"settlement",contract_settle_fee:"fee",append_margin:"transaction",adjust_down_lever_append_margin:"transaction",reduce_margin:"transaction",auto_append_margin:"transaction",cash_gift_issue:"cashback",cash_gift_recycle:"cashback",bonus_issue:"rebate",bonus_recycle:"rebate",bonus_expired:"rebate",transfer_in:"transfer",transfer_out:"transfer",deposit:"deposit",withdraw:"withdrawal",buy:"trade",sell:"trade"},e,e)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e);let o;[o,s]=this.handleMarginModeAndParams("fetchMyTrades",s);let n,d=!1;if([d,s]=this.handleOptionAndParams(s,"fetchMyTrades","paginate"),d){let r;return a.spot?void 0!==o&&(r="minId"):r="endId",await this.fetchPaginatedCallCursor("fetchMyTrades",e,t,i,s,r,"idLessThan")}let h={symbol:a.id};if([h,s]=this.handleUntilOption("endTime",h,s),void 0!==t&&(h.startTime=t),void 0!==i&&(h.limit=i),a.spot)void 0!==o?(void 0===t&&(h.startTime=this.milliseconds()-7776e6),"isolated"===o?n=await this.privateMarginGetV2MarginIsolatedFills(this.extend(h,s)):"cross"===o&&(n=await this.privateMarginGetV2MarginCrossedFills(this.extend(h,s)))):n=await this.privateSpotGetV2SpotTradeFills(this.extend(h,s));else{let e;[e,s]=this.handleProductTypeAndParams(a,s),h.productType=e,n=await this.privateMixGetV2MixOrderFills(this.extend(h,s))}const c=this.safeValue(n,"data");if(a.swap||a.future){const e=this.safeList(c,"fillList",[]);return this.parseTrades(e,a,t,i)}if(void 0!==o){const e=this.safeList(c,"fills",[]);return this.parseTrades(e,a,t,i)}return this.parseTrades(c,a,t,i)}async fetchPosition(e,t={}){await this.loadMarkets();const i=this.market(e);let s;[s,t]=this.handleProductTypeAndParams(i,t);const r={symbol:i.id,marginCoin:i.settleId,productType:s},a=await this.privateMixGetV2MixPositionSinglePosition(this.extend(r,t)),o=this.safeList(a,"data",[]),n=this.safeDict(o,0,{});return this.parsePosition(n,i)}async fetchPositions(e=void 0,t={}){await this.loadMarkets();let i,s=!1;if([s,t]=this.handleOptionAndParams(t,"fetchPositions","paginate"),s)return await this.fetchPaginatedCallCursor("fetchPositions",void 0,void 0,void 0,t,"endId","idLessThan");let a,o;if(this.safeBool(t,"useHistoryEndpoint",!1)?i="privateMixGetV2MixPositionHistoryPosition":[i,t]=this.handleOptionAndParams(t,"fetchPositions","method","privateMixGetV2MixPositionAllPosition"),void 0!==e){const t=this.safeString(e,0);a=this.market(t)}[o,t]=this.handleProductTypeAndParams(a,t);const n={productType:o};let d,h=!1;if("privateMixGetV2MixPositionAllPosition"===i){let i=this.safeString(t,"marginCoin","USDT");if(void 0!==e)i=a.settleId;else if("USDT-FUTURES"===o)i="USDT";else if("USDC-FUTURES"===o)i="USDC";else if("SUSDT-FUTURES"===o)i="SUSDT";else if("SUSDC-FUTURES"===o)i="SUSDC";else if(("SCOIN-FUTURES"===o||"COIN-FUTURES"===o)&&void 0===i)throw new r.ArgumentsRequired(this.id+" fetchPositions() requires a marginCoin parameter that matches the productType");n.marginCoin=i,d=await this.privateMixGetV2MixPositionAllPosition(this.extend(n,t))}else h=!0,void 0!==a&&(n.symbol=a.id),d=await this.privateMixGetV2MixPositionHistoryPosition(this.extend(n,t));let c=[];if(h){const e=this.safeDict(d,"data",{});c=this.safeList(e,"list",[])}else c=this.safeList(d,"data",[]);const l=[];for(let e=0;e0)throw new r.BadRequest(this.id+" reduceMargin() amount parameter must be a negative value");if(void 0===this.safeString(i,"holdSide"))throw new r.ArgumentsRequired(this.id+" reduceMargin() requires a holdSide parameter, either long or short");return await this.modifyMarginHelper(e,t,"reduce",i)}async addMargin(e,t,i={}){if(void 0===this.safeString(i,"holdSide"))throw new r.ArgumentsRequired(this.id+" addMargin() requires a holdSide parameter, either long or short");return await this.modifyMarginHelper(e,t,"add",i)}async fetchLeverage(e,t={}){await this.loadMarkets();const i=this.market(e);let s;[s,t]=this.handleProductTypeAndParams(i,t);const r={symbol:i.id,marginCoin:i.settleId,productType:s},a=await this.privateMixGetV2MixAccountAccount(this.extend(r,t)),o=this.safeDict(a,"data",{});return this.parseLeverage(o,i)}parseLeverage(e,t=void 0){const i="crossed"===this.safeString(e,"marginMode"),s=i?"crossedMarginLeverage":"isolatedLongLever",r=i?"crossedMarginLeverage":"isolatedShortLever";return{info:e,symbol:t.symbol,marginMode:i?"cross":"isolated",longLeverage:this.safeInteger(e,s),shortLeverage:this.safeInteger(e,r)}}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();const s=this.market(t);let a;[a,i]=this.handleProductTypeAndParams(s,i);const o={symbol:s.id,marginCoin:s.settleId,leverage:this.numberToString(e),productType:a};return await this.privateMixPostV2MixAccountSetLeverage(this.extend(o,i))}async setMarginMode(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("cross"===(e=e.toLowerCase())&&(e="crossed"),"isolated"!==e&&"crossed"!==e)throw new r.ArgumentsRequired(this.id+" setMarginMode() marginMode must be either isolated or crossed (cross)");await this.loadMarkets();const s=this.market(t);let a;[a,i]=this.handleProductTypeAndParams(s,i);const o={symbol:s.id,marginCoin:s.settleId,marginMode:e,productType:a};return await this.privateMixPostV2MixAccountSetMarginMode(this.extend(o,i))}async setPositionMode(e,t=void 0,i={}){await this.loadMarkets();const s=e?"hedge_mode":"one_way_mode";let r,a;void 0!==t&&(r=this.market(t)),[a,i]=this.handleProductTypeAndParams(r,i);const o={posMode:s,productType:a};return await this.privateMixPostV2MixAccountSetPositionMode(this.extend(o,i))}async fetchOpenInterest(e,t={}){await this.loadMarkets();const i=this.market(e);if(!i.contract)throw new r.BadRequest(this.id+" fetchOpenInterest() supports contract markets only");let s;[s,t]=this.handleProductTypeAndParams(i,t);const a={symbol:i.id,productType:s},o=await this.publicMixGetV2MixMarketOpenInterest(this.extend(a,t)),n=this.safeDict(o,"data",{});return this.parseOpenInterest(n,i)}parseOpenInterest(e,t=void 0){const i=this.safeValue(e,"openInterestList",[]),s=this.safeInteger(e,"ts"),r=this.safeString(i[0],"symbol");return this.safeOpenInterest({symbol:this.safeSymbol(r,t,void 0,"contract"),openInterestAmount:this.safeNumber(i[0],"size"),openInterestValue:void 0,timestamp:s,datetime:this.iso8601(s),info:e},t)}async fetchTransfers(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchTransfers() requires a code argument");let a;await this.loadMarkets(),[a,s]=this.handleMarketTypeAndParams("fetchTransfers",void 0,s);const o=this.safeString(s,"fromAccount",a);s=this.omit(s,"fromAccount");const n=this.safeValue(this.options,"accountsByType",{});a=this.safeString(n,o);const d=this.currency(e);let h={coin:d.id,fromType:a};void 0!==t&&(h.startTime=t),void 0!==i&&(h.limit=i),[h,s]=this.handleUntilOption("endTime",h,s);const c=await this.privateSpotGetV2SpotAccountTransferRecords(this.extend(h,s)),l=this.safeList(c,"data",[]);return this.parseTransfers(l,d,t,i)}async transfer(e,t,i,s,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeValue(this.options,"accountsByType",{}),n={fromType:this.safeString(o,i),toType:this.safeString(o,s),amount:t,coin:a.id},d=this.safeString(r,"symbol");let h;r=this.omit(r,"symbol"),void 0!==d&&(h=this.market(d),n.symbol=h.id);const c=await this.privateSpotPostV2SpotWalletTransfer(this.extend(n,r)),l=this.safeValue(c,"data",{});return l.ts=this.safeInteger(c,"requestTime"),this.parseTransfer(l,a)}parseTransfer(e,t=void 0){const i=this.safeInteger(e,"ts"),s=this.safeStringLower(e,"status"),r=this.safeString(e,"coin"),a=this.safeString(e,"fromType"),o=this.safeValue(this.options,"accountsById",{}),n=this.safeString(o,a,a),d=this.safeString(e,"toType"),h=this.safeString(o,d,d);return{info:e,id:this.safeString(e,"transferId"),timestamp:i,datetime:this.iso8601(i),currency:this.safeCurrencyCode(r,t),amount:this.safeNumber(e,"size"),fromAccount:n,toAccount:h,status:this.parseTransferStatus(s)}}parseTransferStatus(e){return this.safeString({successful:"ok"},e,e)}parseDepositWithdrawFee(e,t=void 0){const i=this.safeValue(e,"chains",[]),s=i.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};for(let e=0;e0){const t=this.market(e[0]);a.symbol=t.id}}void 0!==t&&(a.startTime=t),void 0!==i&&(a.limit=i),void 0!==r&&(a.endTime=r);const o=await this.privateMixGetV2MixPositionHistoryPosition(this.extend(a,s)),n=this.safeDict(o,"data"),d=this.safeList(n,"list"),h=this.parsePositions(d,e,s);return this.filterBySinceLimit(h,t,i)}async fetchConvertQuote(e,t,i=void 0,s={}){await this.loadMarkets();const r={fromCoin:e,toCoin:t,fromCoinSize:this.numberToString(i)},a=await this.privateConvertGetV2ConvertQuotedPrice(this.extend(r,s)),o=this.safeDict(a,"data",{}),n=this.safeString(o,"fromCoin",e),d=this.currency(n),h=this.safeString(o,"toCoin",t),c=this.currency(h);return this.parseConversion(o,d,c)}async createConvertTrade(e,t,i,s=void 0,a={}){await this.loadMarkets();const o=this.safeString2(a,"price","cnvtPrice");if(void 0===o)throw new r.ArgumentsRequired(this.id+" createConvertTrade() requires a price parameter");const n=this.safeString2(a,"toAmount","toCoinSize");if(void 0===n)throw new r.ArgumentsRequired(this.id+" createConvertTrade() requires a toAmount parameter");a=this.omit(a,["price","toAmount"]);const d={traceId:e,fromCoin:t,toCoin:i,fromCoinSize:this.numberToString(s),toCoinSize:n,cnvtPrice:o},h=await this.privateConvertPostV2ConvertTrade(this.extend(d,a)),c=this.safeDict(h,"data",{}),l=this.safeString(c,"toCoin",i),u=this.currency(l);return this.parseConversion(c,void 0,u)}async fetchConvertTradeHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={},a=this.milliseconds();r.startTime=void 0!==t?t:a-864e5;const o=this.safeString2(s,"endTime","until");r.endTime=void 0!==o?o:a,void 0!==i&&(r.limit=i),s=this.omit(s,"until");const n=await this.privateConvertGetV2ConvertConvertRecord(this.extend(r,s)),d=this.safeDict(n,"data",{}),h=this.safeList(d,"dataList",[]);return this.parseConversions(h,e,"fromCoin","toCoin",t,i)}parseConversion(e,t=void 0,i=void 0){const s=this.safeInteger(e,"ts"),r=this.safeString(e,"fromCoin"),a=this.safeCurrencyCode(r,t),o=this.safeString(e,"toCoin"),n=this.safeCurrencyCode(o,i);return{info:e,timestamp:s,datetime:this.iso8601(s),id:this.safeString2(e,"id","traceId"),fromCurrency:a,fromAmount:this.safeNumber(e,"fromCoinSize"),toCurrency:n,toAmount:this.safeNumber(e,"toCoinSize"),price:this.safeNumber(e,"cnvtPrice"),fee:this.safeNumber(e,"fee")}}async fetchConvertCurrencies(e={}){await this.loadMarkets();const t=await this.privateConvertGetV2ConvertCurrencies(e),i={},s=this.safeList(t,"data",[]);for(let e=0;e0&&(c=c+"?"+this.urlencode(l))}if(o){this.checkRequiredCredentials();const e=this.nonce().toString();let t=e+i+h;if("POST"===i)t+=a=this.json(s);else if(Object.keys(s).length){let e="?"+this.urlencode(this.keysort(s));e.indexOf("%24")>-1&&(e=e.replace("%24","$")),c+=e,t+=e}const o=this.hmac(this.encode(t),this.encode(this.secret),n.s,"base64"),d=this.safeString(this.options,"broker");r={"ACCESS-KEY":this.apiKey,"ACCESS-SIGN":o,"ACCESS-TIMESTAMP":e,"ACCESS-PASSPHRASE":this.password,"X-CHANNEL-API-CODE":d},"POST"===i&&(r["Content-Type"]="application/json")}if(this.safeBool2(this.options,"sandboxMode","sandbox",!1)&&"v2/public/time"!==e){void 0===r&&(r={});const e=this.safeString(s,"productType");"SCOIN-FUTURES"!==e&&"SUSDT-FUTURES"!==e&&"SUSDC-FUTURES"!==e&&(r.PAPTRADING="1")}return{url:c,method:i,body:a,headers:r}}}},357:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(3974),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bithumb",name:"Bithumb",countries:["KR"],rateLimit:500,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!0,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},hostname:"bithumb.com",urls:{logo:"https://github.com/user-attachments/assets/c9e0eefb-4777-46b9-8f09-9d7f7c4af82d",api:{public:"https://api.{hostname}/public",private:"https://api.{hostname}"},www:"https://www.bithumb.com",doc:"https://apidocs.bithumb.com",fees:"https://en.bithumb.com/customer_support/info_fee"},api:{public:{get:["ticker/ALL_{quoteId}","ticker/{baseId}_{quoteId}","orderbook/ALL_{quoteId}","orderbook/{baseId}_{quoteId}","transaction_history/{baseId}_{quoteId}","network-info","assetsstatus/multichain/ALL","assetsstatus/multichain/{currency}","withdraw/minimum/ALL","withdraw/minimum/{currency}","assetsstatus/ALL","assetsstatus/{baseId}","candlestick/{baseId}_{quoteId}/{interval}"]},private:{post:["info/account","info/balance","info/wallet_address","info/ticker","info/orders","info/user_transactions","info/order_detail","trade/place","trade/cancel","trade/btc_withdrawal","trade/krw_deposit","trade/krw_withdrawal","trade/market_buy","trade/market_sell","trade/stop_limit"]}},fees:{trading:{maker:this.parseNumber("0.0025"),taker:this.parseNumber("0.0025")}},precisionMode:o.v,features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:void 0,fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{"Bad Request(SSL)":r.BadRequest,"Bad Request(Bad Method)":r.BadRequest,"Bad Request.(Auth Data)":r.AuthenticationError,"Not Member":r.AuthenticationError,"Invalid Apikey":r.AuthenticationError,"Method Not Allowed.(Access IP)":r.PermissionDenied,"Method Not Allowed.(BTC Adress)":r.InvalidAddress,"Method Not Allowed.(Access)":r.PermissionDenied,"Database Fail":r.ExchangeNotAvailable,"Invalid Parameter":r.BadRequest,5600:r.ExchangeError,"Unknown Error":r.ExchangeError,"After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions":r.ExchangeError},timeframes:{"1m":"1m","3m":"3m","5m":"5m","10m":"10m","30m":"30m","1h":"1h","6h":"6h","12h":"12h","1d":"24h"},options:{quoteCurrencies:{BTC:{limits:{cost:{min:2e-4,max:100}}},KRW:{limits:{cost:{min:500,max:5e9}}}}},commonCurrencies:{ALT:"ArchLoot",FTC:"FTC2",SOC:"Soda Coin"}})}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return super.safeMarket(e,t,i,"spot")}amountToPrecision(e,t){return this.decimalToPrecision(t,o.R3,this.markets[e].precision.amount,o.fv)}async fetchMarkets(e={}){const t=[],i=this.safeDict(this.options,"quoteCurrencies",{}),s=Object.keys(i),r=[];for(let t=0;t1){const e=t[0];let s=t[1];s.length<8&&(s="0"+s),i=this.parse8601(e+" "+s)}else i=this.safeIntegerProduct(e,"transaction_date",.001)}void 0!==i&&(i-=324e5);let r=this.safeString(e,"type");r="ask"===r?"sell":"buy";const a=this.safeString(e,"cont_no");t=this.safeMarket(void 0,t);const o=this.safeString(e,"price"),n=this.fixCommaNumber(this.safeString2(e,"units_traded","units")),d=this.safeString(e,"total");let h;const c=this.safeString(e,"fee");if(void 0!==c){const t=this.safeString(e,"fee_currency");h={cost:c,currency:this.commonCurrencyCode(t)}}return this.safeTrade({id:a,info:e,timestamp:i,datetime:this.iso8601(i),symbol:t.symbol,order:void 0,type:undefined,side:r,takerOrMaker:void 0,price:o,amount:n,cost:d,fee:h},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={baseId:r.baseId,quoteId:r.quoteId};void 0!==i&&(a.count=i);const o=await this.publicGetTransactionHistoryBaseIdQuoteId(this.extend(a,s)),n=this.safeList(o,"data",[]);return this.parseTrades(n,r,t,i)}async createOrder(e,t,i,s,a=void 0,o={}){await this.loadMarkets();const n=this.market(e),d={order_currency:n.id,payment_currency:n.quote,units:s};let h="privatePostTradePlace";"limit"===t?(d.price=a,d.type="buy"===i?"bid":"ask"):h="privatePostTradeMarket"+this.capitalize(i);const c=await this[h](this.extend(d,o)),l=this.safeString(c,"order_id");if(void 0===l)throw new r.InvalidOrder(this.id+" createOrder() did not return an order id");return this.safeOrder({info:c,symbol:e,type:t,side:i,id:l},n)}async fetchOrder(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");await this.loadMarkets();const s=this.market(t),a={order_id:e,count:1,order_currency:s.base,payment_currency:s.quote},o=await this.privatePostInfoOrderDetail(this.extend(a,i)),n=this.safeDict(o,"data");return this.parseOrder(this.extend(n,{order_id:e}),s)}parseOrderStatus(e){return this.safeString({Pending:"open",Completed:"closed",Cancel:"canceled"},e,e)}parseOrder(e,t=void 0){const i=this.safeIntegerProduct(e,"order_date",.001),s="bid"===this.safeString2(e,"type","side")?"buy":"sell",r=this.parseOrderStatus(this.safeString(e,"order_status")),o=this.safeString2(e,"order_price","price");let n="limit";a.Y.stringEquals(o,"0")&&(n="market");const d=this.fixCommaNumber(this.safeString2(e,"order_qty","units"));let h,c=this.fixCommaNumber(this.safeString(e,"units_remaining"));void 0===c&&("closed"===r?c="0":"canceled"!==r&&(c=d));const l=this.safeString(e,"order_currency"),u=this.safeString(e,"payment_currency"),f=this.safeCurrencyCode(l),p=this.safeCurrencyCode(u);void 0!==f&&void 0!==p&&(h=f+"/"+p),void 0===h&&(h=(t=this.safeMarket(void 0,t)).symbol);const m=this.safeString(e,"order_id"),g=this.safeList(e,"contract",[]);return this.safeOrder({info:e,id:m,clientOrderId:void 0,timestamp:i,datetime:this.iso8601(i),lastTradeTimestamp:void 0,symbol:h,type:n,timeInForce:void 0,postOnly:void 0,side:s,price:o,triggerPrice:void 0,amount:d,cost:void 0,average:void 0,filled:void 0,remaining:c,status:r,fee:void 0,trades:g},t)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchOpenOrders() requires a symbol argument");await this.loadMarkets();const a=this.market(e);void 0===i&&(i=100);const o={count:i,order_currency:a.base,payment_currency:a.quote};void 0!==t&&(o.after=t);const n=await this.privatePostInfoOrders(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseOrders(d,a,t,i)}async cancelOrder(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");if(!("side"in i))throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a `side` parameter (sell or buy)");const s=this.market(t),a="buy"===i.side?"bid":"ask";i=this.omit(i,["side","currency"]);const o={order_id:e,type:a,order_currency:s.base,payment_currency:s.quote},n=await this.privatePostTradeCancel(this.extend(o,i));return this.safeOrder({info:n})}async cancelUnifiedOrder(e,t={}){const i={side:e.side};return await this.cancelOrder(e.id,e.symbol,this.extend(i,t))}async withdraw(e,t,i,s=void 0,a={}){[s,a]=this.handleWithdrawTagAndParams(s,a),this.checkAddress(i),await this.loadMarkets();const o=this.currency(e),n={units:t,address:i,currency:o.id};if("XRP"===e||"XMR"===e||"EOS"===e||"STEEM"===e||"TON"===e){const t=this.safeString(a,"destination");if(void 0===s&&void 0===t)throw new r.ArgumentsRequired(this.id+" "+e+" withdraw() requires a tag argument or an extra destination param");void 0!==s&&(n.destination=s)}const d=await this.privatePostTradeBtcWithdrawal(this.extend(n,a));return this.parseTransaction(d,o)}parseTransaction(e,t=void 0){return{id:void 0,txid:void 0,timestamp:void 0,datetime:void 0,network:void 0,addressFrom:void 0,address:void 0,addressTo:void 0,amount:void 0,type:void 0,currency:(t=this.safeCurrency(void 0,t)).code,status:void 0,updated:void 0,tagFrom:void 0,tag:void 0,tagTo:void 0,comment:void 0,internal:void 0,fee:void 0,info:e}}fixCommaNumber(e){if(void 0===e)return;let t=e;for(;t.indexOf(",")>-1;)t=t.replace(",","");return t}nonce(){return this.milliseconds()}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){const o="/"+this.implodeParams(e,s);let d=this.implodeHostname(this.urls.api[t])+o;const h=this.omit(s,this.extractParams(e));if("public"===t)Object.keys(h).length&&(d+="?"+this.urlencode(h));else{this.checkRequiredCredentials(),a=this.urlencode(this.extend({endpoint:o},h));const e=this.nonce().toString(),t=o+"\0"+a+"\0"+e,i=this.hmac(this.encode(t),this.encode(this.secret),n.Zf),s=this.stringToBase64(i);r={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","Api-Key":this.apiKey,"Api-Sign":s,"Api-Nonce":e}}return{url:d,method:i,body:a,headers:r}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0!==n&&"status"in n){const e=this.safeString(n,"status"),t=this.safeString(n,"message");if(void 0!==e){if("0000"===e)return;if("거래 진행중인 내역이 존재하지 않습니다."===t)return;const i=this.id+" "+t;throw this.throwExactlyMatchedException(this.exceptions,e,i),this.throwExactlyMatchedException(this.exceptions,t,i),new r.ExchangeError(i)}}}}},1837:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(1466),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitmart",name:"BitMart",countries:["US","CN","HK","KR"],rateLimit:33.34,version:"v2",certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,createTrailingPercentOrder:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!0,fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!0,fetchLedger:!0,fetchLiquidations:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionMode:!0,fetchPositions:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransactionFees:!1,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawAddresses:!0,fetchWithdrawAddressesByNetwork:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!0,transfer:!0,withdraw:!0},hostname:"bitmart.com",urls:{logo:"https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14",api:{spot:"https://api-cloud.{hostname}",swap:"https://api-cloud-v2.{hostname}"},www:"https://www.bitmart.com/",doc:"https://developer-pro.bitmart.com/",referral:{url:"http://www.bitmart.com/?r=rQCFLh",discount:.3},fees:"https://www.bitmart.com/fee/en"},requiredCredentials:{apiKey:!0,secret:!0,uid:!0},api:{public:{get:{"system/time":3,"system/service":3,"spot/v1/currencies":7.5,"spot/v1/symbols":7.5,"spot/v1/symbols/details":5,"spot/quotation/v3/tickers":6,"spot/quotation/v3/ticker":4,"spot/quotation/v3/lite-klines":5,"spot/quotation/v3/klines":7,"spot/quotation/v3/books":4,"spot/quotation/v3/trades":4,"spot/v1/ticker":5,"spot/v2/ticker":30,"spot/v1/ticker_detail":5,"spot/v1/steps":30,"spot/v1/symbols/kline":6,"spot/v1/symbols/book":5,"spot/v1/symbols/trades":5,"contract/v1/tickers":15,"contract/public/details":5,"contract/public/depth":5,"contract/public/open-interest":30,"contract/public/funding-rate":30,"contract/public/funding-rate-history":30,"contract/public/kline":6,"account/v1/currencies":30,"contract/public/markprice-kline":5}},private:{get:{"account/sub-account/v1/transfer-list":7.5,"account/sub-account/v1/transfer-history":7.5,"account/sub-account/main/v1/wallet":5,"account/sub-account/main/v1/subaccount-list":7.5,"account/contract/sub-account/main/v1/wallet":5,"account/contract/sub-account/main/v1/transfer-list":7.5,"account/contract/sub-account/v1/transfer-history":7.5,"account/v1/wallet":5,"account/v1/currencies":30,"spot/v1/wallet":5,"account/v1/deposit/address":30,"account/v1/withdraw/charge":32,"account/v2/deposit-withdraw/history":7.5,"account/v1/deposit-withdraw/detail":7.5,"account/v1/withdraw/address/list":30,"spot/v1/order_detail":1,"spot/v2/orders":5,"spot/v1/trades":5,"spot/v2/trades":4,"spot/v3/orders":5,"spot/v2/order_detail":1,"spot/v1/margin/isolated/borrow_record":1,"spot/v1/margin/isolated/repay_record":1,"spot/v1/margin/isolated/pairs":30,"spot/v1/margin/isolated/account":5,"spot/v1/trade_fee":30,"spot/v1/user_fee":30,"spot/v1/broker/rebate":1,"contract/private/assets-detail":5,"contract/private/order":1.2,"contract/private/order-history":10,"contract/private/position":10,"contract/private/position-v2":10,"contract/private/get-open-orders":1.2,"contract/private/current-plan-order":1.2,"contract/private/trades":10,"contract/private/position-risk":10,"contract/private/affilate/rebate-list":10,"contract/private/affilate/trade-list":10,"contract/private/transaction-history":10,"contract/private/get-position-mode":1},post:{"account/sub-account/main/v1/sub-to-main":30,"account/sub-account/sub/v1/sub-to-main":30,"account/sub-account/main/v1/main-to-sub":30,"account/sub-account/sub/v1/sub-to-sub":30,"account/sub-account/main/v1/sub-to-sub":30,"account/contract/sub-account/main/v1/sub-to-main":7.5,"account/contract/sub-account/main/v1/main-to-sub":7.5,"account/contract/sub-account/sub/v1/sub-to-main":7.5,"account/v1/withdraw/apply":7.5,"spot/v1/submit_order":1,"spot/v1/batch_orders":1,"spot/v2/cancel_order":1,"spot/v1/cancel_orders":15,"spot/v4/query/order":1,"spot/v4/query/client-order":1,"spot/v4/query/open-orders":5,"spot/v4/query/history-orders":5,"spot/v4/query/trades":5,"spot/v4/query/order-trades":5,"spot/v4/cancel_orders":3,"spot/v4/cancel_all":90,"spot/v4/batch_orders":3,"spot/v3/cancel_order":1,"spot/v2/batch_orders":1,"spot/v2/submit_order":1,"spot/v1/margin/submit_order":1.5,"spot/v1/margin/isolated/borrow":30,"spot/v1/margin/isolated/repay":30,"spot/v1/margin/isolated/transfer":30,"account/v1/transfer-contract-list":60,"account/v1/transfer-contract":60,"contract/private/submit-order":2.5,"contract/private/cancel-order":1.5,"contract/private/cancel-orders":30,"contract/private/submit-plan-order":2.5,"contract/private/cancel-plan-order":1.5,"contract/private/submit-leverage":2.5,"contract/private/submit-tp-sl-order":2.5,"contract/private/modify-plan-order":2.5,"contract/private/modify-preset-plan-order":2.5,"contract/private/modify-limit-order":2.5,"contract/private/modify-tp-sl-order":2.5,"contract/private/submit-trail-order":2.5,"contract/private/cancel-trail-order":1.5,"contract/private/set-position-mode":1}}},timeframes:{"1m":1,"3m":3,"5m":5,"15m":15,"30m":30,"45m":45,"1h":60,"2h":120,"3h":180,"4h":240,"1d":1440,"1w":10080,"1M":43200},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0040"),maker:this.parseNumber("0.0035"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0020")],[this.parseNumber("10"),this.parseNumber("0.18")],[this.parseNumber("50"),this.parseNumber("0.0016")],[this.parseNumber("250"),this.parseNumber("0.0014")],[this.parseNumber("1000"),this.parseNumber("0.0012")],[this.parseNumber("5000"),this.parseNumber("0.0010")],[this.parseNumber("25000"),this.parseNumber("0.0008")],[this.parseNumber("50000"),this.parseNumber("0.0006")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("10"),this.parseNumber("0.0009")],[this.parseNumber("50"),this.parseNumber("0.0008")],[this.parseNumber("250"),this.parseNumber("0.0007")],[this.parseNumber("1000"),this.parseNumber("0.0006")],[this.parseNumber("5000"),this.parseNumber("0.0005")],[this.parseNumber("25000"),this.parseNumber("0.0004")],[this.parseNumber("50000"),this.parseNumber("0.0003")]]}}},precisionMode:o.kb,exceptions:{exact:{3e4:r.ExchangeError,30001:r.AuthenticationError,30002:r.AuthenticationError,30003:r.AccountSuspended,30004:r.AuthenticationError,30005:r.AuthenticationError,30006:r.AuthenticationError,30007:r.AuthenticationError,30008:r.AuthenticationError,30010:r.PermissionDenied,30011:r.AuthenticationError,30012:r.AuthenticationError,30013:r.RateLimitExceeded,30014:r.ExchangeNotAvailable,30016:r.OnMaintenance,30017:r.RateLimitExceeded,30018:r.BadRequest,30019:r.PermissionDenied,6e4:r.BadRequest,60001:r.BadRequest,60002:r.BadRequest,60003:r.ExchangeError,60004:r.ExchangeError,60005:r.ExchangeError,60006:r.ExchangeError,60007:r.InvalidAddress,60008:r.InsufficientFunds,60009:r.ExchangeError,60010:r.ExchangeError,60011:r.InvalidAddress,60012:r.ExchangeError,60020:r.PermissionDenied,60021:r.PermissionDenied,60022:r.PermissionDenied,60026:r.PermissionDenied,60027:r.PermissionDenied,60028:r.AccountSuspended,60029:r.AccountSuspended,60030:r.BadRequest,60031:r.BadRequest,60050:r.ExchangeError,60051:r.ExchangeError,61001:r.InsufficientFunds,61003:r.BadRequest,61004:r.BadRequest,61005:r.BadRequest,61006:r.NotSupported,61007:r.ExchangeError,61008:r.ExchangeError,7e4:r.ExchangeError,70001:r.BadRequest,70002:r.BadSymbol,70003:r.NetworkError,71001:r.BadRequest,71002:r.BadRequest,71003:r.BadRequest,71004:r.BadRequest,71005:r.BadRequest,5e4:r.BadRequest,50001:r.BadSymbol,50002:r.BadRequest,50003:r.BadRequest,50004:r.BadRequest,50005:r.OrderNotFound,50006:r.InvalidOrder,50007:r.InvalidOrder,50008:r.InvalidOrder,50009:r.InvalidOrder,50010:r.InvalidOrder,50011:r.InvalidOrder,50012:r.InvalidOrder,50013:r.InvalidOrder,50014:r.BadRequest,50015:r.BadRequest,50016:r.BadRequest,50017:r.BadRequest,50018:r.BadRequest,50019:r.ExchangeError,50020:r.InsufficientFunds,50021:r.BadRequest,50022:r.ExchangeNotAvailable,50023:r.BadSymbol,50024:r.BadRequest,50025:r.BadRequest,50026:r.BadRequest,50027:r.BadRequest,50028:r.BadRequest,50029:r.InvalidOrder,50030:r.OrderNotFound,50031:r.OrderNotFound,50032:r.OrderNotFound,50033:r.InvalidOrder,50034:r.InvalidOrder,50035:r.InvalidOrder,50036:r.ExchangeError,50037:r.BadRequest,50038:r.BadRequest,50039:r.BadRequest,50040:r.BadSymbol,50041:r.ExchangeError,50042:r.BadRequest,51e3:r.BadSymbol,51001:r.ExchangeError,51002:r.ExchangeError,51003:r.ExchangeError,51004:r.InsufficientFunds,51005:r.InvalidOrder,51006:r.InvalidOrder,51007:r.BadRequest,51008:r.ExchangeError,51009:r.InvalidOrder,51010:r.InvalidOrder,51011:r.InvalidOrder,51012:r.InvalidOrder,51013:r.InvalidOrder,51014:r.InvalidOrder,51015:r.InvalidOrder,52e3:r.BadRequest,52001:r.BadRequest,52002:r.BadRequest,52003:r.BadRequest,52004:r.BadRequest,53e3:r.AccountSuspended,53001:r.AccountSuspended,53002:r.PermissionDenied,53003:r.PermissionDenied,53005:r.PermissionDenied,53006:r.PermissionDenied,53007:r.PermissionDenied,53008:r.PermissionDenied,53009:r.PermissionDenied,53010:r.PermissionDenied,57001:r.BadRequest,58001:r.BadRequest,59001:r.ExchangeError,59002:r.ExchangeError,59003:r.ExchangeError,59004:r.ExchangeError,59005:r.PermissionDenied,59006:r.ExchangeError,59007:r.ExchangeError,59008:r.ExchangeError,59009:r.ExchangeError,59010:r.InsufficientFunds,59011:r.ExchangeError,40001:r.ExchangeError,40002:r.ExchangeError,40003:r.ExchangeError,40004:r.ExchangeError,40005:r.ExchangeError,40006:r.PermissionDenied,40007:r.BadRequest,40008:r.InvalidNonce,40009:r.BadRequest,40010:r.BadRequest,40011:r.BadRequest,40012:r.ExchangeError,40013:r.ExchangeError,40014:r.BadSymbol,40015:r.BadSymbol,40016:r.InvalidOrder,40017:r.InvalidOrder,40018:r.InvalidOrder,40019:r.ExchangeError,40020:r.InvalidOrder,40021:r.ExchangeError,40022:r.ExchangeError,40023:r.ExchangeError,40024:r.ExchangeError,40025:r.ExchangeError,40026:r.ExchangeError,40027:r.InsufficientFunds,40028:r.PermissionDenied,40029:r.InvalidOrder,40030:r.InvalidOrder,40031:r.InvalidOrder,40032:r.InvalidOrder,40033:r.InvalidOrder,40034:r.BadSymbol,40035:r.OrderNotFound,40036:r.InvalidOrder,40037:r.OrderNotFound,40038:r.BadRequest,40039:r.BadRequest,40040:r.InvalidOrder,40041:r.InvalidOrder,40042:r.InvalidOrder,40043:r.InvalidOrder,40044:r.InvalidOrder,40045:r.InvalidOrder,40046:r.PermissionDenied,40047:r.PermissionDenied,40048:r.InvalidOrder,40049:r.InvalidOrder,40050:r.InvalidOrder},broad:{"You contract account available balance not enough":r.InsufficientFunds,"you contract account available balance not enough":r.InsufficientFunds}},commonCurrencies:{$GM:"GOLDMINER",$HERO:"Step Hero",$PAC:"PAC",BP:"BEYOND",GDT:"Gorilla Diamond",GLD:"Goldario",MVP:"MVP Coin",TRU:"Truebit"},options:{defaultNetworks:{USDT:"TRC20",BTC:"BTC",ETH:"ERC20"},timeDifference:0,adjustForTimeDifference:!1,networks:{ERC20:"ERC20",SOL:"SOL",BTC:"BTC",TRC20:"TRC20",OMNI:"OMNI",XLM:"XLM",EOS:"EOS",NEO:"NEO",BTM:"BTM",BCH:"BCH",LTC:"LTC",BSV:"BSV",XRP:"XRP",PLEX:"PLEX",XCH:"XCH",NEAR:"NEAR",FIO:"FIO",SCRT:"SCRT",IOTX:"IOTX",ALGO:"ALGO",ATOM:"ATOM",DOT:"DOT",ADA:"ADA",DOGE:"DOGE",XYM:"XYM",GLMR:"GLMR",MOVR:"MOVR",ZIL:"ZIL",INJ:"INJ",KSM:"KSM",ZEC:"ZEC",NAS:"NAS",POLYGON:"MATIC",HRC20:"HECO",XDC:"XDC",ONE:"ONE",LAT:"LAT",CSPR:"Casper",ICP:"Computer",XTZ:"XTZ",MINA:"MINA",BEP20:"BSC_BNB",THETA:"THETA",AKT:"AKT",AR:"AR",CELO:"CELO",FIL:"FIL",NULS:"NULS",ETC:"ETC",DASH:"DASH",DGB:"DGB",BEP2:"BEP2",GRIN:"GRIN",WAVES:"WAVES",ABBC:"ABBC",ACA:"ACA",QTUM:"QTUM",PAC:"PAC",TLOS:"TLOS",KARDIA:"KardiaChain",FUSE:"FUSE",TRC10:"TRC10",FIRO:"FIRO",FTM:"Fantom",EVER:"EVER",KAVA:"KAVA",HYDRA:"HYDRA",PLCU:"PLCU",BRISE:"BRISE",OPTIMISM:"OPTIMISM",REEF:"REEF",SYS:"SYS",VITE:"VITE",STX:"STX",SXP:"SXP",BITCI:"BITCI",XRD:"XRD",ASTR:"ASTAR",ZEN:"HORIZEN",LTO:"LTO",ETHW:"ETHW",ETHF:"ETHF",IOST:"IOST",APT:"APT",ONT:"ONT",EVMOS:"EVMOS",XMR:"XMR",OASYS:"OAS",OSMO:"OSMO",OMAX:"OMAX Chain",DESO:"DESO",BFIC:"BFIC",OHO:"OHO",CS:"CS",CHEQ:"CHEQ",NODL:"NODL",NEM:"XEM",FRA:"FRA",ERGO:"ERG"},networksById:{ETH:"ERC20",Ethereum:"ERC20",USDT:"OMNI",Bitcoin:"BTC"},defaultType:"spot",fetchBalance:{type:"spot"},accountsByType:{spot:"spot",swap:"swap"},createMarketBuyOrderRequiresPrice:!0,brokerId:"CCXTxBitmart000"},features:{default:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0,leverage:!0,selfTradePrevention:!1,iceberg:!1},createOrders:{max:10},fetchMyTrades:{marginMode:!0,limit:200,daysBack:void 0,untilDays:99999,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!0,limit:200,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,limit:200,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},forDerivatives:{extends:"default",createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!1},triggerDirection:!0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!0,index:!1},price:!1},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!0,marketBuyRequiresPrice:!0,marketBuyByCost:!0},fetchMyTrades:{marginMode:!0,limit:void 0,daysBack:void 0,untilDays:99999},fetchOrder:{marginMode:!1,trigger:!1,trailing:!0},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!0,trailing:!1},fetchClosedOrders:{marginMode:!0,limit:200,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1},fetchOHLCV:{limit:500}},spot:{extends:"default"},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}}})}async fetchTime(e={}){const t=await this.publicGetSystemTime(e),i=this.safeDict(t,"data",{});return this.safeInteger(i,"server_time")}async fetchStatus(e={}){const t=this.safeDict(this.options,"fetchStatus",{}),i=this.safeString(this.options,"defaultType");let s=this.safeString(t,"type",i);s=this.safeString(e,"type",s),e=this.omit(e,"type");const r=await this.publicGetSystemService(e),a=this.safeDict(r,"data",{}),o=this.safeList(a,"service",[]),n=this.indexBy(o,"service_type");"swap"===s&&(s="contract");const d=this.safeString(n,s);let h,c;if(void 0!==d){2===this.safeInteger(d,"status")?h="ok":(h="maintenance",c=this.safeInteger(d,"end_time"))}return{status:h,updated:void 0,eta:c,url:void 0,info:r}}async fetchSpotMarkets(e={}){const t=await this.publicGetSpotV1SymbolsDetails(e),i=this.safeDict(t,"data",{}),s=this.safeList(i,"symbols",[]),r=[],o=this.fees.trading;for(let e=0;e=0;if(!n){const e=i.split("-");a=this.safeString(e,0);const t=this.safeString(e,1);void 0!==t&&(o=t.toUpperCase())}const d=this.safeCurrencyCode(a);let h=this.safeDict(r,d);void 0===h&&(h={info:t,id:a,code:d,precision:void 0,name:this.safeString(t,"name"),deposit:void 0,withdraw:void 0,active:void 0,networks:{},type:n?"other":"crypto"});const c=this.networkIdToCode(o),l=this.safeBool(t,"withdraw_enabled"),u=this.safeBool(t,"deposit_enabled");h.networks[c]={info:t,id:o,code:c,withdraw:l,deposit:u,active:l&&u,fee:this.safeNumber(t,"withdraw_fee"),limits:{withdraw:{min:this.safeNumber(t,"withdraw_minsize"),max:void 0},deposit:{min:void 0,max:void 0}}},r[d]=h}const a=Object.keys(r);for(let e=0;e0&&(t=this.safeValue(a,e[0]))}o=this.safeDict(t,"info",{}),s=this.safeString(o,"currency")}else{const i=this.safeDict(a,t);void 0!==i?(o=this.safeDict(i,"info",{}),s=this.safeString(o,"currency")):r+="-"+this.networkCodeToId(t,e)}return void 0!==s?s:r}async fetchTransactionFee(e,t={}){await this.loadMarkets();const i=this.currency(e);let s;[s,t]=this.handleNetworkCodeAndParams(t);const r={currency:this.getCurrencyIdFromCodeAndNetwork(i.code,s)},a=await this.privateGetAccountV1WithdrawCharge(this.extend(r,t)),o=a.data,n={};return n[e]=this.safeNumber(o,"withdraw_fee"),{info:a,withdraw:n,deposit:{}}}parseDepositWithdrawFee(e,t=void 0){return{info:e,withdraw:{fee:this.safeNumber(e,"withdraw_fee"),percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}}}async fetchDepositWithdrawFee(e,t={}){let i;await this.loadMarkets(),[i,t]=this.handleNetworkCodeAndParams(t);const s={currency:this.getCurrencyIdFromCodeAndNetwork(e,i)},r=(await this.privateGetAccountV1WithdrawCharge(this.extend(s,t))).data;return this.parseDepositWithdrawFee(r)}parseTicker(e,t=void 0){const i=this.safeList(e,"result",[]),s=this.safeString2(e,"avg_price","index_price");let r=this.safeString2(e,"symbol","contract_symbol"),o=this.safeInteger2(e,"timestamp","ts"),n=this.safeString2(e,"last_price","last"),d=this.safeString2(e,"price_change_percent_24h","change_24h"),h=this.safeString(e,"fluctuation"),c=this.safeString2(e,"high_24h","high_price"),l=this.safeString2(e,"low_24h","low_price"),u=this.safeString2(e,"best_bid","bid_px"),f=this.safeString2(e,"best_bid_size","bid_sz"),p=this.safeString2(e,"best_ask","ask_px"),m=this.safeString2(e,"best_ask_size","ask_sz"),g=this.safeString(e,"open_24h"),v=this.safeStringN(e,["base_volume_24h","v_24h","volume_24h"]),y=this.safeStringLowerN(e,["quote_volume_24h","qv_24h","turnover_24h"]);const w=this.safeString(i,0);void 0!==w&&(r=w,o=this.safeInteger(i,12),c=this.safeString(i,5),l=this.safeString(i,6),u=this.safeString(i,8),f=this.safeString(i,9),p=this.safeString(i,10),m=this.safeString(i,11),g=this.safeString(i,4),n=this.safeString(i,1),h=this.safeString(i,7),v=this.safeString(i,2),y=this.safeStringLower(i,3));const b=(t=this.safeMarket(r,t)).symbol;return void 0===o&&(o=this.safeIntegerProduct(e,"s_t",1e3)),void 0===d&&(d=a.Y.stringMul(h,"100")),void 0===y&&(void 0===v?y=this.safeString(e,"volume_24h",y):(y=v,v=void 0)),this.safeTicker({symbol:b,timestamp:o,datetime:this.iso8601(o),high:c,low:l,bid:u,bidVolume:f,ask:p,askVolume:m,vwap:void 0,open:g,close:n,last:n,previousClose:void 0,change:void 0,percentage:d,average:s,baseVolume:v,quoteVolume:y,indexPrice:this.safeString(e,"index_price"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={};let a;if(i.swap)s.symbol=i.id,a=await this.publicGetContractPublicDetails(this.extend(s,t));else{if(!i.spot)throw new r.NotSupported(this.id+" fetchTicker() does not support "+i.type+" markets, only spot and swap markets are accepted");s.symbol=i.id,a=await this.publicGetSpotQuotationV3Ticker(this.extend(s,t))}let o=[],n={};if(i.spot)n=this.safeDict(a,"data",{});else{const e=this.safeDict(a,"data",{});o=this.safeList(e,"symbols",[]),n=this.safeDict(o,0,{})}return this.parseTicker(n,i)}async fetchTickers(e=void 0,t={}){let i,s,a;if(await this.loadMarkets(),void 0!==(e=this.marketSymbols(e))){const t=this.safeString(e,0);s=this.market(t)}if([i,t]=this.handleMarketTypeAndParams("fetchTickers",s,t),"spot"===i)a=await this.publicGetSpotQuotationV3Tickers(t);else{if("swap"!==i)throw new r.NotSupported(this.id+" fetchTickers() does not support "+i+" markets, only spot and swap markets are accepted");a=await this.publicGetContractPublicDetails(t)}let o=[];if("spot"===i)o=this.safeList(a,"data",[]);else{const e=this.safeDict(a,"data",{});o=this.safeList(e,"symbols",[])}const n={};for(let e=0;e{i.d(t,{A:()=>h});var s=i(8186),r=i(1579),a=i(2079),o=i(5147),n=i(4852),d=i(8995);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitmex",name:"BitMEX",countries:["SC"],version:"v1",userAgent:void 0,rateLimit:100,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!0,option:!1,addMargin:void 0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createOrder:!0,createReduceOnlyOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDepositsWithdrawals:"emulated",fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:"emulated",fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchLedger:!0,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,reduceMargin:void 0,sandbox:!0,setLeverage:!0,setMargin:void 0,setMarginMode:!0,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","1h":"1h","1d":"1d"},urls:{test:{public:"https://testnet.bitmex.com",private:"https://testnet.bitmex.com"},logo:"https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04",api:{public:"https://www.bitmex.com",private:"https://www.bitmex.com"},www:"https://www.bitmex.com",doc:["https://www.bitmex.com/app/apiOverview","https://github.com/BitMEX/api-connectors/tree/master/official-http"],fees:"https://www.bitmex.com/app/fees",referral:{url:"https://www.bitmex.com/app/register/NZTR1q",discount:.1}},api:{public:{get:{announcement:5,"announcement/urgent":5,chat:5,"chat/channels":5,"chat/connected":5,"chat/pinned":5,funding:5,guild:5,instrument:5,"instrument/active":5,"instrument/activeAndIndices":5,"instrument/activeIntervals":5,"instrument/compositeIndex":5,"instrument/indices":5,"instrument/usdVolume":5,insurance:5,leaderboard:5,liquidation:5,"orderBook/L2":5,"porl/nonce":5,quote:5,"quote/bucketed":5,schema:5,"schema/websocketHelp":5,settlement:5,stats:5,"stats/history":5,"stats/historyUSD":5,trade:5,"trade/bucketed":5,"wallet/assets":5,"wallet/networks":5}},private:{get:{address:5,apiKey:5,execution:5,"execution/tradeHistory":5,globalNotification:5,"leaderboard/name":5,order:5,"porl/snapshots":5,position:5,user:5,"user/affiliateStatus":5,"user/checkReferralCode":5,"user/commission":5,"user/csa":5,"user/depositAddress":5,"user/executionHistory":5,"user/getWalletTransferAccounts":5,"user/margin":5,"user/quoteFillRatio":5,"user/quoteValueRatio":5,"user/staking":5,"user/staking/instruments":5,"user/staking/tiers":5,"user/tradingVolume":5,"user/unstakingRequests":5,"user/wallet":5,"user/walletHistory":5,"user/walletSummary":5,userAffiliates:5,userEvent:5},post:{address:5,chat:5,guild:5,"guild/archive":5,"guild/join":5,"guild/kick":5,"guild/leave":5,"guild/sharesTrades":5,order:1,"order/cancelAllAfter":5,"order/closePosition":5,"position/isolate":1,"position/leverage":1,"position/riskLimit":5,"position/transferMargin":1,"user/addSubaccount":5,"user/cancelWithdrawal":5,"user/communicationToken":5,"user/confirmEmail":5,"user/confirmWithdrawal":5,"user/logout":5,"user/preferences":5,"user/requestWithdrawal":5,"user/unstakingRequests":5,"user/updateSubaccount":5,"user/walletTransfer":5},put:{guild:5,order:1},delete:{order:1,"order/all":1,"user/unstakingRequests":5}}},exceptions:{exact:{"Invalid API Key.":a.AuthenticationError,"This key is disabled.":a.PermissionDenied,"Access Denied":a.PermissionDenied,"Duplicate clOrdID":a.InvalidOrder,"orderQty is invalid":a.InvalidOrder,"Invalid price":a.InvalidOrder,"Invalid stopPx for ordType":a.InvalidOrder,"Account is restricted":a.PermissionDenied},broad:{"Signature not valid":a.AuthenticationError,overloaded:a.ExchangeNotAvailable,"Account has insufficient Available Balance":a.InsufficientFunds,"Service unavailable":a.ExchangeNotAvailable,"Server Error":a.ExchangeError,"Unable to cancel order due to existing state":a.InvalidOrder,"We require all new traders to verify":a.PermissionDenied}},precisionMode:r.kb,options:{"api-expires":5,fetchOHLCVOpenTimestamp:!0,oldPrecision:!1,networks:{BTC:"btc",ERC20:"eth",BEP20:"bsc",TRC20:"tron",AVAXC:"avax",NEAR:"near",XTZ:"xtz",DOT:"dot",SOL:"sol",ADA:"ada"}},features:{default:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0},triggerDirection:!0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!0,marketBuyRequiresPrice:!1,marketBuyByCost:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:500,daysBack:void 0,untilDays:1e6,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:500,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:500,daysBack:void 0,untilDays:1e6,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:500,daysBack:void 0,daysBackCanceled:void 0,untilDays:1e6,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e4}},spot:{extends:"default",createOrder:{triggerPriceType:{index:!1}}},derivatives:{extends:"default",createOrder:{triggerPriceType:{index:!0}}},swap:{linear:{extends:"derivatives"},inverse:{extends:"derivatives"}},future:{linear:{extends:"derivatives"},inverse:{extends:"derivatives"}}},commonCurrencies:{USDt:"USDT",XBt:"BTC",XBT:"BTC",Gwei:"ETH",GWEI:"ETH",LAMP:"SOL",LAMp:"SOL"}})}async fetchCurrencies(e={}){const t=await this.publicGetWalletAssets(e),i={};for(let e=0;e=0)throw new a.OrderNotFound(this.id+" cancelOrder() failed: "+d);return this.parseOrder(n)}async cancelOrders(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeValue2(i,"clOrdID","clientOrderId"),r={};void 0===s?r.orderID=e:(r.clOrdID=s,i=this.omit(i,["clOrdID","clientOrderId"]));const a=await this.privateDeleteOrder(this.extend(r,i));return this.parseOrders(a)}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const i={};let s;void 0!==e&&(s=this.market(e),i.symbol=s.id);const r=await this.privateDeleteOrderAll(this.extend(i,t));return this.parseOrders(r,s)}async cancelAllOrdersAfter(e,t={}){await this.loadMarkets();const i={timeout:e>0?this.parseToInt(e/1e3):0};return await this.privatePostOrderCancelAllAfter(this.extend(i,t))}async fetchLeverages(e=void 0,t={}){await this.loadMarkets();const i=await this.fetchPositions(e,t);return this.parseLeverages(i,e,"symbol")}parseLeverage(e,t=void 0){const i=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(i,t),marginMode:this.safeStringLower(e,"marginMode"),longLeverage:this.safeInteger(e,"leverage"),shortLeverage:this.safeInteger(e,"leverage")}}async fetchPositions(e=void 0,t={}){await this.loadMarkets();const i=await this.privateGetPosition(t),s=this.parsePositions(i,e);return this.filterByArrayPositions(s,"symbol",e,!1)}parsePosition(e,t=void 0){const i=(t=this.safeMarket(this.safeString(e,"symbol"),t)).symbol,s=this.safeString(e,"timestamp"),r=!0===this.safeValue(e,"crossMargin")?"cross":"isolated",a=o.Y.stringAbs(this.safeString2(e,"foreignNotional","homeNotional")),n=this.safeString(t,"settle"),d=this.convertToRealAmount(n,this.safeString(e,"maintMargin")),h=this.convertToRealAmount(n,this.safeString(e,"unrealisedPnl")),c=this.parseNumber(o.Y.stringAbs(this.safeString(e,"currentQty"))),l=this.safeNumber(t,"contractSize");let u;const f=this.safeString(e,"homeNotional");return void 0!==f&&(u="-"===f[0]?"short":"long"),this.safePosition({info:e,id:this.safeString(e,"account"),symbol:i,timestamp:this.parse8601(s),datetime:s,lastUpdateTimestamp:void 0,hedged:void 0,side:u,contracts:c,contractSize:l,entryPrice:this.safeNumber(e,"avgEntryPrice"),markPrice:this.safeNumber(e,"markPrice"),lastPrice:void 0,notional:this.parseNumber(a),leverage:this.safeNumber(e,"leverage"),collateral:void 0,initialMargin:this.safeNumber(e,"initMargin"),initialMarginPercentage:this.safeNumber(e,"initMarginReq"),maintenanceMargin:d,maintenanceMarginPercentage:this.safeNumber(e,"maintMarginReq"),unrealizedPnl:h,liquidationPrice:this.safeNumber(e,"liquidationPrice"),marginMode:r,marginRatio:void 0,percentage:this.safeNumber(e,"unrealisedPnlPcnt"),stopLossPrice:void 0,takeProfitPrice:void 0})}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),this.checkAddress(i),await this.loadMarkets();const a=this.currency(e),o=this.convertFromRealAmount(e,t);let n;[n,r]=this.handleNetworkCodeAndParams(r);const h={currency:a.id,amount:o,address:i,network:this.networkCodeToId(n,a.code)};void 0!==this.twofa&&(h.otpToken=(0,d.O)(this.twofa));const c=await this.privatePostUserRequestWithdrawal(this.extend(h,r));return this.parseTransaction(c,a)}async fetchFundingRates(e=void 0,t={}){await this.loadMarkets();const i=await this.publicGetInstrumentActiveAndIndices(t),s=[];for(let e=0;e1&&this.inArray(t[1],i)){e=this.currency(t[0]).id+":"+t[1],r.symbol=e}else a=this.market(e),r.symbol=a.id}void 0!==t&&(r.startTime=this.iso8601(t)),void 0!==i&&(r.count=i);const o=this.safeInteger(s,"until");s=this.omit(s,["until"]),void 0!==o&&(r.endTime=this.iso8601(o)),void 0===t&&void 0===o&&(r.reverse=!0);const n=await this.publicGetFunding(this.extend(r,s));return this.parseFundingRateHistories(n,a,t,i)}parseFundingRateHistory(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeString(e,"timestamp");return{info:e,symbol:this.safeSymbol(i,t),fundingRate:this.safeNumber(e,"fundingRate"),timestamp:this.parse8601(s),datetime:s}}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new a.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<.01||e>100)throw new a.BadRequest(this.id+" leverage should be between 0.01 and 100");await this.loadMarkets();const s=this.market(t);if("swap"!==s.type&&"future"!==s.type)throw new a.BadSymbol(this.id+" setLeverage() supports future and swap contracts only");const r={symbol:s.id,leverage:e};return await this.privatePostPositionLeverage(this.extend(r,i))}async setMarginMode(e,t=void 0,i={}){if(void 0===t)throw new a.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("isolated"!==(e=e.toLowerCase())&&"cross"!==e)throw new a.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");await this.loadMarkets();const s=this.market(t);if("swap"!==s.type&&"future"!==s.type)throw new a.BadSymbol(this.id+" setMarginMode() supports swap and future contracts only");const r="cross"!==e,o={symbol:s.id,enabled:r};return await this.privatePostPositionIsolate(this.extend(o,i))}async fetchDepositAddress(e,t={}){let i;if(await this.loadMarkets(),[i,t]=this.handleNetworkCodeAndParams(t),void 0===i)throw new a.ArgumentsRequired(this.id+' fetchDepositAddress requires params["network"]');const s=this.currency(e);t=this.omit(t,"network");const r={currency:s.id,network:this.networkCodeToId(i,s.code)},o=await this.privateGetUserDepositAddress(this.extend(r,t));return{info:o,currency:e,network:i,address:o.replace('"',"").replace('"',""),tag:void 0}}parseDepositWithdrawFee(e,t=void 0){const i=this.safeValue(e,"networks",[]),s=i.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==s){const a=this.safeString(e,"scale"),n=this.parsePrecision(a);for(let e=0;e=400){const t=this.safeValue(n,"error",{}),i=this.safeString(t,"message"),s=this.id+" "+o;if(this.throwExactlyMatchedException(this.exceptions.exact,i,s),this.throwBroadlyMatchedException(this.exceptions.broad,i,s),400===e)throw new a.BadRequest(s);throw new a.ExchangeError(s)}}}nonce(){return this.milliseconds()}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+e;if("GET"===i)Object.keys(s).length&&(o+="?"+this.urlencode(s));else{const e=this.safeString(s,"_format");void 0!==e&&(o+="?"+this.urlencode({_format:e}),s=this.omit(s,"_format"))}const d=this.urls.api[t]+o,h=this.checkRequiredCredentials(!1);if("private"===t||"public"===t&&h){this.checkRequiredCredentials();let e=i+o,t=this.safeInteger(this.options,"api-expires");r={"Content-Type":"application/json","api-key":this.apiKey},t=this.sum(this.seconds(),t);const d=t.toString();e+=d,r["api-expires"]=d,"POST"!==i&&"PUT"!==i&&"DELETE"!==i||Object.keys(s).length&&(e+=a=this.json(s)),r["api-signature"]=this.hmac(this.encode(e),this.encode(this.secret),n.s)}return{url:d,method:i,body:a,headers:r}}}},2753:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(7202),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitopro",name:"BitoPro",countries:["TW"],version:"v3",rateLimit:100,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,createStopOrder:!0,createTriggerOrder:!0,editOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","3h":"3h","6h":"6h","12h":"12h","1d":"1d","1w":"1w","1M":"1M"},urls:{logo:"https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6",api:{rest:"https://api.bitopro.com/v3"},www:"https://www.bitopro.com",doc:["https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md"],fees:"https://www.bitopro.com/fees"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{"order-book/{pair}":1,tickers:1,"tickers/{pair}":1,"trades/{pair}":1,"provisioning/currencies":1,"provisioning/trading-pairs":1,"provisioning/limitations-and-fees":1,"trading-history/{pair}":1,"price/otc/{currency}":1}},private:{get:{"accounts/balance":1,"orders/history":1,"orders/all/{pair}":1,"orders/trades/{pair}":1,"orders/{pair}/{orderId}":1,"wallet/withdraw/{currency}/{serial}":1,"wallet/withdraw/{currency}/id/{id}":1,"wallet/depositHistory/{currency}":1,"wallet/withdrawHistory/{currency}":1,"orders/open":1},post:{"orders/{pair}":.5,"orders/batch":20/3,"wallet/withdraw/{currency}":10},put:{orders:5},delete:{"orders/{pair}/{id}":2/3,"orders/all":5,"orders/{pair}":5}}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.001"),taker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("3000000"),this.parseNumber("0.00194")],[this.parseNumber("5000000"),this.parseNumber("0.0015")],[this.parseNumber("30000000"),this.parseNumber("0.0014")],[this.parseNumber("300000000"),this.parseNumber("0.0013")],[this.parseNumber("550000000"),this.parseNumber("0.0012")],[this.parseNumber("1300000000"),this.parseNumber("0.0011")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("3000000"),this.parseNumber("0.00097")],[this.parseNumber("5000000"),this.parseNumber("0.0007")],[this.parseNumber("30000000"),this.parseNumber("0.0006")],[this.parseNumber("300000000"),this.parseNumber("0.0005")],[this.parseNumber("550000000"),this.parseNumber("0.0004")],[this.parseNumber("1300000000"),this.parseNumber("0.0003")]]}}},options:{networks:{ERC20:"ERC20",ETH:"ERC20",TRX:"TRX",TRC20:"TRX",BEP20:"BSC",BSC:"BSC"},fiatCurrencies:["TWD"]},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e4,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{"Unsupported currency.":r.BadRequest,"Unsupported order type":r.BadRequest,"Invalid body":r.BadRequest,"Invalid Signature":r.AuthenticationError,"Address not in whitelist.":r.BadRequest},broad:{"Invalid amount":r.InvalidOrder,"Balance for ":r.InsufficientFunds,"Invalid ":r.BadRequest,"Wrong parameter":r.BadRequest}},commonCurrencies:{}})}async fetchCurrencies(e={}){const t=await this.publicGetProvisioningCurrencies(e),i=this.safeList(t,"data",[]),s={},r=this.safeList(this.options,"fiatCurrencies",[]);for(let e=0;e=200&&e<300)return;const c=this.id+" "+o,l=this.safeString(n,"error");throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,l,c),new r.ExchangeError(c)}}},9061:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(8800),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitrue",name:"Bitrue",countries:["SG"],rateLimit:1e3,certified:!1,version:"v1",pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!0,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!0,setMargin:!0,setMarginMode:!1,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","1d":"1D","1w":"1W"},urls:{logo:"https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e",api:{spot:"https://www.bitrue.com/api",fapi:"https://fapi.bitrue.com/fapi",dapi:"https://fapi.bitrue.com/dapi",kline:"https://www.bitrue.com/kline-api"},www:"https://www.bitrue.com",referral:"https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE",doc:["https://github.com/Bitrue-exchange/bitrue-official-api-docs","https://www.bitrue.com/api-docs"],fees:"https://bitrue.zendesk.com/hc/en-001/articles/4405479952537"},api:{spot:{kline:{public:{get:{"public.json":1,"public{currency}.json":1}}},v1:{public:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10]]},trades:1,historicalTrades:5,aggTrades:1,"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:1,noSymbol:2},"market/kline":1}},private:{get:{order:1,openOrders:1,allOrders:5,account:5,myTrades:{cost:5,noSymbol:40},"etf/net-value/{symbol}":1,"withdraw/history":1,"deposit/history":1},post:{order:4,"withdraw/commit":1},delete:{order:1}}},v2:{private:{get:{myTrades:5}}}},fapi:{v1:{public:{get:{ping:1,time:1,contracts:1,depth:1,ticker:1,klines:1}}},v2:{private:{get:{myTrades:1,openOrders:1,order:1,account:1,leverageBracket:1,commissionRate:1,futures_transfer_history:1,forceOrdersHistory:1},post:{positionMargin:1,level_edit:1,cancel:1,order:1,allOpenOrders:1,futures_transfer:1}}}},dapi:{v1:{public:{get:{ping:1,time:1,contracts:1,depth:1,ticker:1,klines:1}}},v2:{private:{get:{myTrades:1,openOrders:1,order:1,account:1,leverageBracket:1,commissionRate:1,futures_transfer_history:1,forceOrdersHistory:1},post:{positionMargin:1,level_edit:1,cancel:1,order:1,allOpenOrders:1,futures_transfer:1}}}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.00098"),maker:this.parseNumber("0.00098")},future:{trading:{feeSide:"quote",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000400"),maker:this.parseNumber("0.000200"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000400")],[this.parseNumber("250"),this.parseNumber("0.000400")],[this.parseNumber("2500"),this.parseNumber("0.000350")],[this.parseNumber("7500"),this.parseNumber("0.000320")],[this.parseNumber("22500"),this.parseNumber("0.000300")],[this.parseNumber("50000"),this.parseNumber("0.000270")],[this.parseNumber("100000"),this.parseNumber("0.000250")],[this.parseNumber("200000"),this.parseNumber("0.000220")],[this.parseNumber("400000"),this.parseNumber("0.000200")],[this.parseNumber("750000"),this.parseNumber("0.000170")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000200")],[this.parseNumber("250"),this.parseNumber("0.000160")],[this.parseNumber("2500"),this.parseNumber("0.000140")],[this.parseNumber("7500"),this.parseNumber("0.000120")],[this.parseNumber("22500"),this.parseNumber("0.000100")],[this.parseNumber("50000"),this.parseNumber("0.000080")],[this.parseNumber("100000"),this.parseNumber("0.000060")],[this.parseNumber("200000"),this.parseNumber("0.000040")],[this.parseNumber("400000"),this.parseNumber("0.000020")],[this.parseNumber("750000"),this.parseNumber("0")]]}}},delivery:{trading:{feeSide:"base",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000100"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000500")],[this.parseNumber("250"),this.parseNumber("0.000450")],[this.parseNumber("2500"),this.parseNumber("0.000400")],[this.parseNumber("7500"),this.parseNumber("0.000300")],[this.parseNumber("22500"),this.parseNumber("0.000250")],[this.parseNumber("50000"),this.parseNumber("0.000240")],[this.parseNumber("100000"),this.parseNumber("0.000240")],[this.parseNumber("200000"),this.parseNumber("0.000240")],[this.parseNumber("400000"),this.parseNumber("0.000240")],[this.parseNumber("750000"),this.parseNumber("0.000240")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000100")],[this.parseNumber("250"),this.parseNumber("0.000080")],[this.parseNumber("2500"),this.parseNumber("0.000050")],[this.parseNumber("7500"),this.parseNumber("0.0000030")],[this.parseNumber("22500"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.000050")],[this.parseNumber("100000"),this.parseNumber("-0.000060")],[this.parseNumber("200000"),this.parseNumber("-0.000070")],[this.parseNumber("400000"),this.parseNumber("-0.000080")],[this.parseNumber("750000"),this.parseNumber("-0.000090")]]}}}},options:{createMarketBuyOrderRequiresPrice:!0,fetchMarkets:["spot","linear","inverse"],fetchMyTradesMethod:"v2PrivateGetMyTrades",hasAlreadyAuthenticatedSuccessfully:!1,currencyToPrecisionRoundingMode:o.R3,recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,parseOrderToPrecision:!1,newOrderRespType:{market:"FULL",limit:"FULL"},networks:{ERC20:"ETH",TRC20:"TRX",AETERNITY:"Aeternity",AION:"AION",ALGO:"Algorand",ASK:"ASK",ATOM:"ATOM",AVAXC:"AVAX C-Chain",BCH:"BCH",BEP2:"BEP2",BEP20:"BEP20",Bitcoin:"Bitcoin",BRP20:"BRP20",ADA:"Cardano",CASINOCOIN:"CasinoCoin","CASINOCOIN-XRPL":"CasinoCoin XRPL",CONTENTOS:"Contentos",DASH:"Dash",DECOIN:"Decoin",DFI:"DeFiChain",DGB:"DGB",DIVI:"Divi",DOGE:"dogecoin",EOS:"EOS",ETC:"ETC",FILECOIN:"Filecoin",FREETON:"FREETON",HBAR:"HBAR",HEDERA:"Hedera Hashgraph",HRC20:"HRC20",ICON:"ICON",ICP:"ICP",IGNIS:"Ignis",INTERNETCOMPUTER:"Internet Computer",IOTA:"IOTA",KAVA:"KAVA",KSM:"KSM",LTC:"LiteCoin",LUNA:"Luna",MATIC:"MATIC",MOBILECOIN:"Mobile Coin",MONACOIN:"MonaCoin",XMR:"Monero",NEM:"NEM",NEP5:"NEP5",OMNI:"OMNI",PAC:"PAC",DOT:"Polkadot",RAVEN:"Ravencoin",SAFEX:"Safex",SOL:"SOLANA",SGB:"Songbird",XML:"Stellar Lumens",XYM:"Symbol",XTZ:"Tezos",theta:"theta",THETA:"THETA",VECHAIN:"VeChain",WANCHAIN:"Wanchain",XINFIN:"XinFin Network",XRP:"XRP",XRPL:"XRPL",ZIL:"ZIL"},defaultType:"spot",timeframes:{spot:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","12h":"12H","1d":"1D","1w":"1W"},future:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1h","1d":"1day","1w":"1week","1M":"1month"}},accountsByType:{spot:"wallet",future:"contract",swap:"contract",funding:"wallet",fund:"wallet",contract:"contract"}},commonCurrencies:{MIM:"MIM Swarm"},precisionMode:o.kb,features:{default:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:void 0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!0,marketBuyByCost:!0,selfTradePrevention:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:90,daysBackCanceled:1,untilDays:90,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1440}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrder:{marginMode:!0,leverage:!0,marketBuyRequiresPrice:!1,marketBuyByCost:!1},fetchOHLCV:{limit:300},fetchClosedOrders:void 0},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"System is under maintenance.":r.OnMaintenance,"System abnormality":r.ExchangeError,"You are not authorized to execute this request.":r.PermissionDenied,"API key does not exist":r.AuthenticationError,"Order would trigger immediately.":r.OrderImmediatelyFillable,"Stop price would trigger immediately.":r.OrderImmediatelyFillable,"Order would immediately match and take.":r.OrderImmediatelyFillable,"Account has insufficient balance for requested action.":r.InsufficientFunds,"Rest API trading is not enabled.":r.ExchangeNotAvailable,"You don't have permission.":r.PermissionDenied,"Market is closed.":r.ExchangeNotAvailable,"Too many requests. Please try again later.":r.DDoSProtection,"-1000":r.ExchangeNotAvailable,"-1001":r.ExchangeNotAvailable,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1013":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.ExchangeNotAvailable,"-1020":r.BadRequest,"-1021":r.InvalidNonce,"-1022":r.AuthenticationError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1111":r.BadRequest,"-1112":r.InvalidOrder,"-1114":r.BadRequest,"-1115":r.BadRequest,"-1116":r.BadRequest,"-1117":r.BadRequest,"-1166":r.InvalidOrder,"-1118":r.BadRequest,"-1119":r.BadRequest,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1125":r.AuthenticationError,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-1131":r.BadRequest,"-1160":r.InvalidOrder,"-1156":r.InvalidOrder,"-2008":r.AuthenticationError,"-2010":r.ExchangeError,"-2011":r.OrderNotFound,"-2013":r.OrderNotFound,"-2014":r.AuthenticationError,"-2015":r.AuthenticationError,"-2017":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-3005":r.InsufficientFunds,"-3006":r.InsufficientFunds,"-3008":r.InsufficientFunds,"-3010":r.ExchangeError,"-3015":r.ExchangeError,"-3022":r.AccountSuspended,"-4028":r.BadRequest,"-3020":r.InsufficientFunds,"-3041":r.InsufficientFunds,"-5013":r.InsufficientFunds,"-11008":r.InsufficientFunds,"-4051":r.InsufficientFunds},broad:{"Insufficient account balance":r.InsufficientFunds,"has no operation privilege":r.PermissionDenied,MAX_POSITION:r.InvalidOrder}}})}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchStatus(e={}){const t=await this.spotV1PublicGetPing(e);return{status:Object.keys(t).length?"maintenance":"ok",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchTime(e={}){const t=await this.spotV1PublicGetTime(e);return this.safeInteger(t,"serverTime")}async fetchCurrencies(e={}){const t=await this.spotV1PublicGetExchangeInfo(e),i={},s=this.safeList(t,"coins",[]);for(let e=0;e100&&(t=100),e.limit=t),s.linear?a=await this.fapiV1PublicGetDepth(this.extend(e,i)):s.inverse&&(a=await this.dapiV1PublicGetDepth(this.extend(e,i)))}else{if(!s.spot)throw new r.NotSupported(this.id+" fetchOrderBook only support spot & swap markets");{const e={symbol:s.id};void 0!==t&&(t>1e3&&(t=1e3),e.limit=t),a=await this.spotV1PublicGetDepth(this.extend(e,i))}}const o=this.safeInteger2(a,"time","lastUpdateId"),n=this.parseOrderBook(a,e,o);return n.nonce=this.safeInteger(a,"lastUpdateId"),n}parseTicker(e,t=void 0){const i=this.safeSymbol(void 0,t),s=this.safeString2(e,"lastPrice","last"),r=this.safeInteger(e,"time");let o;return o=t.swap?a.Y.stringMul(this.safeString(e,"rose"),"100"):this.safeString(e,"priceChangePercent"),this.safeTicker({symbol:i,timestamp:r,datetime:this.iso8601(r),high:this.safeString2(e,"highPrice","high"),low:this.safeString2(e,"lowPrice","low"),bid:this.safeString2(e,"bidPrice","buy"),bidVolume:this.safeString(e,"bidQty"),ask:this.safeString2(e,"askPrice","sell"),askVolume:this.safeString(e,"askQty"),vwap:this.safeString(e,"weightedAvgPrice"),open:this.safeString(e,"openPrice"),close:s,last:s,previousClose:void 0,change:this.safeString(e,"priceChange"),percentage:o,average:void 0,baseVolume:this.safeString2(e,"volume","vol"),quoteVolume:this.safeString(e,"quoteVolume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e);let s,a;if(i.swap){const e={contractName:i.id};i.linear?s=await this.fapiV1PublicGetTicker(this.extend(e,t)):i.inverse&&(s=await this.dapiV1PublicGetTicker(this.extend(e,t))),a=s}else{if(!i.spot)throw new r.NotSupported(this.id+" fetchTicker only support spot & swap markets");{const e={symbol:i.id};s=await this.spotV1PublicGetTicker24hr(this.extend(e,t)),a=this.safeDict(s,0,{})}}return this.parseTicker(a,i)}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeDict(this.options,"timeframes",{});let d,h;if(o.swap){const e=this.safeDict(n,"future",{}),i={contractName:o.id,interval:this.safeString(e,t,"1min")};void 0!==s&&(i.limit=s),o.linear?d=await this.fapiV1PublicGetKlines(this.extend(i,a)):o.inverse&&(d=await this.dapiV1PublicGetKlines(this.extend(i,a))),h=d}else{if(!o.spot)throw new r.NotSupported(this.id+" fetchOHLCV only support spot & swap markets");{const e=this.safeDict(n,"spot",{}),i={symbol:o.id,scale:this.safeString(e,t,"1m")};void 0!==s&&(i.limit=s);const r=this.safeInteger(a,"until");void 0!==r&&(a=this.omit(a,"until"),i.fromIdx=r),d=await this.spotV1PublicGetMarketKline(this.extend(i,a)),h=this.safeList(d,"data",[])}}return this.parseOHLCVs(h,o,t,i,s)}parseOHLCV(e,t=void 0){let i=this.safeTimestamp(e,"i");return void 0===i&&(i=this.safeInteger(e,"idx")),[i,this.safeNumber2(e,"o","open"),this.safeNumber2(e,"h","high"),this.safeNumber2(e,"l","low"),this.safeNumber2(e,"c","close"),this.safeNumber2(e,"v","vol")]}async fetchBidsAsks(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e,void 0,!1);const i=this.safeString(e,0),s=this.market(i);let a;if(s.swap){const e={contractName:s.id};s.linear?a=await this.fapiV1PublicGetTicker(this.extend(e,t)):s.inverse&&(a=await this.dapiV1PublicGetTicker(this.extend(e,t)))}else{if(!s.spot)throw new r.NotSupported(this.id+" fetchBidsAsks only support spot & swap markets");{const e={symbol:s.id};a=await this.spotV1PublicGetTickerBookTicker(this.extend(e,t))}}const o={};return o[s.id]=a,this.parseTickers(o,e)}async fetchTickers(e=void 0,t={}){let i,s;await this.loadMarkets();const a={};let o;if(void 0!==(e=this.marketSymbols(e))){const o=this.safeString(e,0),n=this.market(o);if(n.swap)throw new r.NotSupported(this.id+" fetchTickers does not support swap markets, please use fetchTicker instead");if(!n.spot)throw new r.NotSupported(this.id+" fetchTickers only support spot & swap markets");i=await this.spotV1PublicGetTicker24hr(this.extend(a,t)),s=i}else{if([o,t]=this.handleMarketTypeAndParams("fetchTickers",void 0,t),"spot"!==o)throw new r.NotSupported(this.id+" fetchTickers only support spot when symbols are not proved");i=await this.spotV1PublicGetTicker24hr(this.extend(a,t)),s=i}const n={};for(let e=0;e1e3&&(i=1e3),d.limit=i),a.swap)d.contractName=a.id,a.linear?o=await this.fapiV2PrivateGetMyTrades(this.extend(d,s)):a.inverse&&(o=await this.dapiV2PrivateGetMyTrades(this.extend(d,s))),n=this.safeList(o,"data",[]);else{if(!a.spot)throw new r.NotSupported(this.id+" fetchMyTrades only support spot & swap markets");d.symbol=a.id,o=await this.spotV2PrivateGetMyTrades(this.extend(d,s)),n=o}return this.parseTrades(n,a,t,i)}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchDeposits() requires a code argument");await this.loadMarkets();const a=this.currency(e),o={coin:a.id,status:1};void 0!==t&&(o.startTime=t),void 0!==i&&(o.limit=i);const n=await this.spotV1PrivateGetDepositHistory(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchWithdrawals() requires a code argument");await this.loadMarkets();const a=this.currency(e),o={coin:a.id,status:5};void 0!==t&&(o.startTime=t),void 0!==i&&(o.limit=i);const n=await this.spotV1PrivateGetWithdrawHistory(this.extend(o,s)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a)}parseTransactionStatusByType(e,t=void 0){const i=this.safeDict({deposit:{0:"pending",1:"ok"},withdrawal:{0:"pending",5:"ok",6:"canceled"}},t,{});return this.safeString(i,e,e)}parseTransaction(e,t=void 0){const i=this.safeString2(e,"id","withdrawId"),s=this.safeString(e,"tagType");let r,a,o=this.safeString(e,"addressTo"),n=this.safeString(e,"addressFrom");if(void 0!==s){if(void 0!==o){const e=o.split("_");o=this.safeString(e,0),r=this.safeString(e,1)}if(void 0!==n){const e=n.split("_");n=this.safeString(e,0),a=this.safeString(e,1)}}const d=this.safeString(e,"txid"),h=this.safeInteger(e,"createdAt"),c=this.safeInteger(e,"updatedAt"),l="payAmount"in e||"ctime"in e?"withdrawal":"deposit",u=this.parseTransactionStatusByType(this.safeString(e,"status"),l),f=this.safeNumber(e,"amount");let p,m=this.safeString2(e,"symbol","coin");if(void 0!==m){const e=m.split("_");m=this.safeString(e,0);const t=this.safeString(e,1);void 0!==t&&(p=t.toUpperCase())}const g=this.safeCurrencyCode(m,t),v=this.safeNumber(e,"fee");let y;return void 0!==v&&(y={currency:g,cost:v}),{info:e,id:i,txid:d,timestamp:h,datetime:this.iso8601(h),network:p,address:o,addressTo:o,addressFrom:n,tag:r,tagTo:r,tagFrom:a,type:l,amount:f,currency:g,status:u,updated:c,internal:!1,comment:void 0,fee:y}}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),this.checkAddress(i),await this.loadMarkets();const a=this.currency(e),o={coin:a.id,amount:t,addressTo:i};let n;[n,r]=this.handleNetworkCodeAndParams(r),void 0!==n&&(o.chainName=this.networkCodeToId(n)),void 0!==s&&(o.tag=s);const d=await this.spotV1PrivatePostWithdrawCommit(this.extend(o,r)),h=this.safeDict(d,"data",{});return this.parseTransaction(h,a)}parseDepositWithdrawFee(e,t=void 0){const i=this.safeList(e,"chainDetail",[]),s=i.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==s)for(let e=0;e200&&(i=200),r.limit=i);const o=this.safeInteger(s,"until");void 0!==o&&(s=this.omit(s,"until"),r.endTime=o);const n=await this.fapiV2PrivateGetFuturesTransferHistory(this.extend(r,s)),d=this.safeList(n,"data",[]);return this.parseTransfers(d,a,t,i)}async transfer(e,t,i,s,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeDict(this.options,"accountsByType",{}),n=this.safeString(o,i,i),d=this.safeString(o,s,s),h={coinSymbol:a.id,amount:this.currencyToPrecision(e,t),transferType:n+"_to_"+d},c=await this.fapiV2PrivatePostFuturesTransfer(this.extend(h,r)),l=this.safeDict(c,"data",{});return this.parseTransfer(l,a)}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<1||e>125)throw new r.BadRequest(this.id+" leverage should be between 1 and 125");await this.loadMarkets();const s=this.market(t);let a;const o={contractName:s.id,leverage:e};if(!s.swap)throw new r.NotSupported(this.id+" setLeverage only support swap markets");return s.linear?a=await this.fapiV2PrivatePostLevelEdit(this.extend(o,i)):s.inverse&&(a=await this.dapiV2PrivatePostLevelEdit(this.extend(o,i))),a}parseMarginModification(e,t=void 0){return{info:e,symbol:t.symbol,type:void 0,marginMode:"isolated",amount:void 0,total:void 0,code:void 0,status:void 0,timestamp:void 0,datetime:void 0}}async setMargin(e,t,i={}){await this.loadMarkets();const s=this.market(e);if(!s.swap)throw new r.NotSupported(this.id+" setMargin only support swap markets");let a;const o={contractName:s.id,amount:this.parseToNumeric(t)};return s.linear?a=await this.fapiV2PrivatePostPositionMargin(this.extend(o,i)):s.inverse&&(a=await this.dapiV2PrivatePostPositionMargin(this.extend(o,i))),this.parseMarginModification(a,s)}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){const o=this.safeString(t,0),d=this.safeString(t,1),h=this.safeString(t,2);let c;if(c="api"===o&&"kline"===d||"open"===o&&e.indexOf("listenKey")>=0?this.urls.api[o]:this.urls.api[o]+"/"+d,c=c+"/"+this.implodeParams(e,s),s=this.omit(s,this.extractParams(e)),"private"===h){this.checkRequiredCredentials();const t=this.safeInteger(this.options,"recvWindow",5e3);if("spot"===o||"open"===o){let e=this.urlencode(this.extend({timestamp:this.nonce(),recvWindow:t},s));e+="&signature="+this.hmac(this.encode(e),this.encode(this.secret),n.s),r={"X-MBX-APIKEY":this.apiKey},"GET"===i||"DELETE"===i?c+="?"+e:(a=e,r["Content-Type"]="application/x-www-form-urlencoded")}else{const h=this.nonce().toString();let l;"fapi"===o?l="/fapi":"dapi"===o&&(l="/dapi"),l=l+"/"+d+"/"+e;let u=h+i+l;if("GET"===i){Object.keys(s).length>0&&(u+="?"+this.urlencode(s));const e=this.hmac(this.encode(u),this.encode(this.secret),n.s);r={"X-CH-APIKEY":this.apiKey,"X-CH-SIGN":e,"X-CH-TS":h},c+="?"+this.urlencode(s)}else{const e=this.extend({recvWindow:t},s);u+=a=this.json(e);const i=this.hmac(this.encode(u),this.encode(this.secret),n.s);r={"Content-Type":"application/json","X-CH-APIKEY":this.apiKey,"X-CH-SIGN":i,"X-CH-TS":h}}}}else Object.keys(s).length&&(c+="?"+this.urlencode(s));return{url:c,method:i,body:a,headers:r}}handleErrors(e,t,i,s,o,n,d,h,c){if(418===e||429===e)throw new r.DDoSProtection(this.id+" "+e.toString()+" "+t+" "+n);if(e>=400){if(n.indexOf("Price * QTY is zero or less")>=0)throw new r.InvalidOrder(this.id+" order cost = amount * price is zero or less "+n);if(n.indexOf("LOT_SIZE")>=0)throw new r.InvalidOrder(this.id+" order amount should be evenly divisible by lot size "+n);if(n.indexOf("PRICE_FILTER")>=0)throw new r.InvalidOrder(this.id+" order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid float value in general, use this.priceToPrecision (symbol, amount) "+n)}if(void 0===d)return;const l=this.safeBool(d,"success",!0);if(!l){const e=this.safeString(d,"msg");let t;if(void 0!==e){try{t=JSON.parse(e)}catch(e){t=void 0}void 0!==t&&(d=t)}}const u=this.safeString(d,"msg");void 0!==u&&(this.throwExactlyMatchedException(this.exceptions.exact,u,this.id+" "+u),this.throwBroadlyMatchedException(this.exceptions.broad,u,this.id+" "+u));const f=this.safeString(d,"code");if(void 0!==f){if("200"===f||a.Y.stringEquals(f,"0"))return;if("-2015"===f&&this.options.hasAlreadyAuthenticatedSuccessfully)throw new r.DDoSProtection(this.id+" temporary banned: "+n);const e=this.id+" "+n;throw this.throwExactlyMatchedException(this.exceptions.exact,f,e),new r.ExchangeError(e)}if(!l)throw new r.ExchangeError(this.id+" "+n)}calculateRateLimiterCost(e,t,i,s,r={}){if("noSymbol"in r&&!("symbol"in s))return r.noSymbol;if("byLimit"in r&&"limit"in s){const e=s.limit,t=r.byLimit;for(let i=0;i{i.d(t,{A:()=>d});var s=i(9656),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitso",name:"Bitso",countries:["MX"],rateLimit:2e3,version:"v3",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!1,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFee:!1,fetchTransactionFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},urls:{logo:"https://github.com/user-attachments/assets/178c8e56-9054-4107-b192-5e5053d4f975",api:{rest:"https://bitso.com/api"},test:{rest:"https://stage.bitso.com/api"},www:"https://bitso.com",doc:"https://bitso.com/api_info",fees:"https://bitso.com/fees",referral:"https://bitso.com/?ref=itej"},precisionMode:o.kb,options:{precision:{XRP:1e-6,MXN:.01,TUSD:.01},defaultPrecision:1e-8,networks:{TRC20:"trx",ERC20:"erc20",BEP20:"bsc",BEP2:"bep2"}},timeframes:{"1m":"60","5m":"300","15m":"900","30m":"1800","1h":"3600","4h":"14400","12h":"43200","1d":"86400","1w":"604800"},api:{public:{get:["available_books","ticker","order_book","trades","ohlc"]},private:{get:["account_status","balance","fees","fundings","fundings/{fid}","funding_destination","kyc_documents","ledger","ledger/trades","ledger/fees","ledger/fundings","ledger/withdrawals","mx_bank_codes","open_orders","order_trades/{oid}","orders/{oid}","user_trades","user_trades/{tid}","withdrawals/","withdrawals/{wid}"],post:["bitcoin_withdrawal","debit_card_withdrawal","ether_withdrawal","orders","phone_number","phone_verification","phone_withdrawal","spei_withdrawal","ripple_withdrawal","bcash_withdrawal","litecoin_withdrawal"],delete:["orders","orders/{oid}","orders/all"]}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:void 0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:500,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:300}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{"0201":r.AuthenticationError,104:r.InvalidNonce,"0304":r.BadRequest}})}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){const r={};void 0!==i&&(r.limit=i);const a=await this.privateGetLedger(this.extend(r,s)),o=this.safeValue(a,"payload",[]),n=this.safeCurrency(e);return this.parseLedger(o,n,t,i)}parseLedgerEntryType(e){return this.safeString({funding:"transaction",withdrawal:"transaction",trade:"trade",fee:"fee"},e,e)}parseLedgerEntry(e,t=void 0){const i=this.safeString(e,"operation"),s=this.parseLedgerEntryType(i),r=this.safeValue(e,"balance_updates",[]),o=this.safeValue(r,0,{});let n,d;const h=this.safeString(o,"amount"),c=this.safeString(o,"currency"),l=this.safeCurrencyCode(c,t);t=this.safeCurrency(c,t);const u=this.safeValue(e,"details",{});let f=this.safeString2(u,"fid","wid");if(void 0===f&&(f=this.safeString(u,"tid")),"funding"===i)n="in";else if("withdrawal"===i)n="out";else if("trade"===i)n=void 0;else if("fee"===i){n="out";d={cost:a.Y.stringAbs(h),currency:t}}const p=this.parse8601(this.safeString(e,"created_at"));return this.safeLedgerEntry({info:e,id:this.safeString(e,"eid"),direction:n,account:void 0,referenceId:f,referenceAccount:void 0,type:s,currency:l,amount:h,timestamp:p,datetime:this.iso8601(p),before:void 0,after:void 0,status:"ok",fee:d},t)}async fetchMarkets(e={}){const t=await this.publicGetAvailableBooks(e),i=this.safeValue(t,"payload",[]),s=[];for(let e=0;e=0){const e=a.split("?dt=");a=this.safeString(e,0),r=this.safeString(e,1)}return this.checkAddress(a),{info:s,currency:e,network:void 0,address:a,tag:r}}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const i=await this.privateGetFees(t),s={},r=this.safeValue(i,"payload",{}),a=this.safeValue(r,"deposit_fees",[]);for(let t=0;t{i.d(t,{A:()=>d});var s=i(5223),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitstamp",name:"Bitstamp",countries:["GB"],rateLimit:75,version:"v2",userAgent:this.userAgents.chrome,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactionFees:!0,fetchTransactions:"emulated",fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!0,withdraw:!0},urls:{logo:"https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024",api:{public:"https://www.bitstamp.net/api",private:"https://www.bitstamp.net/api"},www:"https://www.bitstamp.net",doc:"https://www.bitstamp.net/api"},timeframes:{"1m":"60","3m":"180","5m":"300","15m":"900","30m":"1800","1h":"3600","2h":"7200","4h":"14400","6h":"21600","12h":"43200","1d":"86400","1w":"259200"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{"ohlc/{pair}/":1,"order_book/{pair}/":1,"ticker/":1,"ticker_hour/{pair}/":1,"ticker/{pair}/":1,"transactions/{pair}/":1,"trading-pairs-info/":1,"currencies/":1,"eur_usd/":1,"travel_rule/vasps/":1}},private:{get:{"travel_rule/contacts/":1,"contacts/{contact_uuid}/":1,"earn/subscriptions/":1,"earn/transactions/":1},post:{"account_balances/":1,"account_balances/{currency}/":1,"balance/":1,"balance/{pair}/":1,"bch_withdrawal/":1,"bch_address/":1,"user_transactions/":1,"user_transactions/{pair}/":1,"crypto-transactions/":1,open_order:1,"open_orders/all/":1,"open_orders/{pair}/":1,"order_status/":1,"cancel_order/":1,"cancel_all_orders/":1,"cancel_all_orders/{pair}/":1,"buy/{pair}/":1,"buy/market/{pair}/":1,"buy/instant/{pair}/":1,"sell/{pair}/":1,"sell/market/{pair}/":1,"sell/instant/{pair}/":1,"transfer-to-main/":1,"transfer-from-main/":1,"my_trading_pairs/":1,"fees/trading/":1,"fees/trading/{market_symbol}":1,"fees/withdrawal/":1,"fees/withdrawal/{currency}/":1,"withdrawal-requests/":1,"withdrawal/open/":1,"withdrawal/status/":1,"withdrawal/cancel/":1,"liquidation_address/new/":1,"liquidation_address/info/":1,"btc_unconfirmed/":1,"websockets_token/":1,"btc_withdrawal/":1,"btc_address/":1,"ripple_withdrawal/":1,"ripple_address/":1,"ltc_withdrawal/":1,"ltc_address/":1,"eth_withdrawal/":1,"eth_address/":1,"xrp_withdrawal/":1,"xrp_address/":1,"xlm_withdrawal/":1,"xlm_address/":1,"pax_withdrawal/":1,"pax_address/":1,"link_withdrawal/":1,"link_address/":1,"usdc_withdrawal/":1,"usdc_address/":1,"omg_withdrawal/":1,"omg_address/":1,"dai_withdrawal/":1,"dai_address/":1,"knc_withdrawal/":1,"knc_address/":1,"mkr_withdrawal/":1,"mkr_address/":1,"zrx_withdrawal/":1,"zrx_address/":1,"gusd_withdrawal/":1,"gusd_address/":1,"aave_withdrawal/":1,"aave_address/":1,"bat_withdrawal/":1,"bat_address/":1,"uma_withdrawal/":1,"uma_address/":1,"snx_withdrawal/":1,"snx_address/":1,"uni_withdrawal/":1,"uni_address/":1,"yfi_withdrawal/":1,"yfi_address/":1,"audio_withdrawal/":1,"audio_address/":1,"crv_withdrawal/":1,"crv_address/":1,"algo_withdrawal/":1,"algo_address/":1,"comp_withdrawal/":1,"comp_address/":1,"grt_withdrawal/":1,"grt_address/":1,"usdt_withdrawal/":1,"usdt_address/":1,"eurt_withdrawal/":1,"eurt_address/":1,"matic_withdrawal/":1,"matic_address/":1,"sushi_withdrawal/":1,"sushi_address/":1,"chz_withdrawal/":1,"chz_address/":1,"enj_withdrawal/":1,"enj_address/":1,"alpha_withdrawal/":1,"alpha_address/":1,"ftt_withdrawal/":1,"ftt_address/":1,"storj_withdrawal/":1,"storj_address/":1,"axs_withdrawal/":1,"axs_address/":1,"sand_withdrawal/":1,"sand_address/":1,"hbar_withdrawal/":1,"hbar_address/":1,"rgt_withdrawal/":1,"rgt_address/":1,"fet_withdrawal/":1,"fet_address/":1,"skl_withdrawal/":1,"skl_address/":1,"cel_withdrawal/":1,"cel_address/":1,"sxp_withdrawal/":1,"sxp_address/":1,"ada_withdrawal/":1,"ada_address/":1,"slp_withdrawal/":1,"slp_address/":1,"ftm_withdrawal/":1,"ftm_address/":1,"perp_withdrawal/":1,"perp_address/":1,"dydx_withdrawal/":1,"dydx_address/":1,"gala_withdrawal/":1,"gala_address/":1,"shib_withdrawal/":1,"shib_address/":1,"amp_withdrawal/":1,"amp_address/":1,"sgb_withdrawal/":1,"sgb_address/":1,"avax_withdrawal/":1,"avax_address/":1,"wbtc_withdrawal/":1,"wbtc_address/":1,"ctsi_withdrawal/":1,"ctsi_address/":1,"cvx_withdrawal/":1,"cvx_address/":1,"imx_withdrawal/":1,"imx_address/":1,"nexo_withdrawal/":1,"nexo_address/":1,"ust_withdrawal/":1,"ust_address/":1,"ant_withdrawal/":1,"ant_address/":1,"gods_withdrawal/":1,"gods_address/":1,"rad_withdrawal/":1,"rad_address/":1,"band_withdrawal/":1,"band_address/":1,"inj_withdrawal/":1,"inj_address/":1,"rly_withdrawal/":1,"rly_address/":1,"rndr_withdrawal/":1,"rndr_address/":1,"vega_withdrawal/":1,"vega_address/":1,"1inch_withdrawal/":1,"1inch_address/":1,"ens_withdrawal/":1,"ens_address/":1,"mana_withdrawal/":1,"mana_address/":1,"lrc_withdrawal/":1,"lrc_address/":1,"ape_withdrawal/":1,"ape_address/":1,"mpl_withdrawal/":1,"mpl_address/":1,"euroc_withdrawal/":1,"euroc_address/":1,"sol_withdrawal/":1,"sol_address/":1,"dot_withdrawal/":1,"dot_address/":1,"near_withdrawal/":1,"near_address/":1,"doge_withdrawal/":1,"doge_address/":1,"flr_withdrawal/":1,"flr_address/":1,"dgld_withdrawal/":1,"dgld_address/":1,"ldo_withdrawal/":1,"ldo_address/":1,"travel_rule/contacts/":1,"earn/subscribe/":1,"earn/subscriptions/setting/":1,"earn/unsubscribe":1,"wecan_withdrawal/":1,"wecan_address/":1,"trac_withdrawal/":1,"trac_address/":1,"eurcv_withdrawal/":1,"eurcv_address/":1,"pyusd_withdrawal/":1,"pyusd_address/":1,"lmwr_withdrawal/":1,"lmwr_address/":1,"pepe_withdrawal/":1,"pepe_address/":1,"blur_withdrawal/":1,"blur_address/":1,"vext_withdrawal/":1,"vext_address/":1,"cspr_withdrawal/":1,"cspr_address/":1,"vchf_withdrawal/":1,"vchf_address/":1,"veur_withdrawal/":1,"veur_address/":1,"truf_withdrawal/":1,"truf_address/":1,"wif_withdrawal/":1,"wif_address/":1,"smt_withdrawal/":1,"smt_address/":1,"sui_withdrawal/":1,"sui_address/":1,"jup_withdrawal/":1,"jup_address/":1,"ondo_withdrawal/":1,"ondo_address/":1,"boba_withdrawal/":1,"boba_address/":1,"pyth_withdrawal/":1,"pyth_address/":1}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.004"),maker:this.parseNumber("0.004"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.003")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1500000"),this.parseNumber("0.0016")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("20000000"),this.parseNumber("0.001")],[this.parseNumber("50000000"),this.parseNumber("0.0008")],[this.parseNumber("100000000"),this.parseNumber("0.0006")],[this.parseNumber("250000000"),this.parseNumber("0.0005")],[this.parseNumber("1000000000"),this.parseNumber("0.0003")]],maker:[[this.parseNumber("0"),this.parseNumber("0.003")],[this.parseNumber("10000"),this.parseNumber("0.002")],[this.parseNumber("100000"),this.parseNumber("0.001")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1500000"),this.parseNumber("0.0006")],[this.parseNumber("5000000"),this.parseNumber("0.0003")],[this.parseNumber("20000000"),this.parseNumber("0.002")],[this.parseNumber("50000000"),this.parseNumber("0.0001")],[this.parseNumber("100000000"),this.parseNumber("0")],[this.parseNumber("250000000"),this.parseNumber("0")],[this.parseNumber("1000000000"),this.parseNumber("0")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{BTC:0,BCH:0,LTC:0,ETH:0,XRP:0,XLM:0,PAX:0,USD:7.5,EUR:0}}},precisionMode:o.kb,commonCurrencies:{UST:"USTC"},options:{networksById:{"bitcoin-cash":"BCH",bitcoin:"BTC",ethereum:"ERC20",litecoin:"LTC",stellar:"XLM",xrpl:"XRP",tron:"TRC20",algorand:"ALGO",flare:"FLR",hedera:"HBAR",cardana:"ADA",songbird:"FLR","avalanche-c-chain":"AVAX",solana:"SOL",polkadot:"DOT",near:"NEAR",doge:"DOGE",sui:"SUI",casper:"CSRP"}},exceptions:{exact:{"No permission found":r.PermissionDenied,"API key not found":r.AuthenticationError,"IP address not allowed":r.PermissionDenied,"Invalid nonce":r.InvalidNonce,"Invalid signature":r.AuthenticationError,"Authentication failed":r.AuthenticationError,"Missing key, signature and nonce parameters":r.AuthenticationError,"Wrong API key format":r.AuthenticationError,"Your account is frozen":r.PermissionDenied,"Please update your profile with your FATCA information, before using API.":r.PermissionDenied,"Order not found.":r.OrderNotFound,"Price is more than 20% below market price.":r.InvalidOrder,"Bitstamp.net is under scheduled maintenance. We'll be back soon.":r.OnMaintenance,"Order could not be placed.":r.ExchangeNotAvailable,"Invalid offset.":r.BadRequest},broad:{"Minimum order size is":r.InvalidOrder,"Check your account balance for details.":r.InsufficientFunds,"Ensure this value has at least":r.InvalidAddress,"Ensure that there are no more than":r.InvalidOrder}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:void 0,untilDays:30,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}}})}async fetchMarkets(e={}){const t=await this.fetchMarketsFromCache(e),i=[];for(let e=0;es){const i=await this.publicGetTradingPairsInfo(e);this.options.fetchMarkets=this.extend(t,{response:i,timestamp:r})}return this.safeValue(this.options.fetchMarkets,"response")}async fetchCurrencies(e={}){const t=await this.fetchMarketsFromCache(e),i={};for(let e=0;e2)throw new r.ExchangeError(this.id+" getMarketFromTrade() too many keys: "+this.json(t)+" in the trade: "+this.json(e));if(2===i){let e=t[0]+t[1];if(e in this.markets_by_id)return this.safeMarket(e);if(e=t[1]+t[0],e in this.markets_by_id)return this.safeMarket(e)}}parseTrade(e,t=void 0){const i=this.safeString2(e,"id","tid");let s,r,o=this.safeString(e,"price"),n=this.safeString(e,"amount");const d=this.safeString(e,"order_id");let h,c=this.safeString(e,"cost");if(void 0===t){const i=Object.keys(e);for(let e=0;e=0&&(h=s,t=this.safeMarket(h,t,"_"))}}void 0===t&&(t=this.getMarketFromTrade(e));const l=this.safeString(e,"fee"),u=t.quote,f=void 0!==h?h:t.marketId;o=this.safeString(e,f,o),n=this.safeString(e,t.baseId,n),c=this.safeString(e,t.quoteId,c),s=t.symbol;const p=this.safeString2(e,"date","datetime");let m,g;if(void 0!==p&&(p.indexOf(" ")>=0?m=this.parse8601(p):(m=parseInt(p),m*=1e3)),"id"in e){if(void 0!==n){a.Y.stringLt(n,"0")?(r="sell",n=a.Y.stringNeg(n)):r="buy"}}else r=this.safeString(e,"type"),r="1"===r?"sell":"0"===r?"buy":void 0;return void 0!==c&&(c=a.Y.stringAbs(c)),void 0!==l&&(g={cost:l,currency:u}),this.safeTrade({id:i,info:e,timestamp:m,datetime:this.iso8601(m),symbol:s,order:d,type:undefined,side:r,takerOrMaker:void 0,price:o,amount:n,cost:c,fee:g},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={pair:r.id,time:"hour"},o=await this.publicGetTransactionsPair(this.extend(a,s));return this.parseTrades(o,r,t,i)}parseOHLCV(e,t=void 0){return[this.safeTimestamp(e,"timestamp"),this.safeNumber(e,"open"),this.safeNumber(e,"high"),this.safeNumber(e,"low"),this.safeNumber(e,"close"),this.safeNumber(e,"volume")]}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,r={}){await this.loadMarkets();const a=this.market(e),o={pair:a.id,step:this.safeString(this.timeframes,t,t)},n=this.parseTimeframe(t);if(void 0===s)if(void 0===i)o.limit=1e3;else{s=1e3;const e=this.parseToInt(i/1e3);o.start=e,o.end=this.sum(e,n*(s-1)),o.limit=s}else{if(void 0!==i){const e=this.parseToInt(i/1e3);o.start=e,o.end=this.sum(e,n*(s-1))}o.limit=Math.min(s,1e3)}const d=await this.publicGetOhlcPair(this.extend(o,r)),h=this.safeValue(d,"data",{}),c=this.safeList(h,"ohlc",[]);return this.parseOHLCVs(c,a,t,i,s)}parseBalance(e){const t={info:e,timestamp:void 0,datetime:void 0};void 0===e&&(e=[]);for(let i=0;i1&&(u=e[0],c=e[1])}let f={currency:void 0,cost:void 0,rate:void 0};return void 0!==o&&(f={currency:n,cost:o,rate:void 0}),{info:e,id:this.safeString(e,"id"),txid:this.safeString(e,"transaction_id"),type:h,currency:r,network:void 0,amount:this.parseNumber(d),status:l,timestamp:i,datetime:this.iso8601(i),address:u,addressFrom:void 0,addressTo:u,tag:c,tagFrom:void 0,tagTo:c,updated:void 0,comment:void 0,internal:void 0,fee:f}}parseTransactionStatus(e){return this.safeString({0:"pending",1:"pending",2:"ok",3:"canceled",4:"failed"},e,e)}parseOrder(e,t=void 0){const i=this.safeString(e,"id"),s=this.safeString(e,"client_order_id");let r=this.safeString(e,"type");void 0!==r&&(r="1"===r?"sell":"buy");const a=this.parse8601(this.safeString(e,"datetime")),o=this.safeStringLower(e,"currency_pair"),n=this.safeSymbol(o,t,"/"),d=this.parseOrderStatus(this.safeString(e,"status")),h=this.safeString(e,"amount"),c=this.safeValue(e,"transactions",[]),l=this.safeString(e,"price");return this.safeOrder({id:i,clientOrderId:s,datetime:this.iso8601(a),timestamp:a,lastTradeTimestamp:void 0,status:d,symbol:n,type:void 0,timeInForce:void 0,postOnly:void 0,side:r,price:l,triggerPrice:void 0,cost:void 0,amount:h,filled:void 0,remaining:void 0,trades:c,fee:void 0,info:e,average:void 0},t)}parseLedgerEntryType(e){return this.safeString({0:"transaction",1:"transaction",2:"trade",14:"transfer"},e,e)}parseLedgerEntry(e,t=void 0){const i=this.parseLedgerEntryType(this.safeString(e,"type"));if("trade"===i){const s=this.parseTrade(e);let r;const a=Object.keys(e);for(let e=0;e=0){const t=a[e].replace("_","");r=this.safeMarket(t,r)}void 0===r&&(r=this.getMarketFromTrade(e));const o="buy"===s.side?"in":"out";return this.safeLedgerEntry({info:e,id:s.id,timestamp:s.timestamp,datetime:s.datetime,direction:o,account:void 0,referenceId:s.order,referenceAccount:void 0,type:i,currency:r.base,amount:s.amount,before:void 0,after:void 0,status:"ok",fee:s.fee},t)}{const s=this.parseTransaction(e,t);let r;if("amount"in e){const t=this.safeString(e,"amount");r=a.Y.stringGt(t,"0")?"in":"out"}else if("currency"in s&&void 0!==s.currency){const i=this.safeString(s,"currency");t=this.currency(i);const o=this.safeString(e,t.id);r=a.Y.stringGt(o,"0")?"in":"out"}return this.safeLedgerEntry({info:e,id:s.id,timestamp:s.timestamp,datetime:s.datetime,direction:r,account:void 0,referenceId:s.txid,referenceAccount:void 0,type:i,currency:s.currency,amount:s.amount,before:void 0,after:void 0,status:s.status,fee:s.fee},t)}}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};void 0!==i&&(r.limit=i);const a=await this.privatePostUserTransactions(this.extend(r,s));let o;return void 0!==e&&(o=this.currency(e)),this.parseLedger(a,o,t,i)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privatePostOpenOrdersAll(s);return this.parseOrders(a,r,t,i,{status:"open",type:"limit"})}getCurrencyName(e){return e.toLowerCase()}isFiat(e){return"USD"===e||"EUR"===e||"GBP"===e}async fetchDepositAddress(e,t={}){if(this.isFiat(e))throw new r.NotSupported(this.id+" fiat fetchDepositAddress() for "+e+" is not supported!");const i=this.getCurrencyName(e),s="privatePost"+this.capitalize(i)+"Address",a=await this[s](t),o=this.safeString(a,"address"),n=this.safeString2(a,"memo_id","destination_tag");return this.checkAddress(o),{info:a,currency:e,network:void 0,address:o,tag:n}}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),await this.loadMarkets(),this.checkAddress(i);const a={amount:t};let o,n;if(this.isFiat(e))n="privatePostWithdrawalOpen",o=this.currency(e),a.iban=i,a.account_currency=o.id;else{const t=this.getCurrencyName(e);n="privatePost"+this.capitalize(t)+"Withdrawal","XRP"===e?void 0!==s&&(a.destination_tag=s):"XLM"!==e&&"HBAR"!==e||void 0!==s&&(a.memo_id=s),a.address=i}const d=await this[n](this.extend(a,r));return this.parseTransaction(d,o)}async transfer(e,t,i,s,a={}){await this.loadMarkets();const o=this.currency(e),n={amount:this.parseToNumeric(this.currencyToPrecision(e,t)),currency:o.id.toUpperCase()};let d;if("main"===i)n.subAccount=s,d=await this.privatePostTransferFromMain(this.extend(n,a));else{if("main"!==s)throw new r.BadRequest(this.id+" transfer() only supports from or to main");n.subAccount=i,d=await this.privatePostTransferToMain(this.extend(n,a))}const h=this.parseTransfer(d,o);return h.amount=t,h.fromAccount=i,h.toAccount=s,h}parseTransfer(e,t=void 0){const i=this.safeString(e,"status");return{info:e,id:void 0,timestamp:void 0,datetime:void 0,currency:t.code,amount:void 0,fromAccount:void 0,toAccount:void 0,status:this.parseTransferStatus(i)}}parseTransferStatus(e){return this.safeString({ok:"ok",error:"failed"},e,e)}nonce(){return this.milliseconds()}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o=this.urls.api[t]+"/";o+=this.version+"/",o+=this.implodeParams(e,s);const d=this.omit(s,this.extractParams(e));if("public"===t)Object.keys(d).length&&(o+="?"+this.urlencode(d));else{this.checkRequiredCredentials();const e="BITSTAMP "+this.apiKey,t=this.uuid(),s=this.milliseconds().toString(),h="v2";let c="";r={"X-Auth":e,"X-Auth-Nonce":t,"X-Auth-Timestamp":s,"X-Auth-Version":h},"POST"===i&&(Object.keys(d).length?(a=this.urlencode(d),c="application/x-www-form-urlencoded",r["Content-Type"]=c):(a=this.urlencode({foo:"bar"}),c="application/x-www-form-urlencoded",r["Content-Type"]=c));const l=a||"",u=e+i+o.replace("https://","")+c+t+s+h+l,f=this.hmac(this.encode(u),this.encode(this.secret),n.s);r["X-Auth-Signature"]=f}return{url:o,method:i,body:a,headers:r}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"status"),l=this.safeValue(n,"error");if("error"===c||void 0!==l){let e=[];if("string"==typeof l)e.push(l);else if(void 0!==l){const t=Object.keys(l);for(let i=0;i{i.d(t,{A:()=>n});var s=i(8535),r=i(2079),a=i(1579),o=i(5147);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitteam",name:"BIT.TEAM",countries:["UK"],version:"v2.0.6",rateLimit:1,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,deposit:!1,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCanceledOrders:!0,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchL3OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!0,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!1,ws:!1},timeframes:{"1m":"1","5m":"5","15m":"15","1h":"60","1d":"1D"},urls:{logo:"https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135",api:{history:"https://history.bit.team",public:"https://bit.team",private:"https://bit.team"},www:"https://bit.team/",referral:"https://bit.team/auth/sign-up?ref=bitboy2023",doc:["https://bit.team/trade/api/documentation"]},api:{history:{get:{"api/tw/history/{pairName}/{resolution}":1}},public:{get:{"trade/api/asset":1,"trade/api/currencies":1,"trade/api/orderbooks/{symbol}":1,"trade/api/orders":1,"trade/api/pair/{name}":1,"trade/api/pairs":1,"trade/api/pairs/precisions":1,"trade/api/rates":1,"trade/api/trade/{id}":1,"trade/api/trades":1,"trade/api/ccxt/pairs":1,"trade/api/cmc/assets":1,"trade/api/cmc/orderbook/{pair}":1,"trade/api/cmc/summary":1,"trade/api/cmc/ticker":1,"trade/api/cmc/trades/{pair}":1}},private:{get:{"trade/api/ccxt/balance":1,"trade/api/ccxt/order/{id}":1,"trade/api/ccxt/ordersOfUser":1,"trade/api/ccxt/tradesOfUser":1,"trade/api/transactionsOfUser":1},post:{"trade/api/ccxt/cancel-all-order":1,"trade/api/ccxt/cancelorder":1,"trade/api/ccxt/ordercreate":1}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")}},precisionMode:a.kb,options:{networksById:{Ethereum:"ERC20",ethereum:"ERC20",Tron:"TRC20",tron:"TRC20",Binance:"BSC",binance:"BSC","Binance Smart Chain":"BSC",bscscan:"BSC",Bitcoin:"BTC",bitcoin:"BTC",Litecoin:"LTC",litecoin:"LTC",Polygon:"POLYGON",polygon:"POLYGON",PRIZM:"PRIZM",Decimal:"Decimal",ufobject:"ufobject",tonchain:"tonchain"},currenciesValuedInUsd:{USDT:!0,BUSD:!0}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:void 0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!0,limit:100,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{400002:r.BadSymbol,401e3:r.AuthenticationError,403002:r.BadRequest,404200:r.BadSymbol},broad:{"is not allowed":r.BadRequest,"Insufficient funds":r.InsufficientFunds,"Invalid request params input":r.BadRequest,"must be a number":r.BadRequest,"must be a string":r.BadRequest,"must be of type":r.BadRequest,"must be one of":r.BadRequest,"Order not found":r.OrderNotFound,"Pair with pair name":r.BadSymbol,pairName:r.BadSymbol,"Service Unavailable":r.ExchangeNotAvailable,"Symbol ":r.BadSymbol}}})}async fetchMarkets(e={}){const t=await this.publicGetTradeApiCcxtPairs(e),i=this.safeValue(t,"result",{}),s=this.safeValue(i,"pairs",[]);return this.parseMarkets(s)}parseMarket(e){const t=this.safeString(e,"name"),i=this.safeInteger(e,"id"),s=t.split("_"),r=this.safeString(s,0),a=this.safeString(s,1),o=this.safeCurrencyCode(r),n=this.safeCurrencyCode(a),d=this.safeValue(e,"active"),h=this.safeString(e,"timeStart"),c=this.parse8601(h);let l;const u=this.safeValue(this.options,"currenciesValuedInUsd",{});if(this.safeBool(u,n,!1)){const t=this.safeValue(e,"settings",{});l=this.safeNumber(t,"limit_usd")}return this.safeMarketStructure({id:t,numericId:i,symbol:o+"/"+n,base:o,quote:n,settle:void 0,baseId:r,quoteId:a,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:d,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"baseStep"))),price:this.parseNumber(this.parsePrecision(this.safeString(e,"quoteStep")))},limits:{leverage:{min:void 0,max:void 0},amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:l,max:void 0}},created:c,info:e})}async fetchCurrencies(e={}){const t=await this.publicGetTradeApiCurrencies(e),i=this.safeValue(t,"result",{}),s=this.safeValue(i,"currencies",[]);let r=await this.publicGetTradeApiCmcAssets();r=this.indexBy(r,"unified_cryptoasset_id");const a={};for(let e=0;e=0&&"GET"===s){const e=i.split("/order/"),t=this.safeString(e,1);throw new r.OrderNotFound(this.id+" order "+t+" not found")}if(i.indexOf("/cmc/orderbook/")>=0){const e=i.split("/cmc/orderbook/"),t=this.safeString(e,1);throw new r.BadSymbol(this.id+" symbolId "+t+" not found")}}const t=this.id+" "+o,a=this.safeString(n,"message"),d=this.safeString(n,"code");throw this.throwBroadlyMatchedException(this.exceptions.broad,a,t),this.throwExactlyMatchedException(this.exceptions.exact,d,t),new r.ExchangeError(t)}}}},2263:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(7754),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bittrade",name:"BitTrade",countries:["JP"],rateLimit:100,userAgent:this.userAgents.chrome39,certified:!1,version:"v1",hostname:"api-cloud.bittrade.co.jp",pro:!0,has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingLimits:!0,fetchWithdrawals:!0,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"60min","4h":"4hour","1d":"1day","1w":"1week","1M":"1mon","1y":"1year"},urls:{logo:"https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg",api:{market:"https://{hostname}",public:"https://{hostname}",private:"https://{hostname}",v2Public:"https://{hostname}",v2Private:"https://{hostname}"},www:"https://www.bittrade.co.jp",referral:"https://www.bittrade.co.jp/register/?invite_code=znnq3",doc:"https://api-doc.bittrade.co.jp",fees:"https://www.bittrade.co.jp/ja-jp/support/fee"},api:{v2Public:{get:{"reference/currencies":1,"market-status":1}},v2Private:{get:{"account/ledger":1,"account/withdraw/quota":1,"account/withdraw/address":1,"account/deposit/address":1,"account/repayment":5,"reference/transact-fee-rate":1,"account/asset-valuation":.2,"point/account":5,"sub-user/user-list":1,"sub-user/user-state":1,"sub-user/account-list":1,"sub-user/deposit-address":1,"sub-user/query-deposit":1,"user/api-key":1,"user/uid":1,"algo-orders/opening":1,"algo-orders/history":1,"algo-orders/specific":1,"c2c/offers":1,"c2c/offer":1,"c2c/transactions":1,"c2c/repayment":1,"c2c/account":1,"etp/reference":1,"etp/transactions":5,"etp/transaction":5,"etp/rebalance":1,"etp/limit":1},post:{"account/transfer":1,"account/repayment":5,"point/transfer":5,"sub-user/management":1,"sub-user/creation":1,"sub-user/tradable-market":1,"sub-user/transferability":1,"sub-user/api-key-generation":1,"sub-user/api-key-modification":1,"sub-user/api-key-deletion":1,"sub-user/deduct-mode":1,"algo-orders":1,"algo-orders/cancel-all-after":1,"algo-orders/cancellation":1,"c2c/offer":1,"c2c/cancellation":1,"c2c/cancel-all":1,"c2c/repayment":1,"c2c/transfer":1,"etp/creation":5,"etp/redemption":5,"etp/{transactId}/cancel":10,"etp/batch-cancel":50}},market:{get:{"history/kline":1,"detail/merged":1,depth:1,trade:1,"history/trade":1,detail:1,tickers:1,etp:1}},public:{get:{"common/symbols":1,"common/currencys":1,"common/timestamp":1,"common/exchange":1,"settings/currencys":1}},private:{get:{"account/accounts":.2,"account/accounts/{id}/balance":.2,"account/accounts/{sub-uid}":1,"account/history":4,"cross-margin/loan-info":1,"margin/loan-info":1,"fee/fee-rate/get":1,"order/openOrders":.4,"order/orders":.4,"order/orders/{id}":.4,"order/orders/{id}/matchresults":.4,"order/orders/getClientOrder":.4,"order/history":1,"order/matchresults":1,"query/deposit-withdraw":1,"margin/loan-orders":.2,"margin/accounts/balance":.2,"cross-margin/loan-orders":1,"cross-margin/accounts/balance":1,"points/actions":1,"points/orders":1,"subuser/aggregate-balance":10,"stable-coin/exchange_rate":1,"stable-coin/quote":1},post:{"account/transfer":1,"futures/transfer":1,"order/batch-orders":.4,"order/orders/place":.2,"order/orders/submitCancelClientOrder":.2,"order/orders/batchCancelOpenOrders":.4,"order/orders/{id}/submitcancel":.2,"order/orders/batchcancel":.4,"dw/withdraw/api/create":1,"dw/withdraw-virtual/{id}/cancel":1,"dw/transfer-in/margin":10,"dw/transfer-out/margin":10,"margin/orders":10,"margin/orders/{id}/repay":10,"cross-margin/transfer-in":1,"cross-margin/transfer-out":1,"cross-margin/orders":1,"cross-margin/orders/{id}/repay":1,"stable-coin/exchange":1,"subuser/transfer":10}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:120,untilDays:2,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:void 0,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:2e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{broad:{"contract is restricted of closing positions on API. Please contact customer service":r.OnMaintenance,maintain:r.OnMaintenance},exact:{"bad-request":r.BadRequest,"base-date-limit-error":r.BadRequest,"api-not-support-temp-addr":r.PermissionDenied,timeout:r.RequestTimeout,"gateway-internal-error":r.ExchangeNotAvailable,"account-frozen-balance-insufficient-error":r.InsufficientFunds,"invalid-amount":r.InvalidOrder,"order-limitorder-amount-min-error":r.InvalidOrder,"order-limitorder-amount-max-error":r.InvalidOrder,"order-marketorder-amount-min-error":r.InvalidOrder,"order-limitorder-price-min-error":r.InvalidOrder,"order-limitorder-price-max-error":r.InvalidOrder,"order-holding-limit-failed":r.InvalidOrder,"order-orderprice-precision-error":r.InvalidOrder,"order-etp-nav-price-max-error":r.InvalidOrder,"order-orderstate-error":r.OrderNotFound,"order-queryorder-invalid":r.OrderNotFound,"order-update-error":r.ExchangeNotAvailable,"api-signature-check-failed":r.AuthenticationError,"api-signature-not-valid":r.AuthenticationError,"base-record-invalid":r.OrderNotFound,"base-symbol-trade-disabled":r.BadSymbol,"base-symbol-error":r.BadSymbol,"system-maintenance":r.OnMaintenance,"invalid symbol":r.BadSymbol,"symbol trade not open now":r.BadSymbol,"invalid-address":r.BadRequest,"base-currency-chain-error":r.BadRequest,"dw-insufficient-balance":r.InsufficientFunds}},options:{defaultNetwork:"ERC20",networks:{ETH:"erc20",TRX:"trc20",HRC20:"hrc20",HECO:"hrc20",HT:"hrc20",ALGO:"algo",OMNI:""},fetchOrdersByStatesMethod:"private_get_order_orders",fetchOpenOrdersMethod:"fetch_open_orders_v1",createMarketBuyOrderRequiresPrice:!0,fetchMarketsMethod:"publicGetCommonSymbols",fetchBalanceMethod:"privateGetAccountAccountsIdBalance",createOrderMethod:"privatePostOrderOrdersPlace",currencyToPrecisionRoundingMode:o.R3,language:"en-US",broker:{id:"AA03022abc"}},commonCurrencies:{GET:"Themis",GTC:"Game.com",HIT:"HitChain",PNT:"Penta",SBTC:"Super Bitcoin",BIFI:"Bitcoin File"}})}async fetchTime(e={}){const t=await this.publicGetCommonTimestamp(e);return this.safeInteger(t,"data")}async fetchTradingLimits(e=void 0,t={}){await this.loadMarkets(),void 0===e&&(e=this.symbols);const i={};for(let s=0;s100)&&(i=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"deposit",from:0};void 0!==r&&(a.currency=r.id),void 0!==i&&(a.size=i);const o=await this.privateGetQueryDepositWithdraw(this.extend(a,s));return this.parseTransactions(o.data,r,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){let r;(void 0===i||i>100)&&(i=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"withdraw",from:0};void 0!==r&&(a.currency=r.id),void 0!==i&&(a.size=i);const o=await this.privateGetQueryDepositWithdraw(this.extend(a,s));return this.parseTransactions(o.data,r,t,i)}parseTransaction(e,t=void 0){const i=this.safeInteger(e,"created-at"),s=this.safeCurrencyCode(this.safeString(e,"currency"));let r=this.safeString(e,"type");"withdraw"===r&&(r="withdrawal");let o=this.safeString(e,"fee");return void 0!==o&&(o=a.Y.stringAbs(o)),{info:e,id:this.safeString2(e,"id","data"),txid:this.safeString(e,"tx-hash"),timestamp:i,datetime:this.iso8601(i),network:this.safeStringUpper(e,"chain"),address:this.safeString(e,"address"),addressTo:void 0,addressFrom:void 0,tag:this.safeString(e,"address-tag"),tagTo:void 0,tagFrom:void 0,type:r,amount:this.safeNumber(e,"amount"),currency:s,status:this.parseTransactionStatus(this.safeString(e,"state")),updated:this.safeInteger(e,"updated-at"),comment:void 0,internal:void 0,fee:{currency:s,cost:this.parseNumber(o),rate:void 0}}}parseTransactionStatus(e){return this.safeString({unknown:"failed",confirming:"pending",confirmed:"ok",safe:"ok",orphan:"failed",submitted:"pending",canceled:"canceled",reexamine:"pending",reject:"failed",pass:"pending","wallet-reject":"failed","confirm-error":"failed",repealed:"failed","wallet-transfer":"pending","pre-transfer":"pending"},e,e)}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),await this.loadMarkets(),this.checkAddress(i);const a=this.currency(e),o={address:i,amount:t,currency:a.id.toLowerCase()};void 0!==s&&(o["addr-tag"]=s);const n=this.safeValue(this.options,"networks",{});let d=this.safeStringUpper(r,"network");d=this.safeStringLower(n,d,d),void 0!==d&&(o.chain="erc20"===d?a.id+d:d+a.id,r=this.omit(r,"network"));const h=await this.privatePostDwWithdrawApiCreate(this.extend(o,r));return this.parseTransaction(h,a)}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/";"market"===t?o+=t:"public"===t||"private"===t?o+=this.version:"v2Public"!==t&&"v2Private"!==t||(o+="v2"),o+="/"+this.implodeParams(e,s);const d=this.omit(s,this.extractParams(e));if("private"===t||"v2Private"===t){this.checkRequiredCredentials();const e=this.ymdhms(this.milliseconds(),"T");let t={SignatureMethod:"HmacSHA256",SignatureVersion:"2",AccessKeyId:this.apiKey,Timestamp:e};"POST"!==i&&(t=this.extend(t,d));const s=this.keysort(t);let h=this.urlencode(s);const c=[i,this.hostname,o,h].join("\n"),l=this.hmac(this.encode(c),this.encode(this.secret),n.s,"base64");h+="&"+this.urlencode({Signature:l}),o+="?"+h,"POST"===i?(a=this.json(d),r={"Content-Type":"application/json"}):r={"Content-Type":"application/x-www-form-urlencoded"}}else Object.keys(s).length&&(o+="?"+this.urlencode(s));return o=this.implodeParams(this.urls.api[t],{hostname:this.hostname})+o,{url:o,method:i,body:a,headers:r}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0!==n&&"status"in n){if("error"===this.safeString(n,"status")){const e=this.safeString(n,"err-code"),t=this.id+" "+o;this.throwBroadlyMatchedException(this.exceptions.broad,o,t),this.throwExactlyMatchedException(this.exceptions.exact,e,t);const i=this.safeString(n,"err-msg");throw this.throwExactlyMatchedException(this.exceptions.exact,i,t),new r.ExchangeError(t)}}}}},3727:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(8716),r=i(2079),a=i(1579),o=i(5147),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bitvavo",name:"Bitvavo",countries:["NL"],rateLimit:60,version:"v2",certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d"},urls:{logo:"https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8",api:{public:"https://api.bitvavo.com",private:"https://api.bitvavo.com"},www:"https://bitvavo.com/",doc:"https://docs.bitvavo.com/",fees:"https://bitvavo.com/en/fees",referral:"https://bitvavo.com/?a=24F34952F7"},api:{public:{get:{time:1,markets:1,assets:1,"{market}/book":1,"{market}/trades":5,"{market}/candles":1,"ticker/price":1,"ticker/book":1,"ticker/24h":{cost:1,noMarket:25}}},private:{get:{account:1,order:1,orders:5,ordersOpen:{cost:1,noMarket:25},trades:5,balance:5,deposit:1,depositHistory:5,withdrawalHistory:5},post:{order:1,withdrawal:1},put:{order:1},delete:{order:1,orders:1}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0025"),maker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0020")],[this.parseNumber("250000"),this.parseNumber("0.0016")],[this.parseNumber("500000"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.0010")],[this.parseNumber("2500000"),this.parseNumber("0.0008")],[this.parseNumber("5000000"),this.parseNumber("0.0006")],[this.parseNumber("10000000"),this.parseNumber("0.0005")],[this.parseNumber("25000000"),this.parseNumber("0.0004")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0010")],[this.parseNumber("250000"),this.parseNumber("0.0008")],[this.parseNumber("500000"),this.parseNumber("0.0006")],[this.parseNumber("1000000"),this.parseNumber("0.0005")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0004")],[this.parseNumber("10000000"),this.parseNumber("0.0003")],[this.parseNumber("25000000"),this.parseNumber("0.0003")]]}}},requiredCredentials:{apiKey:!0,secret:!0},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:void 0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0,selfTradePrevention:!0,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!0,limit:1e3,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:void 0,fetchOHLCV:{limit:1440}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{101:r.ExchangeError,102:r.BadRequest,103:r.RateLimitExceeded,104:r.RateLimitExceeded,105:r.PermissionDenied,107:r.ExchangeNotAvailable,108:r.ExchangeNotAvailable,109:r.ExchangeNotAvailable,110:r.BadRequest,200:r.BadRequest,201:r.BadRequest,202:r.BadRequest,203:r.BadSymbol,204:r.BadRequest,205:r.BadRequest,206:r.BadRequest,210:r.InvalidOrder,211:r.InvalidOrder,212:r.InvalidOrder,213:r.InvalidOrder,214:r.InvalidOrder,215:r.InvalidOrder,216:r.InsufficientFunds,217:r.InvalidOrder,230:r.ExchangeError,231:r.ExchangeError,232:r.BadRequest,233:r.InvalidOrder,234:r.InvalidOrder,235:r.ExchangeError,236:r.BadRequest,240:r.OrderNotFound,300:r.AuthenticationError,301:r.AuthenticationError,302:r.AuthenticationError,303:r.AuthenticationError,304:r.AuthenticationError,305:r.AuthenticationError,306:r.AuthenticationError,307:r.PermissionDenied,308:r.AuthenticationError,309:r.AuthenticationError,310:r.PermissionDenied,311:r.PermissionDenied,312:r.PermissionDenied,315:r.BadRequest,317:r.AccountSuspended,400:r.ExchangeError,401:r.ExchangeError,402:r.PermissionDenied,403:r.PermissionDenied,404:r.OnMaintenance,405:r.ExchangeError,406:r.BadRequest,407:r.ExchangeError,408:r.InsufficientFunds,409:r.InvalidAddress,410:r.ExchangeError,411:r.BadRequest,412:r.InvalidAddress,413:r.InvalidAddress,414:r.ExchangeError},broad:{"start parameter is invalid":r.BadRequest,"symbol parameter is invalid":r.BadSymbol,"amount parameter is invalid":r.InvalidOrder,"orderId parameter is invalid":r.InvalidOrder}},options:{currencyToPrecisionRoundingMode:a.R3,"BITVAVO-ACCESS-WINDOW":1e4,networks:{ERC20:"ETH",TRC20:"TRX"},operatorId:void 0,fiatCurrencies:["EUR"]},precisionMode:a.v,commonCurrencies:{MIOTA:"IOTA"}})}amountToPrecision(e,t){return this.decimalToPrecision(t,a.R3,this.markets[e].precision.amount,a.fv)}priceToPrecision(e,t){return t=this.decimalToPrecision(t,a.D_,this.markets[e].precision.price,this.precisionMode),this.decimalToPrecision(t,a.R3,8,a.fv)}async fetchTime(e={}){const t=await this.publicGetTime(e);return this.safeInteger(t,"time")}async fetchMarkets(e={}){const t=await this.publicGetMarkets(e);return this.parseMarkets(t)}parseMarkets(e){const t=this.currencies,i=this.indexBy(t,"id"),s=[],r=this.fees;for(let t=0;t{i.d(t,{A:()=>n});var s=i(5254),r=i(2079),a=i(5147),o=i(1579);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"blockchaincom",secret:void 0,name:"Blockchain.com",countries:["LX"],rateLimit:500,version:"v3",pro:!0,has:{CORS:!1,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchL2OrderBook:!0,fetchL3OrderBook:!0,fetchLedger:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPositionMode:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!1,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!0,transfer:!1,withdraw:!0},timeframes:void 0,urls:{logo:"https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8",test:{public:"https://testnet-api.delta.exchange",private:"https://testnet-api.delta.exchange"},api:{public:"https://api.blockchain.com/v3/exchange",private:"https://api.blockchain.com/v3/exchange"},www:"https://blockchain.com",doc:["https://api.blockchain.com/v3"],fees:"https://exchange.blockchain.com/fees"},api:{public:{get:{tickers:1,"tickers/{symbol}":1,symbols:1,"symbols/{symbol}":1,"l2/{symbol}":1,"l3/{symbol}":1}},private:{get:{fees:1,orders:1,"orders/{orderId}":1,trades:1,fills:1,deposits:1,"deposits/{depositId}":1,accounts:1,"accounts/{account}/{currency}":1,whitelist:1,"whitelist/{currency}":1,withdrawals:1,"withdrawals/{withdrawalId}":1},post:{orders:1,"deposits/{currency}":1,withdrawals:1},delete:{orders:1,"orders/{orderId}":1}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0045")],[this.parseNumber("10000"),this.parseNumber("0.0035")],[this.parseNumber("50000"),this.parseNumber("0.0018")],[this.parseNumber("100000"),this.parseNumber("0.0018")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("2500000"),this.parseNumber("0.0018")],[this.parseNumber("5000000"),this.parseNumber("0.0016")],[this.parseNumber("25000000"),this.parseNumber("0.0014")],[this.parseNumber("100000000"),this.parseNumber("0.0011")],[this.parseNumber("500000000"),this.parseNumber("0.0008")],[this.parseNumber("1000000000"),this.parseNumber("0.0006")]],maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.0017")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0008")],[this.parseNumber("500000"),this.parseNumber("0.0007")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0005")],[this.parseNumber("5000000"),this.parseNumber("0.0004")],[this.parseNumber("25000000"),this.parseNumber("0.0003")],[this.parseNumber("100000000"),this.parseNumber("0.0002")],[this.parseNumber("500000000"),this.parseNumber("0.0001")],[this.parseNumber("1000000000"),this.parseNumber("0")]]}}},requiredCredentials:{apiKey:!1,secret:!0},options:{networks:{ERC20:"ETH",TRC20:"TRX",ALGO:"ALGO",ADA:"ADA",AR:"AR",ATOM:"ATOM",AVAXC:"AVAX",BCH:"BCH",BSV:"BSV",BTC:"BTC",DCR:"DCR",DESO:"DESO",DASH:"DASH",CELO:"CELO",CHZ:"CHZ",MATIC:"MATIC",SOL:"SOL",DOGE:"DOGE",DOT:"DOT",EOS:"EOS",ETC:"ETC",FIL:"FIL",KAVA:"KAVA",LTC:"LTC",IOTA:"MIOTA",NEAR:"NEAR",STX:"STX",XLM:"XLM",XMR:"XMR",XRP:"XRP",XTZ:"XTZ",ZEC:"ZEC",ZIL:"ZIL"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!1,GTD:!0},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,symbolRequired:!1,trailing:!1},fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{401:r.AuthenticationError,404:r.OrderNotFound},broad:{}}})}async fetchMarkets(e={}){const t=await this.publicGetSymbols(e),i=Object.keys(t),s=[];for(let e=0;e{i.d(t,{A:()=>d});var s=i(1769),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"blofin",name:"BloFin",countries:["US"],version:"v1",rateLimit:100,pro:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,borrowMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createDepositAddress:!1,createMarketBuyOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!1,createTakeProfitOrder:!0,createTriggerOrder:!0,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:void 0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLedgerEntry:void 0,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!1,fetchMarginMode:!0,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:void 0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsForSymbol:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6H","8h":"8H","12h":"12H","1d":"1D","3d":"3D","1w":"1W","1M":"1M"},hostname:"www.blofin.com",urls:{logo:"https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b",api:{rest:"https://openapi.blofin.com"},test:{rest:"https://demo-trading-openapi.blofin.com"},referral:{url:"https://blofin.com/register?referral_code=f79EsS",discount:.05},www:"https://www.blofin.com",doc:"https://blofin.com/docs"},api:{public:{get:{"market/instruments":1,"market/tickers":1,"market/books":1,"market/trades":1,"market/candles":1,"market/mark-price":1,"market/funding-rate":1,"market/funding-rate-history":1}},private:{get:{"asset/balances":1,"trade/orders-pending":1,"trade/fills-history":1,"asset/deposit-history":1,"asset/withdrawal-history":1,"asset/bills":1,"account/balance":1,"account/positions":1,"account/leverage-info":1,"account/margin-mode":1,"account/position-mode":1,"account/batch-leverage-info":1,"trade/orders-tpsl-pending":1,"trade/orders-algo-pending":1,"trade/orders-history":1,"trade/orders-tpsl-history":1,"trade/orders-algo-history":1,"trade/order/price-range":1,"user/query-apikey":1,"affiliate/basic":1,"copytrading/instruments":1,"copytrading/account/balance":1,"copytrading/account/positions-by-order":1,"copytrading/account/positions-details-by-order":1,"copytrading/account/positions-by-contract":1,"copytrading/account/position-mode":1,"copytrading/account/leverage-info":1,"copytrading/trade/orders-pending":1,"copytrading/trade/pending-tpsl-by-contract":1,"copytrading/trade/position-history-by-order":1,"copytrading/trade/orders-history":1,"copytrading/trade/pending-tpsl-by-order":1},post:{"account/set-margin-mode":1,"account/set-position-mode":1,"trade/order":1,"trade/order-algo":1,"trade/cancel-order":1,"trade/cancel-algo":1,"account/set-leverage":1,"trade/batch-orders":1,"trade/order-tpsl":1,"trade/cancel-batch-orders":1,"trade/cancel-tpsl":1,"trade/close-position":1,"asset/transfer":1,"copytrading/account/set-position-mode":1,"copytrading/account/set-leverage":1,"copytrading/trade/place-order":1,"copytrading/trade/cancel-order":1,"copytrading/trade/place-tpsl-by-contract":1,"copytrading/trade/cancel-tpsl-by-contract":1,"copytrading/trade/place-tpsl-by-order":1,"copytrading/trade/cancel-tpsl-by-order":1,"copytrading/trade/close-position-by-order":1,"copytrading/trade/close-position-by-contract":1}}},fees:{swap:{taker:this.parseNumber("0.00060"),maker:this.parseNumber("0.00020")}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},features:{default:{sandbox:!1,createOrder:{timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:{max:10},fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:100,trigger:!0,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!0,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1440}},spot:{extends:"default",createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,hedged:!1}},forDerivatives:{extends:"default",createOrder:{marginMode:!0,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!0},hedged:!0}},swap:{linear:{extends:"forDerivatives"},inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{400:r.BadRequest,401:r.AuthenticationError,500:r.ExchangeError,404:r.BadRequest,405:r.BadRequest,406:r.BadRequest,429:r.RateLimitExceeded,152001:r.BadRequest,152002:r.BadRequest,152003:r.BadRequest,152004:r.BadRequest,152005:r.BadRequest,152006:r.InvalidOrder,152007:r.InvalidOrder,152008:r.InvalidOrder,152009:r.InvalidOrder,150003:r.InvalidOrder,150004:r.InvalidOrder,542:r.InvalidOrder,102002:r.InvalidOrder,102005:r.InvalidOrder,102014:r.InvalidOrder,102015:r.InvalidOrder,102022:r.InvalidOrder,102037:r.InvalidOrder,102038:r.InvalidOrder,102039:r.InvalidOrder,102040:r.InvalidOrder,102047:r.InvalidOrder,102048:r.InvalidOrder,102049:r.InvalidOrder,102050:r.InvalidOrder,102051:r.InvalidOrder,102052:r.InvalidOrder,102053:r.InvalidOrder,102054:r.InvalidOrder,102055:r.InvalidOrder,102064:r.BadRequest,102065:r.BadRequest,102068:r.BadRequest,103013:r.ExchangeError,"Order failed. Insufficient USDT margin in account":r.InsufficientFunds},broad:{"Internal Server Error":r.ExchangeNotAvailable,"server error":r.ExchangeNotAvailable}},httpExceptions:{429:r.ExchangeNotAvailable},precisionMode:o.kb,options:{brokerId:"ec6dd3a7dd982d0b",accountsByType:{swap:"futures",funding:"funding",future:"futures",copy_trading:"copy_trading",earn:"earn",spot:"spot"},accountsById:{funding:"funding",futures:"swap",copy_trading:"copy_trading",earn:"earn",spot:"spot"},defaultNetwork:"ERC20",defaultNetworks:{ETH:"ERC20",BTC:"BTC",USDT:"TRC20"},networks:{BTC:"Bitcoin",BEP20:"BSC",ERC20:"ERC20",TRC20:"TRC20"},fetchOpenInterestHistory:{timeframes:{"5m":"5m","1h":"1H","8h":"8H","1d":"1D","5M":"5m","1H":"1H","8H":"8H","1D":"1D"}},fetchOHLCV:{timezone:"UTC"},fetchPositions:{method:"privateGetAccountPositions"},createOrder:"privatePostTradeOrder",createMarketBuyOrderRequiresPrice:!1,fetchMarkets:["swap"],defaultType:"swap",fetchLedger:{method:"privateGetAssetBills"},fetchOpenOrders:{method:"privateGetTradeOrdersPending"},cancelOrders:{method:"privatePostTradeCancelBatchOrders"},fetchCanceledOrders:{method:"privateGetTradeOrdersHistory"},fetchClosedOrders:{method:"privateGetTradeOrdersHistory"},withdraw:{password:void 0,pwd:void 0},exchangeType:{spot:"SPOT",swap:"SWAP",SPOT:"SPOT",SWAP:"SWAP"}}})}async fetchMarkets(e={}){const t=await this.publicGetMarketInstruments(e),i=this.safeList(t,"data",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"instId"),i=this.safeStringLower(e,"instType"),s="spot"===i,r="future"===i,o="swap"===i,n="option"===i,d=o||r,h=this.safeString(e,"baseCurrency"),c=this.safeString(e,"quoteCurrency"),l=this.safeString(e,"quoteCurrency"),u=this.safeCurrencyCode(l),f=this.safeCurrencyCode(h),p=this.safeCurrencyCode(c);let m=f+"/"+p;o&&(m=m+":"+u);const g=void 0,v=this.safeString(e,"tickSize"),y=this.safeDict2(this.fees,i,"trading",{}),w=this.safeNumber(y,"taker"),b=this.safeNumber(y,"maker");let k=this.safeString(e,"maxLeverage","100");k=a.Y.stringMax(k,"1");const S="live"===this.safeString(e,"state");return this.safeMarketStructure({id:t,symbol:m,base:f,quote:p,baseId:h,quoteId:c,settle:u,settleId:l,type:i,spot:s,option:n,margin:s&&a.Y.stringGt(k,"1"),swap:o,future:r,active:S,taker:w,maker:b,contract:d,linear:d?c===l:void 0,inverse:d?h===l:void 0,contractSize:d?this.safeNumber(e,"contractValue"):void 0,expiry:g,expiryDatetime:g,strike:undefined,optionType:undefined,created:this.safeInteger(e,"listTime"),precision:{amount:this.safeNumber(e,"lotSize"),price:this.parseNumber(v)},limits:{leverage:{min:this.parseNumber("1"),max:this.parseNumber(k)},amount:{min:this.safeNumber(e,"minSize"),max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:e})}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s={instId:this.market(e).id};void 0!==(t=void 0===t?50:t)&&(s.size=t);const r=await this.publicGetMarketBooks(this.extend(s,i)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{}),n=this.safeInteger(o,"ts");return this.parseOrderBook(o,e,n)}parseTicker(e,t=void 0){const i=this.safeInteger(e,"ts"),s=this.safeString(e,"instId"),r=(t=this.safeMarket(s,t,"-")).symbol,a=this.safeString(e,"last"),o=this.safeString(e,"open24h"),n=this.safeBool(t,"spot",!1)?this.safeString(e,"volCurrency24h"):void 0,d=this.safeString(e,"vol24h"),h=this.safeString(e,"high24h"),c=this.safeString(e,"low24h");return this.safeTicker({symbol:r,timestamp:i,datetime:this.iso8601(i),high:h,low:c,bid:this.safeString(e,"bidPrice"),bidVolume:this.safeString(e,"bidSize"),ask:this.safeString(e,"askPrice"),askVolume:this.safeString(e,"askSize"),vwap:void 0,open:o,close:a,last:a,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:d,quoteVolume:n,indexPrice:this.safeString(e,"indexPrice"),markPrice:this.safeString(e,"markPrice"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={instId:i.id},r=await this.publicGetMarketTickers(this.extend(s,t)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{});return this.parseTicker(o,i)}async fetchMarkPrice(e,t={}){await this.loadMarkets();const i=this.market(e),s={symbol:i.id},r=await this.publicGetMarketMarkPrice(this.extend(s,t)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{});return this.parseTicker(o,i)}async fetchTickers(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e);const i=await this.publicGetMarketTickers(t),s=this.safeList(i,"data",[]);return this.parseTickers(s,e)}parseTrade(e,t=void 0){const i=this.safeString(e,"tradeId"),s=this.safeString(e,"instId"),r=(t=this.safeMarket(s,t,"-")).symbol,a=this.safeInteger(e,"ts"),o=this.safeString2(e,"price","fillPrice"),n=this.safeString2(e,"size","fillSize"),d=this.safeString(e,"side"),h=this.safeString(e,"orderId"),c=this.safeString(e,"fee");let l;return void 0!==c&&(l={cost:c,currency:t.settle}),this.safeTrade({info:e,timestamp:a,datetime:this.iso8601(a),symbol:r,id:i,order:h,type:void 0,takerOrMaker:void 0,side:d,price:o,amount:n,cost:void 0,fee:l},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallCursor("fetchTrades",e,t,i,s,"tradeId","after",void 0,100);const a=this.market(e),o={instId:a.id};let n,d;void 0!==i&&(o.limit=i),[d,s]=this.handleOptionAndParams(s,"fetchTrades","method","publicGetMarketTrades"),"publicGetMarketTrades"===d&&(n=await this.publicGetMarketTrades(this.extend(o,s)));const h=this.safeList(n,"data",[]);return this.parseTrades(h,a,t,i)}parseOHLCV(e,t=void 0){return[this.safeInteger(e,0),this.safeNumber(e,1),this.safeNumber(e,2),this.safeNumber(e,3),this.safeNumber(e,4),this.safeNumber(e,6)]}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,r={}){await this.loadMarkets();const a=this.market(e);let o=!1;if([o,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate"),o)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,i,s,t,r,100);void 0===s&&(s=100);const n={instId:a.id,bar:this.safeString(this.timeframes,t,t),limit:s},d=this.safeInteger(r,"until");let h;void 0!==d&&(n.after=d,r=this.omit(r,"until")),h=await this.publicGetMarketCandles(this.extend(n,r));const c=this.safeList(h,"data",[]);return this.parseOHLCVs(c,a,t,i,s)}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");await this.loadMarkets();let a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchFundingRateHistory","paginate"),a)return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory",e,t,i,"8h",s);const o=this.market(e),n={instId:o.id};void 0!==t&&(n.before=Math.max(t-1,0)),void 0!==i&&(n.limit=i);const d=await this.publicGetMarketFundingRateHistory(this.extend(n,s)),h=[],c=this.safeList(d,"data",[]);for(let e=0;e0?s=s+","+r.id:s+=r.id}const a={instId:s,marginMode:i},o=await this.privateGetAccountBatchLeverageInfo(this.extend(a,t)),n=this.safeList(o,"data",[]);return this.parseLeverages(n,e,"instId")}async fetchLeverage(e,t={}){let i;if(await this.loadMarkets(),[i,t]=this.handleMarginModeAndParams("fetchLeverage",t),void 0===i&&(i=this.safeString(t,"marginMode","cross")),"cross"!==i&&"isolated"!==i)throw new r.BadRequest(this.id+" fetchLeverage() requires a marginMode parameter that must be either cross or isolated");const s=this.market(e),a={instId:s.id,marginMode:i},o=await this.privateGetAccountLeverageInfo(this.extend(a,t)),n=this.safeDict(o,"data",{});return this.parseLeverage(n,s)}parseLeverage(e,t=void 0){const i=this.safeString(e,"instId"),s=this.safeInteger(e,"leverage");return{info:e,symbol:this.safeSymbol(i,t),marginMode:this.safeStringLower(e,"marginMode"),longLeverage:s,shortLeverage:s}}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<1||e>125)throw new r.BadRequest(this.id+" setLeverage() leverage should be between 1 and 125");await this.loadMarkets();const s=this.market(t);let a;if([a,i]=this.handleMarginModeAndParams("setLeverage",i,"cross"),"cross"!==a&&"isolated"!==a)throw new r.BadRequest(this.id+" setLeverage() requires a marginMode parameter that must be either cross or isolated");const o={leverage:e,marginMode:a,instId:s.id};return await this.privatePostAccountSetLeverage(this.extend(o,i))}async closePosition(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r=this.safeString(i,"clientOrderId");let a;[a,i]=this.handleMarginModeAndParams("closePosition",i,"cross");const o={instId:s.id,marginMode:a};void 0!==r&&(o.clientOrderId=r);const n=await this.privatePostTradeClosePosition(this.extend(o,i));return this.safeDict(n,"data")}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchClosedOrders","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchClosedOrders",e,t,i,s);const a={};let o;void 0!==e&&(o=this.market(e),a.instId=o.id),void 0!==i&&(a.limit=i),void 0!==t&&(a.begin=t);const n=this.safeBoolN(s,["stop","trigger","tpsl","TPSL"],!1);let d;[d,s]=this.handleOptionAndParams(s,"fetchOpenOrders","method","privateGetTradeOrdersHistory");const h=this.omit(s,["method","stop","trigger","tpsl","TPSL"]);let c;c=n||"privateGetTradeOrdersTpslHistory"===d?await this.privateGetTradeOrdersTpslHistory(this.extend(a,h)):await this.privateGetTradeOrdersHistory(this.extend(a,h));const l=this.safeList(c,"data",[]);return this.parseOrders(l,o,t,i)}async fetchMarginMode(e,t={}){await this.loadMarkets();const i=this.market(e),s=await this.privateGetAccountMarginMode(t),r=this.safeDict(s,"data",{});return this.parseMarginMode(r,i)}parseMarginMode(e,t=void 0){return{info:e,symbol:this.safeString(t,"symbol"),marginMode:this.safeString(e,"marginMode")}}async setMarginMode(e,t=void 0,i={}){let s;this.checkRequiredArgument("setMarginMode",e,"marginMode",["cross","isolated"]),await this.loadMarkets(),void 0!==t&&(s=this.market(t));const r={marginMode:e},a=await this.privatePostAccountSetMarginMode(this.extend(r,i)),o=this.safeDict(a,"data",{});return this.parseMarginMode(o,s)}async fetchPositionMode(e=void 0,t={}){const i=await this.privateGetAccountPositionMode(t),s=this.safeDict(i,"data",{});return{info:s,hedged:"long_short_mode"===this.safeString(s,"positionMode")}}async setPositionMode(e,t=void 0,i={}){const s={positionMode:e?"long_short_mode":"net_mode"};return await this.privatePostAccountSetPositionMode(this.extend(s,i))}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"msg"),u=this.id+" "+o;if(void 0!==c&&"0"!==c)throw this.throwExactlyMatchedException(this.exceptions.exact,l,u),this.throwExactlyMatchedException(this.exceptions.exact,c,u),this.throwBroadlyMatchedException(this.exceptions.broad,l,u),new r.ExchangeError(u);const f=this.safeList(n,"data"),p=this.safeDict(f,0),m=this.safeString(p,"msg"),g=this.safeString(p,"code");void 0!==g&&"0"!==g&&(this.throwExactlyMatchedException(this.exceptions.exact,g,u),this.throwExactlyMatchedException(this.exceptions.exact,m,u),this.throwBroadlyMatchedException(this.exceptions.broad,m,u))}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+this.implodeParams(e,s);const d=this.omit(s,this.extractParams(e));let h=this.implodeHostname(this.urls.api.rest)+o;if("public"===t)this.isEmpty(d)||(h+="?"+this.urlencode(d));else if("private"===t){this.checkRequiredCredentials();const e=this.milliseconds().toString();r={"ACCESS-KEY":this.apiKey,"ACCESS-PASSPHRASE":this.password,"ACCESS-TIMESTAMP":e,"ACCESS-NONCE":e};let t="";if("GET"===i){if(!this.isEmpty(d)){const e="?"+this.urlencode(d);h+=e,o+=e}}else this.isEmpty(d)||(t=a=this.json(d)),r["Content-Type"]="application/json";const s=o+i+e+e+t,c=this.stringToBase64(this.hmac(this.encode(s),this.encode(this.secret),n.s));r["ACCESS-SIGN"]=c}return{url:h,method:i,body:a,headers:r}}}},3413:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(9644),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"btcalpha",name:"BTC-Alpha",countries:["US"],version:"v1",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchL2OrderBook:!0,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","1d":"D"},urls:{logo:"https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d",api:{rest:"https://btc-alpha.com/api"},www:"https://btc-alpha.com",doc:"https://btc-alpha.github.io/api-docs",fees:"https://btc-alpha.com/fees/",referral:"https://btc-alpha.com/?r=123788"},api:{public:{get:["currencies/","pairs/","orderbook/{pair_name}","exchanges/","charts/{pair}/{type}/chart/","ticker/"]},private:{get:["wallets/","orders/own/","order/{id}/","exchanges/own/","deposits/","withdraws/"],post:["order/","order-cancel/"]}},fees:{trading:{maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")},funding:{withdraw:{}}},commonCurrencies:{CBC:"Cashbery"},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:2e3,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:2e3,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:2e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:720}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{},broad:{"Out of balance":r.InsufficientFunds}}})}async fetchMarkets(e={}){const t=await this.publicGetPairs(e);return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"name"),i=this.safeString(e,"currency1"),s=this.safeString(e,"currency2"),r=this.safeCurrencyCode(i),o=this.safeCurrencyCode(s),n=this.safeString(e,"price_precision"),d=this.parsePrecision(n),h=this.safeString(e,"minimum_order_size");return{id:t,symbol:r+"/"+o,base:r,quote:o,settle:void 0,baseId:i,quoteId:s,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:!0,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amount_precision"))),price:this.parseNumber(this.parsePrecision(n))},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.parseNumber(h),max:this.safeNumber(e,"maximum_order_size")},price:{min:this.parseNumber(d),max:void 0},cost:{min:this.parseNumber(a.Y.stringMul(d,h)),max:void 0}},created:void 0,info:e}}async fetchTickers(e=void 0,t={}){await this.loadMarkets();const i=await this.publicGetTicker(t);return this.parseTickers(i,e)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={pair:i.id},r=await this.publicGetTicker(this.extend(s,t));return this.parseTicker(r,i)}parseTicker(e,t=void 0){const i=this.safeString(e,"timestamp"),s=parseInt(a.Y.stringMul(i,"1000000")),r=this.safeString(e,"pair");t=this.safeMarket(r,t,"_");const o=this.safeString(e,"last");return this.safeTicker({info:e,symbol:t.symbol,timestamp:s,datetime:this.iso8601(s),high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:o,last:o,previousClose:void 0,change:this.safeString(e,"diff"),percentage:void 0,average:void 0,baseVolume:void 0,quoteVolume:this.safeString(e,"vol")},t)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r={pair_name:s.id};t&&(r.limit_sell=t,r.limit_buy=t);const a=await this.publicGetOrderbookPairName(this.extend(r,i));return this.parseOrderBook(a,s.symbol,void 0,"buy","sell","price","amount")}parseBidsAsks(e,t=0,i=1,s=2){const r=[];for(let s=0;s{i.d(t,{A:()=>h});var s=i(3829),r=i(2079),a=i(5147),o=i(1579),n=i(4852),d=i(4035);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"btcbox",name:"BtcBox",countries:["JP"],rateLimit:1e3,version:"v1",pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTransfer:!1,fetchTransfers:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1,ws:!1},urls:{logo:"https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b",api:{rest:"https://www.btcbox.co.jp/api"},www:"https://www.btcbox.co.jp/",doc:"https://blog.btcbox.jp/en/archives/8762",fees:"https://support.btcbox.co.jp/hc/en-us/articles/360001235694-Fees-introduction"},api:{public:{get:["depth","orders","ticker","tickers"]},private:{post:["balance","trade_add","trade_cancel","trade_list","trade_view","wallet"]},webApi:{get:["ajax/coin/coinInfo"]}},options:{fetchMarkets:{webApiEnable:!0,webApiRetries:3},amountPrecision:"0.0001"},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:void 0,fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{104:r.AuthenticationError,105:r.PermissionDenied,106:r.InvalidNonce,107:r.InvalidOrder,200:r.InsufficientFunds,201:r.InvalidOrder,202:r.InvalidOrder,203:r.OrderNotFound,401:r.OrderNotFound,402:r.DDoSProtection}})}async fetchMarkets(e={}){const t=this.publicGetTickers(),i=this.fetchWebEndpoint("fetchMarkets","webApiGetAjaxCoinCoinInfo",!0),[s,r]=await Promise.all([t,i]),a=this.safeDict(r,"data",{}),o=Object.keys(s),n=[];for(let e=0;e1&&(r.coin=s.baseId);const a=await this.publicGetDepth(this.extend(r,i));return this.parseOrderBook(a,s.symbol)}parseTicker(e,t=void 0){const i=this.safeSymbol(void 0,t),s=this.safeString(e,"last");return this.safeTicker({symbol:i,timestamp:void 0,datetime:void 0,high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:s,last:s,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:this.safeString(e,"vol"),quoteVolume:this.safeString(e,"volume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={};this.symbols.length>1&&(s.coin=i.baseId);const r=await this.publicGetTicker(this.extend(s,t));return this.parseTicker(r,i)}async fetchTickers(e=void 0,t={}){await this.loadMarkets();const i=await this.publicGetTickers(t);return this.parseTickers(i,e)}parseTrade(e,t=void 0){const i=this.safeTimestamp(e,"date");t=this.safeMarket(void 0,t);const s=this.safeString(e,"tid"),r=this.safeString(e,"price"),a=this.safeString(e,"amount"),o=this.safeString(e,"type");return this.safeTrade({info:e,id:s,order:void 0,timestamp:i,datetime:this.iso8601(i),symbol:t.symbol,type:undefined,side:o,takerOrMaker:void 0,price:r,amount:a,cost:void 0,fee:void 0},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={};this.symbols.length>1&&(a.coin=r.baseId);const o=await this.publicGetOrders(this.extend(a,s));return this.parseTrades(o,r,t,i)}async createOrder(e,t,i,s,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n={amount:s,price:r,type:i,coin:o.baseId},d=await this.privatePostTradeAdd(this.extend(n,a));return this.parseOrder(d,o)}async cancelOrder(e,t=void 0,i={}){await this.loadMarkets(),void 0===t&&(t="BTC/JPY");const s=this.market(t),r={id:e,coin:s.baseId},a=await this.privatePostTradeCancel(this.extend(r,i));return this.parseOrder(a,s)}parseOrderStatus(e){return this.safeString({part:"open",all:"closed",cancelled:"canceled",closed:"closed",no:"closed"},e,e)}parseOrder(e,t=void 0){const i=this.safeString(e,"id");let s;void 0!==this.safeString(e,"datetime")&&(s=this.parse8601(e.datetime+"+09:00"));const r=this.safeString(e,"amount_original"),o=this.safeString(e,"amount_outstanding"),n=this.safeString(e,"price");let d=this.parseOrderStatus(this.safeString(e,"status"));void 0===d&&a.Y.stringEquals(o,"0")&&(d="closed");t=this.safeMarket(void 0,t);const h=this.safeString(e,"type");return this.safeOrder({id:i,clientOrderId:void 0,timestamp:s,datetime:this.iso8601(s),lastTradeTimestamp:void 0,amount:r,remaining:o,filled:void 0,side:h,type:void 0,timeInForce:void 0,postOnly:void 0,status:d,symbol:t.symbol,price:n,triggerPrice:void 0,cost:void 0,trades:undefined,fee:void 0,info:e,average:void 0},t)}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets(),void 0===t&&(t="BTC/JPY");const s=this.market(t),r=this.extend({id:e,coin:s.baseId},i),a=await this.privatePostTradeView(this.extend(r,i));return this.parseOrder(a,s)}async fetchOrdersByType(e,t=void 0,i=void 0,s=void 0,r={}){await this.loadMarkets();const a=this.market(t),o={type:e,coin:a.baseId},n=await this.privatePostTradeList(this.extend(o,r)),d=this.parseOrders(n,a,i,s);if("open"===e)for(let e=0;e=400)return;const c=this.safeValue(n,"result");if(void 0===c||!0===c)return;const l=this.safeValue(n,"code"),u=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions,l,u),new r.ExchangeError(u)}async request(e,t="public",i="GET",s={},a=void 0,o=void 0,n={}){let d=await this.fetch2(e,t,i,s,a,o,n);if("string"==typeof d){if(d=this.strip(d),!this.isJsonEncodedObject(d))throw new r.ExchangeError(this.id+" "+d);d=JSON.parse(d)}return d}}},4936:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(2317),r=i(2079),a=i(1579),o=i(5147),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"btcmarkets",name:"BTC Markets",countries:["AU"],rateLimit:1e3,version:"v3",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,borrowMargin:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createOrderWithTakeProfitAndStopLossWs:!1,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createTriggerOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrders:"emulated",fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverages:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrices:!1,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchTicker:!0,fetchTime:!0,fetchTrades:!0,fetchTransactions:"emulated",fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e",api:{public:"https://api.btcmarkets.net",private:"https://api.btcmarkets.net"},www:"https://btcmarkets.net",doc:["https://api.btcmarkets.net/doc/v3","https://github.com/BTCMarkets/API"]},api:{public:{get:["markets","markets/{marketId}/ticker","markets/{marketId}/trades","markets/{marketId}/orderbook","markets/{marketId}/candles","markets/tickers","markets/orderbooks","time"]},private:{get:["orders","orders/{id}","batchorders/{ids}","trades","trades/{id}","withdrawals","withdrawals/{id}","deposits","deposits/{id}","transfers","transfers/{id}","addresses","withdrawal-fees","assets","accounts/me/trading-fees","accounts/me/withdrawal-limits","accounts/me/balances","accounts/me/transactions","reports/{id}"],post:["orders","batchorders","withdrawals","reports"],delete:["orders","orders/{id}","batchorders/{ids}"],put:["orders/{id}"]}},timeframes:{"1m":"1m","1h":"1h","1d":"1d"},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!0,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:a.kb,exceptions:{exact:{InsufficientFund:r.InsufficientFunds,InvalidPrice:r.InvalidOrder,InvalidAmount:r.InvalidOrder,MissingArgument:r.BadRequest,OrderAlreadyCancelled:r.InvalidOrder,OrderNotFound:r.OrderNotFound,OrderStatusIsFinal:r.InvalidOrder,InvalidPaginationParameter:r.BadRequest},broad:{}},fees:{percentage:!0,tierBased:!0,maker:this.parseNumber("-0.0005"),taker:this.parseNumber("0.0020")},options:{fees:{AUD:{maker:this.parseNumber("0.0085"),taker:this.parseNumber("0.0085")}}}})}async fetchTransactionsWithMethod(e,t=void 0,i=void 0,s=void 0,r={}){await this.loadMarkets();const a={};let o;void 0!==s&&(a.limit=s),void 0!==i&&(a.after=i),void 0!==t&&(o=this.currency(t));const n=await this[e](this.extend(a,r));return this.parseTransactions(n,o,i,s)}async fetchDepositsWithdrawals(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactionsWithMethod("privateGetTransfers",e,t,i,s)}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactionsWithMethod("privateGetDeposits",e,t,i,s)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactionsWithMethod("privateGetWithdrawals",e,t,i,s)}parseTransactionStatus(e){return this.safeString({Accepted:"pending","Pending Authorization":"pending",Complete:"ok",Cancelled:"cancelled",Failed:"failed"},e,e)}parseTransactionType(e){return this.safeString({Withdraw:"withdrawal",Deposit:"deposit"},e,e)}parseTransaction(e,t=void 0){const i=this.parse8601(this.safeString(e,"creationTime")),s=this.parse8601(this.safeString(e,"lastUpdate"));let r=this.parseTransactionType(this.safeStringLower(e,"type"));"withdraw"===r&&(r="withdrawal");const a=this.safeDict(e,"paymentDetail",{}),n=this.safeString(a,"txId");let d,h=this.safeString(a,"address");if(void 0!==h){const e=h.split("?dt=");e.length>1&&(h=e[0],d=e[1])}const c=h,l=d,u=this.safeString(e,"fee"),f=this.parseTransactionStatus(this.safeString(e,"status")),p=this.safeString(e,"assetName"),m=this.safeCurrencyCode(p);let g=this.safeString(e,"amount");return u&&(g=o.Y.stringSub(g,u)),{id:this.safeString(e,"id"),txid:n,timestamp:i,datetime:this.iso8601(i),network:void 0,address:h,addressTo:c,addressFrom:undefined,tag:d,tagTo:l,tagFrom:undefined,type:r,amount:this.parseNumber(g),currency:m,status:f,updated:s,comment:this.safeString(e,"description"),internal:void 0,fee:{currency:m,cost:this.parseNumber(u),rate:void 0},info:e}}async fetchMarkets(e={}){const t=await this.publicGetMarkets(e);return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"baseAssetName"),i=this.safeString(e,"quoteAssetName"),s=this.safeString(e,"marketId"),r=this.safeCurrencyCode(t),a=this.safeCurrencyCode(i),o=r+"/"+a,n=this.safeValue(this.safeDict(this.options,"fees",{}),a,this.fees),d=this.parseNumber(this.parsePrecision(this.safeString(e,"priceDecimals"))),h=this.safeNumber(e,"minOrderAmount"),c=this.safeNumber(e,"maxOrderAmount");let l;return"AUD"===a&&(l=d),{id:s,symbol:o,base:r,quote:a,settle:void 0,baseId:t,quoteId:i,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:"Online"===this.safeString(e,"status"),contract:!1,linear:void 0,inverse:void 0,taker:n.taker,maker:n.maker,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amountDecimals"))),price:d},limits:{leverage:{min:void 0,max:void 0},amount:{min:h,max:c},price:{min:l,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}async fetchTime(e={}){const t=await this.publicGetTime(e);return this.parse8601(this.safeString(t,"timestamp"))}parseBalance(e){const t={info:e};for(let i=0;i{i.d(t,{A:()=>d});var s=i(8430),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"btcturk",name:"BTCTurk",countries:["TR"],rateLimit:100,pro:!1,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!1},timeframes:{"1m":1,"15m":15,"30m":30,"1h":60,"4h":240,"1d":"1 d","1w":"1 w","1y":"1 y"},urls:{logo:"https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6",api:{public:"https://api.btcturk.com/api/v2",private:"https://api.btcturk.com/api/v1",graph:"https://graph-api.btcturk.com/v1"},www:"https://www.btcturk.com",doc:"https://github.com/BTCTrader/broker-api-docs"},api:{public:{get:{orderbook:1,ticker:.1,trades:1,ohlc:1,"server/exchangeinfo":1}},private:{get:{"users/balances":1,openOrders:1,allOrders:1,"users/transactions/trade":1},post:{"users/transactions/crypto":1,"users/transactions/fiat":1,order:1,cancelOrder:1},delete:{order:1}},graph:{get:{ohlcs:1,"klines/history":1}}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:30,symbolRequired:!0},fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:30,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:void 0,fetchOHLCV:{limit:void 0}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},fees:{trading:{maker:this.parseNumber("0.0005"),taker:this.parseNumber("0.0009")}},exceptions:{exact:{FAILED_ORDER_WITH_OPEN_ORDERS:r.InsufficientFunds,FAILED_LIMIT_ORDER:r.InvalidOrder,FAILED_MARKET_ORDER:r.InvalidOrder}},precisionMode:o.kb})}async fetchMarkets(e={}){const t=await this.publicGetServerExchangeinfo(e),i=this.safeDict(t,"data",{}),s=this.safeList(i,"symbols",[]);return this.parseMarkets(s)}parseMarket(e){const t=this.safeString(e,"name"),i=this.safeString(e,"numerator"),s=this.safeString(e,"denominator"),r=this.safeCurrencyCode(i),a=this.safeCurrencyCode(s),o=this.safeList(e,"filters",[]);let n,d,h,c,l;for(let e=0;e{i.d(t,{A:()=>h});var s=i(1293),r=i(1579),a=i(2079),o=i(5147),n=i(4852),d=i(5354);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"bybit",name:"Bybit",countries:["VG"],version:"v5",userAgent:void 0,rateLimit:20,hostname:"bybit.com",pro:!0,certified:!0,has:{CORS:!0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,borrowCrossMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!1,createConvertTrade:!0,createMarketBuyOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!0,createTriggerOrder:!0,editOrder:!0,editOrders:!0,fetchBalance:!0,fetchBidsAsks:"emulated",fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrder:!0,fetchClosedOrders:!0,fetchConvertCurrencies:!0,fetchConvertQuote:!0,fetchConvertTrade:!0,fetchConvertTradeHistory:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:"emulated",fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!0,fetchLongShortRatio:!1,fetchLongShortRatioHistory:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!0,fetchWithdrawals:!0,repayCrossMargin:!0,sandbox:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"1","3m":"3","5m":"5","15m":"15","30m":"30","1h":"60","2h":"120","4h":"240","6h":"360","12h":"720","1d":"D","1w":"W","1M":"M"},urls:{test:{spot:"https://api-testnet.{hostname}",futures:"https://api-testnet.{hostname}",v2:"https://api-testnet.{hostname}",public:"https://api-testnet.{hostname}",private:"https://api-testnet.{hostname}"},logo:"https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed",api:{spot:"https://api.{hostname}",futures:"https://api.{hostname}",v2:"https://api.{hostname}",public:"https://api.{hostname}",private:"https://api.{hostname}"},demotrading:{spot:"https://api-demo.{hostname}",futures:"https://api-demo.{hostname}",v2:"https://api-demo.{hostname}",public:"https://api-demo.{hostname}",private:"https://api-demo.{hostname}"},www:"https://www.bybit.com",doc:["https://bybit-exchange.github.io/docs/inverse/","https://bybit-exchange.github.io/docs/linear/","https://github.com/bybit-exchange"],fees:"https://help.bybit.com/hc/en-us/articles/360039261154",referral:"https://www.bybit.com/register?affiliate_id=35953"},api:{public:{get:{"spot/v3/public/symbols":1,"spot/v3/public/quote/depth":1,"spot/v3/public/quote/depth/merged":1,"spot/v3/public/quote/trades":1,"spot/v3/public/quote/kline":1,"spot/v3/public/quote/ticker/24hr":1,"spot/v3/public/quote/ticker/price":1,"spot/v3/public/quote/ticker/bookTicker":1,"spot/v3/public/server-time":1,"spot/v3/public/infos":1,"spot/v3/public/margin-product-infos":1,"spot/v3/public/margin-ensure-tokens":1,"v3/public/time":1,"contract/v3/public/copytrading/symbol/list":1,"derivatives/v3/public/order-book/L2":1,"derivatives/v3/public/kline":1,"derivatives/v3/public/tickers":1,"derivatives/v3/public/instruments-info":1,"derivatives/v3/public/mark-price-kline":1,"derivatives/v3/public/index-price-kline":1,"derivatives/v3/public/funding/history-funding-rate":1,"derivatives/v3/public/risk-limit/list":1,"derivatives/v3/public/delivery-price":1,"derivatives/v3/public/recent-trade":1,"derivatives/v3/public/open-interest":1,"derivatives/v3/public/insurance":1,"v5/announcements/index":5,"v5/market/time":5,"v5/market/kline":5,"v5/market/mark-price-kline":5,"v5/market/index-price-kline":5,"v5/market/premium-index-price-kline":5,"v5/market/instruments-info":5,"v5/market/orderbook":5,"v5/market/tickers":5,"v5/market/funding/history":5,"v5/market/recent-trade":5,"v5/market/open-interest":5,"v5/market/historical-volatility":5,"v5/market/insurance":5,"v5/market/risk-limit":5,"v5/market/delivery-price":5,"v5/market/account-ratio":5,"v5/spot-lever-token/info":5,"v5/spot-lever-token/reference":5,"v5/spot-margin-trade/data":5,"v5/spot-margin-trade/collateral":5,"v5/spot-cross-margin-trade/data":5,"v5/spot-cross-margin-trade/pledge-token":5,"v5/spot-cross-margin-trade/borrow-token":5,"v5/crypto-loan/collateral-data":5,"v5/crypto-loan/loanable-data":5,"v5/ins-loan/product-infos":5,"v5/ins-loan/ensure-tokens-convert":5,"v5/earn/product":5}},private:{get:{"v5/market/instruments-info":5,"v2/private/wallet/fund/records":25,"spot/v3/private/order":2.5,"spot/v3/private/open-orders":2.5,"spot/v3/private/history-orders":2.5,"spot/v3/private/my-trades":2.5,"spot/v3/private/account":2.5,"spot/v3/private/reference":2.5,"spot/v3/private/record":2.5,"spot/v3/private/cross-margin-orders":10,"spot/v3/private/cross-margin-account":10,"spot/v3/private/cross-margin-loan-info":10,"spot/v3/private/cross-margin-repay-history":10,"spot/v3/private/margin-loan-infos":10,"spot/v3/private/margin-repaid-infos":10,"spot/v3/private/margin-ltv":10,"asset/v3/private/transfer/inter-transfer/list/query":50,"asset/v3/private/transfer/sub-member/list/query":50,"asset/v3/private/transfer/sub-member-transfer/list/query":50,"asset/v3/private/transfer/universal-transfer/list/query":25,"asset/v3/private/coin-info/query":25,"asset/v3/private/deposit/address/query":10,"contract/v3/private/copytrading/order/list":30,"contract/v3/private/copytrading/position/list":40,"contract/v3/private/copytrading/wallet/balance":25,"contract/v3/private/position/limit-info":25,"contract/v3/private/order/unfilled-orders":1,"contract/v3/private/order/list":1,"contract/v3/private/position/list":1,"contract/v3/private/execution/list":1,"contract/v3/private/position/closed-pnl":1,"contract/v3/private/account/wallet/balance":1,"contract/v3/private/account/fee-rate":1,"contract/v3/private/account/wallet/fund-records":1,"unified/v3/private/order/unfilled-orders":1,"unified/v3/private/order/list":1,"unified/v3/private/position/list":1,"unified/v3/private/execution/list":1,"unified/v3/private/delivery-record":1,"unified/v3/private/settlement-record":1,"unified/v3/private/account/wallet/balance":1,"unified/v3/private/account/transaction-log":1,"unified/v3/private/account/borrow-history":1,"unified/v3/private/account/borrow-rate":1,"unified/v3/private/account/info":1,"user/v3/private/frozen-sub-member":10,"user/v3/private/query-sub-members":5,"user/v3/private/query-api":5,"user/v3/private/get-member-type":1,"asset/v3/private/transfer/transfer-coin/list/query":50,"asset/v3/private/transfer/account-coin/balance/query":50,"asset/v3/private/transfer/account-coins/balance/query":25,"asset/v3/private/transfer/asset-info/query":50,"asset/v3/public/deposit/allowed-deposit-list/query":.17,"asset/v3/private/deposit/record/query":10,"asset/v3/private/withdraw/record/query":10,"v5/order/realtime":5,"v5/order/history":5,"v5/order/spot-borrow-check":1,"v5/position/list":5,"v5/execution/list":5,"v5/position/closed-pnl":5,"v5/position/move-history":5,"v5/pre-upgrade/order/history":5,"v5/pre-upgrade/execution/list":5,"v5/pre-upgrade/position/closed-pnl":5,"v5/pre-upgrade/account/transaction-log":5,"v5/pre-upgrade/asset/delivery-record":5,"v5/pre-upgrade/asset/settlement-record":5,"v5/account/wallet-balance":1,"v5/account/borrow-history":1,"v5/account/collateral-info":1,"v5/asset/coin-greeks":1,"v5/account/fee-rate":10,"v5/account/info":5,"v5/account/transaction-log":1,"v5/account/contract-transaction-log":1,"v5/account/smp-group":1,"v5/account/mmp-state":5,"v5/account/withdrawal":5,"v5/asset/exchange/query-coin-list":.5,"v5/asset/exchange/convert-result-query":.5,"v5/asset/exchange/query-convert-history":.5,"v5/asset/exchange/order-record":5,"v5/asset/delivery-record":5,"v5/asset/settlement-record":5,"v5/asset/transfer/query-asset-info":50,"v5/asset/transfer/query-account-coins-balance":25,"v5/asset/transfer/query-account-coin-balance":50,"v5/asset/transfer/query-transfer-coin-list":50,"v5/asset/transfer/query-inter-transfer-list":50,"v5/asset/transfer/query-sub-member-list":50,"v5/asset/transfer/query-universal-transfer-list":25,"v5/asset/deposit/query-allowed-list":5,"v5/asset/deposit/query-record":10,"v5/asset/deposit/query-sub-member-record":10,"v5/asset/deposit/query-internal-record":5,"v5/asset/deposit/query-address":10,"v5/asset/deposit/query-sub-member-address":10,"v5/asset/coin/query-info":28,"v5/asset/withdraw/query-record":10,"v5/asset/withdraw/withdrawable-amount":5,"v5/asset/withdraw/vasp/list":5,"v5/user/query-sub-members":5,"v5/user/query-api":5,"v5/user/sub-apikeys":5,"v5/user/get-member-type":5,"v5/user/aff-customer-info":5,"v5/user/del-submember":5,"v5/user/submembers":5,"v5/affiliate/aff-user-list":5,"v5/spot-lever-token/order-record":1,"v5/spot-margin-trade/interest-rate-history":5,"v5/spot-margin-trade/state":5,"v5/spot-cross-margin-trade/loan-info":1,"v5/spot-cross-margin-trade/account":1,"v5/spot-cross-margin-trade/orders":1,"v5/spot-cross-margin-trade/repay-history":1,"v5/crypto-loan/borrowable-collateralisable-number":5,"v5/crypto-loan/ongoing-orders":5,"v5/crypto-loan/repayment-history":5,"v5/crypto-loan/borrow-history":5,"v5/crypto-loan/max-collateral-amount":5,"v5/crypto-loan/adjustment-history":5,"v5/ins-loan/product-infos":5,"v5/ins-loan/ensure-tokens-convert":5,"v5/ins-loan/loan-order":5,"v5/ins-loan/repaid-history":5,"v5/ins-loan/ltv-convert":5,"v5/lending/info":5,"v5/lending/history-order":5,"v5/lending/account":5,"v5/broker/earning-record":5,"v5/broker/earnings-info":5,"v5/broker/account-info":5,"v5/broker/asset/query-sub-member-deposit-record":10,"v5/earn/order":5,"v5/earn/position":5},post:{"spot/v3/private/order":2.5,"spot/v3/private/cancel-order":2.5,"spot/v3/private/cancel-orders":2.5,"spot/v3/private/cancel-orders-by-ids":2.5,"spot/v3/private/purchase":2.5,"spot/v3/private/redeem":2.5,"spot/v3/private/cross-margin-loan":10,"spot/v3/private/cross-margin-repay":10,"asset/v3/private/transfer/inter-transfer":150,"asset/v3/private/withdraw/create":300,"asset/v3/private/withdraw/cancel":50,"asset/v3/private/transfer/sub-member-transfer":150,"asset/v3/private/transfer/transfer-sub-member-save":150,"asset/v3/private/transfer/universal-transfer":10,"user/v3/private/create-sub-member":10,"user/v3/private/create-sub-api":10,"user/v3/private/update-api":10,"user/v3/private/delete-api":10,"user/v3/private/update-sub-api":10,"user/v3/private/delete-sub-api":10,"contract/v3/private/copytrading/order/create":30,"contract/v3/private/copytrading/order/cancel":30,"contract/v3/private/copytrading/order/close":30,"contract/v3/private/copytrading/position/close":40,"contract/v3/private/copytrading/position/set-leverage":40,"contract/v3/private/copytrading/wallet/transfer":25,"contract/v3/private/copytrading/order/trading-stop":2.5,"contract/v3/private/order/create":1,"contract/v3/private/order/cancel":1,"contract/v3/private/order/cancel-all":1,"contract/v3/private/order/replace":1,"contract/v3/private/position/set-auto-add-margin":1,"contract/v3/private/position/switch-isolated":1,"contract/v3/private/position/switch-mode":1,"contract/v3/private/position/switch-tpsl-mode":1,"contract/v3/private/position/set-leverage":1,"contract/v3/private/position/trading-stop":1,"contract/v3/private/position/set-risk-limit":1,"contract/v3/private/account/setMarginMode":1,"unified/v3/private/order/create":30,"unified/v3/private/order/replace":30,"unified/v3/private/order/cancel":30,"unified/v3/private/order/create-batch":30,"unified/v3/private/order/replace-batch":30,"unified/v3/private/order/cancel-batch":30,"unified/v3/private/order/cancel-all":30,"unified/v3/private/position/set-leverage":2.5,"unified/v3/private/position/tpsl/switch-mode":2.5,"unified/v3/private/position/set-risk-limit":2.5,"unified/v3/private/position/trading-stop":2.5,"unified/v3/private/account/upgrade-unified-account":2.5,"unified/v3/private/account/setMarginMode":2.5,"fht/compliance/tax/v3/private/registertime":50,"fht/compliance/tax/v3/private/create":50,"fht/compliance/tax/v3/private/status":50,"fht/compliance/tax/v3/private/url":50,"v5/order/create":2.5,"v5/order/amend":5,"v5/order/cancel":2.5,"v5/order/cancel-all":50,"v5/order/create-batch":5,"v5/order/amend-batch":5,"v5/order/cancel-batch":5,"v5/order/disconnected-cancel-all":5,"v5/position/set-leverage":5,"v5/position/switch-isolated":5,"v5/position/set-tpsl-mode":5,"v5/position/switch-mode":5,"v5/position/set-risk-limit":5,"v5/position/trading-stop":5,"v5/position/set-auto-add-margin":5,"v5/position/add-margin":5,"v5/position/move-positions":5,"v5/position/confirm-pending-mmr":5,"v5/account/upgrade-to-uta":5,"v5/account/quick-repayment":5,"v5/account/set-margin-mode":5,"v5/account/set-hedging-mode":5,"v5/account/mmp-modify":5,"v5/account/mmp-reset":5,"v5/asset/exchange/quote-apply":1,"v5/asset/exchange/convert-execute":1,"v5/asset/transfer/inter-transfer":50,"v5/asset/transfer/save-transfer-sub-member":150,"v5/asset/transfer/universal-transfer":10,"v5/asset/deposit/deposit-to-account":5,"v5/asset/withdraw/create":50,"v5/asset/withdraw/cancel":50,"v5/user/create-sub-member":10,"v5/user/create-sub-api":10,"v5/user/frozen-sub-member":10,"v5/user/update-api":10,"v5/user/update-sub-api":10,"v5/user/delete-api":10,"v5/user/delete-sub-api":10,"v5/spot-lever-token/purchase":2.5,"v5/spot-lever-token/redeem":2.5,"v5/spot-margin-trade/switch-mode":5,"v5/spot-margin-trade/set-leverage":5,"v5/spot-cross-margin-trade/loan":2.5,"v5/spot-cross-margin-trade/repay":2.5,"v5/spot-cross-margin-trade/switch":2.5,"v5/crypto-loan/borrow":5,"v5/crypto-loan/repay":5,"v5/crypto-loan/adjust-ltv":5,"v5/ins-loan/association-uid":5,"v5/lending/purchase":5,"v5/lending/redeem":5,"v5/lending/redeem-cancel":5,"v5/account/set-collateral-switch":5,"v5/account/set-collateral-switch-batch":5,"v5/account/demo-apply-money":5,"v5/broker/award/info":5,"v5/broker/award/distribute-award":5,"v5/broker/award/distribution-record":5,"v5/earn/place-order":5}}},httpExceptions:{403:a.RateLimitExceeded},exceptions:{exact:{"-10009":a.BadRequest,"-1004":a.BadRequest,"-1021":a.BadRequest,"-1103":a.BadRequest,"-1140":a.InvalidOrder,"-1197":a.InvalidOrder,"-2013":a.InvalidOrder,"-2015":a.AuthenticationError,"-6017":a.BadRequest,"-6025":a.BadRequest,"-6029":a.BadRequest,5004:a.ExchangeError,7001:a.BadRequest,10001:a.BadRequest,10002:a.InvalidNonce,10003:a.AuthenticationError,10004:a.AuthenticationError,10005:a.PermissionDenied,10006:a.RateLimitExceeded,10007:a.AuthenticationError,10008:a.AccountSuspended,10009:a.AuthenticationError,10010:a.PermissionDenied,10014:a.BadRequest,10016:a.ExchangeError,10017:a.BadRequest,10018:a.RateLimitExceeded,10020:a.PermissionDenied,10024:a.PermissionDenied,10027:a.PermissionDenied,10028:a.PermissionDenied,10029:a.PermissionDenied,12137:a.InvalidOrder,12201:a.BadRequest,12141:a.BadRequest,100028:a.PermissionDenied,110001:a.OrderNotFound,110003:a.InvalidOrder,110004:a.InsufficientFunds,110005:a.InvalidOrder,110006:a.InsufficientFunds,110007:a.InsufficientFunds,110008:a.InvalidOrder,110009:a.InvalidOrder,110010:a.InvalidOrder,110011:a.InvalidOrder,110012:a.InsufficientFunds,110013:a.BadRequest,110014:a.InsufficientFunds,110015:a.BadRequest,110016:a.InvalidOrder,110017:a.InvalidOrder,110018:a.BadRequest,110019:a.InvalidOrder,110020:a.InvalidOrder,110021:a.InvalidOrder,110022:a.InvalidOrder,110023:a.InvalidOrder,110024:a.BadRequest,110025:a.NoChange,110026:a.MarginModeAlreadySet,110027:a.NoChange,110028:a.BadRequest,110029:a.BadRequest,110030:a.InvalidOrder,110031:a.InvalidOrder,110032:a.InvalidOrder,110033:a.InvalidOrder,110034:a.InvalidOrder,110035:a.InvalidOrder,110036:a.InvalidOrder,110037:a.InvalidOrder,110038:a.InvalidOrder,110039:a.InvalidOrder,110040:a.InvalidOrder,110041:a.InvalidOrder,110042:a.InvalidOrder,110043:a.BadRequest,110044:a.InsufficientFunds,110045:a.InsufficientFunds,110046:a.BadRequest,110047:a.BadRequest,110048:a.BadRequest,110049:a.BadRequest,110050:a.BadRequest,110051:a.InsufficientFunds,110052:a.InsufficientFunds,110053:a.InsufficientFunds,110054:a.InvalidOrder,110055:a.InvalidOrder,110056:a.InvalidOrder,110057:a.InvalidOrder,110058:a.InvalidOrder,110059:a.InvalidOrder,110060:a.BadRequest,110061:a.BadRequest,110062:a.BadRequest,110063:a.ExchangeError,110064:a.InvalidOrder,110065:a.PermissionDenied,110066:a.ExchangeError,110067:a.PermissionDenied,110068:a.PermissionDenied,110069:a.PermissionDenied,110070:a.InvalidOrder,110071:a.ExchangeError,110072:a.InvalidOrder,110073:a.ExchangeError,110092:a.InvalidOrder,110093:a.InvalidOrder,110094:a.InvalidOrder,130006:a.InvalidOrder,130021:a.InsufficientFunds,130074:a.InvalidOrder,131001:a.InsufficientFunds,131084:a.ExchangeError,131200:a.ExchangeError,131201:a.ExchangeError,131202:a.BadRequest,131203:a.BadRequest,131204:a.BadRequest,131205:a.BadRequest,131206:a.ExchangeError,131207:a.BadRequest,131208:a.ExchangeError,131209:a.BadRequest,131210:a.BadRequest,131211:a.BadRequest,131212:a.InsufficientFunds,131213:a.BadRequest,131214:a.BadRequest,131215:a.BadRequest,131216:a.ExchangeError,131217:a.ExchangeError,131231:a.NotSupported,131232:a.NotSupported,131002:a.BadRequest,131003:a.ExchangeError,131004:a.AuthenticationError,131085:a.InsufficientFunds,131086:a.BadRequest,131088:a.BadRequest,131089:a.BadRequest,131090:a.ExchangeError,131091:a.ExchangeError,131092:a.ExchangeError,131093:a.ExchangeError,131094:a.BadRequest,131095:a.BadRequest,131096:a.BadRequest,131097:a.ExchangeError,131098:a.ExchangeError,131099:a.ExchangeError,140001:a.OrderNotFound,140003:a.InvalidOrder,140004:a.InsufficientFunds,140005:a.InvalidOrder,140006:a.InsufficientFunds,140007:a.InsufficientFunds,140008:a.InvalidOrder,140009:a.InvalidOrder,140010:a.InvalidOrder,140011:a.InvalidOrder,140012:a.InsufficientFunds,140013:a.BadRequest,140014:a.InsufficientFunds,140015:a.InvalidOrder,140016:a.InvalidOrder,140017:a.InvalidOrder,140018:a.BadRequest,140019:a.InvalidOrder,140020:a.InvalidOrder,140021:a.InvalidOrder,140022:a.InvalidOrder,140023:a.InvalidOrder,140024:a.BadRequest,140025:a.BadRequest,140026:a.BadRequest,140027:a.BadRequest,140028:a.InvalidOrder,140029:a.BadRequest,140030:a.InvalidOrder,140031:a.BadRequest,140032:a.InvalidOrder,140033:a.InvalidOrder,140034:a.InvalidOrder,140035:a.InvalidOrder,140036:a.BadRequest,140037:a.InvalidOrder,140038:a.BadRequest,140039:a.BadRequest,140040:a.InvalidOrder,140041:a.InvalidOrder,140042:a.InvalidOrder,140043:a.BadRequest,140044:a.InsufficientFunds,140045:a.InsufficientFunds,140046:a.BadRequest,140047:a.BadRequest,140048:a.BadRequest,140049:a.BadRequest,140050:a.InvalidOrder,140051:a.InsufficientFunds,140052:a.InsufficientFunds,140053:a.InsufficientFunds,140054:a.InvalidOrder,140055:a.InvalidOrder,140056:a.InvalidOrder,140057:a.InvalidOrder,140058:a.InvalidOrder,140059:a.InvalidOrder,140060:a.BadRequest,140061:a.BadRequest,140062:a.BadRequest,140063:a.ExchangeError,140064:a.InvalidOrder,140065:a.PermissionDenied,140066:a.ExchangeError,140067:a.PermissionDenied,140068:a.PermissionDenied,140069:a.PermissionDenied,140070:a.InvalidOrder,170001:a.ExchangeError,170005:a.InvalidOrder,170007:a.RequestTimeout,170010:a.InvalidOrder,170011:a.InvalidOrder,170019:a.InvalidOrder,170031:a.ExchangeError,170032:a.ExchangeError,170033:a.InsufficientFunds,170034:a.InsufficientFunds,170035:a.BadRequest,170036:a.BadRequest,170037:a.BadRequest,170105:a.BadRequest,170115:a.InvalidOrder,170116:a.InvalidOrder,170117:a.InvalidOrder,170121:a.InvalidOrder,170124:a.InvalidOrder,170130:a.BadRequest,170131:a.InsufficientFunds,170132:a.InvalidOrder,170133:a.InvalidOrder,170134:a.InvalidOrder,170135:a.InvalidOrder,170136:a.InvalidOrder,170137:a.InvalidOrder,170139:a.InvalidOrder,170140:a.InvalidOrder,170141:a.InvalidOrder,170142:a.InvalidOrder,170143:a.InvalidOrder,170144:a.InvalidOrder,170145:a.InvalidOrder,170146:a.InvalidOrder,170147:a.InvalidOrder,170148:a.InvalidOrder,170149:a.ExchangeError,170150:a.ExchangeError,170151:a.InvalidOrder,170157:a.InvalidOrder,170159:a.InvalidOrder,170190:a.InvalidOrder,170191:a.InvalidOrder,170192:a.InvalidOrder,170193:a.InvalidOrder,170194:a.InvalidOrder,170195:a.InvalidOrder,170196:a.InvalidOrder,170197:a.InvalidOrder,170198:a.InvalidOrder,170199:a.InvalidOrder,170200:a.InvalidOrder,170201:a.PermissionDenied,170202:a.InvalidOrder,170203:a.InvalidOrder,170204:a.InvalidOrder,170206:a.InvalidOrder,170210:a.InvalidOrder,170213:a.OrderNotFound,170217:a.InvalidOrder,170218:a.InvalidOrder,170221:a.BadRequest,170222:a.RateLimitExceeded,170223:a.InsufficientFunds,170224:a.PermissionDenied,170226:a.InsufficientFunds,170227:a.ExchangeError,170228:a.InvalidOrder,170229:a.InvalidOrder,170234:a.ExchangeError,170241:a.ManualInteractionNeeded,175e3:a.InvalidOrder,175001:a.InvalidOrder,175002:a.InvalidOrder,175003:a.InsufficientFunds,175004:a.InvalidOrder,175005:a.InvalidOrder,175006:a.InsufficientFunds,175007:a.InvalidOrder,175008:a.InvalidOrder,175009:a.InvalidOrder,175010:a.PermissionDenied,175012:a.InvalidOrder,175013:a.InvalidOrder,175014:a.InvalidOrder,175015:a.InvalidOrder,175016:a.InvalidOrder,175017:a.InvalidOrder,175027:a.ExchangeError,176002:a.BadRequest,176004:a.BadRequest,176003:a.BadRequest,176006:a.BadRequest,176005:a.BadRequest,176008:a.BadRequest,176007:a.BadRequest,176010:a.BadRequest,176009:a.BadRequest,176012:a.BadRequest,176011:a.BadRequest,176014:a.BadRequest,176013:a.BadRequest,176015:a.InsufficientFunds,176016:a.BadRequest,176017:a.BadRequest,176018:a.BadRequest,176019:a.BadRequest,176020:a.BadRequest,176021:a.BadRequest,176022:a.BadRequest,176023:a.BadRequest,176024:a.BadRequest,176025:a.BadRequest,176026:a.BadRequest,176027:a.BadRequest,176028:a.BadRequest,176029:a.BadRequest,176030:a.BadRequest,176031:a.BadRequest,176034:a.BadRequest,176035:a.PermissionDenied,176036:a.PermissionDenied,176037:a.PermissionDenied,176038:a.BadRequest,176039:a.BadRequest,176040:a.BadRequest,181e3:a.BadRequest,181001:a.BadRequest,181002:a.InvalidOrder,181003:a.InvalidOrder,181004:a.InvalidOrder,182e3:a.InvalidOrder,181017:a.BadRequest,20001:a.OrderNotFound,20003:a.InvalidOrder,20004:a.InvalidOrder,20005:a.InvalidOrder,20006:a.InvalidOrder,20007:a.InvalidOrder,20008:a.InvalidOrder,20009:a.InvalidOrder,20010:a.InvalidOrder,20011:a.InvalidOrder,20012:a.InvalidOrder,20013:a.InvalidOrder,20014:a.InvalidOrder,20015:a.InvalidOrder,20016:a.InvalidOrder,20017:a.InvalidOrder,20018:a.InvalidOrder,20019:a.InvalidOrder,20020:a.InvalidOrder,20021:a.InvalidOrder,20022:a.BadRequest,20023:a.BadRequest,20031:a.BadRequest,20070:a.BadRequest,20071:a.BadRequest,20084:a.BadRequest,30001:a.BadRequest,30003:a.InvalidOrder,30004:a.InvalidOrder,30005:a.InvalidOrder,30007:a.InvalidOrder,30008:a.InvalidOrder,30009:a.ExchangeError,30010:a.InsufficientFunds,30011:a.PermissionDenied,30012:a.PermissionDenied,30013:a.PermissionDenied,30014:a.InvalidOrder,30015:a.InvalidOrder,30016:a.ExchangeError,30017:a.InvalidOrder,30018:a.InvalidOrder,30019:a.InvalidOrder,30020:a.InvalidOrder,30021:a.InvalidOrder,30022:a.InvalidOrder,30023:a.InvalidOrder,30024:a.InvalidOrder,30025:a.InvalidOrder,30026:a.InvalidOrder,30027:a.InvalidOrder,30028:a.InvalidOrder,30029:a.InvalidOrder,30030:a.InvalidOrder,30031:a.InsufficientFunds,30032:a.InvalidOrder,30033:a.RateLimitExceeded,30034:a.OrderNotFound,30035:a.RateLimitExceeded,30036:a.ExchangeError,30037:a.InvalidOrder,30041:a.ExchangeError,30042:a.InsufficientFunds,30043:a.InvalidOrder,30044:a.InvalidOrder,30045:a.InvalidOrder,30049:a.InsufficientFunds,30050:a.ExchangeError,30051:a.ExchangeError,30052:a.ExchangeError,30054:a.ExchangeError,30057:a.ExchangeError,30063:a.ExchangeError,30067:a.InsufficientFunds,30068:a.ExchangeError,30074:a.InvalidOrder,30075:a.InvalidOrder,30078:a.ExchangeError,33004:a.AuthenticationError,34026:a.ExchangeError,34036:a.BadRequest,35015:a.BadRequest,340099:a.ExchangeError,3400045:a.ExchangeError,3100116:a.BadRequest,3100198:a.BadRequest,3200300:a.InsufficientFunds},broad:{"Not supported symbols":a.BadSymbol,"Request timeout":a.RequestTimeout,"unknown orderInfo":a.OrderNotFound,"invalid api_key":a.AuthenticationError,oc_diff:a.InsufficientFunds,new_oc:a.InsufficientFunds,"openapi sign params error!":a.AuthenticationError}},precisionMode:r.kb,options:{usePrivateInstrumentsInfo:!1,enableDemoTrading:!1,fetchMarkets:["spot","linear","inverse","option"],enableUnifiedMargin:void 0,enableUnifiedAccount:void 0,unifiedMarginStatus:void 0,createMarketBuyOrderRequiresPrice:!1,createUnifiedMarginAccount:!1,defaultType:"swap",defaultSubType:"linear",defaultSettle:"USDT",code:"BTC",recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,loadAllOptions:!1,loadExpiredOptions:!1,brokerId:"CCXT",accountsByType:{spot:"SPOT",margin:"SPOT",future:"CONTRACT",swap:"CONTRACT",option:"OPTION",investment:"INVESTMENT",unified:"UNIFIED",funding:"FUND",fund:"FUND",contract:"CONTRACT"},accountsById:{SPOT:"spot",MARGIN:"spot",CONTRACT:"contract",OPTION:"option",INVESTMENT:"investment",UNIFIED:"unified",FUND:"fund"},networks:{ERC20:"ETH",TRC20:"TRX",BEP20:"BSC",SOL:"SOL",ACA:"ACA",ADA:"ADA",ALGO:"ALGO",APT:"APTOS",AR:"AR",ARBONE:"ARBI",AVAXC:"CAVAX",AVAXX:"XAVAX",ATOM:"ATOM",BCH:"BCH",BEP2:"BNB",CHZ:"CHZ",DCR:"DCR",DGB:"DGB",DOGE:"DOGE",DOT:"DOT",EGLD:"EGLD",EOS:"EOS",ETC:"ETC",ETHF:"ETHF",ETHW:"ETHW",FIL:"FIL",STEP:"FITFI",FLOW:"FLOW",FTM:"FTM",GLMR:"GLMR",HBAR:"HBAR",HNT:"HNT",ICP:"ICP",ICX:"ICX",KDA:"KDA",KLAY:"KLAY",KMA:"KMA",KSM:"KSM",LTC:"LTC",MATIC:"MATIC",MINA:"MINA",MOVR:"MOVR",NEAR:"NEAR",NEM:"NEM",OASYS:"OAS",OASIS:"ROSE",OMNI:"OMNI",ONE:"ONE",OPTIMISM:"OP",POKT:"POKT",QTUM:"QTUM",RVN:"RVN",SC:"SC",SCRT:"SCRT",STX:"STX",THETA:"THETA",TON:"TON",WAVES:"WAVES",WAX:"WAXP",XDC:"XDC",XEC:"XEC",XLM:"XLM",XRP:"XRP",XTZ:"XTZ",XYM:"XYM",ZEN:"ZEN",ZIL:"ZIL",ZKSYNC:"ZKSYNC"},networksById:{ETH:"ERC20",TRX:"TRC20",BSC:"BEP20",OMNI:"OMNI",SPL:"SOL"},defaultNetwork:"ERC20",defaultNetworks:{USDT:"TRC20"},intervals:{"5m":"5min","15m":"15min","30m":"30min","1h":"1h","4h":"4h","1d":"1d"}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:{last:!0,mark:!0,index:!0},price:!0},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!0,selfTradePrevention:!0,trailing:!0,iceberg:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0},createOrders:{max:10},fetchMyTrades:{marginMode:!1,limit:100,daysBack:730,untilDays:7,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!0,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:50,trigger:!0,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:50,daysBack:730,daysBackCanceled:1,untilDays:7,trigger:!0,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3},editOrders:{max:10}},spot:{extends:"default",createOrder:{triggerPriceType:void 0,triggerDirection:!1,attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!0},marketBuyRequiresPrice:!0}},swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:{extends:"default"},inverse:{extends:"default"}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:75e-5,maker:1e-4},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}}})}enableDemoTrading(e){if(this.isSandboxModeEnabled)throw new a.NotSupported(this.id+" demo trading does not support in sandbox environment");if(e)this.urls.apiBackupDemoTrading=this.urls.api,this.urls.api=this.urls.demotrading;else if("apiBackupDemoTrading"in this.urls){this.urls.api=this.urls.apiBackupDemoTrading;const e=this.omit(this.urls,"apiBackupDemoTrading");this.urls=e}this.options.enableDemoTrading=e}nonce(){return this.milliseconds()-this.options.timeDifference}addPaginationCursorToResult(e){const t=this.safeDict(e,"result",{}),i=this.safeListN(t,["list","rows","data","dataList"],[]),s=this.safeString2(t,"nextPageCursor","cursor"),r=i.length;if(void 0!==s&&r>0){const e=i[0];e.nextPageCursor=s,i[0]=e}return i}async isUnifiedEnabled(e={}){const t=this.safeBool(this.options,"enableUnifiedMargin"),i=this.safeBool(this.options,"enableUnifiedAccount");if(void 0===t||void 0===i){if(this.options.enableDemoTrading)return this.options.enableUnifiedMargin=!1,this.options.enableUnifiedAccount=!0,this.options.unifiedMarginStatus=6,[this.options.enableUnifiedMargin,this.options.enableUnifiedAccount];const t=[this.privateGetV5UserQueryApi(e),this.privateGetV5AccountInfo(e)],i=await Promise.all(t),s=i[0],r=i[1],a=this.safeDict(s,"result",{}),o=this.safeDict(r,"result",{});this.options.enableUnifiedMargin=1===this.safeInteger(a,"unified"),this.options.enableUnifiedAccount=1===this.safeInteger(a,"uta"),this.options.unifiedMarginStatus=this.safeInteger(o,"unifiedMarginStatus",6)}return[this.options.enableUnifiedMargin,this.options.enableUnifiedAccount]}async upgradeUnifiedTradeAccount(e={}){return await this.privatePostV5AccountUpgradeToUta(e)}createExpiredOptionMarket(e){let t,i;const s=e.split("-"),r=e.split("/");let a,o;if(e.indexOf("/")>-1){a=this.safeString(r,0),o=this.safeString(s,1);const e=this.safeString(r,1).split(":"),n=this.safeString(e,0);t=n,i=n}else a=this.safeString(s,0),o=this.convertMarketIdExpireDate(this.safeString(s,1)),e.endsWith("-USDT")?(t="USDT",i="USDT"):(t="USDC",i="USDC");const n=this.safeString(s,2),d=this.safeString(s,3),h=this.convertExpireDate(o),c=this.parse8601(h);let l,u;return"BTC"===a?(l=this.parseNumber("0.01"),u=this.parseNumber("5")):"ETH"===a?(l=this.parseNumber("0.1"),u=this.parseNumber("0.1")):"SOL"===a&&(l=this.parseNumber("1"),u=this.parseNumber("0.01")),{id:a+"-"+this.convertExpireDateToMarketIdDate(o)+"-"+n+"-"+d,symbol:a+"/"+t+":"+i+"-"+o+"-"+n+"-"+d,base:a,quote:t,settle:i,baseId:a,quoteId:t,settleId:i,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:this.parseNumber("1"),expiry:c,expiryDatetime:h,optionType:"C"===d?"call":"put",strike:this.parseNumber(n),precision:{amount:l,price:u},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,i,s)}getBybitType(e,t,i={}){let s,r;return[s,i]=this.handleMarketTypeAndParams(e,t,i),[r,i]=this.handleSubTypeAndParams(e,t,i),"option"===s||"spot"===s?[s,i]:[r,i]}getAmount(e,t){const i=void 0===this.market(e).precision.amount,s=this.numberToString(t);return i||"0"===s?s:this.amountToPrecision(e,t)}getPrice(e,t){if(void 0===t)return t;return void 0===this.market(e).precision.price?t:this.priceToPrecision(e,t)}getCost(e,t){return void 0===this.market(e).precision.price?t:this.costToPrecision(e,t)}async fetchTime(e={}){const t=await this.publicGetV5MarketTime(e);return this.safeInteger(t,"time")}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;if(this.options.enableDemoTrading)return;const t=await this.privateGetV5AssetCoinQueryInfo(e),i=this.safeDict(t,"result",{}),s=this.safeList(i,"rows",[]),r={};for(let e=0;e1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const[s,r]=await this.isUnifiedEnabled();if(!(s||r))return await this.fetchOrderClassic(e,t,i);let o=!1;if([o,i]=this.handleOptionAndParams(i,"fetchOrder","acknowledged"),!o)throw new a.ArgumentsRequired(this.id+' fetchOrder() can only access an order if it is in last 500 orders (of any status) for your account. Set params["acknowledged"] = true to hide this warning. Alternatively, we suggest to use fetchOpenOrder or fetchClosedOrder');const n=this.market(t);let d;[d,i]=this.getBybitType("fetchOrder",n,i);const h={symbol:n.id,orderId:e,category:d};let c;[c,i]=this.handleParamBool2(i,"trigger","stop",!1),c&&(h.orderFilter="StopOrder");const l=await this.privateGetV5OrderRealtime(this.extend(h,i)),u=this.safeDict(l,"result",{}),f=this.safeList(u,"list",[]);if(0===f.length){const t=c?"":' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';throw new a.OrderNotFound("Order "+e.toString()+" was not found."+t)}const p=this.safeDict(f,0,{});return this.parseOrder(p,n)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){const r=await this.isUnifiedEnabled();if(this.safeBool(r,1))throw new a.NotSupported(this.id+" fetchOrders() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders");return await this.fetchOrdersClassic(e,t,i,s)}async fetchOrdersClassic(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchOrders","paginate"),r)return await this.fetchPaginatedCallCursor("fetchOrders",e,t,i,s,"nextPageCursor","cursor",void 0,50);const o={};let n,d;if(void 0!==e&&(n=this.market(e),o.symbol=n.id),[d,s]=this.getBybitType("fetchOrders",n,s),"spot"===d)throw new a.NotSupported(this.id+" fetchOrders() is not supported for spot markets");o.category=d;const h=this.safeBoolN(s,["trigger","stop"],!1);s=this.omit(s,["trigger","stop"]),h&&(o.orderFilter="StopOrder"),void 0!==i&&(o.limit=i),void 0!==t&&(o.startTime=t);const c=this.safeInteger(s,"until"),l=this.safeInteger(s,"endTime",c);s=this.omit(s,["endTime","until"]),void 0!==l&&(o.endTime=l);const u=await this.privateGetV5OrderHistory(this.extend(o,s)),f=this.addPaginationCursorToResult(u);return this.parseOrders(f,n,t,i)}async fetchClosedOrder(e,t=void 0,i={}){await this.loadMarkets();const s={orderId:e},r=await this.fetchClosedOrders(t,void 0,void 0,this.extend(s,i)),o=r.length;if(0===o){const t=this.safeBoolN(i,["trigger","stop"],!1)?"":' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';throw new a.OrderNotFound("Order "+e.toString()+" was not found."+t)}if(o>1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchOpenOrder(e,t=void 0,i={}){await this.loadMarkets();const s={orderId:e},r=await this.fetchOpenOrders(t,void 0,void 0,this.extend(s,i)),o=r.length;if(0===o){const t=this.safeBoolN(i,["trigger","stop"],!1)?"":' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';throw new a.OrderNotFound("Order "+e.toString()+" was not found."+t)}if(o>1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchCanceledAndClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchCanceledAndClosedOrders","paginate"),r)return await this.fetchPaginatedCallCursor("fetchCanceledAndClosedOrders",e,t,i,s,"nextPageCursor","cursor",void 0,50);const a={};let o,n;void 0!==e&&(o=this.market(e),a.symbol=o.id),[n,s]=this.getBybitType("fetchCanceledAndClosedOrders",o,s),a.category=n;const d=this.safeBoolN(s,["trigger","stop"],!1);s=this.omit(s,["trigger","stop"]),d&&(a.orderFilter="StopOrder"),void 0!==i&&(a.limit=i),void 0!==t&&(a.startTime=t);const h=this.safeInteger(s,"until"),c=this.safeInteger(s,"endTime",h);s=this.omit(s,["endTime","until"]),void 0!==c&&(a.endTime=c);const l=await this.privateGetV5OrderHistory(this.extend(a,s)),u=this.addPaginationCursorToResult(l);return this.parseOrders(u,o,t,i)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();return await this.fetchCanceledAndClosedOrders(e,t,i,this.extend({orderStatus:"Filled"},s))}async fetchCanceledOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();return await this.fetchCanceledAndClosedOrders(e,t,i,this.extend({orderStatus:"Cancelled"},s))}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchOpenOrders","paginate"),r)return await this.fetchPaginatedCallCursor("fetchOpenOrders",e,t,i,s,"nextPageCursor","cursor",void 0,50);const a={};let o,n;if(void 0!==e&&(o=this.market(e),a.symbol=o.id),[n,s]=this.getBybitType("fetchOpenOrders",o,s),"linear"===n||"inverse"===n){const t=this.safeString(s,"baseCoin");if(void 0===e&&void 0===t){const e=this.safeString(this.options,"defaultSettle","USDT"),t=this.safeString(s,"settleCoin",e);a.settleCoin=t}}a.category=n;const d=this.safeBool2(s,"stop","trigger",!1);s=this.omit(s,["stop","trigger"]),d&&(a.orderFilter="StopOrder"),void 0!==i&&(a.limit=i);const h=await this.privateGetV5OrderRealtime(this.extend(a,s)),c=this.addPaginationCursorToResult(h);return this.parseOrders(c,o,t,i)}async fetchOrderTrades(e,t=void 0,i=void 0,s=void 0,r={}){const a={},o=this.safeString2(r,"clientOrderId","orderLinkId");return void 0!==o?a.orderLinkId=o:a.orderId=e,r=this.omit(r,["clientOrderId","orderLinkId"]),await this.fetchMyTrades(t,i,s,this.extend(a,r))}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchMyTrades","paginate"),r)return await this.fetchPaginatedCallCursor("fetchMyTrades",e,t,i,s,"nextPageCursor","cursor",void 0,100);let a,o,n={execType:"Trade"};void 0!==e&&(a=this.market(e),n.symbol=a.id),[o,s]=this.getBybitType("fetchMyTrades",a,s),n.category=o,void 0!==i&&(n.limit=i),void 0!==t&&(n.startTime=t),[n,s]=this.handleUntilOption("endTime",n,s);const d=await this.privateGetV5ExecutionList(this.extend(n,s)),h=this.addPaginationCursorToResult(d);return this.parseTrades(h,a,t,i)}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"addressDeposit"),s=this.safeString(e,"tagDeposit"),r=this.safeString(t,"code");return this.checkAddress(i),{info:e,currency:r,network:this.networkIdToCode(this.safeString(e,"chain"),r),address:i,tag:s}}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();let i=this.currency(e);const s={coin:i.id};let r;[r,t]=this.handleNetworkCodeAndParams(t),void 0!==r&&(s.chainType=this.networkCodeToId(r,e));const a=await this.privateGetV5AssetDepositQueryAddress(this.extend(s,t)),o=this.safeDict(a,"result",{}),n=this.safeList(o,"chains",[]),d=this.safeString(o,"coin");i=this.currency(d);const h=this.parseDepositAddresses(n,[i.code],!1,{currency:i.code});return this.indexBy(h,"network")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e),[s,r]=this.handleNetworkCodeAndParams(t),a=await this.fetchDepositAddressesByNetwork(e,r);return a[this.selectNetworkCodeFromUnifiedNetworks(i.code,s,a)]}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchDeposits","paginate"),r)return await this.fetchPaginatedCallCursor("fetchDeposits",e,t,i,s,"nextPageCursor","cursor",void 0,50);let a,o={};void 0!==e&&(a=this.currency(e),o.coin=a.id),void 0!==t&&(o.startTime=t),void 0!==i&&(o.limit=i),[o,s]=this.handleUntilOption("endTime",o,s);const n=await this.privateGetV5AssetDepositQueryRecord(this.extend(o,s)),d=this.addPaginationCursorToResult(n);return this.parseTransactions(d,a,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchWithdrawals","paginate"),r)return await this.fetchPaginatedCallCursor("fetchWithdrawals",e,t,i,s,"nextPageCursor","cursor",void 0,50);let a,o={};void 0!==e&&(a=this.currency(e),o.coin=a.id),void 0!==t&&(o.startTime=t),void 0!==i&&(o.limit=i),[o,s]=this.handleUntilOption("endTime",o,s);const n=await this.privateGetV5AssetWithdrawQueryRecord(this.extend(o,s)),d=this.addPaginationCursorToResult(n);return this.parseTransactions(d,a,t,i)}parseTransactionStatus(e){return this.safeString({0:"unknown",1:"pending",2:"processing",3:"ok",4:"fail",SecurityCheck:"pending",Pending:"pending",success:"ok",CancelByUser:"canceled",Reject:"rejected",Fail:"failed",BlockchainConfirmed:"ok"},e,e)}parseTransaction(e,t=void 0){const i=this.safeString(e,"coin"),s=this.safeCurrencyCode(i,t),r=this.safeInteger2(e,"createTime","successAt"),a=this.safeInteger(e,"updateTime"),o=this.parseTransactionStatus(this.safeString(e,"status")),n=this.safeNumber2(e,"depositFee","withdrawFee"),d="depositFee"in e?"deposit":"withdrawal";let h;void 0!==n&&(h={cost:n,currency:s});const c=this.safeString(e,"toAddress");return{info:e,id:this.safeString2(e,"id","withdrawId"),txid:this.safeString(e,"txID"),timestamp:r,datetime:this.iso8601(r),network:this.networkIdToCode(this.safeString(e,"chain")),address:void 0,addressTo:c,addressFrom:void 0,tag:this.safeString(e,"tag"),tagTo:void 0,tagFrom:void 0,type:d,amount:this.safeNumber(e,"amount"),currency:s,status:o,updated:a,fee:h,internal:void 0,comment:void 0}}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchLedger","paginate"),r)return await this.fetchPaginatedCallCursor("fetchLedger",e,t,i,s,"nextPageCursor","cursor",void 0,50);const a={},o=await this.isUnifiedEnabled();let n,d,h,c="coin";if(o[1]?(c="currency",void 0!==t&&(a.startTime=t)):void 0!==t&&(a.start_date=this.yyyymmdd(t)),void 0!==e&&(n=this.currency(e),a[c]=n.id),void 0!==i&&(a.limit=i),[d,s]=this.handleSubTypeAndParams("fetchLedger",void 0,s),o[1]){const e=this.safeInteger(this.options,"unifiedMarginStatus",5);h="inverse"===d&&e<5?await this.privateGetV5AccountContractTransactionLog(this.extend(a,s)):await this.privateGetV5AccountTransactionLog(this.extend(a,s))}else h=await this.privateGetV5AccountContractTransactionLog(this.extend(a,s));const l=this.addPaginationCursorToResult(h);return this.parseLedger(l,n,t,i)}parseLedgerEntry(e,t=void 0){const i=this.safeString2(e,"coin","currency"),s=this.safeCurrencyCode(i,t);t=this.safeCurrency(i,t);const r=this.safeString2(e,"amount","change"),a=this.safeString2(e,"wallet_balance","cashBalance"),n=o.Y.stringLt(r,"0")?"out":"in";let d,h,c;if(void 0!==a&&void 0!==r){const e="out"===n?r:o.Y.stringNeg(r);d=this.parseToNumeric(o.Y.stringAdd(a,e)),h=this.parseToNumeric(a),c=this.parseToNumeric(o.Y.stringAbs(r))}let l=this.parse8601(this.safeString(e,"exec_time"));return void 0===l&&(l=this.safeInteger(e,"transactionTime")),this.safeLedgerEntry({info:e,id:this.safeString(e,"id"),direction:n,account:this.safeString(e,"wallet_id"),referenceId:this.safeString(e,"tx_id"),referenceAccount:void 0,type:this.parseLedgerEntryType(this.safeString(e,"type")),currency:s,amount:c,timestamp:l,datetime:this.iso8601(l),before:d,after:h,status:"ok",fee:{currency:s,cost:this.safeNumber(e,"fee")}},t)}parseLedgerEntryType(e){return this.safeString({Deposit:"transaction",Withdraw:"transaction",RealisedPNL:"trade",Commission:"fee",Refund:"cashback",Prize:"prize",ExchangeOrderWithdraw:"transaction",ExchangeOrderDeposit:"transaction",TRANSFER_IN:"transaction",TRANSFER_OUT:"transaction",TRADE:"trade",SETTLEMENT:"trade",DELIVERY:"trade",LIQUIDATION:"trade",BONUS:"Prize",FEE_REFUND:"cashback",INTEREST:"transaction",CURRENCY_BUY:"trade",CURRENCY_SELL:"trade"},e,e)}async withdraw(e,t,i,s=void 0,r={}){let a;[s,r]=this.handleWithdrawTagAndParams(s,r),[a,r]=this.handleOptionAndParams(r,"withdraw","accountType","SPOT"),await this.loadMarkets(),this.checkAddress(i);const o=this.currency(e),n={coin:o.id,amount:this.numberToString(t),address:i,timestamp:this.milliseconds(),accountType:a};void 0!==s&&(n.tag=s);const[d,h]=this.handleNetworkCodeAndParams(r),c=this.networkCodeToId(d);void 0!==c&&(n.chain=c.toUpperCase());const l=await this.privatePostV5AssetWithdrawCreate(this.extend(n,h)),u=this.safeDict(l,"result",{});return this.parseTransaction(u,o)}async fetchPosition(e,t={}){if(void 0===e)throw new a.ArgumentsRequired(this.id+" fetchPosition() requires a symbol argument");await this.loadMarkets();const i=this.market(e),s={symbol:i.id};let r,o;[o,t]=this.getBybitType("fetchPosition",i,t),s.category=o,r=await this.privateGetV5PositionList(this.extend(s,t));const n=this.safeDict(r,"result",{}),d=this.safeList2(n,"list","dataList",[]),h=this.safeInteger(r,"time"),c=this.safeDict(d,0,{}),l=this.parsePosition(c,i);return l.timestamp=h,l.datetime=this.iso8601(h),l}async fetchPositions(e=void 0,t={}){await this.loadMarkets();let i,s=!1;if([s,t]=this.handleOptionAndParams(t,"fetchPositions","paginate"),s)return await this.fetchPaginatedCallCursor("fetchPositions",e,void 0,void 0,t,"nextPageCursor","cursor",void 0,200);if(void 0!==e&&Array.isArray(e)){const t=e.length;if(t>1)throw new a.ArgumentsRequired(this.id+" fetchPositions() does not accept an array with more than one symbol");1===t&&(i=e[0]),e=this.marketSymbols(e)}else void 0!==e&&(i=e,e=[this.symbol(i)]);const r={};let o,n;if(void 0!==i&&(o=this.market(i),i=o.symbol,r.symbol=o.id),[n,t]=this.getBybitType("fetchPositions",o,t),"linear"===n||"inverse"===n){const e=this.safeString(t,"baseCoin");if("linear"===n){if(void 0===i&&void 0===e){const e=this.safeString(this.options,"defaultSettle","USDT"),i=this.safeString(t,"settleCoin",e);r.settleCoin=i}}else void 0===i&&void 0===e&&(r.category="inverse")}void 0===this.safeInteger(t,"limit")&&(r.limit=200),t=this.omit(t,["type"]),r.category=n;const d=await this.privateGetV5PositionList(this.extend(r,t)),h=this.addPaginationCursorToResult(d),c=[];for(let e=0;e0&&(r=this.market(e[0])));const n=this.safeInteger(s,"until");[a,s]=this.handleSubTypeAndParams("fetchPositionsHistory",r,s,"linear"),s=this.omit(s,"until");const d={category:a};void 0!==e&&1===o&&(d.symbol=r.id),void 0!==t&&(d.startTime=t),void 0!==i&&(d.limit=i),void 0!==n&&(d.endTime=n);const h=await this.privateGetV5PositionClosedPnl(this.extend(d,s)),c=this.safeDict(h,"result"),l=this.safeList(c,"list"),u=this.parsePositions(l,e,s);return this.filterBySinceLimit(u,t,i)}async fetchConvertCurrencies(e={}){let t;await this.loadMarkets();const[i,s]=await this.isUnifiedEnabled(),r=i||s?"eb_convert_uta":"eb_convert_spot";[t,e]=this.handleOptionAndParams(e,"fetchConvertCurrencies","accountType",r);const a={accountType:t},o=await this.privateGetV5AssetExchangeQueryCoinList(this.extend(a,e)),n={},d=this.safeDict(o,"result",{}),h=this.safeList(d,"coins",[]);for(let e=0;e=0,t=o.indexOf("unified/v3")>=0,h=o.indexOf("contract/v3")>=0,c=o.indexOf("v5")>=0,l=this.nonce().toString();if(e){a=Object.keys(s).length?this.json(s):"{}";const e=l+this.apiKey+a,t=this.hmac(this.encode(e),this.encode(this.secret),n.s,"hex");r={"Content-Type":"application/json","X-BAPI-API-KEY":this.apiKey,"X-BAPI-TIMESTAMP":l,"X-BAPI-SIGN":t}}else if(t||h||c){r={"Content-Type":"application/json","X-BAPI-API-KEY":this.apiKey,"X-BAPI-TIMESTAMP":l,"X-BAPI-RECV-WINDOW":this.options.recvWindow.toString()},(t||h)&&(r["X-BAPI-SIGN-TYPE"]="2");const e=this.extend({},s),c=this.rawencode(e),u=l.toString()+this.apiKey+this.options.recvWindow.toString();let f,p;"POST"===i?f=u+(a=this.json(e)):(f=u+c,o+="?"+this.rawencode(e)),p=this.secret.indexOf("PRIVATE KEY")>-1?(0,d.n)(f,this.secret,n.s):this.hmac(this.encode(f),this.encode(this.secret),n.s),r["X-BAPI-SIGN"]=p}else{const e=this.extend(s,{api_key:this.apiKey,recv_window:this.options.recvWindow,timestamp:l}),t=this.keysort(e),h=this.rawencode(t);let c;if(c=this.secret.indexOf("PRIVATE KEY")>-1?(0,d.n)(h,this.secret,n.s):this.hmac(this.encode(h),this.encode(this.secret),n.s),"POST"===i){const t=o.indexOf("spot")>=0,i=this.extend(e,{sign:c});t?(a=this.urlencode(i),r={"Content-Type":"application/x-www-form-urlencoded"}):(a=this.json(i),r={"Content-Type":"application/json"})}else o+="?"+this.rawencode(t),o+="&sign="+c}}if("POST"===i){const e=this.safeString(this.options,"brokerId");void 0!==e&&(r.Referer=e)}return{url:o,method:i,body:a,headers:r}}handleErrors(e,t,i,s,r,o,n,d,h){if(!n)return;const c=this.safeString2(n,"ret_code","retCode");if("0"!==c){if("30084"===c)return;let e;throw e="10005"===c&&i.indexOf("order")<0?this.id+' private api uses /user/v3/private/query-api to check if you have a unified account. The API key of user id must own one of permissions: "Account Transfer", "Subaccount Transfer", "Withdrawal" '+o:this.id+" "+o,o.indexOf("Withdraw address chain or destination tag are not equal")>-1&&(e+="; You might also need to ensure the address is whitelisted"),this.throwBroadlyMatchedException(this.exceptions.broad,o,e),this.throwExactlyMatchedException(this.exceptions.exact,c,e),new a.ExchangeError(e)}}}},8846:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(5465),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"cex",name:"CEX.IO",countries:["GB","EU","CY","RU"],rateLimit:300,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,createReduceOnlyOrder:!1,createStopOrder:!0,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrder:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchLedger:!0,fetchMarkets:!0,fetchOHLCV:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrderBook:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFees:!0,transfer:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg",api:{public:"https://trade.cex.io/api/spot/rest-public",private:"https://trade.cex.io/api/spot/rest"},www:"https://cex.io",doc:"https://trade.cex.io/docs/",fees:["https://cex.io/fee-schedule","https://cex.io/limits-commissions"],referral:"https://cex.io/r/0/up105393824/0/"},api:{public:{get:{},post:{get_server_time:1,get_pairs_info:1,get_currencies_info:1,get_processing_info:10,get_ticker:1,get_trade_history:1,get_order_book:1,get_candles:1}},private:{get:{},post:{get_my_current_fee:5,get_fee_strategy:1,get_my_volume:5,do_create_account:1,get_my_account_status_v3:5,get_my_wallet_balance:5,get_my_orders:5,do_my_new_order:1,do_cancel_my_order:1,do_cancel_all_orders:5,get_order_book:1,get_candles:1,get_trade_history:1,get_my_transaction_history:1,get_my_funding_history:5,do_my_internal_transfer:1,get_processing_info:10,get_deposit_address:5,do_deposit_funds_from_wallet:1,do_withdrawal_funds_to_wallet:1}}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!1,GTD:!0},hedged:!1,leverage:!1,marketBuyRequiresPrice:!1,marketBuyByCost:!0,selfTradePrevention:!1,trailing:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:void 0,fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{},broad:{"You have negative balance on following accounts":r.InsufficientFunds,"Mandatory parameter side should be one of BUY,SELL":r.BadRequest,"API orders from Main account are not allowed":r.BadRequest,"check failed":r.BadRequest,"Insufficient funds":r.InsufficientFunds,"Get deposit address for main account is not allowed":r.PermissionDenied,"Market Trigger orders are not allowed":r.BadRequest,"key not passed or incorrect":r.AuthenticationError}},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","1d":"1d"},options:{networks:{BTC:"bitcoin",ERC20:"ERC20",BSC20:"binancesmartchain",DOGE:"dogecoin",ALGO:"algorand",XLM:"stellar",ATOM:"cosmos",LTC:"litecoin",XRP:"ripple",FTM:"fantom",MINA:"mina",THETA:"theta",XTZ:"tezos",TIA:"celestia",CRONOS:"cronos",MATIC:"polygon",TON:"ton",TRC20:"tron",SOLANA:"solana",SGB:"songbird",DYDX:"dydx",DASH:"dash",ZIL:"zilliqa",EOS:"eos",AVALANCHEC:"avalanche",ETHPOW:"ethereumpow",NEAR:"near",ARB:"arbitrum",DOT:"polkadot",OPT:"optimism",INJ:"injective",ADA:"cardano",ONT:"ontology",ICP:"icp",KAVA:"kava",KSM:"kusama",SEI:"sei",NEO:"neo",NEO3:"neo3",XDC:"xdc"}}})}async fetchCurrencies(e={}){const t=[];t.push(this.publicPostGetCurrenciesInfo(e)),t.push(this.publicPostGetProcessingInfo(e));const i=await Promise.all(t),s=this.safeList(i[0],"data",[]),r=this.safeDict(i[1],"data",{}),a=this.indexBy(s,"currency"),o=this.deepExtend(a,r);return this.parseCurrencies(this.toArray(o))}parseCurrency(e){const t=this.safeString(e,"currency"),i=this.safeCurrencyCode(t),s=this.safeBool(e,"fiat")?"fiat":"crypto",r=this.parseNumber(this.parsePrecision(this.safeString(e,"precision"))),a={},o=this.safeDict(e,"blockchains",{}),n=Object.keys(o);for(let e=0;e=0){const e=this.safeDict(n,"data",{}),t=this.safeString(e,"rejectReason");if(void 0!==t)throw this.throwBroadlyMatchedException(this.exceptions.broad,t,t),new r.ExchangeError(this.id+" createOrder() "+t)}}}},7504:(e,t,i)=>{i.d(t,{A:()=>h});var s=i(5661),r=i(2079),a=i(5147),o=i(1579),n=i(4852),d=i(5354);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinbase",name:"Coinbase Advanced",countries:["US"],pro:!0,certified:!1,rateLimit:34,version:"v2",userAgent:this.userAgents.chrome,headers:{"CB-VERSION":"2018-05-30"},has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createConvertTrade:!0,createDepositAddress:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrder:!0,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,deposit:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchConvertQuote:!0,fetchConvertTrade:!0,fetchConvertTradeHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:"emulated",fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDepositMethodId:!0,fetchDepositMethodIds:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyBuys:!0,fetchMySells:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:"emulated",fetchTradingFees:!0,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg",api:{rest:"https://api.coinbase.com"},www:"https://www.coinbase.com",doc:["https://developers.coinbase.com/api/v2","https://docs.cloud.coinbase.com/advanced-trade/docs/welcome"],fees:["https://support.coinbase.com/customer/portal/articles/2109597-buy-sell-bank-transfer-fees","https://www.coinbase.com/advanced-fees"],referral:"https://www.coinbase.com/join/58cbe25a355148797479dbd2"},requiredCredentials:{apiKey:!0,secret:!0},api:{v2:{public:{get:{currencies:10.6,"currencies/crypto":10.6,time:10.6,"exchange-rates":10.6,"users/{user_id}":10.6,"prices/{symbol}/buy":10.6,"prices/{symbol}/sell":10.6,"prices/{symbol}/spot":10.6}},private:{get:{accounts:10.6,"accounts/{account_id}":10.6,"accounts/{account_id}/addresses":10.6,"accounts/{account_id}/addresses/{address_id}":10.6,"accounts/{account_id}/addresses/{address_id}/transactions":10.6,"accounts/{account_id}/transactions":10.6,"accounts/{account_id}/transactions/{transaction_id}":10.6,"accounts/{account_id}/buys":10.6,"accounts/{account_id}/buys/{buy_id}":10.6,"accounts/{account_id}/sells":10.6,"accounts/{account_id}/sells/{sell_id}":10.6,"accounts/{account_id}/deposits":10.6,"accounts/{account_id}/deposits/{deposit_id}":10.6,"accounts/{account_id}/withdrawals":10.6,"accounts/{account_id}/withdrawals/{withdrawal_id}":10.6,"payment-methods":10.6,"payment-methods/{payment_method_id}":10.6,user:10.6,"user/auth":10.6},post:{accounts:10.6,"accounts/{account_id}/primary":10.6,"accounts/{account_id}/addresses":10.6,"accounts/{account_id}/transactions":10.6,"accounts/{account_id}/transactions/{transaction_id}/complete":10.6,"accounts/{account_id}/transactions/{transaction_id}/resend":10.6,"accounts/{account_id}/buys":10.6,"accounts/{account_id}/buys/{buy_id}/commit":10.6,"accounts/{account_id}/sells":10.6,"accounts/{account_id}/sells/{sell_id}/commit":10.6,"accounts/{account_id}/deposits":10.6,"accounts/{account_id}/deposits/{deposit_id}/commit":10.6,"accounts/{account_id}/withdrawals":10.6,"accounts/{account_id}/withdrawals/{withdrawal_id}/commit":10.6},put:{"accounts/{account_id}":10.6,user:10.6},delete:{"accounts/{id}":10.6,"accounts/{account_id}/transactions/{transaction_id}":10.6}}},v3:{public:{get:{"brokerage/time":3,"brokerage/market/product_book":3,"brokerage/market/products":3,"brokerage/market/products/{product_id}":3,"brokerage/market/products/{product_id}/candles":3,"brokerage/market/products/{product_id}/ticker":3}},private:{get:{"brokerage/accounts":1,"brokerage/accounts/{account_uuid}":1,"brokerage/orders/historical/batch":1,"brokerage/orders/historical/fills":1,"brokerage/orders/historical/{order_id}":1,"brokerage/products":3,"brokerage/products/{product_id}":3,"brokerage/products/{product_id}/candles":3,"brokerage/products/{product_id}/ticker":3,"brokerage/best_bid_ask":3,"brokerage/product_book":3,"brokerage/transaction_summary":3,"brokerage/portfolios":1,"brokerage/portfolios/{portfolio_uuid}":1,"brokerage/convert/trade/{trade_id}":1,"brokerage/cfm/balance_summary":1,"brokerage/cfm/positions":1,"brokerage/cfm/positions/{product_id}":1,"brokerage/cfm/sweeps":1,"brokerage/intx/portfolio/{portfolio_uuid}":1,"brokerage/intx/positions/{portfolio_uuid}":1,"brokerage/intx/positions/{portfolio_uuid}/{symbol}":1,"brokerage/payment_methods":1,"brokerage/payment_methods/{payment_method_id}":1},post:{"brokerage/orders":1,"brokerage/orders/batch_cancel":1,"brokerage/orders/edit":1,"brokerage/orders/edit_preview":1,"brokerage/orders/preview":1,"brokerage/portfolios":1,"brokerage/portfolios/move_funds":1,"brokerage/convert/quote":1,"brokerage/convert/trade/{trade_id}":1,"brokerage/cfm/sweeps/schedule":1,"brokerage/intx/allocate":1,"brokerage/orders/close_position":1},put:{"brokerage/portfolios/{portfolio_uuid}":1},delete:{"brokerage/portfolios/{portfolio_uuid}":1,"brokerage/cfm/sweeps":1}}}},fees:{trading:{taker:this.parseNumber("0.012"),maker:this.parseNumber("0.006"),tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.006")],[this.parseNumber("10000"),this.parseNumber("0.004")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("15000000"),this.parseNumber("0.0016")],[this.parseNumber("75000000"),this.parseNumber("0.0012")],[this.parseNumber("250000000"),this.parseNumber("0.0008")],[this.parseNumber("400000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.0025")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.001")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("15000000"),this.parseNumber("0.0006")],[this.parseNumber("75000000"),this.parseNumber("0.0003")],[this.parseNumber("250000000"),this.parseNumber("0.0")],[this.parseNumber("400000000"),this.parseNumber("0.0")]]}}},precisionMode:o.kb,exceptions:{exact:{two_factor_required:r.AuthenticationError,param_required:r.ExchangeError,validation_error:r.ExchangeError,invalid_request:r.ExchangeError,personal_details_required:r.AuthenticationError,identity_verification_required:r.AuthenticationError,jumio_verification_required:r.AuthenticationError,jumio_face_match_verification_required:r.AuthenticationError,unverified_email:r.AuthenticationError,authentication_error:r.AuthenticationError,invalid_authentication_method:r.AuthenticationError,invalid_token:r.AuthenticationError,revoked_token:r.AuthenticationError,expired_token:r.AuthenticationError,invalid_scope:r.AuthenticationError,not_found:r.ExchangeError,rate_limit_exceeded:r.RateLimitExceeded,internal_server_error:r.ExchangeError,UNSUPPORTED_ORDER_CONFIGURATION:r.BadRequest,INSUFFICIENT_FUND:r.BadRequest,PERMISSION_DENIED:r.PermissionDenied,INVALID_ARGUMENT:r.BadRequest,PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE:r.InvalidOrder},broad:{"request timestamp expired":r.InvalidNonce,"order with this orderID was not found":r.OrderNotFound}},timeframes:{"1m":"ONE_MINUTE","5m":"FIVE_MINUTE","15m":"FIFTEEN_MINUTE","30m":"THIRTY_MINUTE","1h":"ONE_HOUR","2h":"TWO_HOUR","6h":"SIX_HOUR","1d":"ONE_DAY"},commonCurrencies:{CGLD:"CELO"},options:{usePrivate:!1,brokerId:"ccxt",stablePairs:["BUSD-USD","CBETH-ETH","DAI-USD","GUSD-USD","GYEN-USD","PAX-USD","PAX-USDT","USDC-EUR","USDC-GBP","USDT-EUR","USDT-GBP","USDT-USD","USDT-USDC","WBTC-BTC"],fetchCurrencies:{expires:5e3},accounts:["wallet","fiat"],v3Accounts:["ACCOUNT_TYPE_CRYPTO","ACCOUNT_TYPE_FIAT"],networks:{ERC20:"ethereum",XLM:"stellar"},createMarketBuyOrderRequiresPrice:!0,advanced:!0,fetchMarkets:"fetchMarketsV3",timeDifference:0,adjustForTimeDifference:!1,fetchTicker:"fetchTickerV3",fetchTickers:"fetchTickersV3",fetchAccounts:"fetchAccountsV3",fetchBalance:"v2PrivateGetAccounts",fetchTime:"v2PublicGetTime",user_native_currency:"USD"},features:{default:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,trailing:!1,leverage:!0,marketBuyByCost:!0,marketBuyRequiresPrice:!0,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:3e3,daysBack:void 0,untilDays:1e4,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:1e4,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:void 0,daysBack:void 0,daysBackCanceled:void 0,untilDays:1e4,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:300}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:void 0},future:{linear:{extends:"default"},inverse:void 0}}})}async fetchTime(e={}){const t=this.safeString(this.options,"fetchTime","v2PublicGetTime"),i=this.safeString(e,"method",t);let s;return e=this.omit(e,"method"),"v2PublicGetTime"===i?(s=await this.v2PublicGetTime(e),s=this.safeDict(s,"data",{})):s=await this.v3PublicGetBrokerageTime(e),this.safeTimestamp2(s,"epoch","epochSeconds")}async fetchAccounts(e={}){return"fetchAccountsV3"===this.safeString(this.options,"fetchAccounts","fetchAccountsV3")?await this.fetchAccountsV3(e):await this.fetchAccountsV2(e)}async fetchAccountsV2(e={}){await this.loadMarkets();let t=!1;if([t,e]=this.handleOptionAndParams(e,"fetchAccounts","paginate"),t)return await this.fetchPaginatedCallCursor("fetchAccounts",void 0,void 0,void 0,e,"next_starting_after","starting_after",void 0,100);const i=await this.v2PrivateGetAccounts(this.extend({limit:100},e)),s=this.safeList(i,"data",[]),r=this.safeDict(i,"pagination",{}),a=this.safeString(r,"next_starting_after"),o=this.safeList(i,"data",[]),n=o.length-1,d=this.safeDict(o,n);return void 0!==a&&""!==a&&(d.next_starting_after=a,o[n]=d),this.parseAccounts(s,e)}async fetchAccountsV3(e={}){await this.loadMarkets();let t=!1;if([t,e]=this.handleOptionAndParams(e,"fetchAccounts","paginate"),t)return await this.fetchPaginatedCallCursor("fetchAccounts",void 0,void 0,void 0,e,"cursor","cursor",void 0,250);const i=await this.v3PrivateGetBrokerageAccounts(this.extend({limit:250},e)),s=this.safeList(i,"accounts",[]),r=s.length-1,a=this.safeDict(s,r),o=this.safeString(i,"cursor");return void 0!==o&&""!==o&&(a.cursor=o,s[r]=a),this.parseAccounts(s,e)}async fetchPortfolios(e={}){const t=await this.v3PrivateGetBrokeragePortfolios(e),i=this.safeList(t,"portfolios",[]),s=[];for(let e=0;e0?s[0]:void 0,w.push(t)}return w}parseSpotMarket(e,t){const i=this.safeString(e,"product_id"),s=this.safeString(e,"base_currency_id"),r=this.safeString(e,"quote_currency_id"),a=this.safeCurrencyCode(s),o=this.safeCurrencyCode(r),n=this.safeStringLower(e,"product_type"),d=this.safeBool(e,"trading_disabled"),h=this.safeList(this.options,"stablePairs",[]),c=this.safeNumber(this.fees.trading,"taker"),l=this.safeNumber(this.fees.trading,"maker"),u=this.inArray(i,h)?1e-5:this.safeNumber(t,"taker_fee_rate",c),f=this.inArray(i,h)?0:this.safeNumber(t,"maker_fee_rate",l);return this.safeMarketStructure({id:i,symbol:a+"/"+o,base:a,quote:o,settle:void 0,baseId:s,quoteId:r,settleId:void 0,type:n,spot:"spot"===n,margin:void 0,swap:!1,future:!1,option:!1,active:!d,contract:!1,linear:void 0,inverse:void 0,taker:u,maker:f,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(e,"base_increment"),price:this.safeNumber2(e,"price_increment","quote_increment")},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.safeNumber(e,"base_min_size"),max:this.safeNumber(e,"base_max_size")},price:{min:void 0,max:void 0},cost:{min:this.safeNumber(e,"quote_min_size"),max:this.safeNumber(e,"quote_max_size")}},created:void 0,info:e})}parseContractMarket(e,t){const i=this.safeString(e,"product_id"),s=this.safeDict(e,"future_product_details",{}),r=this.safeString(s,"contract_expiry_type"),a=this.safeNumber(s,"contract_size"),o=this.safeString(s,"contract_expiry"),n=this.parse8601(o),d=this.iso8601(n),h="PERPETUAL"===r,c=this.safeString(s,"contract_root_unit"),l=this.safeString(e,"quote_currency_id"),u=this.safeCurrencyCode(c),f=this.safeCurrencyCode(l),p=this.safeBool(e,"is_disabled");let m,g=u+"/"+f;h?(m="swap",g=g+":"+f):(m="future",g=g+":"+f+"-"+this.yymmdd(n));const v=this.safeNumber(t,"taker_fee_rate"),y=this.safeNumber(t,"maker_fee_rate"),w=v||this.parseNumber("0.06"),b=y||this.parseNumber("0.04");return this.safeMarketStructure({id:i,symbol:g,base:u,quote:f,settle:f,baseId:c,quoteId:l,settleId:l,type:m,spot:!1,margin:!1,swap:h,future:!h,option:!1,active:!p,contract:!0,linear:!0,inverse:!1,taker:w,maker:b,contractSize:a,expiry:n,expiryDatetime:d,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(e,"base_increment"),price:this.safeNumber2(e,"price_increment","quote_increment")},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.safeNumber(e,"base_min_size"),max:this.safeNumber(e,"base_max_size")},price:{min:void 0,max:void 0},cost:{min:this.safeNumber(e,"quote_min_size"),max:this.safeNumber(e,"quote_max_size")}},created:void 0,info:e})}async fetchCurrenciesFromCache(e={}){const t=this.safeDict(this.options,"fetchCurrencies",{}),i=this.safeInteger(t,"timestamp"),s=this.safeInteger(t,"expires",1e3),r=this.milliseconds();if(void 0===i||r-i>s){const i=[this.v2PublicGetCurrencies(e),this.v2PublicGetCurrenciesCrypto(e)],s=await Promise.all(i),a=this.safeDict(s,0,{}),o=this.safeDict(s,1,{}),n=this.safeList(a,"data",[]),d=this.safeList(o,"data",[]),h=await this.v2PublicGetExchangeRates(e);this.options.fetchCurrencies=this.extend(t,{currencies:this.arrayConcat(n,d),exchangeRates:h,timestamp:r})}return this.safeDict(this.options,"fetchCurrencies",{})}async fetchCurrencies(e={}){const t=[this.v2PublicGetCurrencies(e),this.v2PublicGetCurrenciesCrypto(e),this.v2PublicGetExchangeRates(e)],i=await Promise.all(t),s=this.safeDict(i,0,{}),r=this.safeDict(i,1,{}),a=this.safeDict(i,2,{}),o=this.safeList(s,"data",[]),n=this.safeList(r,"data",[]),d=this.safeDict(a,"data",{}),h=this.safeDict(d,"rates",{}),c=Object.keys(h),l=this.arrayConcat(o,n),u={},f={},p={};for(let e=0;e3&&(g=e[3])}return this.safeLedgerEntry({info:e,id:u,timestamp:l,datetime:this.iso8601(l),direction:s,account:g,referenceId:void 0,referenceAccount:void 0,type:f,currency:n,amount:this.parseNumber(r),before:void 0,after:void 0,status:p,fee:d},t)}async findAccountId(e,t={}){await this.loadMarkets(),await this.loadAccounts(!1,t);for(let t=0;t0?l:0,wallet_name:s,account_id:r,account_uuid:this.safeString(t,"account_uuid",""),total_balance_fiat:c,total_balance_crypto:this.parseNumber(this.safeString(t,"total_balance_crypto","0")),available_to_trade_fiat:this.parseNumber(this.safeString(t,"available_to_trade_fiat","0")),available_to_trade_crypto:this.parseNumber(this.safeString(t,"available_to_trade_crypto","0")),available_to_transfer_fiat:this.parseNumber(this.safeString(t,"available_to_transfer_fiat","0")),available_to_transfer_crypto:this.parseNumber(this.safeString(t,"available_to_trade_crypto","0")),allocation:this.parseNumber(this.safeString(t,"allocation","0")),cost_basis:this.parseNumber(f),cost_basis_currency:this.safeString(u,"currency","USD"),is_cash:this.safeBool(t,"is_cash",!1),average_entry_price:this.parseNumber(m),average_entry_price_currency:this.safeString(p,"currency","USD"),asset_uuid:this.safeString(t,"asset_uuid",""),unrealized_pnl:this.parseNumber(this.safeString(t,"unrealized_pnl","0")),asset_color:this.safeString(t,"asset_color",""),account_type:this.safeString(t,"account_type","")};o.push(g)}return o}createAuthToken(e,t=void 0,i=void 0){let s;if(void 0!==i){s=t+" "+i.replace("https://","");const e=s.indexOf("?");e>0&&(s=s.slice(0,e))}const r=this.randomBytes(16),a={aud:["retail_rest_api_proxy"],iss:"coinbase-cloud",nbf:e,exp:e+120,sub:this.apiKey,iat:e};void 0!==s&&(a.uri=s);return(0,d.a)(a,this.encode(this.secret),n.s,!1,{kid:this.apiKey,nonce:r,alg:"ES256"})}nonce(){return this.milliseconds()-this.options.timeDifference}sign(e,t=[],i="GET",s={},a=void 0,o=void 0){const d=t[0],h="private"===t[1],c="v3"===d;let l="/"+(c?"api/v3":"v2")+"/"+this.implodeParams(e,s);const u=this.omit(s,this.extractParams(e)),f=l;"GET"===i&&Object.keys(u).length&&(l+="?"+this.urlencodeWithArrayRepeat(u));const p=this.urls.api.rest+l;if(h){const e=this.safeString(this.headers,"Authorization");let t;if(void 0!==e)t=e;else if(this.token&&!this.checkRequiredCredentials(!1))t="Bearer "+this.token;else{this.checkRequiredCredentials();const e=this.seconds();let s="";"GET"!==i?Object.keys(u).length&&(s=o=this.json(u)):c||Object.keys(u).length&&(s+="?"+this.urlencode(u));if(this.apiKey.indexOf("organizations/")>=0||this.secret.startsWith("-----BEGIN")){if(this.apiKey.startsWith("-----BEGIN"))throw new r.ArgumentsRequired(this.id+" apiKey should contain the name (eg: organizations/3b910e93....) and not the public key");t="Bearer "+this.createAuthToken(e,i,p)}else{const e=this.nonce(),t=this.parseToInt(e/1e3).toString(),r=t+i+f+s,o=this.hmac(this.encode(r),this.encode(this.secret),n.s);a={"CB-ACCESS-KEY":this.apiKey,"CB-ACCESS-SIGN":o,"CB-ACCESS-TIMESTAMP":t,"Content-Type":"application/json"}}}void 0!==t&&(a={Authorization:t,"Content-Type":"application/json"},"GET"!==i&&Object.keys(u).length&&(o=this.json(u)))}return{url:p,method:i,body:o,headers:a}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.id+" "+o;let l=this.safeString(n,"error");if(void 0!==l){const e=this.safeString2(n,"error_description","error");throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,e,c),new r.ExchangeError(c)}const u=this.safeDict(n,"error_response");if(void 0!==u){const e=this.safeString2(u,"preview_failure_reason","preview_failure_reason");throw this.throwExactlyMatchedException(this.exceptions.exact,e,c),this.throwBroadlyMatchedException(this.exceptions.broad,e,c),new r.ExchangeError(c)}const f=this.safeList(n,"errors");if(void 0!==f&&Array.isArray(f)){if(f.length>0){l=this.safeString(f[0],"id");const e=this.safeString(f[0],"message");if(void 0!==l)throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,e,c),new r.ExchangeError(c)}}const p=this.options.advanced;if(!("data"in n)&&!p)throw new r.ExchangeError(this.id+" failed due to a malformed response "+this.json(n))}}},3278:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(7504);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinbaseadvanced",name:"Coinbase Advanced",alias:!0})}}},4293:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(1552),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinbaseexchange",name:"Coinbase Exchange",countries:["US"],rateLimit:100,userAgent:this.userAgents.chrome,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createDepositAddress:!0,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchLedger:!0,fetchMarginMode:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:"emulated",fetchWithdrawals:!0,withdraw:!0},timeframes:{"1m":60,"5m":300,"15m":900,"1h":3600,"6h":21600,"1d":86400},hostname:"exchange.coinbase.com",urls:{test:{public:"https://api-public.sandbox.exchange.coinbase.com",private:"https://api-public.sandbox.exchange.coinbase.com"},logo:"https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e",api:{public:"https://api.{hostname}",private:"https://api.{hostname}"},www:"https://coinbase.com/",doc:"https://docs.cloud.coinbase.com/exchange/docs/",fees:["https://docs.pro.coinbase.com/#fees","https://support.pro.coinbase.com/customer/en/portal/articles/2945310-fees"]},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{public:{get:["currencies","products","products/{id}","products/{id}/book","products/{id}/candles","products/{id}/stats","products/{id}/ticker","products/{id}/trades","time","products/spark-lines","products/volume-summary"]},private:{get:["address-book","accounts","accounts/{id}","accounts/{id}/holds","accounts/{id}/ledger","accounts/{id}/transfers","coinbase-accounts","fills","funding","fees","margin/profile_information","margin/buying_power","margin/withdrawal_power","margin/withdrawal_power_all","margin/exit_plan","margin/liquidation_history","margin/position_refresh_amounts","margin/status","oracle","orders","orders/{id}","orders/client:{client_oid}","otc/orders","payment-methods","position","profiles","profiles/{id}","reports/{report_id}","transfers","transfers/{transfer_id}","users/self/exchange-limits","users/self/hold-balances","users/self/trailing-volume","withdrawals/fee-estimate","conversions/{conversion_id}","conversions/fees"],post:["conversions","deposits/coinbase-account","deposits/payment-method","coinbase-accounts/{id}/addresses","funding/repay","orders","position/close","profiles/margin-transfer","profiles/transfer","reports","withdrawals/coinbase","withdrawals/coinbase-account","withdrawals/crypto","withdrawals/payment-method"],delete:["orders","orders/client:{client_oid}","orders/{id}"]}},commonCurrencies:{CGLD:"CELO"},precisionMode:o.kb,fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.004"),taker:this.parseNumber("0.006")},funding:{tierBased:!1,percentage:!1,withdraw:{BCH:0,BTC:0,LTC:0,ETH:0,EUR:.15,USD:25},deposit:{BCH:0,BTC:0,LTC:0,ETH:0,EUR:.15,USD:10}}},features:{default:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:300}},spot:{extends:"default"},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},options:{networks:{BTC:"bitcoin",ETH:"ethereum",SOL:"solana",ARBONE:"arbitrum",AVAXC:"avacchain",MATIC:"polygon",BASE:"base",SUI:"sui",OP:"optimism",NEAR:"near",APT:"aptos",KAVA:"kava",BLAST:"blast",XLM:"stellar",SEI:"sei",ADA:"cardano",CORE:"coredao",ALGO:"algorand",OSMO:"osmosis",CELO:"celo",HBAR:"hedera",ZKSYNC:"zksync",STX:"stacks",XTZ:"tezos",EGLD:"elrond",LTC:"litecoin",ATOM:"cosmos",FIL:"filecoin",DOT:"polkadot",DOGE:"dogecoin",XRP:"ripple",DASH:"dash"}},exceptions:{exact:{"Insufficient funds":r.InsufficientFunds,NotFound:r.OrderNotFound,"Invalid API Key":r.AuthenticationError,"invalid signature":r.AuthenticationError,"Invalid Passphrase":r.AuthenticationError,"Invalid order id":r.InvalidOrder,"Private rate limit exceeded":r.RateLimitExceeded,"Trading pair not available":r.PermissionDenied,"Product not found":r.InvalidOrder},broad:{"Order already done":r.OrderNotFound,"order not found":r.OrderNotFound,"price too small":r.InvalidOrder,"price too precise":r.InvalidOrder,"under maintenance":r.OnMaintenance,"size is too small":r.InvalidOrder,"Cancel only mode":r.OnMaintenance}}})}async fetchCurrencies(e={}){const t=await this.publicGetCurrencies(e),i={};for(let e=0;e{i.d(t,{A:()=>d});var s=i(2609),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinbaseinternational",name:"Coinbase International",countries:["US"],certified:!1,pro:!0,rateLimit:100,version:"v1",userAgent:this.userAgents.chrome,headers:{"CB-VERSION":"2018-05-30"},has:{CORS:!0,spot:!0,margin:!0,swap:!0,future:!0,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrder:!0,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposits:!0,fetchFundingHistory:!0,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyBuys:!0,fetchMySells:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!1,fetchOrders:!1,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!1,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfers:!0,fetchWithdrawals:!0,reduceMargin:!1,sandbox:!0,setLeverage:!1,setMargin:!0,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625",api:{rest:"https://api.international.coinbase.com/api"},test:{rest:"https://api-n5e1.coinbase.com/api"},www:"https://international.coinbase.com",doc:["https://docs.cloud.coinbase.com/intx/docs"],fees:["https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees"],referral:""},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{v1:{public:{get:["assets","assets/{assets}","assets/{asset}/networks","instruments","instruments/{instrument}","instruments/{instrument}/quote","instruments/{instrument}/funding","instruments/{instrument}/candles"]},private:{get:["orders","orders/{id}","portfolios","portfolios/{portfolio}","portfolios/{portfolio}/detail","portfolios/{portfolio}/summary","portfolios/{portfolio}/balances","portfolios/{portfolio}/balances/{asset}","portfolios/{portfolio}/positions","portfolios/{portfolio}/positions/{instrument}","portfolios/fills","portfolios/{portfolio}/fills","transfers","transfers/{transfer_uuid}"],post:["orders","portfolios","portfolios/margin","portfolios/transfer","transfers/withdraw","transfers/address","transfers/create-counterparty-id","transfers/validate-counterparty-id","transfers/withdraw/counterparty"],put:["orders/{id}","portfolios/{portfolio}"],delete:["orders","orders/{id}"]}}},fees:{trading:{taker:this.parseNumber("0.004"),maker:this.parseNumber("0.002"),tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("1000000"),this.parseNumber("0.004")],[this.parseNumber("5000000"),this.parseNumber("0.0035")],[this.parseNumber("10000000"),this.parseNumber("0.0035")],[this.parseNumber("50000000"),this.parseNumber("0.003")],[this.parseNumber("250000000"),this.parseNumber("0.0025")]],maker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("5000000"),this.parseNumber("0.001")],[this.parseNumber("10000000"),this.parseNumber("0.0008")],[this.parseNumber("50000000"),this.parseNumber("0.0005")],[this.parseNumber("250000000"),this.parseNumber("0")]]}}},precisionMode:o.kb,exceptions:{exact:{},broad:{DUPLICATE_CLIENT_ORDER_ID:r.DuplicateOrderId,"Order rejected":r.InvalidOrder,"market orders must be IoC":r.InvalidOrder,"tif is required":r.InvalidOrder,"Invalid replace order request":r.InvalidOrder,Unauthorized:r.PermissionDenied,"invalid result_limit":r.BadRequest,"is a required field":r.BadRequest,"Not Found":r.BadRequest,"ip not allowed":r.AuthenticationError}},timeframes:{"1m":"ONE_MINUTE","5m":"FIVE_MINUTE","15m":"FIFTEEN_MINUTE","30m":"THIRTY_MINUTE","1h":"ONE_HOUR","2h":"TWO_HOUR","6h":"SIX_HOUR","1d":"ONE_DAY"},options:{brokerId:"nfqkvdjp",portfolio:"",withdraw:{method:"v1PrivatePostTransfersWithdraw"},networksById:{ethereum:"ETH",arbitrum:"ARBITRUM",avacchain:"AVAX",optimism:"OPTIMISM",polygon:"MATIC",solana:"SOL",bitcoin:"BTC"}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0,GTC:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!0,selfTradePrevention:!0,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:1e4,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:300}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:void 0,inverse:void 0}}})}async handlePortfolioAndParams(e,t={}){let i;if([i,t]=this.handleOptionAndParams(t,e,"portfolio"),void 0!==i&&""!==i)return[i,t];const s=this.safeString(this.options,"portfolio");if(void 0!==s&&""!==s)return[s,t];const a=await this.fetchAccounts();for(let e=0;e100)throw new r.BadRequest(this.id+" fetchOpenOrders() maximum limit is 100");c.result_limit=i}void 0!==t&&(c.ref_datetime=this.iso8601(t));const u=await this.v1PrivateGetOrders(this.extend(c,s)),f=this.safeList(u,"results",[]);return this.parseOrders(f,l,t,i)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let a=!1;[a,s]=this.handleOptionAndParams(s,"fetchMyTrades","paginate");const o="ccxtPageKey";let n,d;if([n,s]=this.handleOptionAndParams(s,"fetchMyTrades","maxEntriesPerRequest",100),a)return await this.fetchPaginatedCallIncremental("fetchMyTrades",e,t,i,s,o,n);void 0!==e&&(d=this.market(e));const h=this.safeInteger(s,o,1)-1,c={result_offset:this.safeInteger2(s,"offset","result_offset",h*n)};if(void 0!==i){if(i>100)throw new r.BadRequest(this.id+" fetchMyTrades() maximum limit is 100. Consider setting paginate to true to fetch more trades.");c.result_limit=i}void 0!==t&&(c.time_from=this.iso8601(t));const l=this.safeStringN(s,["until"]);void 0!==l&&(s=this.omit(s,["until"]),c.ref_datetime=this.iso8601(l));const u=await this.v1PrivateGetPortfoliosFills(this.extend(c,s)),f=this.safeList(u,"results",[]);return this.parseTrades(f,d,t,i)}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),this.checkAddress(i),await this.loadMarkets();const a=this.currency(e);let o,n,d;[o,r]=await this.handlePortfolioAndParams("withdraw",r),[n,r]=this.handleOptionAndParams(r,"withdraw","method","v1PrivatePostTransfersWithdraw"),[d,r]=await this.handleNetworkIdAndParams(e,"withdraw",r);const h={portfolio:o,type:"send",asset:a.id,address:i,amount:t,currency:a.id,network_arn_id:d,nonce:this.nonce()},c=await this[n](this.extend(h,r));return this.parseTransaction(c,a)}safeNetwork(e){let t=this.safeBool(e,"withdraw"),i=this.safeBool(e,"deposit");const s=this.safeDict(e,"limits"),r=this.safeDict(s,"withdraw"),a=this.safeNumber(r,"max"),o=this.safeDict(s,"deposit"),n=this.safeNumber(o,"max");void 0===t&&void 0!==a&&(t=a>0),void 0===i&&void 0!==n&&(i=n>0);const d=this.safeString(e,"id"),h=t&&i;return{info:e.info,id:d,name:this.safeString(e,"name"),network:this.safeString(e,"network"),active:this.safeBool(e,"active",h),deposit:i,withdraw:t,fee:this.safeNumber(e,"fee"),precision:this.safeNumber(e,"precision"),limits:{withdraw:{min:this.safeNumber(r,"min"),max:a},deposit:{min:this.safeNumber(o,"min"),max:n}}}}sign(e,t=[],i="GET",s={},r=void 0,a=void 0){const o=t[0],d="private"===t[1];let h="/"+o+"/"+this.implodeParams(e,s);const c=this.omit(s,this.extractParams(e)),l="/api"+h;"GET"!==i&&"DELETE"!==i||Object.keys(c).length&&(h+="?"+this.urlencodeWithArrayRepeat(c));const u=this.urls.api.rest+h;if(d){this.checkRequiredCredentials();const e=this.nonce().toString();let t="";"GET"!==i&&Object.keys(c).length&&(t=a=this.json(c));const s=e+i+l+t;r={"CB-ACCESS-TIMESTAMP":e,"CB-ACCESS-SIGN":this.hmac(this.encode(s),this.base64ToBinary(this.secret),n.s,"base64"),"CB-ACCESS-PASSPHRASE":this.password,"CB-ACCESS-KEY":this.apiKey}}return{url:u,method:i,body:a,headers:r}}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0===n)return;const c=this.id+" "+o,l=this.safeString(n,"title");if(void 0!==l)throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,l,c),new r.ExchangeError(c)}}},570:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(5769),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coincatch",name:"CoinCatch",countries:["VG"],rateLimit:50,version:"v1",certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!0,cancelWithdraw:!1,closePosition:!1,createConvertTrade:!1,createDepositAddress:!1,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrder:!0,createMarketOrderWithCost:!1,createMarketSellOrder:!0,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!1,createTrailingPercentOrder:!1,createTriggerOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchConvertCurrencies:!1,fetchConvertQuote:!1,fetchConvertTrade:!1,fetchConvertTradeHistory:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsForSymbol:!0,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!0,reduceMargin:!0,sandbox:!1,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m",15:"15m",30:"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6H","12h":"12H","1d":"1D","3d":"3D","1w":"1W","1M":"1M"},urls:{logo:"https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3",api:{public:"https://api.coincatch.com",private:"https://api.coincatch.com"},www:"https://www.coincatch.com/",doc:"https://coincatch.github.io/github.io/en/",fees:"https://www.coincatch.com/en/rate/",referral:{url:"https://partner.coincatch.cc/bg/92hy70391729607848548",discount:.1}},api:{public:{get:{"api/spot/v1/public/time":1,"api/spot/v1/public/currencies":20/3,"api/spot/v1/market/ticker":1,"api/spot/v1/market/tickers":1,"api/spot/v1/market/fills":2,"api/spot/v1/market/fills-history":2,"api/spot/v1/market/candles":1,"api/spot/v1/market/history-candles":1,"api/spot/v1/market/depth":1,"api/spot/v1/market/merge-depth":1,"api/mix/v1/market/contracts":1,"api/mix/v1/market/merge-depth":1,"api/mix/v1/market/depth":1,"api/mix/v1/market/ticker":1,"api/mix/v1/market/tickers":1,"api/mix/v1/market/fills":1,"api/mix/v1/market/fills-history":1,"api/mix/v1/market/candles":1,"pi/mix/v1/market/index":1,"api/mix/v1/market/funding-time":1,"api/mix/v1/market/history-fundRate":1,"api/mix/v1/market/current-fundRate":1,"api/mix/v1/market/open-interest":1,"api/mix/v1/market/mark-price":1,"api/mix/v1/market/symbol-leverage":1,"api/mix/v1/market/queryPositionLever":1}},private:{get:{"api/spot/v1/wallet/deposit-address":4,"pi/spot/v1/wallet/withdrawal-list":1,"api/spot/v1/wallet/withdrawal-list-v2":1,"api/spot/v1/wallet/deposit-list":1,"api/spot/v1/account/getInfo":1,"api/spot/v1/account/assets":2,"api/spot/v1/account/transferRecords":1,"api/mix/v1/account/account":2,"api/mix/v1/account/accounts":2,"api/mix/v1/position/singlePosition-v2":2,"api/mix/v1/position/allPosition-v2":4,"api/mix/v1/account/accountBill":2,"api/mix/v1/account/accountBusinessBill":4,"api/mix/v1/order/current":1,"api/mix/v1/order/marginCoinCurrent":1,"api/mix/v1/order/history":2,"api/mix/v1/order/historyProductType":4,"api/mix/v1/order/detail":2,"api/mix/v1/order/fills":2,"api/mix/v1/order/allFills":2,"api/mix/v1/plan/currentPlan":1,"api/mix/v1/plan/historyPlan":2},post:{"api/spot/v1/wallet/transfer-v2":4,"api/spot/v1/wallet/withdrawal-v2":4,"api/spot/v1/wallet/withdrawal-inner-v2":1,"api/spot/v1/account/bills":2,"api/spot/v1/trade/orders":2,"api/spot/v1/trade/batch-orders":{cost:4,step:10},"api/spot/v1/trade/cancel-order":1,"api/spot/v1/trade/cancel-order-v2":2,"api/spot/v1/trade/cancel-symbol-order":2,"api/spot/v1/trade/cancel-batch-orders":1,"api/spot/v1/trade/cancel-batch-orders-v2":1,"api/spot/v1/trade/orderInfo":1,"api/spot/v1/trade/open-orders":1,"api/spot/v1/trade/history":1,"api/spot/v1/trade/fills":1,"api/spot/v1/plan/placePlan":1,"api/spot/v1/plan/modifyPlan":1,"api/spot/v1/plan/cancelPlan":1,"api/spot/v1/plan/currentPlan":1,"api/spot/v1/plan/historyPlan":1,"api/spot/v1/plan/batchCancelPlan":2,"api/mix/v1/account/open-count":1,"api/mix/v1/account/setLeverage":4,"api/mix/v1/account/setMargin":4,"api/mix/v1/account/setMarginMode":4,"api/mix/v1/account/setPositionMode":4,"api/mix/v1/order/placeOrder":2,"api/mix/v1/order/batch-orders":{cost:4,step:10},"api/mix/v1/order/cancel-order":2,"api/mix/v1/order/cancel-batch-orders":2,"api/mix/v1/order/cancel-symbol-orders":2,"api/mix/v1/order/cancel-all-orders":2,"api/mix/v1/plan/placePlan":2,"api/mix/v1/plan/modifyPlan":2,"api/mix/v1/plan/modifyPlanPreset":2,"api/mix/v1/plan/placeTPSL":2,"api/mix/v1/plan/placeTrailStop":2,"api/mix/v1/plan/placePositionsTPSL":2,"api/mix/v1/plan/modifyTPSLPlan":2,"api/mix/v1/plan/cancelPlan":2,"api/mix/v1/plan/cancelSymbolPlan":2,"api/mix/v1/plan/cancelAllPlan":2}}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},fees:{trading:{spot:{tierBased:!1,percentage:!0,feeSide:"get",maker:this.parseNumber("0.001"),taker:this.parseNumber("0.001")}}},options:{brokerId:"47cfy",createMarketBuyOrderRequiresPrice:!0,timeframes:{spot:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1h","4h":"4h","6h":"6h","12h":"12h","1d":"1day","3d":"3day","1w":"1week","1M":"1M"},swap:{"1m":"1m","3m":"3m","5m":"5m",15:"15m",30:"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6H","12h":"12H","1d":"1D","3d":"3D","1w":"1W","1M":"1M"}},currencyIdsListForParseMarket:void 0,broker:"",networks:{BTC:"BITCOIN",ERC20:"ERC20",TRC20:"TRC20",BEP20:"BEP20",ARB:"ArbitrumOne",OPTIMISM:"Optimism",LTC:"LTC",BCH:"BCH",ETC:"ETC",SOL:"SOL",NEO3:"NEO3",STX:"stacks",EGLD:"Elrond",NEAR:"NEARProtocol",ACA:"AcalaToken",KLAY:"Klaytn",FTM:"Fantom",TERRA:"Terra",WAVES:"WAVES",TAO:"TAO",SUI:"SUI",SEI:"SEI",RUNE:"THORChain",ZIL:"ZIL",SXP:"Solar",FET:"FET",AVAX:"C-Chain",XRP:"XRP",EOS:"EOS",DOGE:"DOGECOIN",CAP20:"CAP20",MATIC:"Polygon",CSPR:"CSPR",GLMR:"Moonbeam",MINA:"MINA",CFX:"CFX",STRAT:"StratisEVM",TIA:"Celestia",ChilizChain:"ChilizChain",APT:"Aptos",ONT:"Ontology",ICP:"ICP",ADA:"Cardano",FIL:"FIL",CELO:"CELO",DOT:"DOT",XLM:"StellarLumens",ATOM:"ATOM",CRO:"CronosChain"},networksById:{TRC20:"TRC20","TRX(TRC20)":"TRC20",ArbitrumOne:"ARB",THORChain:"RUNE",Solar:"SXP","C-Chain":"AVAX",CAP20:"CAP20",CFXeSpace:"CFX",CFX:"CFX",StratisEVM:"STRAT",ChilizChain:"ChilizChain",StellarLumens:"XLM",CronosChain:"CRO"}},features:{default:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!1},triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:{max:50},fetchMyTrades:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!0,trailing:!1,marketType:!0,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrder:{attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!1}},fetchMyTrades:{limit:100}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}},commonCurrencies:{},exceptions:{exact:{22001:r.OrderNotFound,429:r.DDoSProtection,40001:r.AuthenticationError,40002:r.AuthenticationError,40003:r.AuthenticationError,40005:r.InvalidNonce,40006:r.AuthenticationError,40007:r.BadRequest,40008:r.InvalidNonce,40009:r.AuthenticationError,40011:r.AuthenticationError,40012:r.AuthenticationError,40013:r.ExchangeError,40014:r.PermissionDenied,40015:r.ExchangeError,40016:r.PermissionDenied,40017:r.ExchangeError,40018:r.PermissionDenied,40019:r.BadRequest,40020:r.BadRequest,40034:r.BadRequest,400172:r.BadRequest,40912:r.BadRequest,40913:r.BadRequest,40102:r.BadRequest,40200:r.OnMaintenance,40305:r.BadRequest,40409:r.ExchangeError,40704:r.ExchangeError,40724:r.BadRequest,40725:r.ExchangeError,40762:r.InsufficientFunds,40774:r.BadRequest,40808:r.BadRequest,43001:r.OrderNotFound,43002:r.InvalidOrder,43004:r.OrderNotFound,43005:r.RateLimitExceeded,43006:r.BadRequest,43007:r.BadRequest,43008:r.BadRequest,43009:r.BadRequest,43010:r.BadRequest,43011:r.BadRequest,43012:r.InsufficientFunds,43117:r.InsufficientFunds,43118:r.BadRequest,43122:r.BadRequest,45006:r.InsufficientFunds,45110:r.BadRequest},broad:{}},precisionMode:o.kb})}calculateRateLimiterCost(e,t,i,s,r={}){const a=this.safeInteger(r,"step"),o=this.safeInteger(r,"cost",1),n=this.safeList2(s,"orderList","orderDataList",[]).length;if(void 0!==a&&n>a){return o*Math.ceil(n/a)}return o}async fetchTime(e={}){const t=await this.publicGetApiSpotV1PublicTime(e);return this.safeInteger(t,"data")}async fetchCurrencies(e={}){const t=await this.publicGetApiSpotV1PublicCurrencies(e),i=this.safeList(t,"data",[]),s={},r=[];for(let e=0;e-1){const s=e.replace(a,"");0===o?(t=a,i=s):(t=s,i=a);break}}return{baseId:t,quoteId:i}}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={symbol:i.id};let a;if(i.spot)a=await this.publicGetApiSpotV1MarketTicker(this.extend(s,t));else{if(!i.swap)throw new r.NotSupported(this.id+" fetchTicker() is not supported for "+i.type+" type of markets");a=await this.publicGetApiMixV1MarketTicker(this.extend(s,t))}const o=this.safeDict(a,"data",{});return this.parseTicker(o,i)}async fetchTickers(e=void 0,t={}){const i="fetchTickers";await this.loadMarkets(),e=this.marketSymbols(e,void 0,!0,!0);const s=this.getMarketFromSymbols(e);let a,o="spot";if([o,t]=this.handleMarketTypeAndParams(i,s,t,o),"spot"===o)a=await this.publicGetApiSpotV1MarketTickers(t);else{if("swap"!==o)throw new r.NotSupported(this.id+" "+i+"() is not supported for "+o+" type of markets");{let e="umcbl";[e,t]=this.handleOptionAndParams(t,i,"productType",e);const s={productType:e};a=await this.publicGetApiMixV1MarketTickers(this.extend(s,t))}}const n=this.safeList(a,"data",[]);return this.parseTickers(n,e)}parseTicker(e,t=void 0){const i=this.safeInteger2(e,"ts","timestamp");let s=this.safeString(e,"symbol","");s.indexOf("_")<0&&(s+="_SPBL"),t=this.safeMarketCustom(s,t);const r=this.safeString2(e,"close","last");return this.safeTicker({symbol:t.symbol,timestamp:i,datetime:this.iso8601(i),high:this.safeString(e,"high24h"),low:this.safeString(e,"low24h"),bid:this.safeString2(e,"buyOne","bestBid"),bidVolume:this.safeString(e,"bidSz"),ask:this.safeString2(e,"sellOne","bestAsk"),askVolume:this.safeString(e,"askSz"),vwap:void 0,open:this.safeString2(e,"openUtc0","openUtc"),close:r,last:r,previousClose:void 0,change:void 0,percentage:a.Y.stringMul(this.safeString2(e,"changeUtc","chgUtc"),"100"),average:void 0,baseVolume:this.safeString2(e,"baseVol","baseVolume"),quoteVolume:this.safeString2(e,"quoteVol","quoteVolume"),indexPrice:this.safeString(e,"indexPrice"),markPrice:void 0,info:e},t)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s="fetchOrderBook",a=this.market(e),o={symbol:a.id};let n,d;if(void 0!==t&&(o.limit=t),[n,i]=this.handleOptionAndParams(i,s,"precision"),void 0!==n&&(o.precision=n),a.spot)d=await this.publicGetApiSpotV1MarketMergeDepth(this.extend(o,i));else{if(!a.swap)throw new r.NotSupported(this.id+" "+s+"() is not supported for "+a.type+" type of markets");d=await this.publicGetApiMixV1MarketMergeDepth(this.extend(o,i))}const h=this.safeDict(d,"data",{}),c=this.safeInteger(h,"ts");return this.parseOrderBook(h,e,c,"bids","asks")}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,a={}){const o="fetchOHLCV";await this.loadMarkets();const n=this.market(e),d={symbol:n.id};let h;[h,a]=this.handleOptionAndParams(a,o,"until");const c=n.type,l=this.options.timeframes[c],u=this.safeString(l,t,t);let f,p=s;if(void 0===i&&void 0===h||(p=1e3),void 0!==p&&(d.limit=p),n.spot){d.period=u,void 0!==i&&(d.after=i),void 0!==h&&(d.before=h),f=await this.publicGetApiSpotV1MarketCandles(this.extend(d,a));const e=this.safeList(f,"data",[]);return this.parseOHLCVs(e,n,t,i,s)}if(n.swap){if(d.granularity=u,void 0===h&&(h=this.milliseconds()),void 0===i){i=h-1e3*this.parseTimeframe(t)*1e3}let e;return d.startTime=i,d.endTime=h,[e,a]=this.handleOptionAndParams(a,o,"price"),"mark"===e&&(d.kLineType="market mark index"),f=await this.publicGetApiMixV1MarketCandles(this.extend(d,a)),this.parseOHLCVs(f,n,t,i,s)}throw new r.NotSupported(this.id+" "+o+"() is not supported for "+n.type+" type of markets")}parseOHLCV(e,t=void 0){return[this.safeInteger2(e,"ts",0),this.safeNumber2(e,"open",1),this.safeNumber2(e,"high",2),this.safeNumber2(e,"low",3),this.safeNumber2(e,"close",4),this.safeNumber2(e,"baseVol",5)]}async fetchTrades(e,t=void 0,i=void 0,s={}){const a="fetchTrades";await this.loadMarkets();const o=this.market(e),n={symbol:o.id};let d;[d,s]=this.handleOptionAndParams(s,a,"until");let h,c=i;if(void 0===t&&void 0===d||(c=1e3,void 0!==t&&(n.startTime=t),void 0!==d&&(n.endTime=d)),void 0!==c&&(n.limit=c),o.spot)h=await this.publicGetApiSpotV1MarketFillsHistory(this.extend(n,s));else{if(!o.swap)throw new r.NotSupported(this.id+" "+a+"() is not supported for "+o.type+" type of markets");h=await this.publicGetApiMixV1MarketFillsHistory(this.extend(n,s))}const l=this.safeList(h,"data",[]);return this.parseTrades(l,o,t,i)}parseTrade(e,t=void 0){const i=this.safeString(e,"symbol");t=this.safeMarketCustom(i,t);const s=this.safeIntegerN(e,["fillTime","timestamp","cTime"]),r=this.safeString2(e,"fees","fee");let o;void 0!==r&&(o=a.Y.stringAbs(r));let n=this.safeString(e,"feeCcy");void 0===n&&void 0!==t.settle&&(n=t.settle);const d=this.safeStringLower2(e,"tradeSide","side");return this.safeTrade({id:this.safeString2(e,"tradeId","fillId"),order:this.safeString(e,"orderId"),timestamp:s,datetime:this.iso8601(s),symbol:t.symbol,type:this.safeString(e,"orderType"),side:this.parseOrderSide(d),takerOrMaker:this.safeString(e,"takerMakerFlag"),price:this.safeString2(e,"fillPrice","price"),amount:this.safeStringN(e,["fillQuantity","size","sizeQty"]),cost:this.safeString2(e,"fillTotalAmount","fillAmount"),fee:{cost:o,currency:n},info:e},t)}async fetchFundingRate(e,t={}){await this.loadMarkets();const i=this.market(e),s=i.id,r=s.split("_"),a={symbol:s,productType:this.safeString(r,1)},o=await this.publicGetApiMixV1MarketCurrentFundRate(this.extend(a,t)),n=this.safeDict(o,"data",{});return this.parseFundingRate(n,i)}parseFundingRate(e,t=void 0){const i=this.safeString(e,"symbol");t=this.safeMarketCustom(i,t);const s=this.safeNumber(e,"fundingRate");return{info:e,symbol:t.symbol,markPrice:void 0,indexPrice:void 0,interestRate:void 0,estimatedSettlePrice:void 0,timestamp:void 0,datetime:void 0,fundingRate:s,fundingTimestamp:void 0,fundingDatetime:void 0,nextFundingRate:void 0,nextFundingTimestamp:void 0,nextFundingDatetime:void 0,previousFundingRate:void 0,previousFundingTimestamp:void 0,previousFundingDatetime:void 0}}handleOptionParamsAndRequest(e,t,i,s,r,a=void 0){const[o,n]=this.handleOptionAndParams(e,t,i,a);return void 0!==o&&(s[r]=o),[s,n]}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={symbol:a.id};let n=i;void 0!==t&&(n=100),void 0!==n&&(o.pageSize=n);const d=await this.publicGetApiMixV1MarketHistoryFundRate(this.extend(o,s)),h=this.safeList(d,"data",[]),c=[];for(let e=0;e1)for(let e=0;e1)throw new r.BadSymbol(this.id+" "+i+"() requires all symbols to belong to the same product type (umcbl or dmcbl)");s=a[0]}else[s,t]=this.handleOptionAndParams(t,i,"productType",s);const a={productType:s};if("dmcbl"===s){let e;if([e,t]=this.handleOptionAndParams(t,i,"marginCoin"),void 0!==e){const t=this.currency(e);a.marginCoin=t.id}}const o=await this.privateGetApiMixV1PositionAllPositionV2(this.extend(a,t)),n=this.safeList(o,"data",[]);return this.parsePositions(n,e)}parsePosition(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeString(e,"marginCoin");t=this.safeMarketCustom(i,t,s);const r=this.safeInteger(e,"cTime"),o=this.safeString(e,"marginMode");let n;const d=this.safeString(e,"holdMode");"double_hold"===d?n=!0:"single_hold"===d&&(n=!1);const h=this.safeNumber(e,"margin"),c=this.safeString(e,"keepMarginRate");return this.safePosition({symbol:t.symbol,id:void 0,timestamp:r,datetime:this.iso8601(r),contracts:this.safeNumber(e,"total"),contractSize:void 0,side:this.safeStringLower(e,"holdSide"),notional:h,leverage:this.safeInteger(e,"leverage"),unrealizedPnl:this.safeNumber(e,"unrealizedPL"),realizedPnl:this.safeNumber(e,"achievedProfits"),collateral:void 0,entryPrice:this.safeNumber(e,"averageOpenPrice"),markPrice:this.safeNumber(e,"marketPrice"),liquidationPrice:this.safeNumber(e,"liquidationPrice"),marginMode:this.parseMarginModeType(o),hedged:n,maintenanceMargin:void 0,maintenanceMarginPercentage:this.parseNumber(a.Y.stringMul(c,"100")),initialMargin:h,initialMarginPercentage:void 0,marginRatio:this.safeNumber(e,"marginRatio"),lastUpdateTimestamp:this.safeInteger(e,"uTime"),lastPrice:void 0,stopLossPrice:void 0,takeProfitPrice:void 0,percentage:void 0,info:e})}safeMarketCustom(e,t=void 0,i=void 0){try{t=this.safeMarket(e,t)}catch(s){const r=this.safeList(this.markets_by_id,e,[]);if(void 0===i)t=r[0];else for(let e=0;e=0){const e=this.safeDict(n,"data",{}),t=this.safeList2(e,"failure","fail_infos",[]);if(!this.isEmpty(t)){f=!1;const e=this.safeDict(t,0,{});u=this.safeString(e,"errorCode"),c=this.safeString(e,"errorMsg")}}if(!f)throw this.throwExactlyMatchedException(this.exceptions.exact,u,l),this.throwBroadlyMatchedException(this.exceptions.broad,c,l),new r.ExchangeError(l)}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/"+e;if("GET"===i){const e=this.urlencode(s);0!==e.length&&(o+="?"+e)}if("private"===t){this.checkRequiredCredentials();const e=this.numberToString(this.milliseconds());let t="";"GET"!==i&&(t=a=this.json(s));const d=e+i+o+t,h=this.hmac(this.encode(d),this.encode(this.secret),n.s,"base64");r={"ACCESS-KEY":this.apiKey,"ACCESS-SIGN":h,"ACCESS-TIMESTAMP":e,"ACCESS-PASSPHRASE":this.password,"Content-Type":"application/json","X-CHANNEL-API-CODE":this.safeString(this.options,"brokerId","47cfy")}}return{url:this.urls.api[t]+o,method:i,body:a,headers:r}}}},2741:(e,t,i)=>{i.d(t,{A:()=>n});var s=i(2938),r=i(2079),a=i(1579),o=i(4852);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coincheck",name:"coincheck",countries:["JP","ID"],rateLimit:1500,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg",api:{rest:"https://coincheck.com/api"},www:"https://coincheck.com",doc:"https://coincheck.com/documents/exchange/api",fees:["https://coincheck.com/exchange/fee","https://coincheck.com/info/fee"]},api:{public:{get:["exchange/orders/rate","order_books","rate/{pair}","ticker","trades"]},private:{get:["accounts","accounts/balance","accounts/leverage_balance","bank_accounts","deposit_money","exchange/orders/opens","exchange/orders/transactions","exchange/orders/transactions_pagination","exchange/leverage/positions","lending/borrows/matches","send_money","withdraws"],post:["bank_accounts","deposit_money/{id}/fast","exchange/orders","exchange/transfers/to_leverage","exchange/transfers/from_leverage","lending/borrows","lending/borrows/{id}/repay","send_money","withdraws"],delete:["bank_accounts/{id}","exchange/orders/{id}","withdraws/{id}"]}},markets:{"BTC/JPY":this.safeMarketStructure({id:"btc_jpy",symbol:"BTC/JPY",base:"BTC",quote:"JPY",baseId:"btc",quoteId:"jpy",type:"spot",spot:!0}),"ETC/JPY":this.safeMarketStructure({id:"etc_jpy",symbol:"ETC/JPY",base:"ETC",quote:"JPY",baseId:"etc",quoteId:"jpy",type:"spot",spot:!0}),"FCT/JPY":this.safeMarketStructure({id:"fct_jpy",symbol:"FCT/JPY",base:"FCT",quote:"JPY",baseId:"fct",quoteId:"jpy",type:"spot",spot:!0}),"MONA/JPY":this.safeMarketStructure({id:"mona_jpy",symbol:"MONA/JPY",base:"MONA",quote:"JPY",baseId:"mona",quoteId:"jpy",type:"spot",spot:!0}),"ETC/BTC":this.safeMarketStructure({id:"etc_btc",symbol:"ETC/BTC",base:"ETC",quote:"BTC",baseId:"etc",quoteId:"btc",type:"spot",spot:!0})},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},fees:{trading:{tierBased:!1,percentage:!0,maker:this.parseNumber("0"),taker:this.parseNumber("0")}},precisionMode:a.kb,exceptions:{exact:{"disabled API Key":r.AuthenticationError,"invalid authentication":r.AuthenticationError},broad:{}}})}parseBalance(e){const t={info:e},i=Object.keys(this.currencies);for(let s=0;s{i.d(t,{A:()=>h});var s=i(5277),r=i(2079),a=i(5147),o=i(1579),n=i(4852),d=i(4035);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinex",name:"CoinEx",version:"v2",countries:["CN"],rateLimit:2.5,pro:!0,certified:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,borrowCrossMargin:!1,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createDepositAddress:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!0,createStopLossOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!0,fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingInterval:!0,fetchFundingIntervals:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!1,fetchLeverage:!0,fetchLeverages:!1,fetchLeverageTiers:!0,fetchMarginAdjustmentHistory:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:!0,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!1,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","2h":"2hour","4h":"4hour","6h":"6hour","12h":"12hour","1d":"1day","3d":"3day","1w":"1week"},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg",api:{public:"https://api.coinex.com",private:"https://api.coinex.com",perpetualPublic:"https://api.coinex.com/perpetual",perpetualPrivate:"https://api.coinex.com/perpetual"},www:"https://www.coinex.com",doc:"https://docs.coinex.com/api/v2",fees:"https://www.coinex.com/fees",referral:"https://www.coinex.com/register?refer_code=yw5fz"},api:{v1:{public:{get:{"amm/market":1,"common/currency/rate":1,"common/asset/config":1,"common/maintain/info":1,"common/temp-maintain/info":1,"margin/market":1,"market/info":1,"market/list":1,"market/ticker":1,"market/ticker/all":1,"market/depth":1,"market/deals":1,"market/kline":1,"market/detail":1}},private:{get:{"account/amm/balance":40,"account/investment/balance":40,"account/balance/history":40,"account/market/fee":40,"balance/coin/deposit":40,"balance/coin/withdraw":40,"balance/info":40,"balance/deposit/address/{coin_type}":40,"contract/transfer/history":40,"credit/info":40,"credit/balance":40,"investment/transfer/history":40,"margin/account":1,"margin/config":1,"margin/loan/history":40,"margin/transfer/history":40,"order/deals":40,"order/finished":40,"order/pending":8,"order/status":8,"order/status/batch":8,"order/user/deals":40,"order/stop/finished":40,"order/stop/pending":8,"order/user/trade/fee":1,"order/market/trade/info":1,"sub_account/balance":1,"sub_account/transfer/history":40,"sub_account/auth/api":40,"sub_account/auth/api/{user_auth_id}":40},post:{"balance/coin/withdraw":40,"contract/balance/transfer":40,"margin/flat":40,"margin/loan":40,"margin/transfer":40,"order/limit/batch":40,"order/ioc":13.334,"order/limit":13.334,"order/market":13.334,"order/modify":13.334,"order/stop/limit":13.334,"order/stop/market":13.334,"order/stop/modify":13.334,"sub_account/transfer":40,"sub_account/register":1,"sub_account/unfrozen":40,"sub_account/frozen":40,"sub_account/auth/api":40},put:{"balance/deposit/address/{coin_type}":40,"sub_account/unfrozen":40,"sub_account/frozen":40,"sub_account/auth/api/{user_auth_id}":40,"v1/account/settings":40},delete:{"balance/coin/withdraw":40,"order/pending/batch":40,"order/pending":13.334,"order/stop/pending":40,"order/stop/pending/{id}":13.334,"order/pending/by_client_id":40,"order/stop/pending/by_client_id":40,"sub_account/auth/api/{user_auth_id}":40,"sub_account/authorize/{id}":40}},perpetualPublic:{get:{ping:1,time:1,"market/list":1,"market/limit_config":1,"market/ticker":1,"market/ticker/all":1,"market/depth":1,"market/deals":1,"market/funding_history":1,"market/kline":1}},perpetualPrivate:{get:{"market/user_deals":1,"asset/query":40,"order/pending":8,"order/finished":40,"order/stop_finished":40,"order/stop_pending":8,"order/status":8,"order/stop_status":8,"position/finished":40,"position/pending":40,"position/funding":40,"position/adl_history":40,"market/preference":40,"position/margin_history":40,"position/settle_history":40},post:{"market/adjust_leverage":1,"market/position_expect":1,"order/put_limit":20,"order/put_market":20,"order/put_stop_limit":20,"order/put_stop_market":20,"order/modify":20,"order/modify_stop":20,"order/cancel":20,"order/cancel_all":40,"order/cancel_batch":40,"order/cancel_stop":20,"order/cancel_stop_all":40,"order/close_limit":20,"order/close_market":20,"position/adjust_margin":20,"position/stop_loss":20,"position/take_profit":20,"position/market_close":20,"order/cancel/by_client_id":20,"order/cancel_stop/by_client_id":20,"market/preference":20}}},v2:{public:{get:{"maintain/info":1,ping:1,time:1,"spot/market":1,"spot/ticker":1,"spot/depth":1,"spot/deals":1,"spot/kline":1,"spot/index":1,"futures/market":1,"futures/ticker":1,"futures/depth":1,"futures/deals":1,"futures/kline":1,"futures/index":1,"futures/funding-rate":1,"futures/funding-rate-history":1,"futures/position-level":1,"futures/liquidation-history":1,"futures/basis-history":1,"assets/deposit-withdraw-config":1,"assets/all-deposit-withdraw-config":1}},private:{get:{"account/subs":1,"account/subs/api-detail":40,"account/subs/info":1,"account/subs/api":40,"account/subs/transfer-history":40,"account/subs/spot-balance":1,"account/trade-fee-rate":40,"assets/spot/balance":40,"assets/futures/balance":40,"assets/margin/balance":1,"assets/financial/balance":40,"assets/amm/liquidity":40,"assets/credit/info":40,"assets/margin/borrow-history":40,"assets/margin/interest-limit":1,"assets/deposit-address":40,"assets/deposit-history":40,"assets/withdraw":40,"assets/transfer-history":40,"spot/order-status":8,"spot/batch-order-status":8,"spot/pending-order":8,"spot/finished-order":40,"spot/pending-stop-order":8,"spot/finished-stop-order":40,"spot/user-deals":40,"spot/order-deals":40,"futures/order-status":8,"futures/batch-order-status":1,"futures/pending-order":8,"futures/finished-order":40,"futures/pending-stop-order":8,"futures/finished-stop-order":40,"futures/user-deals":1,"futures/order-deals":1,"futures/pending-position":40,"futures/finished-position":1,"futures/position-margin-history":1,"futures/position-funding-history":40,"futures/position-adl-history":1,"futures/position-settle-history":1},post:{"account/subs":40,"account/subs/frozen":40,"account/subs/unfrozen":40,"account/subs/api":40,"account/subs/edit-api":40,"account/subs/delete-api":40,"account/subs/transfer":40,"account/settings":40,"assets/margin/borrow":40,"assets/margin/repay":40,"assets/renewal-deposit-address":40,"assets/withdraw":40,"assets/cancel-withdraw":40,"assets/transfer":40,"assets/amm/add-liquidity":1,"assets/amm/remove-liquidity":1,"spot/order":13.334,"spot/stop-order":13.334,"spot/batch-order":40,"spot/batch-stop-order":1,"spot/modify-order":13.334,"spot/modify-stop-order":13.334,"spot/cancel-all-order":1,"spot/cancel-order":6.667,"spot/cancel-stop-order":6.667,"spot/cancel-batch-order":10,"spot/cancel-batch-stop-order":10,"spot/cancel-order-by-client-id":1,"spot/cancel-stop-order-by-client-id":1,"futures/order":20,"futures/stop-order":20,"futures/batch-order":1,"futures/batch-stop-order":1,"futures/modify-order":20,"futures/modify-stop-order":20,"futures/cancel-all-order":1,"futures/cancel-order":10,"futures/cancel-stop-order":10,"futures/cancel-batch-order":20,"futures/cancel-batch-stop-order":20,"futures/cancel-order-by-client-id":1,"futures/cancel-stop-order-by-client-id":1,"futures/close-position":20,"futures/adjust-position-margin":20,"futures/adjust-position-leverage":20,"futures/set-position-stop-loss":20,"futures/set-position-take-profit":20}}}},fees:{trading:{maker:.001,taker:.001},funding:{withdraw:{BCH:0,BTC:.001,LTC:.001,ETH:.001,ZEC:1e-4,DASH:1e-4}}},limits:{amount:{min:.001,max:void 0}},options:{brokerId:"x-167673045",createMarketBuyOrderRequiresPrice:!0,defaultType:"spot",defaultSubType:"linear",fetchDepositAddress:{fillResponseFromRequest:!0},accountsByType:{spot:"SPOT",margin:"MARGIN",swap:"FUTURES"},accountsById:{SPOT:"spot",MARGIN:"margin",FUTURES:"swap"},networks:{BTC:"BTC",BEP20:"BSC",TRC20:"TRC20",ERC20:"ERC20",BRC20:"BRC20",SOL:"SOL",TON:"TON",BSV:"BSV",AVAXC:"AVA_C",AVAXX:"AVA",SUI:"SUI",ACA:"ACA",CHZ:"CHILIZ",ADA:"ADA",ARB:"ARBITRUM",ARBNOVA:"ARBITRUM_NOVA",OP:"OPTIMISM",APT:"APTOS",ATOM:"ATOM",FTM:"FTM",BCH:"BCH",ASTR:"ASTR",LTC:"LTC",MATIC:"MATIC",CRONOS:"CRONOS",DASH:"DASH",DOT:"DOT",ETC:"ETC",ETHW:"ETHPOW",FIL:"FIL",ZIL:"ZIL",DOGE:"DOGE",TIA:"CELESTIA",SEI:"SEI",XRP:"XRP",XMR:"XMR"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!0,selfTradePrevention:!0,iceberg:!0},createOrders:{max:5},fetchMyTrades:{marginMode:!0,limit:1e3,daysBack:void 0,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:1e3,trigger:!0,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,limit:1e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!0,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},forDerivatives:{extends:"spot",createOrder:{marginMode:!0,stopLossPrice:!0,takeProfitPrice:!0},fetchOpenOrders:{marginMode:!1},fetchClosedOrders:{marginMode:!1}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}},commonCurrencies:{ACM:"Actinium"},precisionMode:o.kb,exceptions:{exact:{23:r.PermissionDenied,24:r.AuthenticationError,25:r.AuthenticationError,34:r.AuthenticationError,35:r.ExchangeNotAvailable,36:r.RequestTimeout,213:r.RateLimitExceeded,107:r.InsufficientFunds,158:r.PermissionDenied,600:r.OrderNotFound,601:r.InvalidOrder,602:r.InvalidOrder,606:r.InvalidOrder,3008:r.RequestTimeout,3109:r.InsufficientFunds,3127:r.InvalidOrder,3600:r.OrderNotFound,3606:r.InvalidOrder,3610:r.ExchangeError,3612:r.InvalidOrder,3613:r.InvalidOrder,3614:r.InvalidOrder,3615:r.InvalidOrder,3616:r.InvalidOrder,3617:r.InvalidOrder,3618:r.InvalidOrder,3619:r.InvalidOrder,3620:r.InvalidOrder,3621:r.InvalidOrder,3622:r.InvalidOrder,3627:r.InvalidOrder,3628:r.InvalidOrder,3629:r.InvalidOrder,3632:r.InvalidOrder,3633:r.InvalidOrder,3634:r.InvalidOrder,3635:r.InvalidOrder,4001:r.ExchangeNotAvailable,4002:r.RequestTimeout,4003:r.ExchangeError,4004:r.BadRequest,4005:r.AuthenticationError,4006:r.AuthenticationError,4007:r.PermissionDenied,4008:r.AuthenticationError,4009:r.ExchangeError,4010:r.ExchangeError,4011:r.PermissionDenied,4017:r.ExchangeError,4115:r.AccountSuspended,4117:r.BadSymbol,4123:r.RateLimitExceeded,4130:r.ExchangeError,4158:r.ExchangeError,4213:r.RateLimitExceeded,4512:r.PermissionDenied},broad:{"ip not allow visit":r.PermissionDenied,"service too busy":r.ExchangeNotAvailable}}})}async fetchCurrencies(e={}){const t=await this.v2PublicGetAssetsAllDepositWithdrawConfig(e),i=this.safeList(t,"data",[]),s={};for(let e=0;e1&&"cfx"!==s[0]?(r=s[0],a=s[1]):r=i,{info:e,currency:this.safeCurrencyCode(void 0,t),network:void 0,address:r,tag:this.safeString(e,"memo",a)}}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e);let o,n={market:a.id};if(void 0!==i&&(n.limit=i),void 0!==t&&(n.start_time=t),[n,s]=this.handleUntilOption("end_time",n,s),a.swap)n.market_type="FUTURES",o=await this.v2PrivateGetFuturesUserDeals(this.extend(n,s));else{let e;[e,s]=this.handleMarginModeAndParams("fetchMyTrades",s),n.market_type=void 0!==e?"MARGIN":"SPOT",o=await this.v2PrivateGetSpotUserDeals(this.extend(n,s))}const d=this.safeList(o,"data",[]);return this.parseTrades(d,a,t,i)}async fetchPositions(e=void 0,t={}){let i;await this.loadMarkets(),[i,t]=this.handleOptionAndParams(t,"fetchPositions","method","v2PrivateGetFuturesPendingPosition");const s={market_type:"FUTURES"};let a,o;if(void 0!==(e=this.marketSymbols(e))){let t;if(Array.isArray(e)){if(e.length>1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;a=this.market(t),s.market=a.id}o="v2PrivateGetFuturesPendingPosition"===i?await this.v2PrivateGetFuturesPendingPosition(this.extend(s,t)):await this.v2PrivateGetFuturesFinishedPosition(this.extend(s,t));const n=this.safeList(o,"data",[]),d=[];for(let e=0;eo)throw new r.BadRequest(this.id+" setMarginMode() leverage should be between 1 and "+o.toString()+" for "+t);const n={market:s.id,market_type:"FUTURES",margin_mode:e,leverage:a};return await this.v2PrivatePostFuturesAdjustPositionLeverage(this.extend(n,i))}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();const s=this.market(t);if(!s.swap)throw new r.BadSymbol(this.id+" setLeverage() supports swap contracts only");let a;[a,i]=this.handleMarginModeAndParams("setLeverage",i,"cross");const o=this.safeInteger(s.limits.leverage,"min",1),n=this.safeInteger(s.limits.leverage,"max",100);if(en)throw new r.BadRequest(this.id+" setLeverage() leverage should be between "+o.toString()+" and "+n.toString()+" for "+t);const d={market:s.id,market_type:"FUTURES",margin_mode:a,leverage:e};return await this.v2PrivatePostFuturesAdjustPositionLeverage(this.extend(d,i))}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const i={};if(void 0!==e){const t=this.marketIds(e);i.market=t.join(",")}const s=await this.v2PublicGetFuturesPositionLevel(this.extend(i,t)),r=this.safeList(s,"data",[]);return this.parseLeverageTiers(r,e,"market")}parseMarketLeverageTiers(e,t=void 0){const i=[],s=this.safeList(e,"level",[]);let r=0;for(let a=0;a{i.d(t,{A:()=>d});var s=i(2948),r=i(2079),a=i(1579),o=i(5147),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinlist",name:"Coinlist",countries:["US"],version:"v1",rateLimit:300,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!1,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!0,fetchTransfers:!0,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0,ws:!1},timeframes:{"1m":"1m","5m":"5m","30m":"30m"},urls:{logo:"https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg",api:{public:"https://trade-api.coinlist.co",private:"https://trade-api.coinlist.co"},www:"https://coinlist.co",doc:["https://trade-docs.coinlist.co"],fees:"https://coinlist.co/fees"},api:{public:{get:{"v1/symbols":1,"v1/symbols/summary":1,"v1/symbols/{symbol}":1,"v1/symbols/{symbol}/summary":1,"v1/symbols/{symbol}/book":1,"v1/symbols/{symbol}/quote":1,"v1/symbols/{symbol}/candles":1,"v1/symbols/{symbol}/auctions":1,"v1/symbols/{symbol}/auctions/{auction_code}":1,"v1/time":1,"v1/assets":1,"v1/leaderboard":1,"v1/affiliate/{competition_code}":1,"v1/competition/{competition_id}":1,"v1/symbols/{symbol}/funding":1}},private:{get:{"v1/fees":1,"v1/accounts":1,"v1/accounts/{trader_id}":1,"v1/accounts/{trader_id}/alias":1,"v1/accounts/{trader_id}/ledger":1,"v1/accounts/{trader_id}/wallets":1,"v1/accounts/{trader_id}/wallet-ledger":1,"v1/accounts/{trader_id}/ledger-summary":1,"v1/keys":1,"v1/fills":1,"v1/orders":1,"v1/orders/{order_id}":1,"v1/reports":1,"v1/balances":1,"v1/transfers":1,"v1/user":1,"v1/credits":1,"v1/positions":1,"v1/accounts/{trader_id}/competitions":1,"v1/closedPositions":1},post:{"v1/keys":1,"v1/orders":1,"v1/orders/cancel-all-after":1,"v1/reports":1,"v1/transfers/to-wallet":1,"v1/transfers/from-wallet":1,"v1/transfers/internal-transfer":1,"v1/transfers/withdrawal-request":1,"v1/orders/bulk":1,"v1/accounts/{trader_id}/competitions":1,"v1/accounts/{trader_id}/create-competition":1},patch:{"v1/orders/{order_id}":1,"v1/orders/bulk":1},put:{"v1/accounts/{trader_id}/alias":1},delete:{"v1/keys/{key}":1,"v1/orders":1,"v1/orders/{order_id}":1,"v1/orders/bulk":1}}},features:{default:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!0,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!0,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:500,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:500,daysBack:1e5,daysBackCanceled:void 0,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:300}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:this.parseNumber("0.0045"),maker:this.parseNumber("0.0025"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0045")],[this.parseNumber("20000"),this.parseNumber("0.003")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("750000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("2500000"),this.parseNumber("0.0013")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.001")],[this.parseNumber("50000000"),this.parseNumber("0.0005")],[this.parseNumber("100000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("20000"),this.parseNumber("0.0025")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.0015")],[this.parseNumber("750000"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.001")],[this.parseNumber("2500000"),this.parseNumber("0.0008")],[this.parseNumber("5000000"),this.parseNumber("0.0007")],[this.parseNumber("10000000"),this.parseNumber("0.0006")],[this.parseNumber("50000000"),this.parseNumber("0.0000")],[this.parseNumber("100000000"),this.parseNumber("0.00")]]}}},precisionMode:a.kb,options:{accountsByType:{"CoinList Pro":"trading","CoinList Pro trading account":"trading",Pro:"trading",pro:"trading",trade:"trading",trading:"trading",CoinList:"funding","CoinList wallet":"funding",Wallet:"funding",wallet:"funding",fund:"funding",funding:"funding"}},exceptions:{exact:{AUTH_SIG_INVALID:r.AuthenticationError,DENIED_MAINTENANCE:r.OnMaintenance,ORDER_REJECT_BAD_STATUS:r.InvalidOrder,ORDER_REJECT_INVALID_POST_ONLY:r.InvalidOrder,ORDER_REJECT_INVALID_CLOSE_ONLY:r.InvalidOrder,ORDER_REJECT_POST_ONLY_REQUIRED:r.InvalidOrder,ORDER_REJECT_FROZEN_ORDER:r.InvalidOrder,ORDER_REJECT_LIMIT_PRICE_PROTECTION_VIOLATION:r.InvalidOrder,ORDER_REJECT_CLOSED:r.NotSupported,ORDER_REJECT_MAX_ORDERS:r.BadRequest,ORDER_REJECT_NOT_FOUND:r.OrderNotFound,ORDER_REJECT_PARSE_ERROR:r.BadRequest,ORDER_REJECT_PRICE_INVALID:r.InvalidOrder,ORDER_REJECT_QUANTITY_ZERO:r.InvalidOrder,ORDER_REJECT_TOKEN_LIMIT:r.InsufficientFunds,ORDER_REJECT_TOKEN_LIMIT_OTHER:r.InvalidOrder,ORDER_REJECT_SELF_TRADE:r.InvalidOrder,ORDER_VALIDATE_BAD_SIZE_ALIGNMENT:r.InvalidOrder,ORDER_VALIDATE_BAD_TICK_ALIGNMENT:r.InvalidOrder,ORDER_VALIDATE_SYMBOL_NOT_FOUND:r.BadSymbol,TRANSFERS_WITHDRAWAL_REQUEST_TOO_LARGE:r.InsufficientFunds,WITHDRAWAL_REQUEST_NOT_ALLOWED:r.PermissionDenied},broad:{"A destinationAddress is required for non-USD withdrawals":r.InvalidAddress,"fails to match the JsonSchema date-time format pattern":r.BadRequest,"is required":r.ArgumentsRequired,"must be a string":r.BadRequest,"must be a valid GUID":r.BadRequest,"must be greater than or equal to":r.BadRequest,"must be less than or equal to":r.BadRequest,"must be one of":r.BadRequest,"Symbol not found":r.BadSymbol}}})}calculateRateLimiterCost(e,t,i,s,r={}){if(Array.isArray(s)){const e=s.length;return Math.ceil(e/2)}return 1}async fetchTime(e={}){const t=await this.publicGetV1Time(e),i=this.safeString(t,"iso");return this.parse8601(i)}async fetchCurrencies(e={}){const t=await this.publicGetV1Assets(e),i=this.safeValue(t,"assets",[]),s={};for(let e=0;e0){for(let t=0;t0)for(let e=0;e=0&&"GET"===s){const e=i.split("/orders/"),t=this.safeString(e,1);throw new r.OrderNotFound(this.id+" order "+t+" not found (or rejected on the exchange side)")}return}const c=this.safeString(n,"status"),l=this.safeString(n,"message_code");if(void 0!==l||void 0!==c&&200!==e&&202!==e&&"200"!==c&&"202"!==c){const e=this.id+" "+o,t=this.safeString(n,"message");throw this.throwBroadlyMatchedException(this.exceptions.broad,t,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),new r.ExchangeError(e)}}}},6016:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(8109),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinmate",name:"CoinMate",countries:["GB","CZ","EU"],rateLimit:600,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactions:"emulated",reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg",api:{rest:"https://coinmate.io/api"},www:"https://coinmate.io",fees:"https://coinmate.io/fees",doc:["https://coinmate.docs.apiary.io","https://coinmate.io/developers"],referral:"https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0"},requiredCredentials:{apiKey:!0,secret:!0,uid:!0},api:{public:{get:["orderBook","ticker","tickerAll","products","transactions","tradingPairs"]},private:{post:["balances","bitcoinCashWithdrawal","bitcoinCashDepositAddresses","bitcoinDepositAddresses","bitcoinWithdrawal","bitcoinWithdrawalFees","buyInstant","buyLimit","cancelOrder","cancelOrderWithInfo","createVoucher","dashDepositAddresses","dashWithdrawal","ethereumWithdrawal","ethereumDepositAddresses","litecoinWithdrawal","litecoinDepositAddresses","openOrders","order","orderHistory","orderById","pusherAuth","redeemVoucher","replaceByBuyLimit","replaceByBuyInstant","replaceBySellLimit","replaceBySellInstant","rippleDepositAddresses","rippleWithdrawal","sellInstant","sellLimit","transactionHistory","traderFees","tradeHistory","transfer","transferHistory","unconfirmedBitcoinDeposits","unconfirmedBitcoinCashDeposits","unconfirmedDashDeposits","unconfirmedEthereumDeposits","unconfirmedLitecoinDeposits","unconfirmedRippleDeposits","cancelAllOpenOrders","withdrawVirtualCurrency","virtualCurrencyDepositAddresses","unconfirmedVirtualCurrencyDeposits","adaWithdrawal","adaDepositAddresses","unconfirmedAdaDeposits","solWithdrawal","solDepositAddresses","unconfirmedSolDeposits"]}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.006"),maker:this.parseNumber("0.004"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.006")],[this.parseNumber("10000"),this.parseNumber("0.003")],[this.parseNumber("100000"),this.parseNumber("0.0023")],[this.parseNumber("250000"),this.parseNumber("0.0021")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0015")],[this.parseNumber("3000000"),this.parseNumber("0.0012")],[this.parseNumber("15000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.002")],[this.parseNumber("100000"),this.parseNumber("0.0012")],[this.parseNumber("250000"),this.parseNumber("0.0009")],[this.parseNumber("500000"),this.parseNumber("0.0005")],[this.parseNumber("1000000"),this.parseNumber("0.0003")],[this.parseNumber("3000000"),this.parseNumber("0.0002")],[this.parseNumber("15000000"),this.parseNumber("-0.0004")]]}}},options:{withdraw:{fillResponsefromRequest:!0,methods:{BTC:"privatePostBitcoinWithdrawal",LTC:"privatePostLitecoinWithdrawal",BCH:"privatePostBitcoinCashWithdrawal",ETH:"privatePostEthereumWithdrawal",XRP:"privatePostRippleWithdrawal",DASH:"privatePostDashWithdrawal",DAI:"privatePostDaiWithdrawal",ADA:"privatePostAdaWithdrawal",SOL:"privatePostSolWithdrawal"}}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!0,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"No order with given ID":r.OrderNotFound},broad:{"Not enough account balance available":r.InsufficientFunds,"Incorrect order ID":r.InvalidOrder,"Minimum Order Size ":r.InvalidOrder,"max allowed precision":r.InvalidOrder,"TOO MANY REQUESTS":r.RateLimitExceeded,"Access denied.":r.AuthenticationError}},precisionMode:o.kb})}async fetchMarkets(e={}){const t=await this.publicGetTradingPairs(e),i=this.safeValue(t,"data",[]),s=[];for(let e=0;e{i.d(t,{A:()=>n});var s=i(1671),r=i(2079),a=i(1579),o=i(5147);class n extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinmetro",name:"Coinmetro",countries:["EE"],version:"v1",rateLimit:200,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!0,borrowIsolatedMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!0,createDepositAddress:!1,createOrder:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!1,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!1,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!1,ws:!1},timeframes:{"1m":"60000","5m":"300000","30m":"1800000","4h":"14400000","1d":"86400000"},urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539",api:{public:"https://api.coinmetro.com",private:"https://api.coinmetro.com"},test:{public:"https://api.coinmetro.com/open",private:"https://api.coinmetro.com/open"},www:"https://coinmetro.com/",doc:["https://documenter.getpostman.com/view/3653795/SVfWN6KS"],fees:"https://help.coinmetro.com/hc/en-gb/articles/6844007317789-What-are-the-fees-on-Coinmetro-",referral:"https://go.coinmetro.com/?ref=crypto24"},api:{public:{get:{"demo/temp":1,"exchange/candles/{pair}/{timeframe}/{from}/{to}":3,"exchange/prices":1,"exchange/ticks/{pair}/{from}":3,assets:1,markets:1,"exchange/book/{pair}":3,"exchange/bookUpdates/{pair}/{from}":1}},private:{get:{"users/balances":1,"users/wallets":1,"users/wallets/history/{since}":1.67,"exchange/orders/status/{orderID}":1,"exchange/orders/active":1,"exchange/orders/history/{since}":1.67,"exchange/fills/{since}":1.67,"exchange/margin":1},post:{jwt:1,jwtDevice:1,devices:1,"jwt-read-only":1,"exchange/orders/create":1,"exchange/orders/modify/{orderID}":1,"exchange/swap":1,"exchange/swap/confirm/{swapId}":1,"exchange/orders/close/{orderID}":1,"exchange/orders/hedge":1},put:{jwt:1,"exchange/orders/cancel/{orderID}":1,"users/margin/collateral":1,"users/margin/primary/{currency}":1}}},requiredCredentials:{apiKey:!1,secret:!1,uid:!0,token:!0},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0")}},precisionMode:a.kb,options:{currenciesByIdForParseMarket:void 0,currencyIdsListForParseMarket:["QRDO"]},features:{spot:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!1},timeInForce:{IOC:!0,FOK:!0,PO:!1,GTD:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:1e5,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:void 0,daysBack:1e5,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"Both buyingCurrency and sellingCurrency are required":r.InvalidOrder,"One and only one of buyingQty and sellingQty is required":r.InvalidOrder,"Invalid buyingCurrency":r.InvalidOrder,"Invalid 'from'":r.BadRequest,"Invalid sellingCurrency":r.InvalidOrder,"Invalid buyingQty":r.InvalidOrder,"Invalid sellingQty":r.InvalidOrder,"Insufficient balance":r.InsufficientFunds,"Expiration date is in the past or too near in the future":r.InvalidOrder,Forbidden:r.PermissionDenied,"Order Not Found":r.OrderNotFound,"since must be a millisecond timestamp":r.BadRequest,"This pair is disabled on margin":r.BadSymbol},broad:{"accessing from a new IP":r.PermissionDenied,"available to allocate as collateral":r.InsufficientFunds,"At least":r.BadRequest,"collateral is not allowed":r.BadRequest,"Insufficient liquidity":r.InvalidOrder,"Insufficient order size":r.InvalidOrder,"Invalid quantity":r.InvalidOrder,"Invalid Stop Loss":r.InvalidOrder,"Invalid stop price!":r.InvalidOrder,"Not enough balance":r.InsufficientFunds,"Not enough margin":r.InsufficientFunds,"orderType missing":r.BadRequest,"Server Timeout":r.ExchangeError,"Time in force has to be IOC or FOK for market orders":r.InvalidOrder,"Too many attempts":r.RateLimitExceeded}}})}async fetchCurrencies(e={}){const t=await this.publicGetAssets(e),i={};for(let e=0;e1&&(t=this.parseLedgerEntryType(s[0]),i="-"!==s[1]?s[1]:this.safeString(s,2)),[t,i]}parseLedgerEntryType(e){return this.safeString({Deposit:"transaction",Withdraw:"transaction",Order:"trade"},e,e)}async createOrder(e,t,i,s,a=void 0,n={}){await this.loadMarkets();const d=this.market(e);let h,c={};c.orderType=t,void 0!==s&&(h=this.amountToPrecision(e,s));let l,u=this.safeValue(n,"cost");if(n=this.omit(n,"cost"),"limit"===t){if(void 0===a&&void 0===u)throw new r.ArgumentsRequired(this.id+" createOrder() requires a price or params.cost argument for a "+t+" order");if(void 0!==a&&void 0!==s){const e=o.Y.stringMul(this.numberToString(a),this.numberToString(h));u=this.parseToNumeric(e)}}void 0!==u&&(l=this.costToPrecision(e,u)),"sell"===i?c=this.handleCreateOrderSide(d.baseId,d.quoteId,h,l,c):"buy"===i&&(c=this.handleCreateOrderSide(d.quoteId,d.baseId,l,h,c));const f=this.safeValue(n,"timeInForce");void 0!==f&&(n=this.omit(n,"timeInForce"),c.timeInForce=this.encodeOrderTimeInForce(f));const p=this.safeString2(n,"triggerPrice","stopPrice");void 0!==p&&(n=this.omit(n,["triggerPrice"]),c.stopPrice=this.priceToPrecision(e,p));const m=this.safeValue(n,"userData",{}),g=this.safeString2(n,"clientOrderId","comment");void 0!==g&&(n=this.omit(n,["clientOrderId"]),m.comment=g);const v=this.safeString(n,"stopLossPrice");void 0!==v&&(n=this.omit(n,"stopLossPrice"),m.stopLoss=this.priceToPrecision(e,v));const y=this.safeString(n,"takeProfitPrice");void 0!==y&&(n=this.omit(n,"takeProfitPrice"),m.takeProfit=this.priceToPrecision(e,y)),this.isEmpty(m)||(c.userData=m);const w=await this.privatePostExchangeOrdersCreate(this.extend(c,n));return this.parseOrder(w,d)}handleCreateOrderSide(e,t,i,s,r={}){return r.sellingCurrency=e,r.buyingCurrency=t,void 0!==i&&(r.sellingQty=i),void 0!==s&&(r.buyingQty=s),r}encodeOrderTimeInForce(e){return this.safeValue({GTC:1,IOC:2,GTD:3,FOK:4},e,e)}async cancelOrder(e,t=void 0,i={}){await this.loadMarkets();const s={orderID:e};[i,i]=this.handleMarginModeAndParams("cancelOrder",i);const r=this.safeBool(i,"margin",!1);let a;return i=this.omit(i,"margin"),a=r?await this.privatePostExchangeOrdersCloseOrderID(this.extend(s,i)):await this.privatePutExchangeOrdersCancelOrderID(this.extend(s,i)),this.parseOrder(a)}async closePosition(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeString(i,"orderId");if(void 0===s)throw new r.ArgumentsRequired(this.id+" closePosition() requires a orderId parameter");const a={orderID:s},o=await this.privatePostExchangeOrdersCloseOrderID(this.extend(a,i));return this.parseOrder(o)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privateGetExchangeOrdersActive(s),o=this.parseOrders(a,r,t,i);for(let e=0;e{i.d(t,{A:()=>d});var s=i(6658),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinone",name:"CoinOne",countries:["KR"],rateLimit:50,version:"v2",pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddresses:!0,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg",api:{rest:"https://api.coinone.co.kr",v2Public:"https://api.coinone.co.kr/public/v2",v2Private:"https://api.coinone.co.kr/v2",v2_1Private:"https://api.coinone.co.kr/v2.1"},www:"https://coinone.co.kr",doc:"https://doc.coinone.co.kr"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:["orderbook","ticker","ticker_utc","trades"]},v2Public:{get:["range_units","markets/{quote_currency}","markets/{quote_currency}/{target_currency}","orderbook/{quote_currency}/{target_currency}","trades/{quote_currency}/{target_currency}","ticker_new/{quote_currency}","ticker_new/{quote_currency}/{target_currency}","ticker_utc_new/{quote_currency}","ticker_utc_new/{quote_currency}/{target_currency}","currencies","currencies/{currency}","chart/{quote_currency}/{target_currency}"]},private:{post:["account/deposit_address","account/btc_deposit_address","account/balance","account/daily_balance","account/user_info","account/virtual_account","order/cancel_all","order/cancel","order/limit_buy","order/limit_sell","order/complete_orders","order/limit_orders","order/order_info","transaction/auth_number","transaction/history","transaction/krw/history","transaction/btc","transaction/coin"]},v2Private:{post:["account/balance","account/deposit_address","account/user_info","account/virtual_account","order/cancel","order/limit_buy","order/limit_sell","order/limit_orders","order/complete_orders","order/query_order","transaction/auth_number","transaction/btc","transaction/history","transaction/krw/history"]},v2_1Private:{post:["account/balance/all","account/balance","account/trade_fee","account/trade_fee/{quote_currency}/{target_currency}","order/limit","order/cancel","order/cancel/all","order/open_orders","order/open_orders/all","order/complete_orders","order/complete_orders/all","order/info","transaction/krw/history","transaction/coin/history","transaction/coin/withdrawal/limit"]}},fees:{trading:{tierBased:!1,percentage:!0,taker:.002,maker:.002}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{104:r.OrderNotFound,107:r.BadRequest,108:r.BadSymbol,405:r.OnMaintenance},commonCurrencies:{SOC:"Soda Coin"}})}async fetchCurrencies(e={}){const t=await this.v2PublicGetCurrencies(e),i={},s=this.safeList(t,"currencies",[]);for(let e=0;e{i.d(t,{A:()=>d});var s=i(4935),r=i(2079),a=i(1579),o=i(5147),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinsph",name:"Coins.ph",countries:["PH"],version:"v1",rateLimit:50,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!0,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawal:void 0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!0,ws:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg",api:{public:"https://api.pro.coins.ph",private:"https://api.pro.coins.ph"},www:"https://coins.ph/",doc:["https://coins-docs.github.io/rest-api"],fees:"https://support.coins.ph/hc/en-us/sections/4407198694681-Limits-Fees"},api:{public:{get:{"openapi/v1/ping":1,"openapi/v1/time":1,"openapi/quote/v1/ticker/24hr":{cost:1,noSymbolAndNoSymbols:40,byNumberOfSymbols:[[101,40],[21,20],[0,1]]},"openapi/quote/v1/ticker/price":{cost:1,noSymbol:2},"openapi/quote/v1/ticker/bookTicker":{cost:1,noSymbol:2},"openapi/v1/exchangeInfo":10,"openapi/quote/v1/depth":{cost:1,byLimit:[[101,5],[0,1]]},"openapi/quote/v1/klines":1,"openapi/quote/v1/trades":1,"openapi/v1/pairs":1,"openapi/quote/v1/avgPrice":1}},private:{get:{"openapi/wallet/v1/config/getall":10,"openapi/wallet/v1/deposit/address":10,"openapi/wallet/v1/deposit/history":1,"openapi/wallet/v1/withdraw/history":1,"openapi/v1/account":10,"openapi/v1/openOrders":{cost:3,noSymbol:40},"openapi/v1/asset/tradeFee":1,"openapi/v1/order":2,"openapi/v1/historyOrders":{cost:10,noSymbol:40},"openapi/v1/myTrades":10,"openapi/v1/capital/deposit/history":1,"openapi/v1/capital/withdraw/history":1,"openapi/v3/payment-request/get-payment-request":1,"merchant-api/v1/get-invoices":1,"openapi/account/v3/crypto-accounts":1,"openapi/transfer/v3/transfers/{id}":1},post:{"openapi/wallet/v1/withdraw/apply":600,"openapi/v1/order/test":1,"openapi/v1/order":1,"openapi/v1/capital/withdraw/apply":1,"openapi/v1/capital/deposit/apply":1,"openapi/v3/payment-request/payment-requests":1,"openapi/v3/payment-request/delete-payment-request":1,"openapi/v3/payment-request/payment-request-reminder":1,"openapi/v1/userDataStream":1,"merchant-api/v1/invoices":1,"merchant-api/v1/invoices-cancel":1,"openapi/convert/v1/get-supported-trading-pairs":1,"openapi/convert/v1/get-quote":1,"openapi/convert/v1/accpet-quote":1,"openapi/fiat/v1/support-channel":1,"openapi/fiat/v1/cash-out":1,"openapi/fiat/v1/history":1,"openapi/migration/v4/sellorder":1,"openapi/migration/v4/validate-field":1,"openapi/transfer/v3/transfers":1},delete:{"openapi/v1/order":1,"openapi/v1/openOrders":1,"openapi/v1/userDataStream":1}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,maker:this.parseNumber("0.0025"),taker:this.parseNumber("0.003"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.003")],[this.parseNumber("500000"),this.parseNumber("0.0027")],[this.parseNumber("1000000"),this.parseNumber("0.0024")],[this.parseNumber("2500000"),this.parseNumber("0.002")],[this.parseNumber("5000000"),this.parseNumber("0.0018")],[this.parseNumber("10000000"),this.parseNumber("0.0015")],[this.parseNumber("100000000"),this.parseNumber("0.0012")],[this.parseNumber("500000000"),this.parseNumber("0.0009")],[this.parseNumber("1000000000"),this.parseNumber("0.0007")],[this.parseNumber("2500000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("500000"),this.parseNumber("0.0022")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("2500000"),this.parseNumber("0.0015")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.001")],[this.parseNumber("100000000"),this.parseNumber("0.0008")],[this.parseNumber("500000000"),this.parseNumber("0.0007")],[this.parseNumber("1000000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000000"),this.parseNumber("0.0005")]]}}},precisionMode:a.kb,options:{createMarketBuyOrderRequiresPrice:!0,withdraw:{warning:!1},deposit:{warning:!1},createOrder:{timeInForce:"GTC",newOrderRespType:{market:"FULL",limit:"FULL"}},fetchTicker:{method:"publicGetOpenapiQuoteV1Ticker24hr"},fetchTickers:{method:"publicGetOpenapiQuoteV1Ticker24hr"},networks:{TRC20:"TRX",ERC20:"ETH",BEP20:"BSC",ARB:"ARBITRUM"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!0,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},exceptions:{exact:{"-1000":r.BadRequest,"-1001":r.BadRequest,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1004":r.InvalidOrder,"-1006":r.BadResponse,"-1007":r.BadResponse,"-1014":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.NotSupported,"-1020":r.NotSupported,"-1021":r.BadRequest,"-1022":r.BadRequest,"-1023":r.AuthenticationError,"-1024":r.BadRequest,"-1025":r.BadRequest,"-1030":r.ExchangeError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1111":r.BadRequest,"-1112":r.BadResponse,"-1114":r.BadRequest,"-1115":r.InvalidOrder,"-1116":r.InvalidOrder,"-1117":r.InvalidOrder,"-1118":r.InvalidOrder,"-1119":r.InvalidOrder,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1122":r.InvalidOrder,"-1125":r.BadRequest,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-1131":r.InsufficientFunds,"-1132":r.InvalidOrder,"-1133":r.InvalidOrder,"-1134":r.InvalidOrder,"-1135":r.InvalidOrder,"-1136":r.InvalidOrder,"-1137":r.InvalidOrder,"-1138":r.InvalidOrder,"-1139":r.InvalidOrder,"-1140":r.InvalidOrder,"-1141":r.DuplicateOrderId,"-1142":r.InvalidOrder,"-1143":r.OrderNotFound,"-1144":r.InvalidOrder,"-1145":r.InvalidOrder,"-1146":r.InvalidOrder,"-1147":r.InvalidOrder,"-1148":r.InvalidOrder,"-1149":r.InvalidOrder,"-1150":r.InvalidOrder,"-1151":r.BadSymbol,"-1152":r.NotSupported,"-1153":r.AuthenticationError,"-1154":r.BadRequest,"-1155":r.BadRequest,"-1156":r.InvalidOrder,"-1157":r.BadSymbol,"-1158":r.InvalidOrder,"-1159":r.InvalidOrder,"-1160":r.BadRequest,"-1161":r.BadRequest,"-2010":r.InvalidOrder,"-2013":r.OrderNotFound,"-2011":r.BadRequest,"-2014":r.BadRequest,"-2015":r.AuthenticationError,"-2016":r.BadResponse,"-3126":r.InvalidOrder,"-3127":r.InvalidOrder,"-4001":r.BadRequest,"-100011":r.BadSymbol,"-100012":r.BadSymbol,"-30008":r.InsufficientFunds,"-30036":r.InsufficientFunds,403:r.ExchangeNotAvailable},broad:{"Unknown order sent":r.OrderNotFound,"Duplicate order sent":r.DuplicateOrderId,"Market is closed":r.BadSymbol,"Account has insufficient balance for requested action":r.InsufficientFunds,"Market orders are not supported for this symbol":r.BadSymbol,"Iceberg orders are not supported for this symbol":r.BadSymbol,"Stop loss orders are not supported for this symbol":r.BadSymbol,"Stop loss limit orders are not supported for this symbol":r.BadSymbol,"Take profit orders are not supported for this symbol":r.BadSymbol,"Take profit limit orders are not supported for this symbol":r.BadSymbol,"Price* QTY is zero or less":r.BadRequest,"IcebergQty exceeds QTY":r.BadRequest,"This action disabled is on this account":r.PermissionDenied,"Unsupported order combination":r.InvalidOrder,"Order would trigger immediately":r.InvalidOrder,"Cancel order is invalid. Check origClOrdId and orderId":r.InvalidOrder,"Order would immediately match and take":r.OrderImmediatelyFillable,PRICE_FILTER:r.InvalidOrder,LOT_SIZE:r.InvalidOrder,MIN_NOTIONAL:r.InvalidOrder,MAX_NUM_ORDERS:r.InvalidOrder,MAX_ALGO_ORDERS:r.InvalidOrder,BROKER_MAX_NUM_ORDERS:r.InvalidOrder,BROKER_MAX_ALGO_ORDERS:r.InvalidOrder,ICEBERG_PARTS:r.BadRequest}}})}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;const t=await this.privateGetOpenapiWalletV1ConfigGetall(e),i={};for(let e=0;e=s[0])return s[1]}}else if("byLimit"in r&&"limit"in s){const e=s.limit,t=r.byLimit;for(let i=0;i=s[0])return s[1]}}return this.safeValue(r,"cost",1)}async fetchStatus(e={}){return{status:"ok",updated:void 0,eta:void 0,url:void 0,info:await this.publicGetOpenapiV1Ping(e)}}async fetchTime(e={}){const t=await this.publicGetOpenapiV1Time(e);return this.safeInteger(t,"serverTime")}async fetchMarkets(e={}){const t=await this.publicGetOpenapiV1ExchangeInfo(e),i=this.safeList(t,"symbols",[]),s=[];for(let e=0;e{i.d(t,{A:()=>d});var s=i(9360),r=i(2079),a=i(1579),o=i(7481),n=i(5147);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"coinspot",name:"CoinSpot",countries:["AU"],rateLimit:1e3,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!1},urls:{logo:"https://user-images.githubusercontent.com/1294454/28208429-3cacdf9a-6896-11e7-854e-4c79a772a30f.jpg",api:{public:"https://www.coinspot.com.au/pubapi",private:"https://www.coinspot.com.au/api"},www:"https://www.coinspot.com.au",doc:"https://www.coinspot.com.au/api",referral:"https://www.coinspot.com.au/register?code=PJURCU"},api:{public:{get:["latest"]},private:{post:["orders","orders/history","my/coin/deposit","my/coin/send","quote/buy","quote/sell","my/balances","my/orders","my/buy","my/sell","my/buy/cancel","my/sell/cancel","ro/my/balances","ro/my/balances/{cointype}","ro/my/deposits","ro/my/withdrawals","ro/my/transactions","ro/my/transactions/{cointype}","ro/my/transactions/open","ro/my/transactions/{cointype}/open","ro/my/sendreceive","ro/my/affiliatepayments","ro/my/referralpayments"]}},markets:{"ADA/AUD":this.safeMarketStructure({id:"ada",symbol:"ADA/AUD",base:"ADA",quote:"AUD",baseId:"ada",quoteId:"aud",type:"spot",spot:!0}),"BTC/AUD":this.safeMarketStructure({id:"btc",symbol:"BTC/AUD",base:"BTC",quote:"AUD",baseId:"btc",quoteId:"aud",type:"spot",spot:!0}),"ETH/AUD":this.safeMarketStructure({id:"eth",symbol:"ETH/AUD",base:"ETH",quote:"AUD",baseId:"eth",quoteId:"aud",type:"spot",spot:!0}),"XRP/AUD":this.safeMarketStructure({id:"xrp",symbol:"XRP/AUD",base:"XRP",quote:"AUD",baseId:"xrp",quoteId:"aud",type:"spot",spot:!0}),"LTC/AUD":this.safeMarketStructure({id:"ltc",symbol:"LTC/AUD",base:"LTC",quote:"AUD",baseId:"ltc",quoteId:"aud",type:"spot",spot:!0}),"DOGE/AUD":this.safeMarketStructure({id:"doge",symbol:"DOGE/AUD",base:"DOGE",quote:"AUD",baseId:"doge",quoteId:"aud",type:"spot",spot:!0}),"RFOX/AUD":this.safeMarketStructure({id:"rfox",symbol:"RFOX/AUD",base:"RFOX",quote:"AUD",baseId:"rfox",quoteId:"aud",type:"spot",spot:!0}),"POWR/AUD":this.safeMarketStructure({id:"powr",symbol:"POWR/AUD",base:"POWR",quote:"AUD",baseId:"powr",quoteId:"aud",type:"spot",spot:!0}),"NEO/AUD":this.safeMarketStructure({id:"neo",symbol:"NEO/AUD",base:"NEO",quote:"AUD",baseId:"neo",quoteId:"aud",type:"spot",spot:!0}),"TRX/AUD":this.safeMarketStructure({id:"trx",symbol:"TRX/AUD",base:"TRX",quote:"AUD",baseId:"trx",quoteId:"aud",type:"spot",spot:!0}),"EOS/AUD":this.safeMarketStructure({id:"eos",symbol:"EOS/AUD",base:"EOS",quote:"AUD",baseId:"eos",quoteId:"aud",type:"spot",spot:!0}),"XLM/AUD":this.safeMarketStructure({id:"xlm",symbol:"XLM/AUD",base:"XLM",quote:"AUD",baseId:"xlm",quoteId:"aud",type:"spot",spot:!0}),"RHOC/AUD":this.safeMarketStructure({id:"rhoc",symbol:"RHOC/AUD",base:"RHOC",quote:"AUD",baseId:"rhoc",quoteId:"aud",type:"spot",spot:!0}),"GAS/AUD":this.safeMarketStructure({id:"gas",symbol:"GAS/AUD",base:"GAS",quote:"AUD",baseId:"gas",quoteId:"aud",type:"spot",spot:!0})},commonCurrencies:{DRK:"DASH"},options:{fetchBalance:"private_post_my_balances"},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:void 0,fetchOpenOrders:void 0,fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:a.kb})}parseBalance(e){const t={info:e},i=this.safeValue2(e,"balance","balances");if(Array.isArray(i))for(let e=0;e{i.d(t,{A:()=>d});var s=i(4295),r=i(5147),a=i(2079),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"cryptocom",name:"Crypto.com",countries:["MT"],version:"v2",rateLimit:10,certified:!0,pro:!0,has:{CORS:!1,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!0,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:"emulated",fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","4h":"4h","6h":"6h","12h":"12h","1d":"1D","1w":"7D","2w":"14D","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg",test:{v1:"https://uat-api.3ona.co/exchange/v1",v2:"https://uat-api.3ona.co/v2",derivatives:"https://uat-api.3ona.co/v2"},api:{base:"https://api.crypto.com",v1:"https://api.crypto.com/exchange/v1",v2:"https://api.crypto.com/v2",derivatives:"https://deriv-api.crypto.com/v1"},www:"https://crypto.com/",referral:{url:"https://crypto.com/exch/kdacthrnxt",discount:.75},doc:["https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html","https://exchange-docs.crypto.com/spot/index.html","https://exchange-docs.crypto.com/derivatives/index.html"],fees:"https://crypto.com/exchange/document/fees-limits"},api:{base:{public:{get:{"v1/public/get-announcements":1}}},v1:{public:{get:{"public/auth":10/3,"public/get-instruments":10/3,"public/get-book":1,"public/get-candlestick":1,"public/get-trades":1,"public/get-tickers":1,"public/get-valuations":1,"public/get-expired-settlement-price":10/3,"public/get-insurance":1,"public/get-risk-parameters":1},post:{"public/staking/get-conversion-rate":2}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/user-balance":10/3,"private/user-balance-history":10/3,"private/get-positions":10/3,"private/create-order":2/3,"private/amend-order":4/3,"private/create-order-list":10/3,"private/cancel-order":2/3,"private/cancel-order-list":10/3,"private/cancel-all-orders":2/3,"private/close-position":10/3,"private/get-order-history":100,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/change-account-leverage":10/3,"private/get-transactions":10/3,"private/create-subaccount-transfer":10/3,"private/get-subaccount-balances":10/3,"private/get-order-list":10/3,"private/create-withdrawal":10/3,"private/get-currency-networks":10/3,"private/get-deposit-address":10/3,"private/get-accounts":10/3,"private/get-withdrawal-history":10/3,"private/get-deposit-history":10/3,"private/get-fee-rate":2,"private/get-instrument-fee-rate":2,"private/staking/stake":2,"private/staking/unstake":2,"private/staking/get-staking-position":2,"private/staking/get-staking-instruments":2,"private/staking/get-open-stake":2,"private/staking/get-stake-history":2,"private/staking/get-reward-history":2,"private/staking/convert":2,"private/staking/get-open-convert":2,"private/staking/get-convert-history":2}}},v2:{public:{get:{"public/auth":1,"public/get-instruments":1,"public/get-book":1,"public/get-candlestick":1,"public/get-ticker":1,"public/get-trades":1,"public/margin/get-transfer-currencies":1,"public/margin/get-load-currenices":1,"public/respond-heartbeat":1}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/create-withdrawal":10/3,"private/get-withdrawal-history":10/3,"private/get-currency-networks":10/3,"private/get-deposit-history":10/3,"private/get-deposit-address":10/3,"private/export/create-export-request":10/3,"private/export/get-export-requests":10/3,"private/export/download-export-output":10/3,"private/get-account-summary":10/3,"private/create-order":2/3,"private/cancel-order":2/3,"private/cancel-all-orders":2/3,"private/create-order-list":10/3,"private/get-order-history":10/3,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/get-accounts":10/3,"private/get-subaccount-balances":10/3,"private/create-subaccount-transfer":10/3,"private/otc/get-otc-user":10/3,"private/otc/get-instruments":10/3,"private/otc/request-quote":100,"private/otc/accept-quote":100,"private/otc/get-quote-history":10/3,"private/otc/get-trade-history":10/3,"private/otc/create-order":10/3}}},derivatives:{public:{get:{"public/auth":10/3,"public/get-instruments":10/3,"public/get-book":1,"public/get-candlestick":1,"public/get-trades":1,"public/get-tickers":1,"public/get-valuations":1,"public/get-expired-settlement-price":10/3,"public/get-insurance":1}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/user-balance":10/3,"private/user-balance-history":10/3,"private/get-positions":10/3,"private/create-order":2/3,"private/create-order-list":10/3,"private/cancel-order":2/3,"private/cancel-order-list":10/3,"private/cancel-all-orders":2/3,"private/close-position":10/3,"private/convert-collateral":10/3,"private/get-order-history":100,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/change-account-leverage":10/3,"private/get-transactions":10/3,"private/create-subaccount-transfer":10/3,"private/get-subaccount-balances":10/3,"private/get-order-list":10/3}}}},fees:{trading:{maker:this.parseNumber("0.004"),taker:this.parseNumber("0.004"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("25000"),this.parseNumber("0.0035")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.001")],[this.parseNumber("250000"),this.parseNumber("0.0009")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("20000000"),this.parseNumber("0.0007")],[this.parseNumber("100000000"),this.parseNumber("0.0006")],[this.parseNumber("200000000"),this.parseNumber("0.0004")]],taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("25000"),this.parseNumber("0.0035")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0016")],[this.parseNumber("250000"),this.parseNumber("0.00015")],[this.parseNumber("1000000"),this.parseNumber("0.00014")],[this.parseNumber("20000000"),this.parseNumber("0.00013")],[this.parseNumber("100000000"),this.parseNumber("0.00012")],[this.parseNumber("200000000"),this.parseNumber("0.0001")]]}}},options:{defaultType:"spot",accountsById:{funding:"SPOT",spot:"SPOT",margin:"MARGIN",derivatives:"DERIVATIVES",swap:"DERIVATIVES",future:"DERIVATIVES"},networks:{BEP20:"BSC",ERC20:"ETH",TRC20:"TRON"},broker:"CCXT"},features:{default:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,selfTradePrevention:!0,trailing:!1,iceberg:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!0},createOrders:{max:10},fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:1,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!0,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:100,daysBack:void 0,untilDays:1,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:void 0,daysBackCanceled:void 0,untilDays:1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:300}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:{extends:"default"},inverse:{extends:"default"}}},commonCurrencies:{USD_STABLE_COIN:"USDC"},precisionMode:o.kb,exceptions:{exact:{219:a.InvalidOrder,314:a.InvalidOrder,325:a.InvalidOrder,415:a.InvalidOrder,10001:a.ExchangeError,10002:a.PermissionDenied,10003:a.PermissionDenied,10004:a.BadRequest,10005:a.PermissionDenied,10006:a.DDoSProtection,10007:a.InvalidNonce,10008:a.BadRequest,10009:a.BadRequest,20001:a.BadRequest,20002:a.InsufficientFunds,20005:a.AccountNotEnabled,30003:a.BadSymbol,30004:a.BadRequest,30005:a.BadRequest,30006:a.InvalidOrder,30007:a.InvalidOrder,30008:a.InvalidOrder,30009:a.InvalidOrder,30010:a.BadRequest,30013:a.InvalidOrder,30014:a.InvalidOrder,30016:a.InvalidOrder,30017:a.InvalidOrder,30023:a.InvalidOrder,30024:a.InvalidOrder,30025:a.InvalidOrder,40001:a.BadRequest,40002:a.BadRequest,40003:a.BadRequest,40004:a.BadRequest,40005:a.BadRequest,40006:a.BadRequest,40007:a.BadRequest,40101:a.AuthenticationError,40102:a.InvalidNonce,40103:a.AuthenticationError,40104:a.AuthenticationError,40107:a.BadRequest,40401:a.OrderNotFound,40801:a.RequestTimeout,42901:a.RateLimitExceeded,43005:a.InvalidOrder,43003:a.InvalidOrder,43004:a.InvalidOrder,43012:a.BadRequest,50001:a.ExchangeError,9010001:a.OnMaintenance},broad:{}}})}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;const t=await this.v1PrivatePostPrivateGetCurrencyNetworks(e),i=this.safeDict(t,"result",{}),s=this.safeDict(i,"currency_map",{}),r=Object.keys(s),a={};for(let e=0;e1)throw new a.BadRequest(this.id+" fetchTickers() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;i=this.market(t),s.instrument_name=i.id}const r=await this.v1PublicGetPublicGetTickers(this.extend(s,t)),o=this.safeDict(r,"result",{}),n=this.safeList(o,"data",[]);return this.parseTickers(n,e)}async fetchTicker(e,t={}){await this.loadMarkets(),e=this.symbol(e);const i=await this.fetchTickers([e],t);return this.safeValue(i,e)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r,a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchOrders","paginate"),a)return await this.fetchPaginatedCallDynamic("fetchOrders",e,t,i,s);const o={};void 0!==e&&(r=this.market(e),o.instrument_name=r.id),void 0!==t&&(o.start_time=t),void 0!==i&&(o.limit=i);const n=this.safeInteger(s,"until");s=this.omit(s,["until"]),void 0!==n&&(o.end_time=n);const d=await this.v1PrivatePostPrivateGetOrderHistory(this.extend(o,s)),h=this.safeDict(d,"result",{}),c=this.safeList(h,"data",[]);return this.parseOrders(c,r,t,i)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,i,s);const a=this.market(e),o={instrument_name:a.id};void 0!==t&&(o.start_ts=t),void 0!==i&&(o.count=i);const n=this.safeInteger(s,"until");s=this.omit(s,["until"]),void 0!==n&&(o.end_ts=n);const d=await this.v1PublicGetPublicGetTrades(this.extend(o,s)),h=this.safeDict(d,"result",{}),c=this.safeList(h,"data",[]);return this.parseTrades(c,a,t,i)}async fetchOHLCV(e,t="1m",i=void 0,s=void 0,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate",!1),a)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,i,s,t,r,300);const o=this.market(e),n={instrument_name:o.id,timeframe:this.safeString(this.timeframes,t,t)};void 0!==s&&(s>300&&(s=300),n.count=s);const d=this.microseconds(),h=this.parseTimeframe(t),c=this.safeInteger(r,"until",d);r=this.omit(r,["until"]),void 0!==i?(n.start_ts=i-1e3*h,n.end_ts=void 0!==s?this.sum(i,h*s*1e3):c):n.end_ts=c;const l=await this.v1PublicGetPublicGetCandlestick(this.extend(n,r)),u=this.safeDict(l,"result",{}),f=this.safeList(u,"data",[]);return this.parseOHLCVs(f,o,t,i,s)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s={instrument_name:this.market(e).id};t&&(s.depth=t);const r=await this.v1PublicGetPublicGetBook(this.extend(s,i)),a=this.safeDict(r,"result",{}),o=this.safeList(a,"data",[]),n=this.safeValue(o,0),d=this.safeInteger(n,"t");return this.parseOrderBook(n,e,d)}parseBalance(e){const t=this.safeDict(e,"result",{}),i=this.safeList(t,"data",[]),s=this.safeValue(i[0],"position_balances",[]),r={info:e};for(let e=0;e0){[t,s]=e.split("?");i=s.split("=")[1]}else t=e;return[t,i]}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),await this.loadMarkets();const a=this.safeCurrency(e),o={currency:a.id,amount:t,address:i};let n;void 0!==s&&(o.address_tag=s),[n,r]=this.handleNetworkCodeAndParams(r);const d=this.networkCodeToId(n);void 0!==d&&(o.network_id=d);const h=await this.v1PrivatePostPrivateCreateWithdrawal(this.extend(o,r)),c=this.safeDict(h,"result");return this.parseTransaction(c,a)}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const i={currency:this.safeCurrency(e).id},s=await this.v1PrivatePostPrivateGetDepositAddress(this.extend(i,t)),r=this.safeDict(s,"result",{}),o=this.safeList(r,"deposit_address_list",[]),n=o.length;if(0===n)throw new a.ExchangeError(this.id+" fetchDepositAddressesByNetwork() generating address...");const d={};for(let e=0;e1)throw new a.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;s=this.market(t),i.instrument_name=s.id}const r=await this.v1PrivatePostPrivateGetPositions(this.extend(i,t)),o=this.safeDict(r,"result",{}),n=this.safeList(o,"data",[]),d=[];for(let e=0;e=3)return e.toString();if("string"==typeof e)return e;let i,s="";if(Array.isArray(e))i=e;else{const t=this.keysort(e);i=Object.keys(t)}for(let r=0;r{i.d(t,{A:()=>d});var s=i(3037),r=i(2079),a=i(5147),o=i(1579),n=i(4035);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"cryptomus",name:"Cryptomus",countries:["CA"],rateLimit:100,version:"v2",certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!1,cancelWithdraw:!1,closePosition:!1,createConvertTrade:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!1,createMarketOrder:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopLossOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,createTakeProfitOrder:!1,createTrailingAmountOrder:!1,createTrailingPercentOrder:!1,createTriggerOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchConvertCurrencies:!1,fetchConvertQuote:!1,fetchConvertTrade:!1,fetchConvertTradeHistory:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!1,fetchOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!1,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!1,reduceMargin:!1,sandbox:!1,setLeverage:!1,setMargin:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{},urls:{logo:"https://github.com/user-attachments/assets/8e0b1c48-7c01-4177-9224-f1b01d89d7e7",api:{public:"https://api.cryptomus.com",private:"https://api.cryptomus.com"},www:"https://cryptomus.com",doc:"https://doc.cryptomus.com/personal",fees:"https://cryptomus.com/tariffs",referral:"https://app.cryptomus.com/signup/?ref=JRP4yj"},api:{public:{get:{"v2/user-api/exchange/markets":1,"v2/user-api/exchange/market/price":1,"v1/exchange/market/assets":1,"v1/exchange/market/order-book/{currencyPair}":1,"v1/exchange/market/tickers":1,"v1/exchange/market/trades/{currencyPair}":1}},private:{get:{"v2/user-api/exchange/orders":1,"v2/user-api/exchange/orders/history":1,"v2/user-api/exchange/account/balance":1,"v2/user-api/exchange/account/tariffs":1,"v2/user-api/payment/services":1,"v2/user-api/payout/services":1,"v2/user-api/transaction/list":1},post:{"v2/user-api/exchange/orders":1,"v2/user-api/exchange/orders/market":1},delete:{"v2/user-api/exchange/orders/{orderId}":1}}},fees:{trading:{percentage:!0,feeSide:"get",maker:this.parseNumber("0.02"),taker:this.parseNumber("0.02")}},options:{createMarketBuyOrderRequiresPrice:!0,networks:{BEP20:"bsc",DASH:"dash",POLYGON:"polygon",ARB:"arbitrum",SOL:"sol",TON:"ton",ERC20:"eth",TRC20:"tron",LTC:"ltc",XMR:"xmr",BCH:"bch",DOGE:"doge",AVAX:"avalanche",BTC:"btc",RUB:"rub"},networksById:{bsc:"BEP20",dash:"DASH",polygon:"POLYGON",arbitrum:"ARB",sol:"SOL",ton:"TON",eth:"ERC20",tron:"TRC20",ltc:"LTC",xmr:"XMR",bch:"BCH",doge:"DOGE",avalanche:"AVAX",btc:"BTC",rub:"RUB"},fetchOrderBook:{level:0}},commonCurrencies:{},exceptions:{exact:{500:r.ExchangeError,6:r.InsufficientFunds,"Insufficient funds.":r.InsufficientFunds,"Minimum amount 15 USDT":r.InvalidOrder},broad:{}},precisionMode:o.kb,requiredCredentials:{apiKey:!1,uid:!0},features:{}})}async fetchMarkets(e={}){const t=await this.publicGetV2UserApiExchangeMarkets(e),i=this.safeList(t,"result",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"symbol"),i=t.split("_"),s=i[0],r=i[1],a=this.safeCurrencyCode(s),o=this.safeCurrencyCode(r),n=this.safeDict(this.fees,"trading");return this.safeMarketStructure({id:t,symbol:a+"/"+o,base:a,quote:o,baseId:s,quoteId:r,active:!0,type:"spot",subType:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,contract:!1,settle:void 0,settleId:void 0,contractSize:void 0,linear:void 0,inverse:void 0,taker:this.safeNumber(n,"taker"),maker:this.safeNumber(n,"maker"),percentage:this.safeBool(n,"percentage"),tierBased:void 0,feeSide:this.safeString(n,"feeSide"),expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"quotePrec"))),price:this.parseNumber(this.parsePrecision(this.safeString(e,"basePrec")))},limits:{amount:{min:this.safeNumber(e,"quoteMinSize"),max:this.safeNumber(e,"quoteMaxSize")},price:{min:this.safeNumber(e,"baseMinSize"),max:this.safeNumber(e,"baseMaxSize")},leverage:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e})}async fetchCurrencies(e={}){const t=await this.publicGetV1ExchangeMarketAssets(e),i=this.safeList(t,"result"),s={};for(let e=0;e{i.d(t,{A:()=>d});var s=i(9872),r=i(5147),a=i(1579),o=i(4852),n=i(2079);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"defx",name:"Defx X",rateLimit:100,version:"v1",certified:!1,pro:!1,hostname:"defx.com",dex:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelWithdraw:!1,closeAllPositions:!0,closePosition:!0,createConvertTrade:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!1,createMarketOrder:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!1,createStopLossOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,createTakeProfitOrder:!0,createTrailingAmountOrder:!1,createTrailingPercentOrder:!1,createTriggerOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchCanceledOrders:!0,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchConvertCurrencies:!1,fetchConvertQuote:!1,fetchConvertTrade:!1,fetchConvertTradeHistory:!1,fetchCurrencies:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingInterval:!1,fetchFundingIntervals:!1,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchLedger:!0,fetchLeverage:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrice:!1,fetchMarkPrices:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!1,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!1,reduceMargin:!1,sandbox:!0,setLeverage:!0,setMargin:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","12h":"12h","1d":"1d","1w":"1w","1M":"1M"},urls:{logo:"https://github.com/user-attachments/assets/4e92bace-d7a9-45ea-92be-122168dc87e4",api:{public:"https://api.{hostname}",private:"https://api.{hostname}"},test:{public:"https://api.testnet.{hostname}",private:"https://api.testnet.{hostname}"},www:"https://defx.com/home",doc:["https://docs.defx.com/docs","https://api-docs.defx.com/"],fees:[""],referral:{url:"https://app.defx.com/join/6I2CZ7"}},api:{v1:{public:{get:{"healthcheck/ping":1,"symbols/{symbol}/ohlc":1,"symbols/{symbol}/trades":1,"symbols/{symbol}/prices":1,"symbols/{symbol}/ticker/24hr":1,"symbols/{symbol}/depth/{level}/{slab}":1,"ticker/24HrAgg":1,"c/markets":1,"c/markets/metadata":1,"analytics/market/stats/newUsers":1,"analytics/market/stats/tvl":1,"analytics/market/stats/volumeByInstrument":1,"analytics/market/stats/liquidation":1,"analytics/market/stats/totalVolume":1,"analytics/market/stats/openInterest":1,"analytics/market/stats/totalTrades":1,"analytics/market/stats/basis":1,"analytics/market/stats/insuranceFund":1,"analytics/market/stats/longAndShortRatio":1,"analytics/market/stats/fundingRate":1,"analytics/market/overview":1,"explorer/search":1,"explorer/transactions":1,"explorer/blocks":1}},private:{get:{"api/order/{orderId}":1,"api/orders":1,"api/orders/oco/{parentOrderId}":1,"api/trades":1,"api/position/active":1,"api/users/metadata/leverage":1,"api/users/metadata/feeMultiplier":1,"api/users/metadata/slippage":1,"api/users/referral":1,"api/users/apikeys":1,"connection-signature-message/evm":1,"api/users/profile/wallets":1,"api/notifications":1,"api/wallet/balance":1,"api/wallet/transactions":1,"api/analytics/user/overview":1,"api/analytics/user/pnl":1,"api/analytics/points/overview":1,"api/analytics/points/history":1},post:{"api/order":1,"api/position/oco":1,"api/users/socket/listenKeys":1,"api/users/metadata/leverage":1,"api/users/metadata/feeMultiplier":1,"api/users/metadata/slippage":1,"api/users/referral/recordReferralSignup":1,"api/users/apikeys":1,"api/users/profile/wallets":1,"api/transfers/withdrawal":1,"api/transfers/bridge/withdrawal":1},put:{"api/position/updatePositionMargin":1,"api/users/socket/listenKeys/{listenKey}":1,"api/users/apikeys/{accessKey}/status":1,"api/users/referral":1},patch:{"api/users/apikeys/{accessKey}":1},delete:{"api/orders/allOpen":1,"api/order/{orderId}":1,"api/position/{positionId}":1,"api/position/all":1,"api/users/socket/listenKeys/{listenKey}":1,"api/users/apikeys/{accessKey}":1}}}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.0002"),taker:this.parseNumber("0.0005")}},options:{sandboxMode:!1},features:{spot:void 0,forDerivatives:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!1},triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:void 0,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!0,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:500,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:500,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:{extends:"forDerivatives"},inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{},exceptions:{exact:{404:n.BadRequest,missing_auth_signature:n.AuthenticationError,order_rejected:n.InvalidOrder,invalid_order_id:n.InvalidOrder,filter_lotsize_maxqty:n.InvalidOrder,filter_notional_min:n.InvalidOrder,failed_index_price_up_multiplier_filter:n.InvalidOrder,no_open_orders:n.InvalidOrder,active_position_not_found:n.InvalidOrder,position_inactive:n.InvalidOrder,invalid_position_id:n.InvalidOrder,"Internal server error":n.ExchangeError},broad:{"Bad Request":n.BadRequest}},precisionMode:a.kb})}async fetchStatus(e={}){const t=await this.v1PublicGetHealthcheckPing(e);let i;return i=this.safeBool(t,"success")?"ok":"error",{status:i,updated:void 0,eta:void 0,url:void 0,info:t}}async fetchTime(e={}){const t=await this.v1PublicGetHealthcheckPing(e);return this.safeInteger(t,"t")}async fetchMarkets(e={}){const t={type:"perps"},i=[this.v1PublicGetCMarkets(this.extend(t,e)),this.v1PublicGetCMarketsMetadata(this.extend(t,e))],s=await Promise.all(i),r=this.safeList(s[0],"data"),a=this.indexBy(r,"market"),o=this.safeList(s[1],"data");for(let e=0;e=0?p=this.safeString(e,"stopPrice"):m=this.safeString(e,"stopPrice"));const g=this.parse8601(this.safeString(e,"createdAt")),v=this.parse8601(this.safeString(e,"updatedAt"));return this.safeOrder({id:i,clientOrderId:s,timestamp:g,datetime:this.iso8601(g),lastTradeTimestamp:v,lastUpdateTimestamp:v,status:this.parseOrderStatus(h),symbol:a,type:d,timeInForce:f,postOnly:this.safeBool(e,"postOnly"),reduceOnly:this.safeBool(e,"reduceOnly"),side:c,price:o,triggerPrice:m,takeProfitPrice:p,stopLossPrice:void 0,average:u,amount:n,filled:l,remaining:void 0,cost:void 0,trades:void 0,fee:{cost:this.safeString(e,"totalFee"),currency:"USDC"},info:e},t)}async cancelOrder(e,t=void 0,i={}){await this.loadMarkets();const s={orderId:e,idType:"orderId"},r=this.safeStringN(i,["clOrdID","clientOrderId","client_order_id"]),a=void 0!==r;if(a){if(void 0===t)throw new n.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");const e=this.market(t);s.orderId=r,s.idType="clientOrderId",s.symbol=e.id}i=this.omit(i,["clOrdID","clientOrderId","client_order_id"]);const o=await this.v1PrivateDeleteApiOrderOrderId(this.extend(s,i)),d={symbol:t};return a?d.clientOrderId=r:d.id=e,this.extend(this.parseOrder(o),d)}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const i={symbols:[this.market(e).id]};return await this.v1PrivateDeleteApiOrdersAllOpen(this.extend(i,t))}async fetchPosition(e,t={}){if(void 0===e)throw new n.ArgumentsRequired(this.id+" fetchPosition() requires a symbol argument");await this.loadMarkets();const i=this.market(e),s={symbol:i.id},r=await this.v1PrivateGetApiPositionActive(this.extend(s,t)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{});return this.parsePosition(o,i)}async fetchPositions(e=void 0,t={}){await this.loadMarkets();const i=await this.v1PrivateGetApiPositionActive(t),s=this.safeList(i,"data",[]);return this.parsePositions(s,e)}parsePosition(e,t=void 0){const i=this.safeString(e,"symbol");t=this.safeMarket(i,t);const s=r.Y.stringAbs(this.safeString(e,"quantity")),a=this.safeStringLower(e,"positionSide"),o=this.omitZero(this.safeString(e,"pnl")),n=this.omitZero(this.safeString(e,"entryPrice")),d=this.safeString(e,"marginAmount");return this.safePosition({info:e,id:this.safeString(e,"positionId"),symbol:t.symbol,timestamp:void 0,datetime:void 0,lastUpdateTimestamp:void 0,initialMargin:this.parseNumber(d),initialMarginPercentage:void 0,maintenanceMargin:void 0,maintenanceMarginPercentage:void 0,entryPrice:this.parseNumber(n),notional:void 0,leverage:void 0,unrealizedPnl:this.parseNumber(o),realizedPnl:void 0,contracts:this.parseNumber(s),contractSize:this.safeNumber(t,"contractSize"),marginRatio:void 0,liquidationPrice:void 0,markPrice:void 0,lastPrice:void 0,collateral:void 0,marginMode:void 0,side:a,percentage:void 0,stopLossPrice:void 0,takeProfitPrice:void 0,hedged:void 0})}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const s={orderId:e,idType:"orderId"},r=this.safeStringN(i,["clOrdID","clientOrderId","client_order_id"]);if(i=this.omit(i,["clOrdID","clientOrderId","client_order_id"]),void 0!==r){if(void 0===t)throw new n.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");const e=this.market(t);s.orderId=r,s.idType="clientOrderId",s.symbol=e.id}const a=await this.v1PrivateGetApiOrderOrderId(this.extend(s,i)),o=this.safeDict(a,"data");return this.parseOrder(o)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};if(void 0!==e){const t=this.market(e);r.symbols=t.id}const a=this.safeInteger(s,"until");if(void 0!==a&&(s=this.omit(s,"until"),r.end=this.iso8601(a)),void 0!==t&&(r.start=this.iso8601(t)),void 0!==i){const e=100;i=Math.min(e,i),r.pageSize=i}const o=await this.v1PrivateGetApiOrders(this.extend(r,s)),n=this.safeList(o,"data",[]);return this.parseOrders(n,void 0,t,i)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrders(e,t,i,this.extend({statuses:"OPEN"},s))}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrders(e,t,i,this.extend({statuses:"FILLED"},s))}async fetchCanceledOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrders(e,t,i,this.extend({statuses:"CANCELED"},s))}async closePosition(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeString(i,"positionId");if(void 0===s)throw new n.ArgumentsRequired(this.id+" closePosition() requires a positionId");const r=this.safeStringUpper(i,"type");if(void 0===r)throw new n.ArgumentsRequired(this.id+" closePosition() requires a type");const a=this.safeString(i,"quantity");if(void 0===a)throw new n.ArgumentsRequired(this.id+" closePosition() requires a quantity");const o={positionId:s,type:r,quantity:a};if("MARKET"!==r){const e=this.safeString(i,"price");if(void 0===e)throw new n.ArgumentsRequired(this.id+" closePosition() requires a price");o.price=e}i=this.omit(i,["positionId","type","quantity","price"]);return await this.v1PrivateDeleteApiPositionPositionId(this.extend(o,i))}async closeAllPositions(e={}){await this.loadMarkets();const t=await this.v1PrivateDeleteApiPositionAll(e),i=this.safeList(t,"data",[]);return this.parsePositions(i,void 0,e)}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchLedger","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchLedger",e,t,i,s);const a={};a.start=void 0!==t?t:0;const o=this.safeInteger(s,"until");void 0!==o?(s=this.omit(s,"until"),a.end=o):a.end=this.milliseconds();const n=await this.v1PrivateGetApiWalletTransactions(this.extend(a,s)),d=this.safeList(n,"transactions",[]);return this.parseLedger(d,void 0,t,i)}parseLedgerEntry(e,t=void 0){const i=this.safeString(e,"amount"),s=this.safeString(e,"asset"),r=this.safeCurrencyCode(s,t);t=this.safeCurrency(s,t);const a=this.safeInteger(e,"timestamp"),o=this.safeString(e,"type");return this.safeLedgerEntry({info:e,id:this.safeString(e,"id"),direction:void 0,account:void 0,referenceAccount:void 0,referenceId:void 0,type:this.parseLedgerEntryType(o),currency:r,amount:this.parseNumber(i),timestamp:a,datetime:this.iso8601(a),before:void 0,after:void 0,status:void 0,fee:void 0},t)}parseLedgerEntryType(e){return this.safeString({FundingFee:"fee",FeeRebate:"fee",FeeKickback:"fee",RealizedPnl:"trade",LiquidationClearance:"trade",Transfer:"transfer",ReferralPayout:"referral",Commission:"commission"},e,e)}async withdraw(e,t,i,s=void 0,r={}){await this.loadMarkets();const a=this.currency(e),o={amount:this.currencyToPrecision(e,t),asset:a.id},n=await this.v1PrivatePostApiTransfersBridgeWithdrawal(this.extend(o,r));return this.parseTransaction(n,a)}parseTransaction(e,t=void 0){return{info:e,id:void 0,txid:this.safeString(e,"transactionId"),timestamp:void 0,datetime:void 0,network:void 0,address:void 0,addressTo:void 0,addressFrom:void 0,tag:void 0,tagTo:void 0,tagFrom:void 0,type:void 0,amount:void 0,currency:this.safeCurrencyCode(void 0,t),status:void 0,updated:void 0,internal:void 0,comment:void 0,fee:void 0}}async setLeverage(e,t=void 0,i={}){if(void 0===t)throw new n.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();const s={leverage:this.numberToString(e)},r=this.market(t);s.symbol=r.id;const a=await this.v1PrivatePostApiUsersMetadataLeverage(this.extend(s,i)),o=this.safeDict(a,"data",{});return this.parseLeverage(o,r)}parseLeverage(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeInteger(e,"leverage");return{info:e,symbol:this.safeSymbol(i,t),marginMode:void 0,longLeverage:s,shortLeverage:s}}nonce(){return this.milliseconds()}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){const n=t[0],d=t[1],h=this.implodeParams(e,s);let c=this.implodeHostname(this.urls.api[d]);if(c+="/"+n+"/",s=this.omit(s,this.extractParams(e)),s=this.keysort(s),"public"===d)c+="open/"+h,Object.keys(s).length&&(c+="?"+this.rawencode(s));else{this.checkRequiredCredentials(),r={"X-DEFX-SOURCE":"ccxt"},c+="auth/"+h;const t=this.milliseconds().toString();let n=t;"GET"===i||"api/order/{orderId}"===e?(n+=this.rawencode(s),Object.keys(s).length&&(c+="?"+this.rawencode(s))):(void 0!==s&&(n+=a=this.json(s)),r["Content-Type"]="application/json");const d=this.hmac(this.encode(n),this.encode(this.secret),o.s);r["X-DEFX-APIKEY"]=this.apiKey,r["X-DEFX-TIMESTAMP"]=t,r["X-DEFX-SIGNATURE"]=d}return{url:c,method:i,body:a,headers:r}}handleErrors(e,t,i,s,r,a,o,n,d){if(!o)return;const h=this.safeBool(o,"success"),c=this.safeDict(o,"err",o),l=this.safeString2(c,"errorCode","code");if(!h){const e=this.id+" "+this.json(o);this.throwBroadlyMatchedException(this.exceptions.broad,a,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e)}}defaultNetworkCodeForCurrency(e){const t=this.currency(e).networks,i=Object.keys(t);for(let e=0;e{i.d(t,{A:()=>d});var s=i(7227),r=i(2079),a=i(1579),o=i(5147),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"delta",name:"Delta Exchange",countries:["VC"],rateLimit:300,version:"v2",has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!0,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!0,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!0,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:void 0,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchMarginMode:!0,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!1,fetchOrderBook:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTransfer:void 0,fetchTransfers:void 0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawal:void 0,fetchWithdrawals:void 0,reduceMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","1d":"1d","7d":"7d","1w":"1w","2w":"2w","1M":"30d"},urls:{logo:"https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg",test:{public:"https://testnet-api.delta.exchange",private:"https://testnet-api.delta.exchange"},api:{public:"https://api.delta.exchange",private:"https://api.delta.exchange"},www:"https://www.delta.exchange",doc:["https://docs.delta.exchange"],fees:"https://www.delta.exchange/fees",referral:"https://www.delta.exchange/app/signup/?code=IULYNB"},api:{public:{get:["assets","indices","products","products/{symbol}","tickers","tickers/{symbol}","l2orderbook/{symbol}","trades/{symbol}","stats","history/candles","history/sparklines","settings"]},private:{get:["orders","products/{product_id}/orders/leverage","positions/margined","positions","orders/history","fills","fills/history/download/csv","wallet/balances","wallet/transactions","wallet/transactions/download","wallets/sub_accounts_transfer_history","users/trading_preferences","sub_accounts","profile","deposits/address","orders/leverage"],post:["orders","orders/bracket","orders/batch","products/{product_id}/orders/leverage","positions/change_margin","positions/close_all","wallets/sub_account_balance_transfer","orders/cancel_after","orders/leverage"],put:["orders","orders/bracket","orders/batch","positions/auto_topup","users/update_mmp","users/reset_mmp"],delete:["orders","orders/all","orders/batch"]}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0015"),maker:this.parseNumber("0.0010"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100"),this.parseNumber("0.0013")],[this.parseNumber("250"),this.parseNumber("0.0013")],[this.parseNumber("1000"),this.parseNumber("0.001")],[this.parseNumber("5000"),this.parseNumber("0.0009")],[this.parseNumber("10000"),this.parseNumber("0.00075")],[this.parseNumber("20000"),this.parseNumber("0.00065")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("100"),this.parseNumber("0.001")],[this.parseNumber("250"),this.parseNumber("0.0009")],[this.parseNumber("1000"),this.parseNumber("0.00075")],[this.parseNumber("5000"),this.parseNumber("0.0006")],[this.parseNumber("10000"),this.parseNumber("0.0005")],[this.parseNumber("20000"),this.parseNumber("0.0005")]]}}},options:{networks:{TRC20:"TRC20(TRON)",BEP20:"BEP20(BSC)"}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!0},timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,iceberg:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:500,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:2e3}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:{extends:"default"},inverse:{extends:"default"}}},precisionMode:a.kb,requiredCredentials:{apiKey:!0,secret:!0},exceptions:{exact:{insufficient_margin:r.InsufficientFunds,order_size_exceed_available:r.InvalidOrder,risk_limits_breached:r.BadRequest,invalid_contract:r.BadSymbol,immediate_liquidation:r.InvalidOrder,out_of_bankruptcy:r.InvalidOrder,self_matching_disrupted_post_only:r.InvalidOrder,immediate_execution_post_only:r.InvalidOrder,bad_schema:r.BadRequest,invalid_api_key:r.AuthenticationError,invalid_signature:r.AuthenticationError,open_order_not_found:r.OrderNotFound,unavailable:r.ExchangeNotAvailable},broad:{}}})}createExpiredOptionMarket(e){const t="USDT",i=e.split("-"),s=e.split("/");let r,a,o;e.indexOf("/")>-1?(r=this.safeString(s,0),a=this.safeString(i,1),o=this.safeString(i,3)):(r=this.safeString(i,1),a=this.safeString(i,3),o=this.safeString(i,0)),void 0!==a&&(a=a.slice(4)+a.slice(2,4)+a.slice(0,2));const n=t,d=this.safeString(i,2),h=this.convertExpireDate(a),c=this.parse8601(h);return{id:o+"-"+r+"-"+d+"-"+a,symbol:r+"/"+t+":"+n+"-"+a+"-"+d+"-"+o,base:r,quote:t,settle:n,baseId:r,quoteId:t,settleId:n,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:this.parseNumber("1"),expiry:c,expiryDatetime:h,optionType:"C"===o?"call":"put",strike:this.parseNumber(d),precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return void 0!==e&&(e.endsWith("-C")||e.endsWith("-P")||e.startsWith("C-")||e.startsWith("P-"))&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,i,s)}async fetchTime(e={}){const t=await this.publicGetSettings(e),i=this.safeDict(t,"result",{});return this.safeIntegerProduct(i,"server_time",.001)}async fetchStatus(e={}){const t=await this.publicGetSettings(e),i=this.safeDict(t,"result",{});return{status:"true"===this.safeString(i,"under_maintenance")?"maintenance":"ok",updated:this.safeIntegerProduct(i,"server_time",.001,this.milliseconds()),eta:void 0,url:void 0,info:t}}async fetchCurrencies(e={}){const t=await this.publicGetAssets(e),i=this.safeList(t,"result",[]),s={};for(let e=0;e{i.d(t,{A:()=>h});var s=i(4012),r=i(1579),a=i(2079),o=i(5147),n=i(4852),d=i(8995);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"deribit",name:"Deribit",countries:["NL"],version:"v2",userAgent:void 0,rateLimit:50,pro:!0,has:{CORS:!0,spot:!1,margin:!1,swap:!0,future:!0,option:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!0,createOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFees:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchGreeks:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!0,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!0,fetchWithdrawal:!1,fetchWithdrawals:!0,sandbox:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"1","3m":"3","5m":"5","10m":"10","15m":"15","30m":"30","1h":"60","2h":"120","3h":"180","6h":"360","12h":"720","1d":"1D"},urls:{test:{rest:"https://test.deribit.com"},logo:"https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg",api:{rest:"https://www.deribit.com"},www:"https://www.deribit.com",doc:["https://docs.deribit.com/v2","https://github.com/deribit"],fees:"https://www.deribit.com/pages/information/fees",referral:{url:"https://www.deribit.com/reg-1189.4038",discount:.1}},api:{public:{get:{auth:1,exchange_token:1,fork_token:1,set_heartbeat:1,disable_heartbeat:1,get_time:1,hello:1,status:1,test:1,subscribe:1,unsubscribe:1,unsubscribe_all:1,get_announcements:1,get_book_summary_by_currency:1,get_book_summary_by_instrument:1,get_contract_size:1,get_currencies:1,get_delivery_prices:1,get_funding_chart_data:1,get_funding_rate_history:1,get_funding_rate_value:1,get_historical_volatility:1,get_index:1,get_index_price:1,get_index_price_names:1,get_instrument:1,get_instruments:1,get_last_settlements_by_currency:1,get_last_settlements_by_instrument:1,get_last_trades_by_currency:1,get_last_trades_by_currency_and_time:1,get_last_trades_by_instrument:1,get_last_trades_by_instrument_and_time:1,get_mark_price_history:1,get_order_book:1,get_trade_volumes:1,get_tradingview_chart_data:1,get_volatility_index_data:1,ticker:1}},private:{get:{logout:1,enable_cancel_on_disconnect:1,disable_cancel_on_disconnect:1,get_cancel_on_disconnect:1,subscribe:1,unsubscribe:1,unsubscribe_all:1,change_api_key_name:1,change_scope_in_api_key:1,change_subaccount_name:1,create_api_key:1,create_subaccount:1,disable_api_key:1,disable_tfa_for_subaccount:1,enable_affiliate_program:1,enable_api_key:1,get_access_log:1,get_account_summary:1,get_account_summaries:1,get_affiliate_program_info:1,get_email_language:1,get_new_announcements:1,get_portfolio_margins:1,get_position:1,get_positions:1,get_subaccounts:1,get_subaccounts_details:1,get_transaction_log:1,list_api_keys:1,remove_api_key:1,remove_subaccount:1,reset_api_key:1,set_announcement_as_read:1,set_api_key_as_default:1,set_email_for_subaccount:1,set_email_language:1,set_password_for_subaccount:1,toggle_notifications_from_subaccount:1,toggle_subaccount_login:1,execute_block_trade:4,get_block_trade:1,get_last_block_trades_by_currency:1,invalidate_block_trade_signature:1,verify_block_trade:4,buy:4,sell:4,edit:4,edit_by_label:4,cancel:4,cancel_all:4,cancel_all_by_currency:4,cancel_all_by_instrument:4,cancel_by_label:4,close_position:4,get_margins:1,get_mmp_config:1,get_open_orders_by_currency:1,get_open_orders_by_instrument:1,get_order_history_by_currency:1,get_order_history_by_instrument:1,get_order_margin_by_ids:1,get_order_state:1,get_stop_order_history:1,get_trigger_order_history:1,get_user_trades_by_currency:1,get_user_trades_by_currency_and_time:1,get_user_trades_by_instrument:1,get_user_trades_by_instrument_and_time:1,get_user_trades_by_order:1,reset_mmp:1,set_mmp_config:1,get_settlement_history_by_instrument:1,get_settlement_history_by_currency:1,cancel_transfer_by_id:1,cancel_withdrawal:1,create_deposit_address:1,get_current_deposit_address:1,get_deposits:1,get_transfers:1,get_withdrawals:1,submit_transfer_to_subaccount:1,submit_transfer_to_user:1,withdraw:1}}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,selfTradePrevention:!1,trailing:!0,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:100,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1e3}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:{extends:"default"},inverse:{extends:"default"}}},exceptions:{9999:a.PermissionDenied,1e4:a.AuthenticationError,10001:a.ExchangeError,10002:a.InvalidOrder,10003:a.InvalidOrder,10004:a.OrderNotFound,10005:a.InvalidOrder,10006:a.InvalidOrder,10007:a.InvalidOrder,10008:a.InvalidOrder,10009:a.InsufficientFunds,10010:a.OrderNotFound,10011:a.InvalidOrder,10012:a.InvalidOrder,10013:a.PermissionDenied,10014:a.PermissionDenied,10015:a.PermissionDenied,10016:a.PermissionDenied,10017:a.PermissionDenied,10018:a.PermissionDenied,10019:a.PermissionDenied,10020:a.ExchangeError,10021:a.InvalidOrder,10022:a.InvalidOrder,10023:a.InvalidOrder,10024:a.InvalidOrder,10025:a.InvalidOrder,10026:a.InvalidOrder,10027:a.InvalidOrder,10028:a.DDoSProtection,10029:a.OrderNotFound,10030:a.ExchangeError,10031:a.ExchangeError,10032:a.InvalidOrder,10033:a.NotSupported,10034:a.InvalidOrder,10035:a.InvalidOrder,10036:a.InvalidOrder,10040:a.ExchangeNotAvailable,10041:a.OnMaintenance,10043:a.InvalidOrder,10044:a.InvalidOrder,10045:a.InvalidOrder,10046:a.InvalidOrder,10047:a.DDoSProtection,10048:a.ExchangeError,11008:a.InvalidOrder,11029:a.BadRequest,11030:a.ExchangeError,11031:a.ExchangeError,11035:a.DDoSProtection,11036:a.InvalidOrder,11037:a.BadRequest,11038:a.InvalidOrder,11039:a.InvalidOrder,11041:a.InvalidOrder,11042:a.PermissionDenied,11043:a.BadRequest,11044:a.InvalidOrder,11045:a.BadRequest,11046:a.BadRequest,11047:a.BadRequest,11048:a.ExchangeError,11049:a.BadRequest,11050:a.BadRequest,11051:a.OnMaintenance,11052:a.ExchangeError,11053:a.ExchangeError,11090:a.InvalidAddress,11091:a.InvalidAddress,11092:a.InvalidAddress,11093:a.DDoSProtection,11094:a.ExchangeError,11095:a.ExchangeError,11096:a.ExchangeError,12e3:a.AuthenticationError,12001:a.DDoSProtection,12002:a.ExchangeError,12998:a.AuthenticationError,12003:a.AuthenticationError,12004:a.AuthenticationError,12005:a.AuthenticationError,12100:a.ExchangeError,12999:a.AuthenticationError,13e3:a.AuthenticationError,13001:a.AuthenticationError,13002:a.PermissionDenied,13003:a.AuthenticationError,13004:a.AuthenticationError,13005:a.AuthenticationError,13006:a.AuthenticationError,13007:a.AuthenticationError,13008:a.ExchangeError,13009:a.AuthenticationError,13010:a.BadRequest,13011:a.BadRequest,13012:a.PermissionDenied,13013:a.BadRequest,13014:a.BadRequest,13015:a.BadRequest,13016:a.BadRequest,13017:a.ExchangeError,13018:a.ExchangeError,13019:a.ExchangeError,13020:a.ExchangeError,13021:a.PermissionDenied,13025:a.ExchangeError,"-32602":a.BadRequest,"-32601":a.BadRequest,"-32700":a.BadRequest,"-32000":a.BadRequest,11054:a.InvalidOrder},precisionMode:r.kb,options:{code:"BTC",fetchBalance:{code:"BTC"},transfer:{method:"privateGetSubmitTransferToSubaccount"}}})}createExpiredOptionMarket(e){let t,i="USD";const s=e.split("-"),r=e.split("/");let a,o;e.indexOf("/")>-1?(a=this.safeString(r,0),o=this.safeString(s,1),e.indexOf("USDC")>-1&&(a+="_USDC")):(a=this.safeString(s,0),o=this.convertMarketIdExpireDate(this.safeString(s,1))),e.indexOf("USDC")>-1?(i="USDC",t="USDC"):t=a;let n=a;if(a.indexOf("_")>-1){const e=a.split("_");n=this.safeString(e,0)}const d=this.safeString(s,2),h=this.safeString(s,3),c=this.convertExpireDate(o),l=this.parse8601(c);return{id:a+"-"+this.convertExpireDateToMarketIdDate(o)+"-"+d+"-"+h,symbol:n+"/"+i+":"+t+"-"+o+"-"+d+"-"+h,base:a,quote:i,settle:t,baseId:a,quoteId:i,settleId:t,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:void 0,expiry:l,expiryDatetime:c,optionType:"C"===h?"call":"put",strike:this.parseNumber(d),precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return void 0!==e&&(e.endsWith("-C")||e.endsWith("-P"))&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,i,s)}async fetchTime(e={}){const t=await this.publicGetGetTime(e);return this.safeInteger(t,"result")}async fetchCurrencies(e={}){const t=await this.publicGetGetCurrencies(e),i=this.safeList(t,"result",[]),s={};for(let e=0;e=0,g=a.indexOf("option")>=0,v=a.indexOf("combo")>=0,y=this.safeInteger(t,"expiration_timestamp");let w,b,k,S,O=n,T="swap";if(m?T="future":g?T="option":o&&(T="spot"),o)O=l+"/"+u;else if(!v){if(O=l+"/"+u+":"+f,(g||m)&&(O=O+"-"+this.yymmdd(y,""),g)){w=this.safeNumber(t,"strike"),b=this.safeString(t,"option_type");const e="call"===b?"C":"P";O=O+"-"+this.numberToString(w)+"-"+e}k=u!==f,S=f===u}if(this.safeValue(s,O))continue;s[O]=!0;const P=this.safeNumber(t,"min_trade_amount"),I=this.safeNumber(t,"tick_size");i.push({id:n,symbol:O,base:l,quote:u,settle:f,baseId:d,quoteId:h,settleId:c,type:T,spot:o,margin:!1,swap:p,future:m,option:g,active:this.safeValue(t,"is_active"),contract:!o,linear:S,inverse:k,taker:this.safeNumber(t,"taker_commission"),maker:this.safeNumber(t,"maker_commission"),contractSize:this.safeNumber(t,"contract_size"),expiry:y,expiryDatetime:this.iso8601(y),strike:w,optionType:b,precision:{amount:P,price:I},limits:{leverage:{min:void 0,max:void 0},amount:{min:P,max:void 0},price:{min:I,max:void 0},cost:{min:void 0,max:void 0}},created:this.safeInteger(t,"creation_timestamp"),info:t})}}return i}parseBalance(e){const t={info:e};let i=[];i="summaries"in e?this.safeList(e,"summaries"):[e];for(let e=0;e0){const s=t[0],r=t[i-1];s.continuation=e,r.continuation=e,t[0]=s,t[i-1]=r}}return t}async fetchMyLiquidations(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new a.ArgumentsRequired(this.id+" fetchMyLiquidations() requires a symbol argument");await this.loadMarkets();const r=this.market(e);if(r.spot)throw new a.NotSupported(this.id+" fetchMyLiquidations() does not support "+r.type+" markets");const o={instrument_name:r.id,type:"bankruptcy"};void 0!==t&&(o.search_start_timestamp=t),void 0!==i&&(o.count=i);const n=await this.privateGetGetSettlementHistoryByInstrument(this.extend(o,s)),d=this.safeValue(n,"result",{}),h=this.safeList(d,"settlements",[]);return this.parseLiquidations(h,r,t,i)}parseLiquidation(e,t=void 0){const i=this.safeInteger(e,"timestamp");return this.safeLiquidation({info:e,symbol:this.safeSymbol(void 0,t),contracts:void 0,contractSize:this.safeNumber(t,"contractSize"),price:void 0,baseValue:this.safeNumber(e,"session_bankrupcy"),quoteValue:void 0,timestamp:i,datetime:this.iso8601(i)})}async fetchGreeks(e,t={}){await this.loadMarkets();const i=this.market(e),s={instrument_name:i.id},r=await this.publicGetTicker(this.extend(s,t)),a=this.safeValue(r,"result",{});return this.parseGreeks(a,i)}parseGreeks(e,t=void 0){const i=this.safeInteger(e,"timestamp"),s=this.safeString(e,"instrument_name"),r=this.safeSymbol(s,t),a=this.safeValue(e,"greeks",{});return{symbol:r,timestamp:i,datetime:this.iso8601(i),delta:this.safeNumber(a,"delta"),gamma:this.safeNumber(a,"gamma"),theta:this.safeNumber(a,"theta"),vega:this.safeNumber(a,"vega"),rho:this.safeNumber(a,"rho"),bidSize:this.safeNumber(e,"best_bid_amount"),askSize:this.safeNumber(e,"best_ask_amount"),bidImpliedVolatility:this.safeNumber(e,"bid_iv"),askImpliedVolatility:this.safeNumber(e,"ask_iv"),markImpliedVolatility:this.safeNumber(e,"mark_iv"),bidPrice:this.safeNumber(e,"best_bid_price"),askPrice:this.safeNumber(e,"best_ask_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:this.safeNumber(e,"last_price"),underlyingPrice:this.safeNumber(e,"underlying_price"),info:e}}async fetchOption(e,t={}){await this.loadMarkets();const i=this.market(e),s={instrument_name:i.id},r=await this.publicGetGetBookSummaryByInstrument(this.extend(s,t)),a=this.safeList(r,"result",[]),o=this.safeDict(a,0,{});return this.parseOption(o,void 0,i)}async fetchOptionChain(e,t={}){await this.loadMarkets();const i={currency:this.currency(e).id,kind:"option"},s=await this.publicGetGetBookSummaryByCurrency(this.extend(i,t)),r=this.safeList(s,"result",[]);return this.parseOptionChain(r,"base_currency","instrument_name")}parseOption(e,t=void 0,i=void 0){const s=this.safeString(e,"instrument_name");i=this.safeMarket(s,i);const r=this.safeString(e,"base_currency"),a=this.safeCurrencyCode(r,t),o=this.safeInteger(e,"timestamp");return{info:e,currency:a,symbol:i.symbol,timestamp:o,datetime:this.iso8601(o),impliedVolatility:void 0,openInterest:this.safeNumber(e,"open_interest"),bidPrice:this.safeNumber(e,"bid_price"),askPrice:this.safeNumber(e,"ask_price"),midPrice:this.safeNumber(e,"mid_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:this.safeNumber(e,"last"),underlyingPrice:this.safeNumber(e,"underlying_price"),change:void 0,percentage:this.safeNumber(e,"price_change"),baseVolume:this.safeNumber(e,"volume"),quoteVolume:this.safeNumber(e,"volume_usd")}}nonce(){return this.milliseconds()}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+t+"/"+e;if("public"===t&&Object.keys(s).length&&(o+="?"+this.urlencode(s)),"private"===t){this.checkRequiredCredentials();const e=this.nonce().toString(),t=this.milliseconds().toString(),a="";Object.keys(s).length&&(o+="?"+this.urlencode(s));const d=t+"\n"+e+"\n"+(i+"\n"+o+"\n"+a+"\n"),h=this.hmac(this.encode(d),this.encode(this.secret),n.s);r={Authorization:"deri-hmac-sha256 id="+this.apiKey+",ts="+t+",sig="+h+",nonce="+e}}return{url:this.urls.api.rest+o,method:i,body:a,headers:r}}handleErrors(e,t,i,s,r,o,n,d,h){if(!n)return;const c=this.safeValue(n,"error");if(void 0!==c){const e=this.safeString(c,"code"),t=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions,e,t),new a.ExchangeError(t)}}}},1839:(e,t,i)=>{i.d(t,{A:()=>c});var s=i(970),r=i(5147),a=i(2079),o=i(8283),n=i(8432),d=i(987),h=i(1579);class c extends s.A{describe(){return this.deepExtend(super.describe(),{id:"derive",name:"derive",countries:[],version:"v1",rateLimit:50,certified:!1,pro:!0,dex:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!1,cancelOrdersForSymbols:!1,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!1,createReduceOnlyOrder:!1,createStopOrder:!1,createTriggerOrder:!1,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchMarginMode:void 0,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenInterests:!1,fetchOpenOrders:!0,fetchOrder:!1,fetchOrderBook:!1,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!1,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},hostname:"derive.xyz",urls:{logo:"https://github.com/user-attachments/assets/f835b95f-033a-43dd-b6bb-24e698fc498c",api:{public:"https://api.lyra.finance/public",private:"https://api.lyra.finance/private"},test:{public:"https://api-demo.lyra.finance/public",private:"https://api-demo.lyra.finance/private"},www:"https://www.derive.xyz/",doc:"https://docs.derive.xyz/docs/",fees:"https://docs.derive.xyz/reference/fees-1/",referral:"https://www.derive.xyz/invite/3VB0B"},api:{public:{get:["get_all_currencies"],post:["build_register_session_key_tx","register_session_key","deregister_session_key","login","statistics","get_all_currencies","get_currency","get_instrument","get_all_instruments","get_instruments","get_ticker","get_latest_signed_feeds","get_option_settlement_prices","get_spot_feed_history","get_spot_feed_history_candles","get_funding_rate_history","get_trade_history","get_option_settlement_history","get_liquidation_history","get_interest_rate_history","get_transaction","get_margin","margin_watch","validate_invite_code","get_points","get_all_points","get_points_leaderboard","get_descendant_tree","get_tree_roots","get_swell_percent_points","get_vault_assets","get_etherfi_effective_balances","get_kelp_effective_balances","get_bridge_balances","get_ethena_participants","get_vault_share","get_vault_statistics","get_vault_balances","estimate_integrator_points","create_subaccount_debug","deposit_debug","withdraw_debug","send_quote_debug","execute_quote_debug","get_invite_code","register_invite","get_time","get_live_incidents","get_maker_programs","get_maker_program_scores"]},private:{post:["get_account","create_subaccount","get_subaccount","get_subaccounts","get_all_portfolios","change_subaccount_label","get_notificationsv","update_notifications","deposit","withdraw","transfer_erc20","transfer_position","transfer_positions","order","replace","order_debug","get_order","get_orders","get_open_orders","cancel","cancel_by_label","cancel_by_nonce","cancel_by_instrument","cancel_all","cancel_trigger_order","get_order_history","get_trade_history","get_deposit_history","get_withdrawal_history","send_rfq","cancel_rfq","cancel_batch_rfqs","get_rfqs","poll_rfqs","send_quote","cancel_quote","cancel_batch_quotes","get_quotes","poll_quotes","execute_quote","rfq_get_best_quote","get_margin","get_collaterals","get_positions","get_option_settlement_history","get_subaccount_value_history","expired_and_cancelled_history","get_funding_history","get_interest_history","get_erc20_transfer_history","get_liquidation_history","liquidate","get_liquidator_history","session_keys","edit_session_key","register_scoped_session_key","get_mmp_config","set_mmp_config","reset_mmp","set_cancel_on_disconnect","get_invite_code","register_invite"]}},fees:{},requiredCredentials:{apiKey:!1,secret:!1,walletAddress:!0,privateKey:!0},exceptions:{exact:{"-32000":a.RateLimitExceeded,"-32100":a.RateLimitExceeded,"-32700":a.BadRequest,"-32600":a.BadRequest,"-32601":a.BadRequest,"-32602":a.InvalidOrder,"-32603":a.InvalidOrder,9e3:a.InvalidOrder,1e4:a.BadRequest,10001:a.BadRequest,10002:a.BadRequest,10003:a.BadRequest,10004:a.InvalidOrder,10005:a.BadRequest,10006:a.BadRequest,10007:a.BadRequest,10008:a.BadRequest,10009:a.BadRequest,10010:a.InvalidOrder,10011:a.InsufficientFunds,10012:a.InsufficientFunds,10013:a.ExchangeError,10014:a.ExchangeError,11e3:a.InsufficientFunds,11002:a.InvalidOrder,11003:a.InvalidOrder,11004:a.InvalidOrder,11005:a.InvalidOrder,11006:a.OrderNotFound,11007:a.InvalidOrder,11008:a.InvalidOrder,11009:a.InvalidOrder,11010:a.InvalidOrder,11011:a.InvalidOrder,11012:a.InvalidOrder,11013:a.InvalidOrder,11014:a.InvalidOrder,11015:a.InvalidOrder,11016:a.InvalidOrder,11017:a.InvalidOrder,11018:a.InvalidOrder,11019:a.InvalidOrder,11020:a.InsufficientFunds,11021:a.InvalidOrder,11022:a.InvalidOrder,11023:a.InvalidOrder,11024:a.InvalidOrder,11025:a.InvalidOrder,11026:a.BadRequest,11027:a.InvalidOrder,11028:a.InvalidOrder,11050:a.InvalidOrder,11051:a.InvalidOrder,11052:a.InvalidOrder,11053:a.InvalidOrder,11054:a.InvalidOrder,11055:a.InvalidOrder,11100:a.InvalidOrder,11101:a.InvalidOrder,11102:a.InvalidOrder,11103:a.InvalidOrder,11104:a.InvalidOrder,11105:a.InvalidOrder,11106:a.InvalidOrder,11107:a.InvalidOrder,11200:a.InvalidOrder,11201:a.InvalidOrder,11202:a.InvalidOrder,11203:a.InvalidOrder,12e3:a.InvalidOrder,12001:a.InvalidOrder,12002:a.BadRequest,12003:a.BadRequest,13e3:a.BadRequest,14e3:a.BadRequest,14001:a.InvalidOrder,14002:a.BadRequest,14008:a.BadRequest,14009:a.BadRequest,14010:a.BadRequest,14011:a.BadRequest,14012:a.BadRequest,14013:a.BadRequest,14014:a.InvalidOrder,14015:a.BadRequest,14016:a.BadRequest,14017:a.BadRequest,14018:a.BadRequest,14019:a.BadRequest,14020:a.BadRequest,14021:a.BadRequest,14022:a.AuthenticationError,14023:a.InvalidOrder,14024:a.BadRequest,14025:a.BadRequest,14026:a.BadRequest,14027:a.AuthenticationError,14028:a.BadRequest,14029:a.AuthenticationError,14030:a.BadRequest,14031:a.AuthenticationError,14032:a.BadRequest,16e3:a.AuthenticationError,16001:a.AuthenticationError,16100:a.AuthenticationError,17e3:a.BadRequest,17001:a.BadRequest,17002:a.BadRequest,17003:a.BadRequest,17004:a.BadRequest,17005:a.BadRequest,17006:a.BadRequest,17007:a.BadRequest,18e3:a.BadRequest,18001:a.BadRequest,18002:a.BadRequest,18003:a.BadRequest,18004:a.BadRequest,18005:a.BadRequest,18006:a.BadRequest,18007:a.BadRequest,19e3:a.BadRequest},broad:{}},precisionMode:h.kb,commonCurrencies:{},options:{deriveWalletAddress:"",id:"0x0ad42b8e602c2d3d475ae52d678cf63d84ab2749"}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}async fetchTime(e={}){const t=await this.publicPostGetTime(e);return this.safeInteger(t,"result")}async fetchCurrencies(e={}){const t={},i=await this.publicGetGetAllCurrencies(e),s=this.safeList(i,"result",[]);for(let e=0;e1e3&&(i=1e3),r.page_size=i),void 0!==t&&(r.from_timestamp=t);const o=this.safeInteger(s,"until");s=this.omit(s,["until"]),void 0!==o&&(r.to_timestamp=o);const n=await this.publicPostGetTradeHistory(this.extend(r,s)),d=this.safeDict(n,"result",{}),h=this.safeList(d,"trades",[]);return this.parseTrades(h,a,t,i)}parseTrade(e,t=void 0){const i=this.safeString(e,"instrument_name"),s=this.safeSymbol(i,t),r=this.safeInteger(e,"timestamp"),a={currency:"USDC",cost:this.safeString(e,"trade_fee")};return this.safeTrade({info:e,id:this.safeString(e,"trade_id"),order:this.safeString(e,"order_id"),symbol:s,side:this.safeStringLower(e,"direction"),type:void 0,takerOrMaker:this.safeString(e,"liquidity_role"),price:this.safeString(e,"trade_price"),amount:this.safeString(e,"trade_amount"),cost:void 0,timestamp:r,datetime:this.iso8601(r),fee:a},t)}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={instrument_name:r.id};void 0!==t&&(a.start_timestamp=t);const o=this.safeInteger(s,"until");s=this.omit(s,["until"]),void 0!==o&&(a.to_timestamp=o);const n=await this.publicPostGetFundingRateHistory(this.extend(a,s)),d=this.safeDict(n,"result",{}),h=this.safeList(d,"funding_rate_history",[]),c=[];for(let e=0;ethis.safeInteger(e,"num_pages"))return[]}const u=this.safeList(c,"orders");return this.parseOrders(u,d,t,i)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.extend(s,{status:"open"});return await this.fetchOrders(e,t,i,r)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.extend(s,{status:"filled"});return await this.fetchOrders(e,t,i,r)}async fetchCanceledOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.extend(s,{status:"cancelled"});return await this.fetchOrders(e,t,i,r)}parseTimeInForce(e){return this.safeString({ioc:"IOC",fok:"FOK",gtc:"GTC",post_only:"PO"},e,void 0)}parseOrderStatus(e){if(void 0!==e){const t={open:"open",untriggered:"open",filled:"closed",cancelled:"canceled",expired:"rejected"};return this.safeString(t,e,e)}return e}parseOrder(e,t=void 0){let i=this.safeDict(e,"data");void 0===i&&(i=e);const s=this.safeInteger2(e,"creation_timestamp","nonce"),r=this.safeString(i,"order_id"),a=this.safeString(i,"instrument_name");void 0!==a&&(t=this.safeMarket(a,t));const o=t.symbol,n=this.safeString(i,"limit_price"),d=this.safeString(i,"average_price"),h=this.safeString(i,"desired_amount"),c=this.safeString(i,"filled_amount"),l=this.safeString(i,"order_fee"),u=this.safeStringLower(i,"order_type"),f=this.safeBool(i,"is_bid");let p=this.safeString(i,"direction");void 0===p&&(p=f?"buy":"sell");const m=this.safeString(i,"trigger_type");let g,v,y;void 0!==m&&(y=this.safeString(i,"trigger_price"),"stoploss"===m?g=y:v=y);const w=this.safeInteger(e,"last_update_timestamp"),b=this.safeString(i,"order_status"),k=this.safeString(i,"time_in_force");return this.safeOrder({id:r,clientOrderId:this.safeString(i,"label"),timestamp:s,datetime:this.iso8601(s),lastTradeTimestamp:void 0,lastUpdateTimestamp:w,status:this.parseOrderStatus(b),symbol:o,type:u,timeInForce:this.parseTimeInForce(k),postOnly:void 0,reduceOnly:this.safeBool(i,"reduce_only"),side:p,price:n,triggerPrice:y,takeProfitPrice:v,stopLossPrice:g,average:d,amount:h,filled:c,remaining:void 0,cost:void 0,trades:void 0,fee:{cost:l,currency:"USDC"},info:i},t)}async fetchOrderTrades(e,t=void 0,i=void 0,s=void 0,r={}){let a;await this.loadMarkets(),[a,r]=this.handleDeriveSubaccountId("fetchOrderTrades",r);const o={order_id:e,subaccount_id:a};let n;void 0!==t&&(n=this.market(t),o.instrument_name=n.id),void 0!==s&&(o.page_size=s),void 0!==i&&(o.from_timestamp=i);const d=await this.privatePostGetTradeHistory(this.extend(o,r)),h=this.safeDict(d,"result",{}),c=this.safeList(h,"trades",[]);return this.parseTrades(c,n,i,s,r)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r,a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchMyTrades","paginate"),a)return await this.fetchPaginatedCallIncremental("fetchMyTrades",e,t,i,s,"page",500);[r,s]=this.handleDeriveSubaccountId("fetchMyTrades",s);const o={subaccount_id:r};let n;void 0!==e&&(n=this.market(e),o.instrument_name=n.id),void 0!==i&&(o.page_size=i),void 0!==t&&(o.from_timestamp=t);const d=await this.privatePostGetTradeHistory(this.extend(o,s)),h=this.safeDict(d,"result",{}),c=this.safeInteger(s,"page");if(void 0!==c){const e=this.safeDict(h,"pagination");if(c>this.safeInteger(e,"num_pages"))return[]}const l=this.safeList(h,"trades",[]);return this.parseTrades(l,n,t,i,s)}async fetchPositions(e=void 0,t={}){let i;await this.loadMarkets(),[i,t]=this.handleDeriveSubaccountId("fetchPositions",t);const s={subaccount_id:i};t=this.omit(t,["subaccount_id"]);const r=await this.privatePostGetPositions(this.extend(s,t)),a=this.safeDict(r,"result",{}),o=this.safeList(a,"positions",[]);return this.parsePositions(o,e)}parsePosition(e,t=void 0){const i=this.safeString(e,"instrument_name");t=this.safeMarket(i,t);let s,a=this.safeString(e,"amount");s=r.A.stringGt(a,"0")?"long":"short";const o=this.safeString(t,"contractSize"),n=this.safeString(e,"mark_price"),d=this.safeInteger(e,"creation_timestamp"),h=this.safeString(e,"unrealized_pnl");a=r.A.stringAbs(a);const c=r.A.stringMul(a,n);return this.safePosition({info:e,id:void 0,symbol:this.safeString(t,"symbol"),timestamp:d,datetime:this.iso8601(d),lastUpdateTimestamp:void 0,initialMargin:this.safeString(e,"initial_margin"),initialMarginPercentage:void 0,maintenanceMargin:this.safeString(e,"maintenance_margin"),maintenanceMarginPercentage:void 0,entryPrice:void 0,notional:this.parseNumber(c),leverage:this.safeNumber(e,"leverage"),unrealizedPnl:this.parseNumber(h),contracts:this.parseNumber(a),contractSize:this.parseNumber(o),marginRatio:void 0,liquidationPrice:this.safeNumber(e,"liquidation_price"),markPrice:this.parseNumber(n),lastPrice:void 0,collateral:void 0,marginMode:void 0,side:s,percentage:void 0,hedged:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}async fetchFundingHistory(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r,a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchFundingHistory","paginate"),a)return await this.fetchPaginatedCallIncremental("fetchFundingHistory",e,t,i,s,"page",500);[r,s]=this.handleDeriveSubaccountId("fetchFundingHistory",s);const o={subaccount_id:r};let n;void 0!==e&&(n=this.market(e),o.instrument_name=n.id),void 0!==t&&(o.start_timestamp=t),void 0!==i&&(o.page_size=i);const d=await this.privatePostGetFundingHistory(this.extend(o,s)),h=this.safeDict(d,"result",{}),c=this.safeInteger(s,"page");if(void 0!==c){const e=this.safeDict(h,"pagination");if(c>this.safeInteger(e,"num_pages"))return[]}const l=this.safeList(h,"events",[]);return this.parseIncomes(l,n,t,i)}parseIncome(e,t=void 0){const i=this.safeString(e,"instrument_name"),s=this.safeSymbol(i,t),r=this.safeString(e,"funding"),a=this.safeCurrencyCode("USDC"),o=this.safeInteger(e,"timestamp");return{info:e,symbol:s,code:a,timestamp:o,datetime:this.iso8601(o),id:void 0,amount:void 0,rate:r}}async fetchBalance(e={}){let t;await this.loadMarkets(),[t,e]=this.handleDeriveWalletAddress("fetchBalance",e);const i={wallet:t},s=await this.privatePostGetAllPortfolios(this.extend(i,e)),r=this.safeList(s,"result");return this.parseBalance(r)}parseBalance(e){const t={info:e};for(let i=0;i Developers tab.")}handleErrors(e,t,i,s,r,o,n,d,h){if(!n)return;const c=this.safeDict(n,"error");if(void 0!==c){const e=this.safeString(c,"code"),t=this.id+" "+this.json(n);throw this.throwBroadlyMatchedException(this.exceptions.broad,o,t),this.throwExactlyMatchedException(this.exceptions.exact,e,t),new a.ExchangeError(t)}}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){const o=this.urls.api[t]+"/"+e;if("POST"===i){if(r={"Content-Type":"application/json"},"private"===t){const e=this.milliseconds().toString(),t=this.signMessage(e,this.privateKey);r["X-LyraWallet"]=this.safeString(this.options,"deriveWalletAddress"),r["X-LyraTimestamp"]=e,r["X-LyraSignature"]=t}a=this.json(s)}return{url:o,method:i,body:a,headers:r}}}},779:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(9420),r=i(2079),a=i(1579),o=i(5147),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"digifinex",name:"DigiFinex",countries:["SG"],version:"v3",rateLimit:900,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,cancelOrder:!0,cancelOrders:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingInterval:!0,fetchFundingIntervals:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!0,fetchMarginMode:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransfers:!0,fetchWithdrawals:!0,reduceMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","12h":"720","1d":"1D","1w":"1W"},urls:{logo:"https://user-images.githubusercontent.com/51840849/87443315-01283a00-c5fe-11ea-8628-c2a0feaf07ac.jpg",api:{rest:"https://openapi.digifinex.com"},www:"https://www.digifinex.com",doc:["https://docs.digifinex.com"],fees:"https://digifinex.zendesk.com/hc/en-us/articles/360000328422-Fee-Structure-on-DigiFinex",referral:"https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp"},api:{public:{spot:{get:["{market}/symbols","kline","margin/currencies","margin/symbols","markets","order_book","ping","spot/symbols","time","trades","trades/symbols","ticker","currencies"]},swap:{get:["public/api_weight","public/candles","public/candles_history","public/depth","public/funding_rate","public/funding_rate_history","public/instrument","public/instruments","public/ticker","public/tickers","public/time","public/trades"]}},private:{spot:{get:["{market}/financelog","{market}/mytrades","{market}/order","{market}/order/detail","{market}/order/current","{market}/order/history","margin/assets","margin/financelog","margin/mytrades","margin/order","margin/order/current","margin/order/history","margin/positions","otc/financelog","spot/assets","spot/financelog","spot/mytrades","spot/order","spot/order/current","spot/order/history","deposit/address","deposit/history","withdraw/history"],post:["{market}/order/cancel","{market}/order/new","{market}/order/batch_new","margin/order/cancel","margin/order/new","margin/position/close","spot/order/cancel","spot/order/new","transfer","withdraw/new","withdraw/cancel"]},swap:{get:["account/balance","account/positions","account/finance_record","account/trading_fee_rate","account/transfer_record","account/funding_fee","trade/history_orders","trade/history_trades","trade/open_orders","trade/order_info"],post:["account/transfer","account/leverage","account/position_mode","account/position_margin","trade/batch_cancel_order","trade/batch_order","trade/cancel_order","trade/order_place","follow/sponsor_order","follow/close_order","follow/cancel_order","follow/user_center_current","follow/user_center_history","follow/expert_current_open_order","follow/add_algo","follow/cancel_algo","follow/account_available","follow/plan_task","follow/instrument_list"]}}},features:{default:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:{max:10},fetchMyTrades:{marginMode:!0,limit:500,daysBack:1e5,untilDays:30,symbolRequired:!1},fetchOrder:{marginMode:!0,trigger:!1,trailing:!1,marketType:!0,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!0,limit:100,daysBack:1e5,untilDays:30,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:void 0,fetchOHLCV:{limit:500}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrders:{max:20,marginMode:!1},fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5},fetchOrder:{marginMode:!1},fetchOpenOrders:{marginMode:!1,limit:100},fetchOrders:{marginMode:!1,daysBack:1e5},fetchOHLCV:{limit:100}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:void 0,inverse:void 0}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},precisionMode:a.kb,exceptions:{exact:{10001:[r.BadRequest,"Wrong request method, please check it's a GET ot POST request"],10002:[r.AuthenticationError,"Invalid ApiKey"],10003:[r.AuthenticationError,"Sign doesn't match"],10004:[r.BadRequest,"Illegal request parameters"],10005:[r.DDoSProtection,"Request frequency exceeds the limit"],10006:[r.PermissionDenied,"Unauthorized to execute this request"],10007:[r.PermissionDenied,"IP address Unauthorized"],10008:[r.InvalidNonce,"Timestamp for this request is invalid, timestamp must within 1 minute"],10009:[r.NetworkError,"Unexist endpoint, please check endpoint URL"],10011:[r.AccountSuspended,"ApiKey expired. Please go to client side to re-create an ApiKey"],20001:[r.PermissionDenied,"Trade is not open for this trading pair"],20002:[r.PermissionDenied,"Trade of this trading pair is suspended"],20003:[r.InvalidOrder,"Invalid price or amount"],20007:[r.InvalidOrder,"Price precision error"],20008:[r.InvalidOrder,"Amount precision error"],20009:[r.InvalidOrder,"Amount is less than the minimum requirement"],20010:[r.InvalidOrder,"Cash Amount is less than the minimum requirement"],20011:[r.InsufficientFunds,"Insufficient balance"],20012:[r.BadRequest,"Invalid trade type, valid value: buy/sell)"],20013:[r.InvalidOrder,"No order info found"],20014:[r.BadRequest,"Invalid date, Valid format: 2018-07-25)"],20015:[r.BadRequest,"Date exceeds the limit"],20018:[r.PermissionDenied,"Your trading rights have been banned by the system"],20019:[r.BadSymbol,'Wrong trading pair symbol. Correct format:"usdt_btc". Quote asset is in the front'],20020:[r.DDoSProtection,"You have violated the API operation trading rules and temporarily forbid trading. At present, we have certain restrictions on the user's transaction rate and withdrawal rate."],5e4:[r.ExchangeError,"Exception error"],20021:[r.BadRequest,"Invalid currency"],20022:[r.BadRequest,"The ending timestamp must be larger than the starting timestamp"],20023:[r.BadRequest,"Invalid transfer type"],20024:[r.BadRequest,"Invalid amount"],20025:[r.BadRequest,"This currency is not transferable at the moment"],20026:[r.InsufficientFunds,"Transfer amount exceed your balance"],20027:[r.PermissionDenied,"Abnormal account status"],20028:[r.PermissionDenied,"Blacklist for transfer"],20029:[r.PermissionDenied,"Transfer amount exceed your daily limit"],20030:[r.BadRequest,"You have no position on this trading pair"],20032:[r.PermissionDenied,"Withdrawal limited"],20033:[r.BadRequest,"Wrong Withdrawal ID"],20034:[r.PermissionDenied,"Withdrawal service of this crypto has been closed"],20035:[r.PermissionDenied,"Withdrawal limit"],20036:[r.ExchangeError,"Withdrawal cancellation failed"],20037:[r.InvalidAddress,"The withdrawal address, Tag or chain type is not included in the withdrawal management list"],20038:[r.InvalidAddress,"The withdrawal address is not on the white list"],20039:[r.ExchangeError,"Can't be canceled in current status"],20040:[r.RateLimitExceeded,"Withdraw too frequently; limitation: 3 times a minute, 100 times a day"],20041:[r.PermissionDenied,"Beyond the daily withdrawal limit"],20042:[r.BadSymbol,"Current trading pair does not support API trading"],400002:[r.BadRequest,"Invalid Parameter"]},broad:{}},options:{defaultType:"spot",types:["spot","margin","otc"],createMarketBuyOrderRequiresPrice:!0,accountsByType:{spot:"1",margin:"2",OTC:"3"},networks:{ARBITRUM:"Arbitrum",AVALANCEC:"AVAX-CCHAIN",AVALANCEX:"AVAX-XCHAIN",BEP20:"BEP20",BSC:"BEP20",CARDANO:"Cardano",CELO:"Celo",CHILIZ:"Chiliz",COSMOS:"COSMOS",CRC20:"Crypto.com",CRONOS:"Crypto.com",DOGECOIN:"DogeChain",ERC20:"ERC20",ETH:"ERC20",ETHW:"ETHW",IOTA:"MIOTA",KLAYTN:"KLAY",MATIC:"Polygon",METIS:"MetisDAO",MOONBEAM:"GLMR",MOONRIVER:"Moonriver",OPTIMISM:"OPETH",POLYGON:"Polygon",RIPPLE:"XRP",SOLANA:"SOL",STELLAR:"Stella",TERRACLASSIC:"TerraClassic",TERRA:"Terra",TON:"Ton",TRC20:"TRC20",TRON:"TRC20",TRX:"TRC20",VECHAIN:"Vechain"},networksById:{TRC20:"TRC20",TRX:"TRC20",BEP20:"BEP20",BSC:"BEP20",ERC20:"ERC20",ETH:"ERC20",Polygon:"POLYGON","Crypto.com":"CRONOS"}},commonCurrencies:{BHT:"Black House Test",EPS:"Epanus",FREE:"FreeRossDAO",MBN:"Mobilian Coin",TEL:"TEL666"}})}async fetchCurrencies(e={}){const t=await this.publicSpotGetCurrencies(e),i=this.safeList(t,"data",[]),s=this.groupBy(i,"currency"),r=Object.keys(s),a={};for(let e=0;e1?(o=e[0],a=e[1]):a="limit"}return this.safeOrder({info:e,id:this.safeString2(e,"order_id","data"),clientOrderId:void 0,timestamp:i,datetime:this.iso8601(i),lastTradeTimestamp:s,symbol:d,type:a,timeInForce:r,postOnly:void 0,side:o,price:this.safeNumber(e,"price"),triggerPrice:void 0,amount:this.safeNumber2(e,"amount","size"),filled:this.safeNumber2(e,"executed_amount","filled_qty"),remaining:void 0,cost:void 0,average:this.safeNumber2(e,"avg_price","price_avg"),status:this.parseOrderStatus(this.safeString2(e,"status","state")),fee:{cost:this.safeNumber(e,"fee")},trades:void 0},t)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){let a,o;await this.loadMarkets(),void 0!==e&&(a=this.market(e)),[o,s]=this.handleMarketTypeAndParams("fetchOpenOrders",a,s);const[n,d]=this.handleMarginModeAndParams("fetchOpenOrders",s),h={},c="swap"===o;if(c?(void 0!==t&&(h.start_timestamp=t),void 0!==i&&(h.limit=i)):h.market=o,void 0!==a){h[c?"instrument_id":"symbol"]=a.id}let l;if(void 0!==n||"margin"===o)o="margin",l=await this.privateSpotGetMarginOrderCurrent(this.extend(h,d));else if("spot"===o)l=await this.privateSpotGetSpotOrderCurrent(this.extend(h,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchOpenOrders() not support this market type");l=await this.privateSwapGetTradeOpenOrders(this.extend(h,d))}const u=this.safeList(l,"data",[]);return this.parseOrders(u,a,t,i)}async fetchOrders(e=void 0,t=void 0,i=void 0,s={}){let a,o;await this.loadMarkets(),void 0!==e&&(a=this.market(e)),[o,s]=this.handleMarketTypeAndParams("fetchOrders",a,s);const[n,d]=this.handleMarginModeAndParams("fetchOrders",s),h={};if("swap"===o?void 0!==t&&(h.start_timestamp=t):(h.market=o,void 0!==t&&(h.start_time=this.parseToInt(t/1e3))),void 0!==a){h["swap"===o?"instrument_id":"symbol"]=a.id}let c;if(void 0!==i&&(h.limit=i),void 0!==n||"margin"===o)o="margin",c=await this.privateSpotGetMarginOrderHistory(this.extend(h,d));else if("spot"===o)c=await this.privateSpotGetSpotOrderHistory(this.extend(h,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchOrders() not support this market type");c=await this.privateSwapGetTradeHistoryOrders(this.extend(h,d))}const l=this.safeList(c,"data",[]);return this.parseOrders(l,a,t,i)}async fetchOrder(e,t=void 0,i={}){let s,a;await this.loadMarkets(),void 0!==t&&(s=this.market(t)),[a,i]=this.handleMarketTypeAndParams("fetchOrder",s,i);const[o,n]=this.handleMarginModeAndParams("fetchOrder",i),d={order_id:e};let h;if("swap"===a?void 0!==s&&(d.instrument_id=s.id):d.market=a,void 0!==o||"margin"===a)a="margin",h=await this.privateSpotGetMarginOrder(this.extend(d,n));else if("spot"===a)h=await this.privateSpotGetSpotOrder(this.extend(d,n));else{if("swap"!==a)throw new r.NotSupported(this.id+" fetchOrder() not support this market type");h=await this.privateSwapGetTradeOrderInfo(this.extend(d,n))}const c=this.safeValue(h,"data"),l="swap"===a?c:this.safeValue(c,0);if(void 0===l)throw new r.OrderNotFound(this.id+" fetchOrder() order "+e.toString()+" not found");return this.parseOrder(l,s)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){let a;await this.loadMarkets();const o={};let n;void 0!==e&&(a=this.market(e)),[n,s]=this.handleMarketTypeAndParams("fetchMyTrades",a,s);const[d,h]=this.handleMarginModeAndParams("fetchMyTrades",s);"swap"===n?void 0!==t&&(o.start_timestamp=t):(o.market=n,void 0!==t&&(o.start_time=this.parseToInt(t/1e3)));let c;if(void 0!==e&&(o["swap"===n?"instrument_id":"symbol"]=a.id),void 0!==i&&(o.limit=i),void 0!==d||"margin"===n)n="margin",c=await this.privateSpotGetMarginMytrades(this.extend(o,h));else if("spot"===n)c=await this.privateSpotGetSpotMytrades(this.extend(o,h));else{if("swap"!==n)throw new r.NotSupported(this.id+" fetchMyTrades() not support this market type");c=await this.privateSwapGetTradeHistoryTrades(this.extend(o,h))}const l="swap"===n?"data":"list",u=this.safeList(c,l,[]);return this.parseTrades(u,a,t,i)}parseLedgerEntryType(e){return this.safeString({},e,e)}parseLedgerEntry(e,t=void 0){const i=this.parseLedgerEntryType(this.safeString2(e,"type","finance_type")),s=this.safeString2(e,"currency_mark","currency"),r=this.safeCurrencyCode(s,t);t=this.safeCurrency(s,t);const a=this.safeNumber2(e,"num","change"),o=this.safeNumber(e,"balance");let n=this.safeTimestamp(e,"time");return void 0===n&&(n=this.safeInteger(e,"timestamp")),this.safeLedgerEntry({info:e,id:void 0,direction:void 0,account:void 0,referenceId:void 0,referenceAccount:void 0,type:i,currency:r,amount:a,before:void 0,after:o,status:void 0,timestamp:n,datetime:this.iso8601(n),fee:void 0},t)}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const a={};let o;[o,s]=this.handleMarketTypeAndParams("fetchLedger",void 0,s);const[n,d]=this.handleMarginModeAndParams("fetchLedger",s);"swap"===o?void 0!==t&&(a.start_timestamp=t):(a.market=o,void 0!==t&&(a.start_time=this.parseToInt(t/1e3)));const h="swap"===o?"currency":"currency_mark";let c,l,u;if(void 0!==e&&(c=this.currency(e),a[h]=c.id),void 0!==i&&(a.limit=i),void 0!==n||"margin"===o)o="margin",l=await this.privateSpotGetMarginFinancelog(this.extend(a,d));else if("spot"===o)l=await this.privateSpotGetSpotFinancelog(this.extend(a,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchLedger() not support this market type");l=await this.privateSwapGetAccountFinanceRecord(this.extend(a,d))}if("swap"===o)u=this.safeValue(l,"data",[]);else{const e=this.safeValue(l,"data",{});u=this.safeValue(e,"finance",[])}return this.parseLedger(u,c,t,i)}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"address"),s=this.safeString(e,"addressTag"),r=this.safeStringUpper(e,"currency");return{info:e,currency:this.safeCurrencyCode(r),network:void 0,address:i,tag:s}}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e),s={currency:i.id},a=await this.privateSpotGetDepositAddress(this.extend(s,t)),o=this.safeValue(a,"data",[]),n=this.parseDepositAddresses(o,[i.code]),d=this.safeValue(n,e);if(void 0===d)throw new r.InvalidAddress(this.id+" fetchDepositAddress() did not return an address for "+e+" - create the deposit address in the user settings on the exchange website first.");return d}async fetchTransactionsByType(e,t=void 0,i=void 0,s=void 0,r={}){let a;await this.loadMarkets();const o={};let n;void 0!==t&&(a=this.currency(t),o.currency=a.id),void 0!==s&&(o.size=Math.min(500,s)),n="deposit"===e?await this.privateSpotGetDepositHistory(this.extend(o,r)):await this.privateSpotGetWithdrawHistory(this.extend(o,r));const d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,i,s,{type:e})}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactionsByType("deposit",e,t,i,s)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchTransactionsByType("withdrawal",e,t,i,s)}parseTransactionStatus(e){return this.safeString({1:"pending",2:"pending",3:"ok",4:"failed"},e,e)}parseTransaction(e,t=void 0){const i=this.safeString2(e,"id","withdraw_id"),s=this.safeString(e,"address"),r=this.safeString(e,"memo"),a=this.safeString(e,"hash"),o=this.safeStringUpper(e,"currency"),n=this.safeCurrencyCode(o,t),d=this.parse8601(this.safeString(e,"created_date")),h=this.parse8601(this.safeString(e,"finished_date")),c=this.parseTransactionStatus(this.safeString(e,"state")),l=this.safeNumber(e,"amount"),u=this.safeNumber(e,"fee");let f;void 0!==u&&(f={currency:n,cost:u});const p=this.safeString(e,"chain");return{info:e,id:i,txid:a,timestamp:d,datetime:this.iso8601(d),network:p,address:s,addressTo:s,addressFrom:void 0,tag:r,tagTo:r,tagFrom:void 0,type:void 0,amount:l,currency:n,status:c,updated:h,internal:void 0,comment:void 0,fee:f}}parseTransferStatus(e){return this.safeString({0:"ok"},e,e)}parseTransfer(e,t=void 0){let i,s;const r=this.safeDict(e,"data",e),a=this.safeInteger(r,"type");1===a?(i="spot",s="swap"):2===a&&(i="swap",s="spot");const o=this.safeInteger(e,"timestamp");return{info:e,id:this.safeString(e,"transfer_id"),timestamp:o,datetime:this.iso8601(o),currency:this.safeCurrencyCode(this.safeString(r,"currency"),t),amount:this.safeNumber2(r,"amount","transfer_amount"),fromAccount:i,toAccount:s,status:this.parseTransferStatus(this.safeString(e,"code"))}}async transfer(e,t,i,s,a={}){await this.loadMarkets();const o=this.currency(e),n=o.id,d=this.safeValue(this.options,"accountsByType",{}),h=this.safeString(d,i,i),c=this.safeString(d,s,s),l={},u="swap"===i,f="swap"===s;let p;const m=this.currencyToPrecision(e,t);if(u||f){if("1"!==h&&"1"!==c)throw new r.ExchangeError(this.id+" transfer() supports transferring between spot and swap, spot and margin, spot and OTC only");l.type=f?1:2,l.currency=n,l.transfer_amount=m,p=await this.privateSwapPostAccountTransfer(this.extend(l,a))}else l.currency_mark=n,l.num=m,l.from=h,l.to=c,p=await this.privateSpotPostTransfer(this.extend(l,a));return this.parseTransfer(p,o)}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),this.checkAddress(i),await this.loadMarkets();const a=this.currency(e),o={address:i,amount:this.currencyToPrecision(e,t),currency:a.id};void 0!==s&&(o.memo=s);const n=await this.privateSpotPostWithdrawNew(this.extend(o,r));return this.parseTransaction(n,a)}async fetchBorrowInterest(e=void 0,t=void 0,i=void 0,s=void 0,r={}){await this.loadMarkets();const a={};let o;void 0!==t&&(o=this.market(t),a.symbol=o.id);const n=await this.privateSpotGetMarginPositions(this.extend(a,r)),d=this.safeValue(n,"positions"),h=this.parseBorrowInterests(d,o);return this.filterByCurrencySinceLimit(h,e,i,s)}parseBorrowInterest(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeString(e,"amount"),r=this.safeString(e,"leverage_ratio"),a=o.Y.stringDiv(s,r),n=o.Y.stringSub(s,a),d=void 0===t?void 0:t.base;return{info:e,symbol:this.safeSymbol(i,t),currency:d,interest:void 0,interestRate:.001,amountBorrowed:this.parseNumber(n),marginMode:void 0,timestamp:void 0,datetime:void 0}}async fetchCrossBorrowRate(e,t={}){await this.loadMarkets();const i=await this.privateSpotGetMarginAssets(this.extend({},t)),s=this.safeValue(i,"list",[]);let r=[];for(let t=0;t1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;s=this.market(t)}[a,t]=this.handleMarketTypeAndParams("fetchPositions",s,t);const[o,n]=this.handleMarginModeAndParams("fetchPositions",t);if(void 0!==o&&(a="margin"),void 0!==s){i["swap"===a?"instrument_id":"symbol"]=s.id}let d;if("spot"===a||"margin"===a)d=await this.privateSpotGetMarginPositions(this.extend(i,n));else{if("swap"!==a)throw new r.NotSupported(this.id+" fetchPositions() not support this market type");d=await this.privateSwapGetAccountPositions(this.extend(i,n))}const h="swap"===a?"data":"positions",c=this.safeValue(d,h,[]),l=[];for(let e=0;e100)throw new r.BadRequest(this.id+" leverage should be between 1 and 100");const a={instrument_id:s.id,leverage:e},o=this.safeString2(this.options,"marginMode","defaultMarginMode");let n=this.safeStringLower2(i,"marginMode","defaultMarginMode",o);if(void 0!==n&&(n="cross"===n?"crossed":"isolated",a.margin_mode=n,i=this.omit(i,["marginMode","defaultMarginMode"])),"isolated"===n){const e=this.safeString(i,"side");void 0!==e?(a.side=e,i=this.omit(i,"side")):this.checkRequiredArgument("setLeverage",e,"side",["long","short"])}return await this.privateSwapPostAccountLeverage(this.extend(a,i))}async fetchTransfers(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();const a={};void 0!==e&&(r=this.safeCurrencyCode(e),a.currency=r.id),void 0!==t&&(a.start_timestamp=t),void 0!==i&&(a.limit=i);const o=await this.privateSwapGetAccountTransferRecord(this.extend(a,s)),n=this.safeList(o,"data",[]);return this.parseTransfers(n,r,t,i)}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const i=await this.publicSwapGetPublicInstruments(t),s=this.safeValue(i,"data",[]);return e=this.marketSymbols(e),this.parseLeverageTiers(s,e,"instrument_id")}async fetchMarketLeverageTiers(e,t={}){await this.loadMarkets();const i=this.market(e);if(!i.swap)throw new r.BadRequest(this.id+" fetchMarketLeverageTiers() supports swap markets only");const s={instrument_id:i.id},a=await this.publicSwapGetPublicInstrument(this.extend(s,t)),o=this.safeValue(a,"data",{});return this.parseMarketLeverageTiers(o,i)}parseMarketLeverageTiers(e,t=void 0){const i=[],s=this.safeValue(e,"open_max_limits",{});for(let r=0;r{i.d(t,{A:()=>c});var s=i(6351),r=i(2079),a=i(6414),o=i(8283),n=i(5147),d=i(4852),h=i(1579);class c extends s.A{describe(){return this.deepExtend(super.describe(),{id:"ellipx",name:"Ellipx",countries:["PL"],rateLimit:200,version:"v1",certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!1,cancelWithdraw:!1,closePosition:!1,createConvertTrade:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!1,createMarketOrder:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopLossOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,createTakeProfitOrder:!1,createTrailingAmountOrder:!1,createTrailingPercentOrder:!1,createTriggerOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchCanceledAndClosedOrders:!1,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchConvertCurrencies:!1,fetchConvertQuote:!1,fetchConvertTrade:!1,fetchConvertTradeHistory:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!1,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!1,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!1,reduceMargin:!1,sandbox:!1,setLeverage:!1,setMargin:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","10m":"10m","1h":"1h","6h":"6h","12h":"12h","1d":"1d"},urls:{logo:"https://github.com/user-attachments/assets/e07c3f40-281c-4cdf-bacf-fa1c58218a2c",api:{public:"https://data.ellipx.com",private:"https://app.ellipx.com/_rest",_rest:"https://app.ellipx.com/_rest"},www:"https://www.ellipx.com",doc:"https://docs.google.com/document/d/1ZXzTQYffKE_EglTaKptxGQERRnunuLHEMmar7VC9syM",fees:"https://www.ellipx.com/pages/pricing",referral:""},api:{_rest:{get:{Market:1,"Market/{currencyPair}":1,"Crypto/Token/Info":1}},public:{get:{"Market/{currencyPair}:getDepth":1,"Market/{currencyPair}:ticker":1,"Market/{currencyPair}:getTrades":1,"Market/{currencyPair}:getGraph":1,"CMC:summary":1,"CMC/{currencyPair}:ticker":1}},private:{get:{"User/Wallet":1,"Market/{currencyPair}/Order":1,"Market/Order/{orderUuid}":1,"Market/{currencyPair}/Trade":1,"Market/TradeFee:query":1,"Unit/{currency}":1,"Crypto/Token/{currency}":1,"Crypto/Token/{currency}:chains":1},post:{"Market/{currencyPair}/Order":1,"Crypto/Address:fetch":1,"Crypto/Disbursement:withdraw":1},delete:{"Market/Order/{orderUuid}":1}}},fees:{trading:{tierBased:!0,feeSide:"get",percentage:!0,maker:this.parseNumber("0.0025"),taker:this.parseNumber("0.0030"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("10000"),this.parseNumber("0.0020")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0010")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("5000000"),this.parseNumber("0.0003")],[this.parseNumber("15000000"),this.parseNumber("0.0000")],[this.parseNumber("75000000"),this.parseNumber("0.0000")],[this.parseNumber("100000000"),this.parseNumber("0.0000")]],taker:[[this.parseNumber("0"),this.parseNumber("0.0030")],[this.parseNumber("10000"),this.parseNumber("0.0025")],[this.parseNumber("50000"),this.parseNumber("0.0020")],[this.parseNumber("100000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.0012")],[this.parseNumber("5000000"),this.parseNumber("0.0010")],[this.parseNumber("15000000"),this.parseNumber("0.0008")],[this.parseNumber("75000000"),this.parseNumber("0.0005")],[this.parseNumber("100000000"),this.parseNumber("0.0003")]]}},stablecoin:{tierBased:!1,percentage:!0,maker:this.parseNumber("0.0000"),taker:this.parseNumber("0.000015")}},options:{defaultType:"spot",recvWindow:5e3,broker:"CCXT",networks:{Bitcoin:"Bitcoin",Ethereum:"ERC20"},defaultNetwork:"defaultNetwork",defaultNetworkCodeReplacements:{BTC:"Bitcoin",ETH:"Ethereum"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:void 0,fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:void 0,fetchOHLCV:{limit:100}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{},exceptions:{exact:{400:r.BadRequest,401:r.AuthenticationError,403:r.PermissionDenied,404:r.BadRequest,429:r.DDoSProtection,418:r.PermissionDenied,500:r.ExchangeError,504:r.ExchangeError},broad:{}},precisionMode:h.kb})}sign(e,t="public",i="GET",s={},r=void 0,n=void 0){e=this.implodeParams(e,s);let h=this.urls.api[t]+"/"+e;if("private"===t){this.checkRequiredCredentials();const t=this.uuid(),r=this.seconds().toString();n="GET"===i?"":this.json(s),s=this.extend({_key:this.apiKey,_time:r,_nonce:t},s);const h=this.urlencode(s),c=this.hash(this.encode(n),d.s),l=this.base16ToBinary(c),u=this.numberToBE(0,1),f=[this.encode(i),u,this.encode(e),u,this.encode(h),u,l],p=this.binaryConcatArray(f),m=this.secret,g=this.calculateMod(m.length,4),v=g?4-g:0;let y=this.secret.replaceAll("-","+");y=y.replaceAll("_","/"),y=y.padEnd(this.secret.length+v,"=");const w=this.base64ToBinary(y),b=this.arraySlice(w,0,32),k=(0,o.q4)(p,b,a.ev);s._sign=k}return Object.keys(s).length&&(h+="?"+this.urlencode(s)),"GET"===i?n=void 0:r={"Content-Type":"application/json"},{url:h,method:i,body:n,headers:r}}calculateMod(e,t){return e%t}async fetchMarkets(e={}){const t=await this._restGetMarket(e),i=this.safeValue(t,"data",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"Key"),i=this.safeString(e.Primary,"Key"),s=this.safeString(e.Secondary,"Key"),r=this.safeString(e.Primary,"Crypto_Token__"),a=this.safeString(e.Secondary,"Crypto_Token__"),o="active"===this.safeString(e,"Status"),n=this.safeTimestamp(e.Created,"unix"),d=this.parseNumber(this.parsePrecision(this.safeString(e.Primary,"Decimals"))),h=this.parseNumber(this.parsePrecision(this.safeString(e.Secondary,"Decimals"))),c=this.fees;return this.safeMarketStructure({id:t,symbol:i+"/"+s,base:i,quote:s,settle:void 0,baseId:r,quoteId:a,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:o,contract:!1,linear:void 0,inverse:void 0,taker:c.trading.taker,maker:c.trading.maker,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:d,price:h},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:e,created:n})}async fetchTicker(e,t={}){await this.loadMarkets();const i=this.market(e),s={currencyPair:i.id},r=await this.publicGetMarketCurrencyPairTicker(this.extend(s,t)),a=this.safeValue(r.data,"ticker",{});return this.parseTicker(a,i)}parseTicker(e,t=void 0){const i=this.safeIntegerProduct(e,"time",1e3),s=this.parseAmount(this.safeValue(e,"open")),r=this.parseAmount(this.safeValue(e,"high")),a=this.parseAmount(this.safeValue(e,"low")),o=this.parseAmount(this.safeValue(e,"close")),n=this.parseAmount(this.safeValue(e,"avg")),d=this.parseAmount(this.safeValue(e,"vwap")),h=this.parseAmount(this.safeValue(e,"vol")),c=this.parseAmount(this.safeValue(e,"secvol"));return this.safeTicker({symbol:this.safeSymbol(void 0,t),timestamp:i,datetime:this.iso8601(i),high:r,low:a,bid:void 0,bidVolume:void 0,ask:void 0,askVolume:void 0,vwap:d,open:s,close:o,last:o,previousClose:void 0,change:void 0,percentage:void 0,average:n,baseVolume:h,quoteVolume:c,info:e},t)}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s={currencyPair:this.market(e).id},r=await this.publicGetMarketCurrencyPairGetDepth(this.extend(s,i)),a=this.safeValue(r,"data",{}),o=this.milliseconds(),n=a.bids.length,d=a.asks.length;for(let e=0;e0){const e=s[0],t=this.safeDict(e,"Balance_Date",{});i.timestamp=this.safeInteger(t,"unixms"),i.datetime=this.iso8601(i.timestamp)}for(let e=0;e{i.d(t,{A:()=>d});var s=i(1352),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"exmo",name:"EXMO",countries:["LT"],rateLimit:100,version:"v1.1",has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!1,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchCanceledOrders:!0,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:"emulated",fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:!0,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!0,setMargin:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","45m":"45","1h":"60","2h":"120","3h":"180","4h":"240","1d":"D","1w":"W","1M":"M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766491-1b0ea956-5eda-11e7-9225-40d67b481b8d.jpg",api:{public:"https://api.exmo.com",private:"https://api.exmo.com",web:"https://exmo.me"},www:"https://exmo.me",referral:"https://exmo.me/?ref=131685",doc:["https://exmo.me/en/api_doc?ref=131685"],fees:"https://exmo.com/en/docs/fees"},api:{web:{get:["ctrl/feesAndLimits","en/docs/fees"]},public:{get:["currency","currency/list/extended","order_book","pair_settings","ticker","trades","candles_history","required_amount","payments/providers/crypto/list"]},private:{post:["user_info","order_create","order_cancel","stop_market_order_create","stop_market_order_cancel","user_open_orders","user_trades","user_cancelled_orders","order_trades","deposit_address","withdraw_crypt","withdraw_get_txid","excode_create","excode_load","code_check","wallet_history","wallet_operations","margin/user/order/create","margin/user/order/update","margin/user/order/cancel","margin/user/position/close","margin/user/position/margin_add","margin/user/position/margin_remove","margin/currency/list","margin/pair/list","margin/settings","margin/funding/list","margin/user/info","margin/user/order/list","margin/user/order/history","margin/user/order/trades","margin/user/order/max_quantity","margin/user/position/list","margin/user/position/margin_remove_info","margin/user/position/margin_add_info","margin/user/wallet/list","margin/user/wallet/history","margin/user/trade/list","margin/trades","margin/liquidation/feed"]}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,maker:this.parseNumber("0.004"),taker:this.parseNumber("0.004")},transaction:{tierBased:!1,percentage:!1}},options:{networks:{ETH:"ERC20",TRX:"TRC20"},fetchTradingFees:{method:"fetchPrivateTradingFees"},margin:{fillResponseFromRequest:!0}},features:{spot:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!0,marketBuyByCost:!0,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!0,limit:100,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{GMT:"GMT Token"},precisionMode:o.kb,exceptions:{exact:{140333:r.InvalidOrder,140434:r.BadRequest,40005:r.AuthenticationError,40009:r.InvalidNonce,40015:r.ExchangeError,40016:r.OnMaintenance,40017:r.AuthenticationError,40032:r.PermissionDenied,40033:r.PermissionDenied,40034:r.RateLimitExceeded,50052:r.InsufficientFunds,50054:r.InsufficientFunds,50304:r.OrderNotFound,50173:r.OrderNotFound,50277:r.InvalidOrder,50319:r.InvalidOrder,50321:r.InvalidOrder,50381:r.InvalidOrder},broad:{"range period is too long":r.BadRequest,"invalid syntax":r.BadRequest,"API rate limit exceeded":r.RateLimitExceeded}}})}async modifyMarginHelper(e,t,i,s={}){await this.loadMarkets();const r=this.market(e),a={position_id:r.id,quantity:t};let o;"add"===i?o=await this.privatePostMarginUserPositionMarginAdd(this.extend(a,s)):"reduce"===i&&(o=await this.privatePostMarginUserPositionMarginRemove(this.extend(a,s)));const n=this.parseMarginModification(o,r),d=this.safeValue(this.options,"margin",{});return this.safeBool(d,"fillResponseFromRequest",!0)&&(n.type=i,n.amount=t),n}parseMarginModification(e,t=void 0){return{info:e,symbol:this.safeSymbol(void 0,t),type:void 0,marginMode:"isolated",amount:void 0,total:void 0,code:this.safeValue(t,"quote"),status:"ok",timestamp:void 0,datetime:void 0}}async reduceMargin(e,t,i={}){return await this.modifyMarginHelper(e,t,"reduce",i)}async addMargin(e,t,i={}){return await this.modifyMarginHelper(e,t,"add",i)}async fetchTradingFees(e={}){const t=this.safeValue(this.options,"fetchTradingFees",{}),i=this.safeString(t,"method","fetchPrivateTradingFees"),s=this.safeString(e,"method",i);return e=this.omit(e,"method"),"fetchPrivateTradingFees"===s?await this.fetchPrivateTradingFees(e):await this.fetchPublicTradingFees(e)}async fetchPrivateTradingFees(e={}){await this.loadMarkets();const t=await this.privatePostMarginPairList(e),i=this.safeValue(t,"pairs",[]),s={};for(let e=0;e=0,i=e.split(" ")[0].replace("%",""),s=parseFloat(i);if(s>0&&t)throw new r.ExchangeError(this.id+" parseFixedFloatValue() detected an unsupported non-zero percentage-based fee "+e);return s}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const i=await this.publicGetPaymentsProvidersCryptoList(t),s={},r=Object.keys(i);for(let t=0;t=2}void 0===this.safeValue(i.networks,n)&&(i.networks[n]={withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0}}),i.networks[n][a]={fee:this.parseFixedFloatValue(this.safeString(c,0)),percentage:h}}return this.assignDefaultDepositWithdrawFees(i)}async fetchCurrencies(e={}){const t=await this.publicGetCurrencyListExtended(e),i=await this.publicGetPaymentsProvidersCryptoList(e),s={};for(let e=0;e2048){const e=this.ids.length;throw new r.ExchangeError(this.id+" fetchOrderBooks() has "+e.toString()+" symbols exceeding max URL length, you are required to specify a list of symbols in the first argument to fetchOrderBooks")}}else s=this.marketIds(e),s=s.join(",");const a={pair:s};void 0!==t&&(a.limit=t);const o=await this.publicGetOrderBook(this.extend(a,i)),n={},d=Object.keys(o);for(let e=0;e=0&&(e="canceled"),this.safeString({cancel_started:"canceled"},e,e)}parseSide(e){return this.safeString({limit_buy:"buy",limit_sell:"sell",market_buy:"buy",market_sell:"sell",stop_buy:"buy",stop_sell:"sell",stop_limit_buy:"buy",stop_limit_sell:"sell",trailing_stop_buy:"buy",trailing_stop_sell:"sell",stop_market_sell:"sell",stop_market_buy:"buy",buy:"buy",sell:"sell"},e,e)}parseOrder(e,t=void 0){const i=this.safeString2(e,"order_id","parent_order_id"),s=this.safeIntegerProduct2(e,"event_time","created",1e-6),r=this.safeTimestamp(e,"created",s),a=this.safeString2(e,"type","order_type"),o=this.parseSide(a);let n;"pair"in e?n=e.pair:"in_currency"in e&&"out_currency"in e&&(n="buy"===o?e.in_currency+"_"+e.out_currency:e.out_currency+"_"+e.in_currency);const d=(t=this.safeMarket(n,t)).symbol;let h=this.safeString(e,"quantity");if(void 0===h){const t="buy"===o?"in_amount":"out_amount";h=this.safeString(e,t)}const c=this.safeString(e,"price"),l=this.safeString(e,"amount"),u=this.safeValue(e,"trades",[]),f=this.safeInteger(e,"client_id");let p,m=this.safeString(e,"stop_price");return"0"===m&&(m=void 0),"buy"!==a&&"sell"!==a&&(p=a),this.safeOrder({id:i,clientOrderId:f,datetime:this.iso8601(r),timestamp:r,lastTradeTimestamp:this.safeIntegerProduct(e,"updated",1e-6),status:this.parseStatus(this.safeString(e,"order_status")),symbol:d,type:p,timeInForce:void 0,postOnly:void 0,side:o,price:c,triggerPrice:m,cost:l,amount:h,filled:void 0,remaining:void 0,average:void 0,trades:u,fee:void 0,info:e},t)}async fetchCanceledOrders(e=void 0,t=void 0,i=void 0,s={}){let a;if(await this.loadMarkets(),[a,s]=this.handleMarginModeAndParams("fetchOrders",s),"cross"===a)throw new r.BadRequest(this.id+" only supports isolated margin");void 0===i&&(i=100);const o="isolated"!==a;if(void 0!==e){e=this.market(e).symbol}const n={limit:i};let d,h;if(n.offset=void 0!==t?i:0,n.limit=i,void 0!==e&&(d=this.market(e)),o)return h=await this.privatePostUserCancelledOrders(this.extend(n,s)),s=this.extend(s,{status:"canceled"}),this.parseOrders(h,d,t,i,s);{const e=await this.privatePostMarginUserOrderHistory(this.extend(n,s)),r=this.safeValue(e,"items"),a=this.parseOrders(r,d,t,i,s),o=[];for(let e=0;e1&&(a=e[1])}return this.checkAddress(r),{info:i,currency:e,network:void 0,address:r,tag:a}}getMarketFromTrades(e){const t=this.indexBy(e,"pair"),i=Object.keys(t);if(1===i.length)return this.markets[i[0]]}async withdraw(e,t,i,s=void 0,r={}){[s,r]=this.handleWithdrawTagAndParams(s,r),await this.loadMarkets();const a=this.currency(e),o={amount:t,currency:a.id,address:i};void 0!==s&&(o.invoice=s);const n=this.safeValue(this.options,"networks",{});let d=this.safeStringUpper(r,"network");d=this.safeString(n,d,d),void 0!==d&&(o.transport=d,r=this.omit(r,"network"));const h=await this.privatePostWithdrawCrypt(this.extend(o,r));return this.parseTransaction(h,a)}parseTransactionStatus(e){return this.safeString({transferred:"ok",paid:"ok",pending:"pending",processing:"pending",verifying:"pending"},e,e)}parseTransaction(e,t=void 0){const i=this.safeTimestamp2(e,"dt","created");let s=this.safeString(e,"amount");void 0!==s&&(s=a.Y.stringAbs(s));let r=this.safeString(e,"txid");if(void 0===r){const t=this.safeValue(e,"extra",{}),i=this.safeString(t,"txid");""!==i&&(r=i)}const o=this.safeString(e,"type"),n=this.safeString2(e,"curr","currency"),d=this.safeCurrencyCode(n,t);let h,c;const l=this.safeString(e,"account");if("deposit"===o)c=l;else if("withdrawal"===o&&(h=l,void 0!==h)){const e=h.split(":");2===e.length&&(h=this.safeString(e,1),h=h.replace(" ",""))}const u={currency:void 0,cost:void 0,rate:void 0};if(!this.fees.transaction.percentage){const t="withdrawal"===o?"withdraw":"deposit";let i=this.safeString(e,"commission");if(void 0===i){const e=this.safeValue(this.options,"transactionFees",{}),s=this.safeValue(e,d,{});i=this.safeString(s,t)}"cashback"===this.safeString(e,"provider")&&(i="0"),void 0!==i&&("withdrawal"===o&&(s=a.Y.stringSub(s,i)),u.cost=this.parseNumber(i),u.currency=d)}return{info:e,id:this.safeString2(e,"order_id","task_id"),txid:r,type:o,currency:d,network:this.safeString(e,"provider"),amount:this.parseNumber(s),status:this.parseTransactionStatus(this.safeStringLower(e,"status")),timestamp:i,datetime:this.iso8601(i),address:h,addressFrom:void 0,addressTo:h,tag:void 0,tagFrom:void 0,tagTo:void 0,updated:this.safeTimestamp(e,"updated"),comment:c,internal:void 0,fee:u}}async fetchDepositsWithdrawals(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};let a;void 0!==t&&(r.date=this.parseToInt(t/1e3)),void 0!==e&&(a=this.currency(e));const o=await this.privatePostWalletHistory(this.extend(r,s));return this.parseTransactions(o.history,a,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();const a={type:"withdraw"};void 0!==i&&(a.limit=i),void 0!==e&&(r=this.currency(e),a.currency=r.id);const o=await this.privatePostWalletOperations(this.extend(a,s)),n=this.safeList(o,"items",[]);return this.parseTransactions(n,r,t,i)}async fetchWithdrawal(e,t=void 0,i={}){let s;await this.loadMarkets();const r={order_id:e,type:"withdraw"};void 0!==t&&(s=this.currency(t),r.currency=s.id);const a=await this.privatePostWalletOperations(this.extend(r,i)),o=this.safeValue(a,"items",[]),n=this.safeDict(o,0,{});return this.parseTransaction(n,s)}async fetchDeposit(e,t=void 0,i={}){let s;await this.loadMarkets();const r={order_id:e,type:"deposit"};void 0!==t&&(s=this.currency(t),r.currency=s.id);const a=await this.privatePostWalletOperations(this.extend(r,i)),o=this.safeValue(a,"items",[]),n=this.safeDict(o,0,{});return this.parseTransaction(n,s)}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets();const a={type:"deposit"};void 0!==i&&(a.limit=i),void 0!==e&&(r=this.currency(e),a.currency=r.id);const o=await this.privatePostWalletOperations(this.extend(a,s)),n=this.safeList(o,"items",[]);return this.parseTransactions(n,r,t,i)}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o=this.urls.api[t]+"/";if("web"!==t&&(o+=this.version+"/"),o+=e,"public"===t||"web"===t)Object.keys(s).length&&(o+="?"+this.urlencode(s));else if("private"===t){this.checkRequiredCredentials();const e=this.nonce();a=this.urlencode(this.extend({nonce:e},s)),r={"Content-Type":"application/x-www-form-urlencoded",Key:this.apiKey,Sign:this.hmac(this.encode(a),this.encode(this.secret),n.Zf)}}return{url:o,method:i,body:a,headers:r}}nonce(){return this.milliseconds()}handleErrors(e,t,i,s,a,o,n,d,h){if(void 0!==n){if("error"in n&&!("result"in n)){const e=this.safeValue(n,"error",{}),t=this.safeString(e,"msg"),i=this.safeString(e,"code"),s=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,i,s),this.throwBroadlyMatchedException(this.exceptions.broad,t,s),new r.ExchangeError(s)}if("result"in n||"errmsg"in n){let e=this.safeBool(n,"result",!1);if("string"==typeof e&&(e="true"===e||"1"===e),!e){let e;const t=this.safeString2(n,"error","errmsg"),i=t.split(":");if(i.length>1){const t=i[0].split(" ");e=t.length>1?t[1]:t[0]}const s=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,e,s),this.throwBroadlyMatchedException(this.exceptions.broad,t,s),new r.ExchangeError(s)}}}}}},3042:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(7996);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"fmfwio",name:"FMFW.io",countries:["KN"],urls:{logo:"https://user-images.githubusercontent.com/1294454/159177712-b685b40c-5269-4cea-ac83-f7894c49525d.jpg",api:{public:"https://api.fmfw.io/api/3",private:"https://api.fmfw.io/api/3"},www:"https://fmfw.io",doc:"https://api.fmfw.io/",fees:"https://fmfw.io/fees-and-limits",referral:"https://fmfw.io/referral/da948b21d6c92d69"},fees:{trading:{maker:this.parseNumber("0.005"),taker:this.parseNumber("0.005")}}})}}},9403:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(7418),r=i(5147),a=i(1579),o=i(2079),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"gate",name:"Gate.io",countries:["KR"],rateLimit:50,version:"v4",certified:!0,pro:!0,urls:{logo:"https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85",doc:"https://www.gate.io/docs/developers/apiv4/en/",www:"https://gate.io/",api:{public:{wallet:"https://api.gateio.ws/api/v4",futures:"https://api.gateio.ws/api/v4",margin:"https://api.gateio.ws/api/v4",delivery:"https://api.gateio.ws/api/v4",spot:"https://api.gateio.ws/api/v4",options:"https://api.gateio.ws/api/v4",sub_accounts:"https://api.gateio.ws/api/v4",earn:"https://api.gateio.ws/api/v4"},private:{withdrawals:"https://api.gateio.ws/api/v4",wallet:"https://api.gateio.ws/api/v4",futures:"https://api.gateio.ws/api/v4",margin:"https://api.gateio.ws/api/v4",delivery:"https://api.gateio.ws/api/v4",spot:"https://api.gateio.ws/api/v4",options:"https://api.gateio.ws/api/v4",subAccounts:"https://api.gateio.ws/api/v4",unified:"https://api.gateio.ws/api/v4",rebate:"https://api.gateio.ws/api/v4",earn:"https://api.gateio.ws/api/v4",account:"https://api.gateio.ws/api/v4",loan:"https://api.gateio.ws/api/v4"}},test:{public:{futures:"https://fx-api-testnet.gateio.ws/api/v4",delivery:"https://fx-api-testnet.gateio.ws/api/v4",options:"https://fx-api-testnet.gateio.ws/api/v4"},private:{futures:"https://fx-api-testnet.gateio.ws/api/v4",delivery:"https://fx-api-testnet.gateio.ws/api/v4",options:"https://fx-api-testnet.gateio.ws/api/v4"}},referral:{url:"https://www.gate.io/signup/2436035",discount:.2}},has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,createMarketBuyOrderWithCost:!0,createMarketOrder:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!0,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchNetworkDepositAddress:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactionFees:!0,fetchUnderlyingAssets:!0,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,sandbox:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},api:{public:{wallet:{get:{currency_chains:1}},spot:{get:{currencies:1,"currencies/{currency}":1,currency_pairs:1,"currency_pairs/{currency_pair}":1,tickers:1,order_book:1,trades:1,candlesticks:1,time:1}},margin:{get:{currency_pairs:1,"currency_pairs/{currency_pair}":1,funding_book:1,"cross/currencies":1,"cross/currencies/{currency}":1,"uni/currency_pairs":1,"uni/currency_pairs/{currency_pair}":1}},flash_swap:{get:{currencies:1}},futures:{get:{"{settle}/contracts":1,"{settle}/contracts/{contract}":1,"{settle}/order_book":1,"{settle}/trades":1,"{settle}/candlesticks":1,"{settle}/premium_index":1,"{settle}/tickers":1,"{settle}/funding_rate":1,"{settle}/insurance":1,"{settle}/contract_stats":1,"{settle}/index_constituents/{index}":1,"{settle}/liq_orders":1,"{settle}/risk_limit_tiers":1}},delivery:{get:{"{settle}/contracts":1,"{settle}/contracts/{contract}":1,"{settle}/order_book":1,"{settle}/trades":1,"{settle}/candlesticks":1,"{settle}/tickers":1,"{settle}/insurance":1}},options:{get:{underlyings:1,expirations:1,contracts:1,"contracts/{contract}":1,settlements:1,"settlements/{contract}":1,order_book:1,tickers:1,"underlying/tickers/{underlying}":1,candlesticks:1,"underlying/candlesticks":1,trades:1}},earn:{get:{"uni/currencies":1,"uni/currencies/{currency}":1}}},private:{withdrawals:{post:{withdrawals:20,push:1},delete:{"withdrawals/{withdrawal_id}":1}},wallet:{get:{deposit_address:1,withdrawals:1,deposits:1,sub_account_transfers:1,order_status:1,withdraw_status:1,sub_account_balances:2.5,sub_account_margin_balances:2.5,sub_account_futures_balances:2.5,sub_account_cross_margin_balances:2.5,saved_address:1,fee:1,total_balance:2.5,small_balance:1,small_balance_history:1,push:1},post:{transfers:2.5,sub_account_transfers:2.5,sub_account_to_sub_account:2.5,small_balance:1}},subAccounts:{get:{sub_accounts:2.5,"sub_accounts/{user_id}":2.5,"sub_accounts/{user_id}/keys":2.5,"sub_accounts/{user_id}/keys/{key}":2.5},post:{sub_accounts:2.5,"sub_accounts/{user_id}/keys":2.5,"sub_accounts/{user_id}/lock":2.5,"sub_accounts/{user_id}/unlock":2.5},put:{"sub_accounts/{user_id}/keys/{key}":2.5},delete:{"sub_accounts/{user_id}/keys/{key}":2.5}},unified:{get:{accounts:20/15,account_mode:20/15,borrowable:20/15,transferable:20/15,loans:20/15,loan_records:20/15,interest_records:20/15,estimate_rate:20/15,currency_discount_tiers:20/15,risk_units:20/15,unified_mode:20/15,loan_margin_tiers:20/15,"leverage/user_currency_config":20/15,"leverage/user_currency_setting":20/15},post:{account_mode:20/15,loans:200/15,portfolio_calculator:20/15,"leverage/user_currency_setting":20/15},put:{unified_mode:20/15}},spot:{get:{fee:1,batch_fee:1,accounts:1,account_book:1,open_orders:1,orders:1,"orders/{order_id}":1,my_trades:1,price_orders:1,"price_orders/{order_id}":1},post:{batch_orders:.4,cross_liquidate_orders:1,orders:.4,cancel_batch_orders:20/75,countdown_cancel_all:20/75,amend_batch_orders:.4,price_orders:.4},delete:{orders:20/75,"orders/{order_id}":20/75,price_orders:20/75,"price_orders/{order_id}":20/75},patch:{"orders/{order_id}":.4}},margin:{get:{accounts:20/15,account_book:20/15,funding_accounts:20/15,auto_repay:20/15,transferable:20/15,loans:20/15,"loans/{loan_id}":20/15,"loans/{loan_id}/repayment":20/15,loan_records:20/15,"loan_records/{loan_record_id}":20/15,borrowable:20/15,"cross/accounts":20/15,"cross/account_book":20/15,"cross/loans":20/15,"cross/loans/{loan_id}":20/15,"cross/repayments":20/15,"cross/interest_records":20/15,"cross/transferable":20/15,"cross/estimate_rate":20/15,"cross/borrowable":20/15,"uni/estimate_rate":20/15,"uni/loans":20/15,"uni/loan_records":20/15,"uni/interest_records":20/15,"uni/borrowable":20/15},post:{auto_repay:20/15,loans:20/15,merged_loans:20/15,"loans/{loan_id}/repayment":20/15,"cross/loans":20/15,"cross/repayments":20/15,"uni/loans":20/15},patch:{"loans/{loan_id}":20/15,"loan_records/{loan_record_id}":20/15},delete:{"loans/{loan_id}":20/15}},flash_swap:{get:{currencies:1,currency_pairs:1,orders:1,"orders/{order_id}":1},post:{orders:1,"orders/preview":1}},futures:{get:{"{settle}/accounts":1,"{settle}/account_book":1,"{settle}/positions":1,"{settle}/positions/{contract}":1,"{settle}/dual_comp/positions/{contract}":1,"{settle}/orders":1,"{settle}/orders_timerange":1,"{settle}/orders/{order_id}":1,"{settle}/my_trades":1,"{settle}/my_trades_timerange":1,"{settle}/position_close":1,"{settle}/liquidates":1,"{settle}/auto_deleverages":1,"{settle}/fee":1,"{settle}/risk_limit_tiers":1,"{settle}/price_orders":1,"{settle}/price_orders/{order_id}":1},post:{"{settle}/positions/{contract}/margin":1,"{settle}/positions/{contract}/leverage":1,"{settle}/positions/{contract}/risk_limit":1,"{settle}/dual_mode":1,"{settle}/dual_comp/positions/{contract}/margin":1,"{settle}/dual_comp/positions/{contract}/leverage":1,"{settle}/dual_comp/positions/{contract}/risk_limit":1,"{settle}/orders":.4,"{settle}/batch_orders":.4,"{settle}/countdown_cancel_all":.4,"{settle}/batch_cancel_orders":.4,"{settle}/price_orders":.4},put:{"{settle}/orders/{order_id}":1},delete:{"{settle}/orders":20/75,"{settle}/orders/{order_id}":20/75,"{settle}/price_orders":20/75,"{settle}/price_orders/{order_id}":20/75}},delivery:{get:{"{settle}/accounts":20/15,"{settle}/account_book":20/15,"{settle}/positions":20/15,"{settle}/positions/{contract}":20/15,"{settle}/orders":20/15,"{settle}/orders/{order_id}":20/15,"{settle}/my_trades":20/15,"{settle}/position_close":20/15,"{settle}/liquidates":20/15,"{settle}/settlements":20/15,"{settle}/price_orders":20/15,"{settle}/price_orders/{order_id}":20/15},post:{"{settle}/positions/{contract}/margin":20/15,"{settle}/positions/{contract}/leverage":20/15,"{settle}/positions/{contract}/risk_limit":20/15,"{settle}/orders":20/15,"{settle}/price_orders":20/15},delete:{"{settle}/orders":20/15,"{settle}/orders/{order_id}":20/15,"{settle}/price_orders":20/15,"{settle}/price_orders/{order_id}":20/15}},options:{get:{my_settlements:20/15,accounts:20/15,account_book:20/15,positions:20/15,"positions/{contract}":20/15,position_close:20/15,orders:20/15,"orders/{order_id}":20/15,my_trades:20/15,mmp:20/15},post:{orders:20/15,countdown_cancel_all:20/15,mmp:20/15,"mmp/reset":20/15},delete:{orders:20/15,"orders/{order_id}":20/15}},earn:{get:{"uni/currencies":20/15,"uni/currencies/{currency}":20/15,"uni/lends":20/15,"uni/lend_records":20/15,"uni/interests/{currency}":20/15,"uni/interest_records":20/15,"uni/interest_status/{currency}":20/15},post:{"uni/lends":20/15},put:{"uni/interest_reinvest":20/15},patch:{"uni/lends":20/15}},loan:{get:{"collateral/orders":20/15,"collateral/orders/{order_id}":20/15,"collateral/repay_records":20/15,"collateral/collaterals":20/15,"collateral/total_amount":20/15,"collateral/ltv":20/15,"collateral/currencies":20/15,"multi_collateral/orders":20/15,"multi_collateral/orders/{order_id}":20/15,"multi_collateral/repay":20/15,"multi_collateral/mortgage":20/15,"multi_collateral/currency_quota":20/15,"multi_collateral/currencies":20/15,"multi_collateral/ltv":20/15,"multi_collateral/fixed_rate":20/15,"multi_collateral/current_rate":20/15},post:{"collateral/orders":20/15,"collateral/repay":20/15,"collateral/collaterals":20/15,"multi_collateral/orders":20/15,"multi_collateral/repay":20/15,"multi_collateral/mortgage":20/15}},account:{get:{detail:20/15,rate_limit:20/15,stp_groups:20/15,"stp_groups/{stp_id}/users":20/15,"stp_groups/debit_fee":20/15},post:{stp_groups:20/15,"stp_groups/{stp_id}/users":20/15},delete:{"stp_groups/{stp_id}/users":20/15}},rebate:{get:{"agency/transaction_history":20/15,"agency/commission_history":20/15}}}},timeframes:{"10s":"10s","1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","8h":"8h","1d":"1d","7d":"7d","1w":"7d"},commonCurrencies:{ORT:"XREATORS",ASS:"ASSF","88MPH":"MPH",AXIS:"AXISDEFI",BIFI:"BITCOINFILE",BOX:"DEFIBOX",BYN:"BEYONDFI",EGG:"GOOSEFINANCE",GTC:"GAMECOM",GTC_HT:"GAMECOM_HT",GTC_BSC:"GAMECOM_BSC",HIT:"HITCHAIN",MM:"MILLION",MPH:"MORPHER",POINT:"GATEPOINT",RAI:"RAIREFLEXINDEX",RED:"RedLang",SBTC:"SUPERBITCOIN",TNC:"TRINITYNETWORKCREDIT",VAI:"VAIOT",TRAC:"TRACO"},requiredCredentials:{apiKey:!0,secret:!0},headers:{"X-Gate-Channel-Id":"ccxt"},options:{timeDifference:0,adjustForTimeDifference:!1,sandboxMode:!1,unifiedAccount:void 0,createOrder:{expiration:86400},createMarketBuyOrderRequiresPrice:!0,networks:{BTC:"BTC",BRC20:"BTCBRC",ETH:"ETH",ERC20:"ETH",TRX:"TRX",TRC20:"TRX",HECO:"HT",HRC20:"HT",BSC:"BSC",BEP20:"BSC",SOL:"SOL",POLYGON:"POL",MATIC:"POL",OP:"OPETH",OPTIMISM:"OPETH",ADA:"ADA",AVAXC:"AVAX_C",NEAR:"NEAR",ARBONE:"ARBEVM",BASE:"BASEEVM",SUI:"SUI",CRONOS:"CRO",CRO:"CRO",APT:"APT",SCROLL:"SCROLLETH",TAIKO:"TAIKOETH",HYPE:"HYPE",ALGO:"ALGO",LINEA:"LINEAETH",BLAST:"BLASTETH",XLM:"XLM",RSK:"RBTC",TON:"TON",MNT:"MNT",CELO:"CELO",HBAR:"HBAR",ZKSERA:"ZKSERA",KLAY:"KLAY",EOS:"EOS",ACA:"ACA",XTZ:"XTZ",EGLD:"EGLD",GLMR:"GLMR",AURORA:"AURORAEVM",KON:"KONET",GATECHAIN:"GTEVM",KUSAMA:"KSMSM",OKC:"OKT",POLKADOT:"DOTSM",LUNA:"LUNC"},networksById:{OPETH:"OP",ETH:"ERC20",ERC20:"ERC20",TRX:"TRC20",TRC20:"TRC20",HT:"HRC20",HECO:"HRC20",BSC:"BEP20",BEP20:"BEP20",POLYGON:"MATIC",POL:"MATIC"},timeInForce:{GTC:"gtc",IOC:"ioc",PO:"poc",POC:"poc",FOK:"fok"},accountsByType:{funding:"spot",spot:"spot",margin:"margin",cross_margin:"cross_margin",cross:"cross_margin",isolated:"margin",swap:"futures",future:"delivery",futures:"futures",delivery:"delivery",option:"options",options:"options"},swap:{fetchMarkets:{settlementCurrencies:["usdt","btc"]}},future:{fetchMarkets:{settlementCurrencies:["usdt"]}}},features:{default:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerDirection:!0,triggerPriceType:void 0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,iceberg:!0,selfTradePrevention:!0,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!0},createOrders:{max:40},fetchMyTrades:{marginMode:!0,limit:1e3,daysBack:void 0,untilDays:30,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!0,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,trigger:!0,trailing:!1,limit:100,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,trigger:!0,trailing:!1,limit:100,untilDays:30,daysBack:void 0,daysBackCanceled:void 0,symbolRequired:!1},fetchOHLCV:{limit:1e3}},spot:{extends:"default"},forDerivatives:{extends:"spot",createOrder:{marginMode:!1,triggerPriceType:{last:!0,mark:!0,index:!0}},createOrders:{max:10},fetchMyTrades:{marginMode:!1,untilDays:void 0},fetchOpenOrders:{marginMode:!1},fetchClosedOrders:{marginMode:!1,untilDays:void 0,limit:1e3},fetchOHLCV:{limit:1999}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}}},precisionMode:a.kb,fees:{trading:{tierBased:!0,feeSide:"get",percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1.5"),this.parseNumber("0.00185")],[this.parseNumber("3"),this.parseNumber("0.00175")],[this.parseNumber("6"),this.parseNumber("0.00165")],[this.parseNumber("12.5"),this.parseNumber("0.00155")],[this.parseNumber("25"),this.parseNumber("0.00145")],[this.parseNumber("75"),this.parseNumber("0.00135")],[this.parseNumber("200"),this.parseNumber("0.00125")],[this.parseNumber("500"),this.parseNumber("0.00115")],[this.parseNumber("1250"),this.parseNumber("0.00105")],[this.parseNumber("2500"),this.parseNumber("0.00095")],[this.parseNumber("3000"),this.parseNumber("0.00085")],[this.parseNumber("6000"),this.parseNumber("0.00075")],[this.parseNumber("11000"),this.parseNumber("0.00065")],[this.parseNumber("20000"),this.parseNumber("0.00055")],[this.parseNumber("40000"),this.parseNumber("0.00055")],[this.parseNumber("75000"),this.parseNumber("0.00055")]],taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1.5"),this.parseNumber("0.00195")],[this.parseNumber("3"),this.parseNumber("0.00185")],[this.parseNumber("6"),this.parseNumber("0.00175")],[this.parseNumber("12.5"),this.parseNumber("0.00165")],[this.parseNumber("25"),this.parseNumber("0.00155")],[this.parseNumber("75"),this.parseNumber("0.00145")],[this.parseNumber("200"),this.parseNumber("0.00135")],[this.parseNumber("500"),this.parseNumber("0.00125")],[this.parseNumber("1250"),this.parseNumber("0.00115")],[this.parseNumber("2500"),this.parseNumber("0.00105")],[this.parseNumber("3000"),this.parseNumber("0.00095")],[this.parseNumber("6000"),this.parseNumber("0.00085")],[this.parseNumber("11000"),this.parseNumber("0.00075")],[this.parseNumber("20000"),this.parseNumber("0.00065")],[this.parseNumber("40000"),this.parseNumber("0.00065")],[this.parseNumber("75000"),this.parseNumber("0.00065")]]}},swap:{tierBased:!0,feeSide:"base",percentage:!0,maker:this.parseNumber("0.0"),taker:this.parseNumber("0.0005"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0000")],[this.parseNumber("1.5"),this.parseNumber("-0.00005")],[this.parseNumber("3"),this.parseNumber("-0.00005")],[this.parseNumber("6"),this.parseNumber("-0.00005")],[this.parseNumber("12.5"),this.parseNumber("-0.00005")],[this.parseNumber("25"),this.parseNumber("-0.00005")],[this.parseNumber("75"),this.parseNumber("-0.00005")],[this.parseNumber("200"),this.parseNumber("-0.00005")],[this.parseNumber("500"),this.parseNumber("-0.00005")],[this.parseNumber("1250"),this.parseNumber("-0.00005")],[this.parseNumber("2500"),this.parseNumber("-0.00005")],[this.parseNumber("3000"),this.parseNumber("-0.00008")],[this.parseNumber("6000"),this.parseNumber("-0.01000")],[this.parseNumber("11000"),this.parseNumber("-0.01002")],[this.parseNumber("20000"),this.parseNumber("-0.01005")],[this.parseNumber("40000"),this.parseNumber("-0.02000")],[this.parseNumber("75000"),this.parseNumber("-0.02005")]],taker:[[this.parseNumber("0"),this.parseNumber("0.00050")],[this.parseNumber("1.5"),this.parseNumber("0.00048")],[this.parseNumber("3"),this.parseNumber("0.00046")],[this.parseNumber("6"),this.parseNumber("0.00044")],[this.parseNumber("12.5"),this.parseNumber("0.00042")],[this.parseNumber("25"),this.parseNumber("0.00040")],[this.parseNumber("75"),this.parseNumber("0.00038")],[this.parseNumber("200"),this.parseNumber("0.00036")],[this.parseNumber("500"),this.parseNumber("0.00034")],[this.parseNumber("1250"),this.parseNumber("0.00032")],[this.parseNumber("2500"),this.parseNumber("0.00030")],[this.parseNumber("3000"),this.parseNumber("0.00030")],[this.parseNumber("6000"),this.parseNumber("0.00030")],[this.parseNumber("11000"),this.parseNumber("0.00030")],[this.parseNumber("20000"),this.parseNumber("0.00030")],[this.parseNumber("40000"),this.parseNumber("0.00030")],[this.parseNumber("75000"),this.parseNumber("0.00030")]]}}},exceptions:{exact:{INVALID_PARAM_VALUE:o.BadRequest,INVALID_PROTOCOL:o.BadRequest,INVALID_ARGUMENT:o.BadRequest,INVALID_REQUEST_BODY:o.BadRequest,MISSING_REQUIRED_PARAM:o.ArgumentsRequired,BAD_REQUEST:o.BadRequest,INVALID_CONTENT_TYPE:o.BadRequest,NOT_ACCEPTABLE:o.BadRequest,METHOD_NOT_ALLOWED:o.BadRequest,NOT_FOUND:o.ExchangeError,AUTHENTICATION_FAILED:o.AuthenticationError,INVALID_CREDENTIALS:o.AuthenticationError,INVALID_KEY:o.AuthenticationError,IP_FORBIDDEN:o.AuthenticationError,READ_ONLY:o.PermissionDenied,INVALID_SIGNATURE:o.AuthenticationError,MISSING_REQUIRED_HEADER:o.AuthenticationError,REQUEST_EXPIRED:o.AuthenticationError,ACCOUNT_LOCKED:o.AccountSuspended,FORBIDDEN:o.PermissionDenied,SUB_ACCOUNT_NOT_FOUND:o.ExchangeError,SUB_ACCOUNT_LOCKED:o.AccountSuspended,MARGIN_BALANCE_EXCEPTION:o.ExchangeError,MARGIN_TRANSFER_FAILED:o.ExchangeError,TOO_MUCH_FUTURES_AVAILABLE:o.ExchangeError,FUTURES_BALANCE_NOT_ENOUGH:o.InsufficientFunds,ACCOUNT_EXCEPTION:o.ExchangeError,SUB_ACCOUNT_TRANSFER_FAILED:o.ExchangeError,ADDRESS_NOT_USED:o.ExchangeError,TOO_FAST:o.RateLimitExceeded,WITHDRAWAL_OVER_LIMIT:o.ExchangeError,API_WITHDRAW_DISABLED:o.ExchangeNotAvailable,INVALID_WITHDRAW_ID:o.ExchangeError,INVALID_WITHDRAW_CANCEL_STATUS:o.ExchangeError,INVALID_PRECISION:o.InvalidOrder,INVALID_CURRENCY:o.BadSymbol,INVALID_CURRENCY_PAIR:o.BadSymbol,POC_FILL_IMMEDIATELY:o.OrderImmediatelyFillable,ORDER_NOT_FOUND:o.OrderNotFound,CLIENT_ID_NOT_FOUND:o.OrderNotFound,ORDER_CLOSED:o.InvalidOrder,ORDER_CANCELLED:o.InvalidOrder,QUANTITY_NOT_ENOUGH:o.InvalidOrder,BALANCE_NOT_ENOUGH:o.InsufficientFunds,MARGIN_NOT_SUPPORTED:o.InvalidOrder,MARGIN_BALANCE_NOT_ENOUGH:o.InsufficientFunds,AMOUNT_TOO_LITTLE:o.InvalidOrder,AMOUNT_TOO_MUCH:o.InvalidOrder,REPEATED_CREATION:o.InvalidOrder,LOAN_NOT_FOUND:o.OrderNotFound,LOAN_RECORD_NOT_FOUND:o.OrderNotFound,NO_MATCHED_LOAN:o.ExchangeError,NOT_MERGEABLE:o.ExchangeError,NO_CHANGE:o.ExchangeError,REPAY_TOO_MUCH:o.ExchangeError,TOO_MANY_CURRENCY_PAIRS:o.InvalidOrder,TOO_MANY_ORDERS:o.InvalidOrder,TOO_MANY_REQUESTS:o.RateLimitExceeded,MIXED_ACCOUNT_TYPE:o.InvalidOrder,AUTO_BORROW_TOO_MUCH:o.ExchangeError,TRADE_RESTRICTED:o.InsufficientFunds,USER_NOT_FOUND:o.AccountNotEnabled,CONTRACT_NO_COUNTER:o.ExchangeError,CONTRACT_NOT_FOUND:o.BadSymbol,RISK_LIMIT_EXCEEDED:o.ExchangeError,INSUFFICIENT_AVAILABLE:o.InsufficientFunds,LIQUIDATE_IMMEDIATELY:o.InvalidOrder,LEVERAGE_TOO_HIGH:o.InvalidOrder,LEVERAGE_TOO_LOW:o.InvalidOrder,ORDER_NOT_OWNED:o.ExchangeError,ORDER_FINISHED:o.ExchangeError,POSITION_CROSS_MARGIN:o.ExchangeError,POSITION_IN_LIQUIDATION:o.ExchangeError,POSITION_IN_CLOSE:o.ExchangeError,POSITION_EMPTY:o.InvalidOrder,REMOVE_TOO_MUCH:o.ExchangeError,RISK_LIMIT_NOT_MULTIPLE:o.ExchangeError,RISK_LIMIT_TOO_HIGH:o.ExchangeError,RISK_LIMIT_TOO_lOW:o.ExchangeError,PRICE_TOO_DEVIATED:o.InvalidOrder,SIZE_TOO_LARGE:o.InvalidOrder,SIZE_TOO_SMALL:o.InvalidOrder,PRICE_OVER_LIQUIDATION:o.InvalidOrder,PRICE_OVER_BANKRUPT:o.InvalidOrder,ORDER_POC_IMMEDIATE:o.OrderImmediatelyFillable,INCREASE_POSITION:o.InvalidOrder,CONTRACT_IN_DELISTING:o.ExchangeError,INTERNAL:o.ExchangeNotAvailable,SERVER_ERROR:o.ExchangeNotAvailable,TOO_BUSY:o.ExchangeNotAvailable,CROSS_ACCOUNT_NOT_FOUND:o.ExchangeError,RISK_LIMIT_TOO_LOW:o.BadRequest,AUTO_TRIGGER_PRICE_LESS_LAST:o.InvalidOrder,AUTO_TRIGGER_PRICE_GREATE_LAST:o.InvalidOrder,POSITION_HOLDING:o.BadRequest,USER_LOAN_EXCEEDED:o.BadRequest},broad:{}}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}async loadUnifiedStatus(e={}){if(void 0===this.safeBool(this.options,"unifiedAccount"))try{const t=await this.privateAccountGetDetail(e),i=this.safeDict(t,"key",{});this.options.unifiedAccount=2===this.safeInteger(i,"mode")}catch(e){this.options.unifiedAccount=!1}return this.options.unifiedAccount}async upgradeUnifiedTradeAccount(e={}){return await this.privateUnifiedPutUnifiedMode(e)}async fetchTime(e={}){const t=await this.publicSpotGetTime(e);return this.safeInteger(t,"server_time")}createExpiredOptionMarket(e){const t="USDT",i=t,s=e.split("-"),r=e.split("/"),a=e.split("_");let o,n=this.safeString(s,1);e.indexOf("/")>-1?o=this.safeString(r,0):(o=this.safeString(a,0),n=n.slice(2,8));const d=this.safeString(s,2),h=this.safeString(s,3),c=this.convertExpireDate(n),l=this.parse8601(c);return{id:o+"_"+t+"-20"+n+"-"+d+"-"+h,symbol:o+"/"+t+":"+i+"-"+n+"-"+d+"-"+h,base:o,quote:t,settle:i,baseId:o,quoteId:t,settleId:i,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:this.parseNumber("1"),expiry:l,expiryDatetime:c,optionType:"C"===h?"call":"put",strike:this.parseNumber(d),precision:{amount:this.parseNumber("1"),price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,i=void 0,s=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,i,s)}async fetchMarkets(e={}){this.options.adjustForTimeDifference&&await this.loadTimeDifference(),this.checkRequiredCredentials(!1)&&await this.loadUnifiedStatus();const t=this.safeBool(this.options,"sandboxMode",!1);let i=[this.fetchContractMarkets(e),this.fetchOptionMarkets(e)];if(!t){const t=[this.fetchSpotMarkets(e)];i=this.arrayConcat(i,t)}const s=await Promise.all(i),r=this.safeValue(s,0,[]),a=this.safeValue(s,1,[]),o=this.safeValue(s,2,[]),n=this.arrayConcat(r,a);return this.arrayConcat(n,o)}async fetchSpotMarkets(e={}){const t=this.publicMarginGetCurrencyPairs(e),i=this.publicSpotGetCurrencyPairs(e),[s,a]=await Promise.all([t,i]),o=this.indexBy(s,"id"),n=[];for(let e=0;e10)throw new o.BadRequest(this.id+" createOrders() accepts a maximum of 10 orders at a time");for(let r=0;r28)throw new o.BadRequest(this.id+" createOrder () clientOrderId or text param must be up to 28 characters");n=this.omit(n,["text","clientOrderId","textIsRequired"]),"t"!==c[0]&&(c="t-"+c),O.text=c}else l&&(O.text="t-"+this.uuid16())}else{if(d.option)throw new o.NotSupported(this.id+" createOrder() conditional option orders are not supported");if(h){if(O={initial:{contract:d.id,size:s},settle:d.settleId},O.initial.price="market"===t||0===a?"0":this.priceToPrecision(e,a),void 0===c){let t,s;p?(t="buy"===i?1:2,s=this.priceToPrecision(e,u)):m&&(t="buy"===i?2:1,s=this.priceToPrecision(e,f));const r=this.safeInteger(n,"price_type",0);if(r<0||r>2)throw new o.BadRequest(this.id+" createOrder () price_type should be 0 latest deal price, 1 mark price, 2 index price");n=this.omit(n,["price_type"]),O.trigger={price_type:r,price:this.priceToPrecision(e,s),rule:t}}void 0!==v&&(O.initial.reduce_only=v),void 0!==b&&(O.initial.tif=b)}else{const r=this.safeValue(this.options,"createOrder",{});let o;if([o,n]=this.getMarginMode(!0,n),void 0===b&&(b="gtc"),O={put:{type:t,side:i,price:this.priceToPrecision(e,a),amount:this.amountToPrecision(e,s),account:o,time_in_force:b},market:d.id},void 0===c){const t=this.safeInteger(r,"expiration"),s=this.safeInteger(n,"expiration",t);let a,o;p?(a="buy"===i?">=":"<=",o=this.priceToPrecision(e,u)):m&&(a="buy"===i?"<=":">=",o=this.priceToPrecision(e,f)),O.trigger={price:this.priceToPrecision(e,o),rule:a,expiration:s}}}}return this.extend(O,n)}async createMarketBuyOrderWithCost(e,t,i={}){await this.loadMarkets(),await this.loadUnifiedStatus();if(!this.market(e).spot)throw new o.NotSupported(this.id+" createMarketBuyOrderWithCost() supports spot orders only");return i.createMarketBuyOrderRequiresPrice=!1,await this.createOrder(e,"market","buy",t,void 0,i)}editOrderRequest(e,t,i,s,a=void 0,n=void 0,d={}){const h=this.market(t);let c;[c,d]=this.handleMarketTypeAndParams("editOrder",h,d);let l=this.convertTypeToAccount(c),u=!1;[u,d]=this.handleOptionAndParams(d,"editOrder","unifiedAccount"),u&&(l="unified");if("spot"===l&&!("limit"===i))throw new o.InvalidOrder(this.id+" editOrder() does not support "+i+" orders for "+c+" markets");const f={order_id:e.toString(),currency_pair:h.id,account:l};return void 0!==a&&(h.spot?f.amount=this.amountToPrecision(t,a):f.size="sell"===s?this.parseToNumeric(r.Y.stringNeg(this.amountToPrecision(t,a))):this.parseToNumeric(this.amountToPrecision(t,a))),void 0!==n&&(f.price=this.priceToPrecision(t,n)),h.spot||(f.settle=h.settleId),this.extend(f,d)}async editOrder(e,t,i,s,r=void 0,a=void 0,o={}){await this.loadMarkets(),await this.loadUnifiedStatus();const n=this.market(t),d=this.editOrderRequest(e,t,i,s,r,a,o);let h;return h=n.spot?await this.privateSpotPatchOrdersOrderId(d):await this.privateFuturesPutSettleOrdersOrderId(d),this.parseOrder(h,n)}parseOrderStatus(e){return this.safeString({open:"open",_new:"open",filled:"closed",cancelled:"canceled",liquidated:"closed",ioc:"canceled",failed:"canceled",expired:"canceled",finished:"closed",finish:"closed",succeeded:"closed"},e,e)}parseOrder(e,t=void 0){if(!this.safeBool(e,"succeeded",!0))return this.safeOrder({clientOrderId:this.safeString(e,"text"),info:e,status:"rejected",id:this.safeString(e,"id")});const i=this.safeValue2(e,"put","initial",{}),s=this.safeValue(e,"trigger",{});let a=this.safeString(i,"contract"),o=this.safeString(i,"type"),n=this.safeStringUpper2(i,"time_in_force","tif"),d=this.safeString2(i,"amount","size"),h=this.safeString(i,"side"),c=this.safeString(i,"price");a=this.safeString(e,"contract",a),o=this.safeString(e,"type",o),n=this.safeStringUpper2(e,"time_in_force","tif",n),"POC"===n&&(n="PO");const l="PO"===n;d=this.safeString2(e,"amount","size",d),h=this.safeString(e,"side",h),c=this.safeString(e,"price",c);let u=this.safeString(e,"left"),f=this.safeString(e,"filled_total");const p=this.safeNumber(s,"price");let m=this.safeNumber2(e,"avg_deal_price","fill_price");if(p&&(u=d,f="0"),a){o=r.Y.stringEquals(c,"0")&&"IOC"===n?"market":"limit",h=r.Y.stringGt(d,"0")?"buy":"sell"}const g=this.safeStringN(e,["finish_as","status","open"]);let v=this.safeInteger(e,"create_time_ms");void 0===v&&(v=this.safeTimestamp2(e,"create_time","ctime"));let y=this.safeInteger(e,"update_time_ms");void 0===y&&(y=this.safeTimestamp2(e,"update_time","finish_time"));let w="contract";("currency_pair"in e||"market"in e)&&(w="spot");const b=this.safeString2(e,"currency_pair","market",a),k=this.safeSymbol(b,t,"_",w),S=[],O=this.safeString(e,"gt_fee");void 0!==O&&S.push({currency:"GT",cost:O});const T=this.safeString(e,"fee");void 0!==T&&S.push({currency:this.safeCurrencyCode(this.safeString(e,"fee_currency")),cost:T});const P=this.safeString(e,"rebated_fee");void 0!==P&&S.push({currency:this.safeCurrencyCode(this.safeString(e,"rebated_fee_currency")),cost:r.Y.stringNeg(P)});const I=S.length>1,M=this.parseOrderStatus(g);let x=r.Y.stringAbs(u);if("spot"===this.safeString(e,"account")){const t=this.safeString(e,"avg_deal_price");m=this.parseNumber(t),"market"===o&&"buy"===h&&(x=r.Y.stringDiv(u,t),c=void 0,f=d,d=r.Y.stringDiv(d,t))}return this.safeOrder({id:this.safeString(e,"id"),clientOrderId:this.safeString(e,"text"),timestamp:v,datetime:this.iso8601(v),lastTradeTimestamp:y,status:M,symbol:k,type:o,timeInForce:n,postOnly:l,reduceOnly:this.safeValue(e,"is_reduce_only"),side:h,price:c,triggerPrice:p,average:m,amount:r.Y.stringAbs(d),cost:r.Y.stringAbs(f),filled:void 0,remaining:x,fee:I?void 0:this.safeValue(S,0),fees:I?S:[],trades:void 0,info:e},t)}fetchOrderRequest(e,t=void 0,i={}){const s=void 0===t?void 0:this.market(t),r=this.safeBoolN(i,["trigger","is_stop_order","stop"],!1);i=this.omit(i,["is_stop_order","stop","trigger"]);let a=this.safeString2(i,"text","clientOrderId"),o=e;void 0!==a&&(i=this.omit(i,["text","clientOrderId"]),"t"!==a[0]&&(a="t-"+a),o=a);const[n,d]=this.handleMarketTypeAndParams("fetchOrder",s,i),h="swap"===n||"future"===n||"option"===n,[c,l]=h?this.prepareRequest(s,n,d):this.spotOrderPrepareRequest(s,r,d);return c.order_id=o.toString(),[c,l]}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets(),await this.loadUnifiedStatus();const s=void 0===t?void 0:this.market(t),r=this.handleMarketTypeAndParams("fetchOrder",s,i),a=this.safeString(r,0),n=this.safeBoolN(i,["trigger","is_stop_order","stop"],!1),[d,h]=this.fetchOrderRequest(e,t,i);let c;if("spot"===a||"margin"===a)c=n?await this.privateSpotGetPriceOrdersOrderId(this.extend(d,h)):await this.privateSpotGetOrdersOrderId(this.extend(d,h));else if("swap"===a)c=n?await this.privateFuturesGetSettlePriceOrdersOrderId(this.extend(d,h)):await this.privateFuturesGetSettleOrdersOrderId(this.extend(d,h));else if("future"===a)c=n?await this.privateDeliveryGetSettlePriceOrdersOrderId(this.extend(d,h)):await this.privateDeliveryGetSettleOrdersOrderId(this.extend(d,h));else{if("option"!==a)throw new o.NotSupported(this.id+" fetchOrder() not support this market type");c=await this.privateOptionsGetOrdersOrderId(this.extend(d,h))}return this.parseOrder(c,s)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){return await this.fetchOrdersByStatus("open",e,t,i,s)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets(),await this.loadUnifiedStatus();const r=this.safeInteger(s,"until");let a;void 0!==e&&(a=this.market(e),e=a.symbol);const o=this.handleMarketTypeAndParams("fetchClosedOrders",a,s),n=this.safeString(o,0);let d=!1;if([d,s]=this.handleOptionAndParams(s,"fetchClosedOrders","historical",!1),!d&&(void 0===t&&void 0===r||"swap"!==n))return await this.fetchOrdersByStatus("finished",e,t,i,s);s=this.omit(s,"type");let h={};[h,s]=this.prepareRequest(a,n,s),void 0!==t&&(h.from=this.parseToInt(t/1e3)),void 0!==r&&(s=this.omit(s,"until"),h.to=this.parseToInt(r/1e3)),void 0!==i&&(h.limit=i);const c=await this.privateFuturesGetSettleOrdersTimerange(this.extend(h,s));return this.parseOrders(c,a,t,i)}prepareOrdersByStatusRequest(e,t=void 0,i=void 0,s=void 0,r={}){let a,o,n;void 0!==t&&(a=this.market(t),t=a.symbol),[o,r]=this.handleParamBool2(r,"trigger","stop"),[n,r]=this.handleMarketTypeAndParams("fetchOrdersByStatus",a,r);const d="spot"===n||"margin"===n;let h={};if([h,r]=d?this.multiOrderSpotPrepareRequest(a,o,r):this.prepareRequest(a,n,r),d&&o&&(h=this.omit(h,"account")),"closed"===e&&(e="finished"),h.status=e,void 0!==s&&(h.limit=s),d){void 0!==i&&(h.from=this.parseToInt(i/1e3));const e=this.safeInteger(r,"until");void 0!==e&&(r=this.omit(r,"until"),h.to=this.parseToInt(e/1e3))}const[c,l]=this.handleParamString2(r,"lastId","last_id");return void 0!==c&&(h.last_id=c),[h,l]}async fetchOrdersByStatus(e,t=void 0,i=void 0,s=void 0,r={}){let a;await this.loadMarkets(),await this.loadUnifiedStatus(),void 0!==t&&(a=this.market(t),t=a.symbol);const n=this.safeBool2(r,"trigger","stop"),d=this.handleMarketTypeAndParams("fetchOrdersByStatus",a,r),h=this.safeString(d,0),[c,l]=this.prepareOrdersByStatusRequest(e,t,i,s,r),u="spot"===h||"margin"===h,f="open"===e,p=u&&f&&!n;let m;if(u)m=n?await this.privateSpotGetPriceOrders(this.extend(c,l)):f?await this.privateSpotGetOpenOrders(this.extend(c,l)):await this.privateSpotGetOrders(this.extend(c,l));else if("swap"===h)m=n?await this.privateFuturesGetSettlePriceOrders(this.extend(c,l)):await this.privateFuturesGetSettleOrders(this.extend(c,l));else if("future"===h)m=n?await this.privateDeliveryGetSettlePriceOrders(this.extend(c,l)):await this.privateDeliveryGetSettleOrders(this.extend(c,l));else{if("option"!==h)throw new o.NotSupported(this.id+" fetchOrders() not support this market type");m=await this.privateOptionsGetOrders(this.extend(c,l))}let g=m;if(p){g=[];for(let e=0;e100)throw new o.BadRequest(this.id+" setLeverage() leverage should be between 1 and 100");await this.loadMarkets();const s=this.market(t),[r,a]=this.prepareRequest(s,void 0,i),n=this.safeString2(this.options,"marginMode","defaultMarginMode"),d=this.safeString(a,"cross_leverage_limit");let h,c=this.safeString(a,"marginMode",n),l=this.numberToString(e);if(void 0!==d&&(c="cross",l=d),"cross"===c||"cross_margin"===c?(r.cross_leverage_limit=l,r.leverage="0"):r.leverage=l,s.swap)h=await this.privateFuturesPostSettlePositionsContractLeverage(this.extend(r,a));else{if(!s.future)throw new o.NotSupported(this.id+" setLeverage() not support this market type");h=await this.privateDeliveryPostSettlePositionsContractLeverage(this.extend(r,a))}return h}parsePosition(e,t=void 0){const i=this.safeString(e,"contract");t=this.safeMarket(i,t,"_","contract");const s=this.safeString2(e,"size","accum_size");let a=this.safeString(e,"side");void 0===a&&(r.Y.stringGt(s,"0")?a="long":r.Y.stringLt(s,"0")&&(a="short"));const o=this.safeString(e,"maintenance_rate"),n=this.safeString(e,"value"),d=this.safeString(e,"leverage");let h;void 0!==d&&(h="0"===d?"cross":"isolated");let c,l=this.safeString(e,"pnl_fee");if(void 0===l){const e="0.00075";l=r.Y.stringMul(e,n),c=r.Y.stringAdd(r.Y.stringDiv(n,d),l)}let u=this.safeTimestamp2(e,"open_time","first_open_time");return 0===u&&(u=void 0),this.safePosition({info:e,id:void 0,symbol:this.safeString(t,"symbol"),timestamp:u,datetime:this.iso8601(u),lastUpdateTimestamp:this.safeTimestamp2(e,"update_time","time"),initialMargin:this.parseNumber(c),initialMarginPercentage:this.parseNumber(r.Y.stringDiv(c,n)),maintenanceMargin:this.parseNumber(r.Y.stringMul(o,n)),maintenanceMarginPercentage:this.parseNumber(o),entryPrice:this.safeNumber(e,"entry_price"),notional:this.parseNumber(n),leverage:this.safeNumber(e,"leverage"),unrealizedPnl:this.safeNumber(e,"unrealised_pnl"),realizedPnl:this.safeNumber2(e,"realised_pnl","pnl"),contracts:this.parseNumber(r.Y.stringAbs(s)),contractSize:this.safeNumber(t,"contractSize"),marginRatio:void 0,liquidationPrice:this.safeNumber(e,"liq_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:void 0,collateral:this.safeNumber(e,"margin"),marginMode:h,side:a,percentage:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}async fetchPosition(e,t={}){await this.loadMarkets();const i=this.market(e);if(!i.contract)throw new o.BadRequest(this.id+" fetchPosition() supports contract markets only");let s={};[s,t]=this.prepareRequest(i,i.type,t);const r=this.extend(s,t);let a;return i.swap?a=await this.privateFuturesGetSettlePositionsContract(r):i.future?a=await this.privateDeliveryGetSettlePositionsContract(r):"option"===i.type&&(a=await this.privateOptionsGetPositionsContract(r)),this.parsePosition(a,i)}async fetchPositions(e=void 0,t={}){let i,s;if(await this.loadMarkets(),void 0!==(e=this.marketSymbols(e,void 0,!0,!0,!0))){e.length>0&&(i=this.market(e[0]))}let r,a={};if([s,t]=this.handleMarketTypeAndParams("fetchPositions",i,t),void 0!==s&&"spot"!==s||(s="swap"),"option"===s){if(void 0!==e){const e=i.id.split("-");a.underlying=this.safeString(e,0)}}else[a,t]=this.prepareRequest(void 0,s,t);return"swap"===s?r=await this.privateFuturesGetSettlePositions(this.extend(a,t)):"future"===s?r=await this.privateDeliveryGetSettlePositions(this.extend(a,t)):"option"===s&&(r=await this.privateOptionsGetPositions(this.extend(a,t))),this.parsePositions(r,e)}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const[i,s]=this.handleMarketTypeAndParams("fetchLeverageTiers",void 0,t),[r,a]=this.prepareRequest(void 0,i,s);if("future"!==i&&"swap"!==i)throw new o.BadRequest(this.id+" fetchLeverageTiers only supports swap and future");let n;if("swap"===i)n=await this.publicFuturesGetSettleContracts(this.extend(r,a));else{if("future"!==i)throw new o.NotSupported(this.id+" fetchLeverageTiers() not support this market type");n=await this.publicDeliveryGetSettleContracts(this.extend(r,a))}return this.parseLeverageTiers(n,e,"name")}async fetchMarketLeverageTiers(e,t={}){await this.loadMarkets();const i=this.market(e),[s,r]=this.handleMarketTypeAndParams("fetchMarketLeverageTiers",i,t),[a,n]=this.prepareRequest(i,s,r);if("future"!==s&&"swap"!==s)throw new o.BadRequest(this.id+" fetchMarketLeverageTiers only supports swap and future");const d=await this.privateFuturesGetSettleRiskLimitTiers(this.extend(a,n));return this.parseMarketLeverageTiers(d,i)}parseEmulatedLeverageTiers(e,t=void 0){const i=this.safeString(e,"name"),s=this.safeString(e,"maintenance_rate"),a=this.safeString(e,"leverage_max"),o=this.safeString(e,"risk_limit_step"),n=this.safeString(e,"risk_limit_max"),d=r.Y.stringDiv("1",a);let h=s,c=d,l="0";const u=[];for(;r.Y.stringLt(l,n);){const a=r.Y.stringAdd(l,o);u.push({tier:this.parseNumber(r.Y.stringDiv(a,o)),symbol:this.safeSymbol(i,t,void 0,"contract"),currency:this.safeString(t,"settle"),minNotional:this.parseNumber(l),maxNotional:this.parseNumber(a),maintenanceMarginRate:this.parseNumber(h),maxLeverage:this.parseNumber(r.Y.stringDiv("1",c)),info:e}),h=r.Y.stringAdd(h,s),c=r.Y.stringAdd(c,d),l=a}return u}parseMarketLeverageTiers(e,t=void 0){if(!Array.isArray(e))return this.parseEmulatedLeverageTiers(e,t);let i=0;const s=[];for(let r=0;r-1&&e.endsWith("batch_cancel_orders")){const t=this.safeDict(s,0);e=this.implodeParams(e,t);const i=[],r=s;for(let e=1;e=0||i.indexOf("positions")>=0}if("GET"===i||"DELETE"===i||s||"PATCH"===i)Object.keys(c).length&&(t=this.urlencode(c),t.indexOf("currencies=")>=0&&t.indexOf("%2C")>=0&&(t=t.replaceAll("%2C",",")),f+="?"+t),"PATCH"===i&&(a=this.json(c));else{const e=this.safeValue(c,"query",{});Object.keys(e).length&&(t=this.urlencode(e),f+="?"+t),c=this.omit(c,"query"),a=this.json(c)}const o=void 0===a?"":a,d=this.hash(this.encode(o),n.Zf),l=this.nonce(),p=this.parseToInt(l/1e3).toString(),m="/api/"+this.version+u,g=[i.toUpperCase(),m,t,d,p].join("\n"),v=this.hmac(this.encode(g),this.encode(this.secret),n.Zf);r={KEY:this.apiKey,Timestamp:p,SIGN:v,"Content-Type":"application/json"}}return{url:f,method:i,body:a,headers:r}}async modifyMarginHelper(e,t,i={}){await this.loadMarkets();const s=this.market(e),[r,a]=this.prepareRequest(s,void 0,i);let n;if(r.change=this.numberToString(t),s.swap)n=await this.privateFuturesPostSettlePositionsContractMargin(this.extend(r,a));else{if(!s.future)throw new o.NotSupported(this.id+" modifyMarginHelper() not support this market type");n=await this.privateDeliveryPostSettlePositionsContractMargin(this.extend(r,a))}return this.parseMarginModification(n,s)}parseMarginModification(e,t=void 0){const i=this.safeString(e,"contract");t=this.safeMarket(i,t,"_","contract");const s=this.safeNumber(e,"margin");return{info:e,symbol:t.symbol,type:void 0,marginMode:"isolated",amount:void 0,total:s,code:this.safeValue(t,"quote"),status:"ok",timestamp:void 0,datetime:void 0}}async reduceMargin(e,t,i={}){return await this.modifyMarginHelper(e,-t,i)}async addMargin(e,t,i={}){return await this.modifyMarginHelper(e,t,i)}async fetchOpenInterestHistory(e,t="5m",i=void 0,s=void 0,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOpenInterestHistory","paginate",!1),a)return await this.fetchPaginatedCallDeterministic("fetchOpenInterestHistory",e,i,s,t,r,100);const n=this.market(e);if(!n.swap)throw new o.BadRequest(this.id+" fetchOpenInterest() supports swap markets only");const d={contract:n.id,settle:n.settleId,interval:this.safeString(this.timeframes,t,t)};void 0!==s&&(d.limit=s),void 0!==i&&(d.from=i);const h=await this.publicFuturesGetSettleContractStats(this.extend(d,r));return this.parseOpenInterestsHistory(h,n,i,s)}parseOpenInterest(e,t=void 0){const i=this.safeTimestamp(e,"time");return{symbol:this.safeString(t,"symbol"),openInterestAmount:this.safeNumber(e,"open_interest"),openInterestValue:this.safeNumber(e,"open_interest_usd"),timestamp:i,datetime:this.iso8601(i),info:e}}async fetchSettlementHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new o.ArgumentsRequired(this.id+" fetchSettlementHistory() requires a symbol argument");await this.loadMarkets();const r=this.market(e);let a;if([a,s]=this.handleMarketTypeAndParams("fetchSettlementHistory",r,s),"option"!==a)throw new o.NotSupported(this.id+" fetchSettlementHistory() supports option markets only");const n=r.id.split("-"),d={underlying:this.safeString(n,0)};void 0!==t&&(d.from=t),void 0!==i&&(d.limit=i);const h=await this.publicOptionsGetSettlements(this.extend(d,s)),c=this.parseSettlements(h,r),l=this.sortBy(c,"timestamp");return this.filterBySymbolSinceLimit(l,e,t,i)}async fetchMySettlementHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new o.ArgumentsRequired(this.id+" fetchMySettlementHistory() requires a symbol argument");await this.loadMarkets();const r=this.market(e);let a;if([a,s]=this.handleMarketTypeAndParams("fetchMySettlementHistory",r,s),"option"!==a)throw new o.NotSupported(this.id+" fetchMySettlementHistory() supports option markets only");const n=r.id,d=n.split("-"),h={underlying:this.safeString(d,0),contract:n};void 0!==t&&(h.from=t),void 0!==i&&(h.limit=i);const c=await this.privateOptionsGetMySettlements(this.extend(h,s)),l=this.safeValue(c,"result",{}),u=this.safeValue(l,"list",[]),f=this.parseSettlements(u,r),p=this.sortBy(f,"timestamp");return this.filterBySymbolSinceLimit(p,r.symbol,t,i)}parseSettlement(e,t){const i=this.safeTimestamp(e,"time"),s=this.safeString(e,"contract");return{info:e,symbol:this.safeSymbol(s,t),price:this.safeNumber(e,"settle_price"),timestamp:i,datetime:this.iso8601(i)}}parseSettlements(e,t){const i=[];for(let s=0;s10?parseInt(n):1e3*parseInt(n);const h=this.safeString(e,"balance"),c=this.safeString(e,"change"),l=this.parseNumber(r.Y.stringSub(h,c));return this.safeLedgerEntry({info:e,id:this.safeString(e,"id"),direction:i,account:void 0,referenceAccount:void 0,referenceId:void 0,type:this.parseLedgerEntryType(o),currency:this.safeCurrencyCode(a,t),amount:this.parseNumber(s),timestamp:d,datetime:this.iso8601(d),before:l,after:this.safeNumber(e,"balance"),status:void 0,fee:void 0},t)}parseLedgerEntryType(e){return this.safeString({deposit:"deposit",withdraw:"withdrawal",sub_account_transfer:"transfer",margin_in:"transfer",margin_out:"transfer",margin_funding_in:"transfer",margin_funding_out:"transfer",cross_margin_in:"transfer",cross_margin_out:"transfer",copy_trading_in:"transfer",copy_trading_out:"transfer",quant_in:"transfer",quant_out:"transfer",futures_in:"transfer",futures_out:"transfer",delivery_in:"transfer",delivery_out:"transfer",new_order:"trade",order_fill:"trade",referral_fee:"rebate",order_fee:"fee",interest:"interest",lend:"loan",redeem:"loan",profit:"interest",flash_swap_buy:"trade",flash_swap_sell:"trade",unknown:"unknown",set:"settlement",prem:"trade",point_refr:"rebate",point_fee:"fee",point_dnw:"deposit/withdraw",fund:"fee",refr:"rebate",fee:"fee",pnl:"trade",dnw:"deposit/withdraw"},e,e)}async setPositionMode(e,t=void 0,i={}){const s=void 0!==t?this.market(t):void 0,[r,a]=this.prepareRequest(s,"swap",i);return r.dual_mode=e,await this.privateFuturesPostSettleDualMode(this.extend(r,a))}async fetchUnderlyingAssets(e={}){let t;if(await this.loadMarkets(),[t,e]=this.handleMarketTypeAndParams("fetchUnderlyingAssets",void 0,e),void 0!==t&&"spot"!==t||(t="option"),"option"!==t)throw new o.NotSupported(this.id+" fetchUnderlyingAssets() supports option markets only");const i=await this.publicOptionsGetUnderlyings(e),s=[];for(let e=0;e{i.d(t,{A:()=>r});var s=i(9403);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"gateio",alias:!0})}}},8823:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(3434),r=i(2079),a=i(5147),o=i(1579),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"gemini",name:"Gemini",countries:["US"],rateLimit:100,version:"v1",pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:"emulated",postOnly:!0,reduceMargin:!1,sandbox:!0,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg",api:{public:"https://api.gemini.com",private:"https://api.gemini.com",web:"https://docs.gemini.com",webExchange:"https://exchange.gemini.com"},www:"https://gemini.com/",doc:["https://docs.gemini.com/rest-api","https://docs.sandbox.gemini.com"],test:{public:"https://api.sandbox.gemini.com",private:"https://api.sandbox.gemini.com",web:"https://docs.gemini.com",webExchange:"https://exchange.gemini.com"},fees:["https://gemini.com/api-fee-schedule","https://gemini.com/trading-fees","https://gemini.com/transfer-fees"]},api:{webExchange:{get:[""]},web:{get:["rest-api"]},public:{get:{"v1/symbols":5,"v1/symbols/details/{symbol}":5,"v1/staking/rates":5,"v1/pubticker/{symbol}":5,"v2/ticker/{symbol}":5,"v2/candles/{symbol}/{timeframe}":5,"v1/trades/{symbol}":5,"v1/auction/{symbol}":5,"v1/auction/{symbol}/history":5,"v1/pricefeed":5,"v1/book/{symbol}":5,"v1/earn/rates":5}},private:{post:{"v1/staking/unstake":1,"v1/staking/stake":1,"v1/staking/rewards":1,"v1/staking/history":1,"v1/order/new":1,"v1/order/cancel":1,"v1/wrap/{symbol}":1,"v1/order/cancel/session":1,"v1/order/cancel/all":1,"v1/order/status":1,"v1/orders":1,"v1/mytrades":1,"v1/notionalvolume":1,"v1/tradevolume":1,"v1/clearing/new":1,"v1/clearing/status":1,"v1/clearing/cancel":1,"v1/clearing/confirm":1,"v1/balances":1,"v1/balances/staking":1,"v1/notionalbalances/{currency}":1,"v1/transfers":1,"v1/addresses/{network}":1,"v1/deposit/{network}/newAddress":1,"v1/deposit/{currency}/newAddress":1,"v1/withdraw/{currency}":1,"v1/account/transfer/{currency}":1,"v1/payments/addbank":1,"v1/payments/methods":1,"v1/payments/sen/withdraw":1,"v1/balances/earn":1,"v1/earn/interest":1,"v1/earn/history":1,"v1/approvedAddresses/{network}/request":1,"v1/approvedAddresses/account/{network}":1,"v1/approvedAddresses/{network}/remove":1,"v1/account":1,"v1/account/create":1,"v1/account/list":1,"v1/heartbeat":1,"v1/roles":1}}},precisionMode:o.kb,fees:{trading:{taker:.004,maker:.002}},httpExceptions:{400:r.BadRequest,403:r.PermissionDenied,404:r.OrderNotFound,406:r.InsufficientFunds,429:r.RateLimitExceeded,500:r.ExchangeError,502:r.ExchangeNotAvailable,503:r.OnMaintenance},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1hr","6h":"6hr","1d":"1day"},exceptions:{exact:{AuctionNotOpen:r.BadRequest,ClientOrderIdTooLong:r.BadRequest,ClientOrderIdMustBeString:r.BadRequest,ConflictingOptions:r.BadRequest,EndpointMismatch:r.BadRequest,EndpointNotFound:r.BadRequest,IneligibleTiming:r.BadRequest,InsufficientFunds:r.InsufficientFunds,InvalidJson:r.BadRequest,InvalidNonce:r.InvalidNonce,InvalidApiKey:r.AuthenticationError,InvalidOrderType:r.InvalidOrder,InvalidPrice:r.InvalidOrder,InvalidQuantity:r.InvalidOrder,InvalidSide:r.InvalidOrder,InvalidSignature:r.AuthenticationError,InvalidSymbol:r.BadRequest,InvalidTimestampInPayload:r.BadRequest,Maintenance:r.OnMaintenance,MarketNotOpen:r.InvalidOrder,MissingApikeyHeader:r.AuthenticationError,MissingOrderField:r.InvalidOrder,MissingRole:r.AuthenticationError,MissingPayloadHeader:r.AuthenticationError,MissingSignatureHeader:r.AuthenticationError,NoSSL:r.AuthenticationError,OptionsMustBeArray:r.BadRequest,OrderNotFound:r.OrderNotFound,RateLimit:r.RateLimitExceeded,System:r.ExchangeError,UnsupportedOption:r.BadRequest},broad:{"The Gemini Exchange is currently undergoing maintenance.":r.OnMaintenance,"We are investigating technical issues with the Gemini Exchange.":r.ExchangeNotAvailable,"Internal Server Error":r.ExchangeNotAvailable}},options:{fetchMarketsMethod:"fetch_markets_from_api",fetchMarketFromWebRetries:10,fetchMarketsFromAPI:{fetchDetailsForAllSymbols:!1,quoteCurrencies:["USDT","GUSD","USD","DAI","EUR","GBP","SGD","BTC","ETH","LTC","BCH","SOL"]},fetchMarkets:{webApiEnable:!0,webApiRetries:10},fetchUsdtMarkets:["btcusdt","ethusdt"],fetchCurrencies:{webApiEnable:!0,webApiRetries:5,webApiMuteFailure:!0},fetchTickerMethod:"fetchTickerV1",networks:{BTC:"bitcoin",ERC20:"ethereum",BCH:"bitcoincash",LTC:"litecoin",ZEC:"zcash",FIL:"filecoin",DOGE:"dogecoin",XTZ:"tezos",AVAXX:"avalanche",SOL:"solana",ATOM:"cosmos",DOT:"polkadot"},nonce:"milliseconds",conflictingMarkets:{paxgusd:{base:"PAXG",quote:"USD"}}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:500,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:void 0}},spot:{extends:"default"},swap:{linear:{extends:"default"},inverse:void 0},future:{linear:void 0,inverse:void 0}}})}async fetchCurrencies(e={}){return await this.fetchCurrenciesFromWeb(e)}async fetchCurrenciesFromWeb(e={}){const t=await this.fetchWebEndpoint("fetchCurrencies","webExchangeGet",!0,'="currencyData">',"<\/script>");if(void 0===t)return;const i={};this.options.tradingPairs=this.safeList(t,"tradingPairs");const s=this.safeValue(t,"currencies",[]);for(let e=0;eSymbols and minimums'),i=this.id+" fetchMarketsFromWeb() the API doc HTML markup has changed, breaking the parser of order limits and precision info for markets.",s=t.split("tbody>");if(s.length<2)throw new r.NotSupported(i);const a=s[1].split("\n\n"),o=a.length;if(o<2)throw new r.NotSupported(i);const n=[];for(let e=1;e\n");if(s.length<5)throw new r.NotSupported(i);let o=s[0].replace("","");o=o.replace("*","");const d=s[1].replace("","").split(" "),h=this.safeNumber(d,0),c=s[2].replace("","").split(" "),l=o.length-0,u=l-3,f=s[3].replace("","").split(" "),p=this.safeStringLower(f,1,o.slice(u,l)),m=this.safeStringLower(c,1,o.replace(p,"")),g=this.safeCurrencyCode(m),v=this.safeCurrencyCode(p);n.push({id:o,symbol:g+"/"+v,base:g,quote:v,settle:void 0,baseId:m,quoteId:p,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:void 0,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(c,0),price:this.safeNumber(f,0)},limits:{leverage:{min:void 0,max:void 0},amount:{min:h,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:t})}return n}parseMarketActive(e){return void 0===e||this.safeBool({open:!0,closed:!1,cancel_only:!0,post_only:!0,limit_only:!0},e,!0)}async fetchUSDTMarkets(e={}){if("test"in this.urls)return[];const t=this.safeValue(this.options,"fetchUsdtMarkets",[]),i=[];for(let s=0;s=0,c=d.replace("PERP",""),l=this.safeDict(this.options,"conflictingMarkets",{}),u=c.toLowerCase();if(u in l){const e=l[u];i=e.base,s=e.quote,h&&(r=e.quote)}else{const e=this.handleOption("fetchMarketsFromAPI","quoteCurrencies",[]);for(let t=0;t{i.d(t,{A:()=>d});var s=i(9722),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"hashkey",name:"HashKey Global",countries:["BM"],rateLimit:100,version:"v1",certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!1,cancelOrder:!0,cancelOrders:!0,cancelWithdraw:!1,closePosition:!1,createConvertTrade:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrder:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrderWithTakeProfitAndStopLoss:!1,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!1,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!1,createTrailingAmountOrder:!1,createTrailingPercentOrder:!1,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrder:!0,fetchClosedOrders:!1,fetchConvertCurrencies:!1,fetchConvertQuote:!1,fetchConvertTrade:!1,fetchConvertTradeHistory:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!0,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsForSymbol:!0,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!0,reduceMargin:!1,sandbox:!1,setLeverage:!0,setMargin:!1,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d","1w":"1w","1M":"1M"},urls:{logo:"https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98",api:{public:"https://api-glb.hashkey.com",private:"https://api-glb.hashkey.com"},test:{public:"https://api-glb.sim.hashkeydev.com",private:"https://api-glb.sim.hashkeydev.com"},www:"https://global.hashkey.com/",doc:"https://hashkeyglobal-apidoc.readme.io/",fees:"https://support.global.hashkey.com/hc/en-us/articles/13199900083612-HashKey-Global-Fee-Structure",referral:"https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN"},api:{public:{get:{"api/v1/exchangeInfo":5,"quote/v1/depth":1,"quote/v1/trades":1,"quote/v1/klines":1,"quote/v1/ticker/24hr":1,"quote/v1/ticker/price":1,"quote/v1/ticker/bookTicker":1,"quote/v1/depth/merged":1,"quote/v1/markPrice":1,"quote/v1/index":1,"api/v1/futures/fundingRate":1,"api/v1/futures/historyFundingRate":1,"api/v1/ping":1,"api/v1/time":1}},private:{get:{"api/v1/spot/order":1,"api/v1/spot/openOrders":1,"api/v1/spot/tradeOrders":5,"api/v1/futures/leverage":1,"api/v1/futures/order":1,"api/v1/futures/openOrders":1,"api/v1/futures/userTrades":1,"api/v1/futures/positions":1,"api/v1/futures/historyOrders":1,"api/v1/futures/balance":1,"api/v1/futures/liquidationAssignStatus":1,"api/v1/futures/riskLimit":1,"api/v1/futures/commissionRate":1,"api/v1/futures/getBestOrder":1,"api/v1/account/vipInfo":1,"api/v1/account":1,"api/v1/account/trades":5,"api/v1/account/type":5,"api/v1/account/checkApiKey":1,"api/v1/account/balanceFlow":5,"api/v1/spot/subAccount/openOrders":1,"api/v1/spot/subAccount/tradeOrders":1,"api/v1/subAccount/trades":1,"api/v1/futures/subAccount/openOrders":1,"api/v1/futures/subAccount/historyOrders":1,"api/v1/futures/subAccount/userTrades":1,"api/v1/account/deposit/address":1,"api/v1/account/depositOrders":1,"api/v1/account/withdrawOrders":1},post:{"api/v1/userDataStream":1,"api/v1/spot/orderTest":1,"api/v1/spot/order":1,"api/v1.1/spot/order":1,"api/v1/spot/batchOrders":5,"api/v1/futures/leverage":1,"api/v1/futures/order":1,"api/v1/futures/position/trading-stop":3,"api/v1/futures/batchOrders":5,"api/v1/account/assetTransfer":1,"api/v1/account/authAddress":1,"api/v1/account/withdraw":1},put:{"api/v1/userDataStream":1},delete:{"api/v1/spot/order":1,"api/v1/spot/openOrders":5,"api/v1/spot/cancelOrderByIds":5,"api/v1/futures/order":1,"api/v1/futures/batchOrders":1,"api/v1/futures/cancelOrderByIds":1,"api/v1/userDataStream":1}}},fees:{trading:{spot:{tierBased:!0,percentage:!0,feeSide:"get",maker:this.parseNumber("0.0012"),taker:this.parseNumber("0.0012"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.00080")],[this.parseNumber("5000000"),this.parseNumber("0.00070")],[this.parseNumber("10000000"),this.parseNumber("0.00060")],[this.parseNumber("50000000"),this.parseNumber("0.00040")],[this.parseNumber("200000000"),this.parseNumber("0.00030")],[this.parseNumber("400000000"),this.parseNumber("0.00010")],[this.parseNumber("800000000"),this.parseNumber("0.00")]],taker:[[this.parseNumber("0"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.00090")],[this.parseNumber("5000000"),this.parseNumber("0.00085")],[this.parseNumber("10000000"),this.parseNumber("0.00075")],[this.parseNumber("50000000"),this.parseNumber("0.00065")],[this.parseNumber("200000000"),this.parseNumber("0.00045")],[this.parseNumber("400000000"),this.parseNumber("0.00040")],[this.parseNumber("800000000"),this.parseNumber("0.00035")]]}},swap:{tierBased:!0,percentage:!0,feeSide:"get",maker:this.parseNumber("0.00025"),taker:this.parseNumber("0.00060"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.00025")],[this.parseNumber("1000000"),this.parseNumber("0.00016")],[this.parseNumber("5000000"),this.parseNumber("0.00014")],[this.parseNumber("10000000"),this.parseNumber("0.00012")],[this.parseNumber("50000000"),this.parseNumber("0.000080")],[this.parseNumber("200000000"),this.parseNumber("0.000060")],[this.parseNumber("400000000"),this.parseNumber("0.000020")],[this.parseNumber("800000000"),this.parseNumber("0.00")]],taker:[[this.parseNumber("0"),this.parseNumber("0.00060")],[this.parseNumber("1000000"),this.parseNumber("0.00050")],[this.parseNumber("5000000"),this.parseNumber("0.00045")],[this.parseNumber("10000000"),this.parseNumber("0.00040")],[this.parseNumber("50000000"),this.parseNumber("0.00035")],[this.parseNumber("200000000"),this.parseNumber("0.00030")],[this.parseNumber("400000000"),this.parseNumber("0.00025")],[this.parseNumber("800000000"),this.parseNumber("0.00020")]]}}}},options:{broker:"10000700011",recvWindow:void 0,sandboxMode:!1,networks:{BTC:"BTC",ERC20:"ETH",AVAX:"AvalancheC",SOL:"Solana",MATIC:"Polygon",ATOM:"Cosmos",DOT:"Polkadot",LTC:"LTC",OPTIMISM:"Optimism",ARB:"Arbitrum",DOGE:"Dogecoin",TRC20:"Tron",ZKSYNC:"zkSync",TON:"TON",KLAYTN:"Klaytn",MERLINCHAIN:"Merlin Chain"},networksById:{BTC:"BTC",Bitcoin:"BTC",ETH:"ERC20",ERC20:"ERC20",AvalancheC:"AVAX","AVAX C-Chain":"AVAX",Solana:"SOL",Cosmos:"ATOM",Arbitrum:"ARB",Polygon:"MATIC",Optimism:"OPTIMISM",Polkadot:"DOT",LTC:"LTC",Litecoin:"LTC",Dogecoin:"DOGE","Merlin Chain":"MERLINCHAIN",zkSync:"ZKSYNC",TRC20:"TRC20",Tron:"TRC20",TON:"TON","BSC(BEP20)":"BSC",Klaytn:"KLAYTN"},defaultNetwork:"ERC20"},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!0,selfTradePrevention:!0,iceberg:!1},createOrders:{max:20},fetchMyTrades:{marginMode:!1,limit:1e3,daysBack:30,untilDays:30,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:void 0,fetchOHLCV:{limit:1e3}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrder:{triggerPrice:!0,selfTradePrevention:!0},fetchOpenOrders:{trigger:!0,limit:500}},swap:{linear:{extends:"forDerivatives"},inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{},exceptions:{exact:{"0001":r.BadRequest,"0002":r.AuthenticationError,"0003":r.RateLimitExceeded,"0102":r.AuthenticationError,"0103":r.AuthenticationError,"0104":r.PermissionDenied,"0201":r.ExchangeError,"0202":r.PermissionDenied,"0206":r.BadRequest,"0207":r.BadRequest,"0209":r.BadRequest,"0210":r.BadRequest,"0211":r.OrderNotFound,"0401":r.InsufficientFunds,"0402":r.BadRequest,"-1000":r.ExchangeError,"-1001":r.ExchangeError,"-100010":r.BadSymbol,"-100012":r.BadSymbol,"-1002":r.AuthenticationError,"-1004":r.BadRequest,"-1005":r.PermissionDenied,"-1006":r.ExchangeError,"-1007":r.RequestTimeout,"-1014":r.InvalidOrder,"-1015":r.InvalidOrder,"-1020":r.OperationRejected,"-1021":r.InvalidNonce,"-1024":r.BadRequest,"-1101":r.ExchangeNotAvailable,"-1115":r.InvalidOrder,"-1117":r.InvalidOrder,"-1123":r.InvalidOrder,"-1124":r.InvalidOrder,"-1126":r.InvalidOrder,"-1129":r.BadRequest,"-1130":r.BadRequest,"-1132":r.BadRequest,"-1133":r.BadRequest,"-1135":r.BadRequest,"-1136":r.BadRequest,"-1138":r.InvalidOrder,"-1137":r.InvalidOrder,"-1139":r.OrderImmediatelyFillable,"-1140":r.InvalidOrder,"-1141":r.DuplicateOrderId,"-1142":r.OrderNotFillable,"-1143":r.OrderNotFound,"-1144":r.OperationRejected,"-1145":r.NotSupported,"-1146":r.RequestTimeout,"-1147":r.RequestTimeout,"-1148":r.InvalidOrder,"-1149":r.OperationRejected,"-1150":r.OperationFailed,"-1151":r.OperationRejected,"-1152":r.AccountNotEnabled,"-1153":r.InvalidOrder,"-1154":r.InvalidOrder,"-1155":r.OperationRejected,"-1156":r.OperationFailed,"-1157":r.OperationFailed,"-1158":r.OperationFailed,"-1159":r.AccountNotEnabled,"-1160":r.AccountNotEnabled,"-1161":r.OperationFailed,"-1162":r.ContractUnavailable,"-1163":r.InvalidAddress,"-1164":r.OperationFailed,"-1165":r.ArgumentsRequired,"-1166":r.OperationRejected,"-1167":r.BadRequest,"-1168":r.BadRequest,"-1169":r.PermissionDenied,"-1170":r.PermissionDenied,"-1171":r.PermissionDenied,"-1172":r.BadRequest,"-1173":r.BadRequest,"-1174":r.PermissionDenied,"-1175":r.BadRequest,"-1176":r.BadRequest,"-1177":r.InvalidOrder,"-1178":r.AccountNotEnabled,"-1179":r.AccountSuspended,"-1181":r.ExchangeError,"-1193":r.OperationRejected,"-1194":r.OperationRejected,"-1195":r.BadRequest,"-1196":r.BadRequest,"-1200":r.BadRequest,"-1201":r.BadRequest,"-1202":r.BadRequest,"-1203":r.BadRequest,"-1204":r.BadRequest,"-1205":r.AccountNotEnabled,"-1206":r.BadRequest,"-1207":r.BadRequest,"-1208":r.BadRequest,"-1209":r.BadRequest,"-2001":r.ExchangeNotAvailable,"-2002":r.OperationFailed,"-2003":r.OperationFailed,"-2004":r.OperationFailed,"-2005":r.RequestTimeout,"-2010":r.OperationRejected,"-2011":r.OperationRejected,"-2016":r.OperationRejected,"-2017":r.OperationRejected,"-2018":r.OperationRejected,"-2019":r.PermissionDenied,"-2020":r.PermissionDenied,"-2021":r.PermissionDenied,"-2022":r.OperationRejected,"-2023":r.AuthenticationError,"-2024":r.AccountNotEnabled,"-2025":r.AccountNotEnabled,"-2026":r.BadRequest,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-2029":r.OperationRejected,"-2030":r.InsufficientFunds,"-2031":r.NotSupported,"-2032":r.OperationRejected,"-2033":r.OperationFailed,"-2034":r.InsufficientFunds,"-2035":r.OperationRejected,"-2036":r.NotSupported,"-2037":r.ExchangeError,"-2038":r.InsufficientFunds,"-2039":r.NotSupported,"-2040":r.ExchangeNotAvailable,"-2041":r.BadRequest,"-2042":r.OperationRejected,"-2043":r.OperationRejected,"-2044":r.BadRequest,"-2045":r.BadRequest,"-2046":r.BadRequest,"-2048":r.BadRequest,"-2049":r.BadRequest,"-2050":r.BadRequest,"-2051":r.OperationRejected,"-2052":r.OperationRejected,"-2053":r.OperationRejected,"-2054":r.BadRequest,"-2055":r.BadRequest,"-2056":r.BadRequest,"-2057":r.BadRequest,"-3117":r.PermissionDenied,"-3143":r.PermissionDenied,"-3144":r.PermissionDenied,"-3145":r.DDoSProtection,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.InsufficientFunds,"-4004":r.BadRequest,"-4005":r.BadRequest,"-4006":r.AccountNotEnabled,"-4007":r.NotSupported,"-4008":r.AccountNotEnabled,"-4009":r.PermissionDenied,"-4010":r.PermissionDenied,"-4011":r.ExchangeError,"-4012":r.ExchangeError,"-4013":r.OperationFailed},broad:{}},precisionMode:o.kb})}async fetchTime(e={}){const t=await this.publicGetApiV1Time(e);return this.safeInteger(t,"serverTime")}async fetchStatus(e={}){return{status:"ok",updated:void 0,eta:void 0,url:void 0,info:await this.publicGetApiV1Ping(e)}}async fetchMarkets(e={}){const t=await this.publicGetApiV1ExchangeInfo(this.extend({},e)),i=this.safeList(t,"symbols",[]),s=this.safeList(t,"contracts",[]);let r=this.arrayConcat(i,s);return this.isEmpty(r)&&(r=[t]),this.parseMarkets(r)}parseMarket(e){const t=this.safeString(e,"symbol"),i=this.safeString(e,"quoteAsset"),s=this.safeCurrencyCode(i),r=this.safeString(e,"marginToken"),o=this.safeCurrencyCode(r);let n=this.safeString(e,"baseAsset"),d="spot",h=!0,c=!1,l="";const u=t.split("-");"PERPETUAL"===this.safeString(u,1)&&(d="swap",h=!1,c=!0,n=this.safeString(e,"underlying"),l+=":"+r);const f=this.safeCurrencyCode(n),p=f+"/"+s+l,m="TRADING"===this.safeString(e,"status");let g,v;const y=this.safeBool(e,"inverse");void 0!==y&&(y?(g=!1,v="inverse"):(g=!0,v="linear"));const w=this.safeList(e,"filters",[]),b=this.indexBy(w,"filterType"),k=this.safeDict(b,"PRICE_FILTER",{}),S=this.safeDict(b,"LOT_SIZE",{}),O=this.safeDict(b,"MIN_NOTIONAL",{}),T=this.omitZero(this.safeString(O,"min_notional")),P=this.safeString(e,"contractMultiplier");let I,M,x=this.safeString(S,"stepSize"),_=this.safeString(S,"minQty"),A=this.safeString(S,"maxQty");if(c){x=a.Y.stringDiv(x,P),_=a.Y.stringDiv(_,P),A=a.Y.stringDiv(A,P);const t=this.safeList(e,"riskLimits");if(void 0!==t){const e=this.safeDict(t,0),i=t.length,s=this.safeDict(t,i-1);let r=this.safeString(e,"initialMargin"),o=this.safeString(s,"initialMargin");a.Y.stringGt(r,o)&&([r,o]=[o,r]),I=this.parseToInt(a.Y.stringDiv("1",o)),M=this.parseToInt(a.Y.stringDiv("1",r))}}const C=this.safeDict(this.fees,"trading"),B=h?this.safeDict(C,"spot"):this.safeDict(C,"swap");return this.safeMarketStructure({id:t,symbol:p,base:f,quote:s,baseId:n,quoteId:i,active:m,type:d,subType:v,spot:h,margin:this.safeBool(e,"allowMargin"),swap:c,future:!1,option:!1,contract:c,settle:o,settleId:r,contractSize:this.parseNumber(P),linear:g,inverse:y,taker:this.safeNumber(B,"taker"),maker:this.safeNumber(B,"maker"),percentage:this.safeBool(B,"percentage"),tierBased:this.safeBool(B,"tierBased"),feeSide:this.safeString(B,"feeSide"),expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(x),price:this.safeNumber(k,"tickSize")},limits:{amount:{min:this.parseNumber(_),max:this.parseNumber(A)},price:{min:this.safeNumber(k,"minPrice"),max:this.safeNumber(k,"maxPrice")},leverage:{min:I,max:M},cost:{min:this.parseNumber(T),max:void 0}},created:void 0,info:e})}async fetchCurrencies(e={}){const t=await this.publicGetApiV1ExchangeInfo(e),i=this.safeList(t,"coins"),s={};for(let e=0;e=0&&(c="out");const l=this.safeString(e,"total"),u=this.parseNumber(l);return this.safeLedgerEntry({info:e,id:i,timestamp:r,datetime:this.iso8601(r),account:s,direction:c,referenceId:void 0,referenceAccount:void 0,type:a,currency:n,symbol:void 0,amount:h,before:void 0,after:u,status:"ok",fee:void 0},t)}async createOrder(e,t,i,s,a=void 0,o={}){await this.loadMarkets();const n=this.market(e);if(n.spot)return await this.createSpotOrder(e,t,i,s,a,o);if(n.swap)return await this.createSwapOrder(e,t,i,s,a,o);throw new r.NotSupported(this.id+" createOrder() is not supported for "+n.type+" type of markets")}async createMarketBuyOrderWithCost(e,t,i={}){await this.loadMarkets();if(!this.market(e).spot)throw new r.NotSupported(this.id+" createMarketBuyOrderWithCost() is supported for spot markets only");const s={cost:t};return await this.createOrder(e,"market","buy",t,void 0,this.extend(s,i))}async createSpotOrder(e,t,i,s,a=void 0,o={}){if(void 0!==this.safeString2(o,"stopPrice","triggerPrice"))throw new r.NotSupported(this.id+" trigger orders are not supported for spot markets");await this.loadMarkets();const n=this.market(e),d="market"===t&&"buy"===i,h=this.safeString(o,"cost");if(!d&&void 0!==h)throw new r.NotSupported(this.id+" createOrder() supports cost parameter for spot market buy orders only");const c=this.createSpotOrderRequest(e,t,i,s,a,o);let l={};return this.safeBool(o,"test")?(o=this.omit(o,"test"),l=await this.privatePostApiV1SpotOrderTest(c)):l=d&&void 0===h?await this.privatePostApiV11SpotOrder(c):await this.privatePostApiV1SpotOrder(c),this.parseOrder(l,n)}createOrderRequest(e,t,i,s,a=void 0,o={}){const n=this.market(e);if(n.spot)return this.createSpotOrderRequest(e,t,i,s,a,o);if(n.swap)return this.createSwapOrderRequest(e,t,i,s,a,o);throw new r.NotSupported(this.id+" createOrderRequest() is not supported for "+n.type+" type of markets")}createSpotOrderRequest(e,t,i,s,r=void 0,a={}){const o=this.market(e);t=t.toUpperCase();const n={symbol:o.id,side:i.toUpperCase(),type:t};let d;void 0!==s&&(n.quantity=this.amountToPrecision(e,s)),[d,a]=this.handleParamString(a,"cost"),void 0!==d&&(n.quantity=this.costToPrecision(e,d)),void 0!==r&&(n.price=this.priceToPrecision(e,r));const h="MARKET"===t;let c,l=!1;return[l,a]=this.handlePostOnly(h,"LIMIT_MAKER"===t,a),l&&"LIMIT"===t&&(n.type="LIMIT_MAKER"),[c,a]=this.handleParamString(a,"clientOrderId"),void 0!==c&&(a.newClientOrderId=c),this.extend(n,a)}createSwapOrderRequest(e,t,i,s,r=void 0,a={}){const o={symbol:this.market(e).id,type:"LIMIT",quantity:this.amountToPrecision(e,s)},n="market"===t;n&&(o.priceType="MARKET"),void 0!==r&&(o.price=this.priceToPrecision(e,r),o.priceType="INPUT");let d=!1;[d,a]=this.handleParamBool(a,"reduceOnly",d);let h,c="_OPEN";d&&(c="_CLOSE"),o.side=i.toUpperCase()+c,[h,a]=this.handleParamString(a,"timeInForce");let l=!1;[l,a]=this.handlePostOnly(n,"LIMIT_MAKER"===h,a),l&&(h="LIMIT_MAKER"),void 0!==h&&(o.timeInForce=h);void 0===this.safeString(a,"clientOrderId")&&(o.clientOrderId=this.uuid());const u=this.safeString(a,"triggerPrice");return void 0!==u&&(o.stopPrice=this.priceToPrecision(e,u),o.type="STOP",a=this.omit(a,"triggerPrice")),this.extend(o,a)}async createSwapOrder(e,t,i,s,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.createSwapOrderRequest(e,t,i,s,r,a),d=await this.privatePostApiV1FuturesOrder(this.extend(n,a));return this.parseOrder(d,o)}async createOrders(e,t={}){await this.loadMarkets();const i=[];for(let t=0;t{i.d(t,{A:()=>d});var s=i(706),r=i(1579),a=i(5147),o=i(2079),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"hitbtc",name:"HitBTC",countries:["HK"],rateLimit:3.333,version:"3",has:{CORS:!1,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closePosition:!1,createDepositAddress:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowRateHistories:void 0,fetchBorrowRateHistory:void 0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:void 0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!1,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!0,fetchLeverageTiers:void 0,fetchLiquidations:!1,fetchMarginMode:"emulated",fetchMarginModes:!0,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenInterests:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOption:!1,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositions:!0,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:"emulated",fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!0,sandbox:!0,setLeverage:!0,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!0,withdraw:!0},precisionMode:r.kb,urls:{logo:"https://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpg",test:{public:"https://api.demo.hitbtc.com/api/3",private:"https://api.demo.hitbtc.com/api/3"},api:{public:"https://api.hitbtc.com/api/3",private:"https://api.hitbtc.com/api/3"},www:"https://hitbtc.com",referral:"https://hitbtc.com/?ref_id=5a5d39a65d466",doc:["https://api.hitbtc.com","https://github.com/hitbtc-com/hitbtc-api/blob/master/APIv2.md"],fees:["https://hitbtc.com/fees-and-limits","https://support.hitbtc.com/hc/en-us/articles/115005148605-Fees-and-limits"]},api:{public:{get:{"public/currency":10,"public/currency/{currency}":10,"public/symbol":10,"public/symbol/{symbol}":10,"public/ticker":10,"public/ticker/{symbol}":10,"public/price/rate":10,"public/price/history":10,"public/price/ticker":10,"public/price/ticker/{symbol}":10,"public/trades":10,"public/trades/{symbol}":10,"public/orderbook":10,"public/orderbook/{symbol}":10,"public/candles":10,"public/candles/{symbol}":10,"public/converted/candles":10,"public/converted/candles/{symbol}":10,"public/futures/info":10,"public/futures/info/{symbol}":10,"public/futures/history/funding":10,"public/futures/history/funding/{symbol}":10,"public/futures/candles/index_price":10,"public/futures/candles/index_price/{symbol}":10,"public/futures/candles/mark_price":10,"public/futures/candles/mark_price/{symbol}":10,"public/futures/candles/premium_index":10,"public/futures/candles/premium_index/{symbol}":10,"public/futures/candles/open_interest":10,"public/futures/candles/open_interest/{symbol}":10}},private:{get:{"spot/balance":15,"spot/balance/{currency}":15,"spot/order":1,"spot/order/{client_order_id}":1,"spot/fee":15,"spot/fee/{symbol}":15,"spot/history/order":15,"spot/history/trade":15,"margin/account":1,"margin/account/isolated/{symbol}":1,"margin/account/cross/{currency}":1,"margin/order":1,"margin/order/{client_order_id}":1,"margin/config":15,"margin/history/order":15,"margin/history/trade":15,"margin/history/positions":15,"margin/history/clearing":15,"futures/balance":15,"futures/balance/{currency}":15,"futures/account":1,"futures/account/isolated/{symbol}":1,"futures/order":1,"futures/order/{client_order_id}":1,"futures/config":15,"futures/fee":15,"futures/fee/{symbol}":15,"futures/history/order":15,"futures/history/trade":15,"futures/history/positions":15,"futures/history/clearing":15,"wallet/balance":30,"wallet/balance/{currency}":30,"wallet/crypto/address":30,"wallet/crypto/address/recent-deposit":30,"wallet/crypto/address/recent-withdraw":30,"wallet/crypto/address/check-mine":30,"wallet/transactions":30,"wallet/transactions/{tx_id}":30,"wallet/crypto/fee/estimate":30,"wallet/airdrops":30,"wallet/amount-locks":30,"sub-account":15,"sub-account/acl":15,"sub-account/balance/{subAccID}":15,"sub-account/crypto/address/{subAccID}/{currency}":15},post:{"spot/order":1,"spot/order/list":1,"margin/order":1,"margin/order/list":1,"futures/order":1,"futures/order/list":1,"wallet/crypto/address":30,"wallet/crypto/withdraw":30,"wallet/convert":30,"wallet/transfer":30,"wallet/internal/withdraw":30,"wallet/crypto/check-offchain-available":30,"wallet/crypto/fees/estimate":30,"wallet/airdrops/{id}/claim":30,"sub-account/freeze":15,"sub-account/activate":15,"sub-account/transfer":15,"sub-account/acl":15},patch:{"spot/order/{client_order_id}":1,"margin/order/{client_order_id}":1,"futures/order/{client_order_id}":1},delete:{"spot/order":1,"spot/order/{client_order_id}":1,"margin/position":1,"margin/position/isolated/{symbol}":1,"margin/order":1,"margin/order/{client_order_id}":1,"futures/position":1,"futures/position/{margin_mode}/{symbol}":1,"futures/order":1,"futures/order/{client_order_id}":1,"wallet/crypto/withdraw/{id}":30},put:{"margin/account/isolated/{symbol}":1,"futures/account/isolated/{symbol}":1,"wallet/crypto/withdraw/{id}":30}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0009"),maker:this.parseNumber("0.0009"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0009")],[this.parseNumber("10"),this.parseNumber("0.0007")],[this.parseNumber("100"),this.parseNumber("0.0006")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0003")],[this.parseNumber("5000"),this.parseNumber("0.0002")],[this.parseNumber("10000"),this.parseNumber("0.0001")],[this.parseNumber("20000"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.0001")],[this.parseNumber("100000"),this.parseNumber("-0.0001")]],taker:[[this.parseNumber("0"),this.parseNumber("0.0009")],[this.parseNumber("10"),this.parseNumber("0.0008")],[this.parseNumber("100"),this.parseNumber("0.0007")],[this.parseNumber("500"),this.parseNumber("0.0007")],[this.parseNumber("1000"),this.parseNumber("0.0006")],[this.parseNumber("5000"),this.parseNumber("0.0006")],[this.parseNumber("10000"),this.parseNumber("0.0005")],[this.parseNumber("20000"),this.parseNumber("0.0004")],[this.parseNumber("50000"),this.parseNumber("0.0003")],[this.parseNumber("100000"),this.parseNumber("0.0002")]]}}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!0,limit:1e3,daysBack:1e5,untilDays:1e5,symbolRequired:!1,marketType:!0},fetchOrder:{marginMode:!0,trigger:!1,trailing:!1,symbolRequired:!1,marketType:!0},fetchOpenOrders:{marginMode:!0,limit:1e3,trigger:!1,trailing:!1,symbolRequired:!1,marketType:!0},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1,marketType:!0},fetchOHLCV:{limit:1e3}},spot:{extends:"default"},forDerivatives:{extends:"default",createOrder:{marginMode:!0},fetchOrder:{marginMode:!1},fetchMyTrades:{marginMode:!1},fetchOpenOrders:{marginMode:!1},fetchClosedOrders:{marginMode:!1}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}}},timeframes:{"1m":"M1","3m":"M3","5m":"M5","15m":"M15","30m":"M30","1h":"H1","4h":"H4","1d":"D1","1w":"D7","1M":"1M"},exceptions:{exact:{429:o.RateLimitExceeded,500:o.ExchangeError,503:o.ExchangeNotAvailable,504:o.ExchangeNotAvailable,600:o.PermissionDenied,800:o.ExchangeError,1002:o.AuthenticationError,1003:o.PermissionDenied,1004:o.AuthenticationError,1005:o.AuthenticationError,2001:o.BadSymbol,2002:o.BadRequest,2003:o.BadRequest,2010:o.BadRequest,2011:o.BadRequest,2012:o.BadRequest,2020:o.BadRequest,2022:o.BadRequest,2024:o.InvalidOrder,10001:o.BadRequest,10021:o.AccountSuspended,10022:o.BadRequest,20001:o.InsufficientFunds,20002:o.OrderNotFound,20003:o.ExchangeError,20004:o.ExchangeError,20005:o.ExchangeError,20006:o.ExchangeError,20007:o.ExchangeError,20008:o.InvalidOrder,20009:o.InvalidOrder,20010:o.OnMaintenance,20011:o.ExchangeError,20012:o.ExchangeError,20014:o.ExchangeError,20016:o.ExchangeError,20018:o.ExchangeError,20031:o.ExchangeError,20032:o.ExchangeError,20033:o.ExchangeError,20034:o.ExchangeError,20040:o.ExchangeError,20041:o.ExchangeError,20042:o.ExchangeError,20043:o.ExchangeError,20044:o.PermissionDenied,20045:o.InvalidOrder,20047:o.InvalidOrder,20048:o.InvalidOrder,20049:o.InvalidOrder,20080:o.ExchangeError,21001:o.ExchangeError,21003:o.AccountSuspended,21004:o.AccountSuspended,22004:o.ExchangeError,22008:o.ExchangeError},broad:{}},options:{defaultNetwork:"ERC20",defaultNetworks:{ETH:"ETH",USDT:"TRC20"},networks:{BTC:"btc",OMNI:"BTC",ETH:"eth",ERC20:"ETH",ETC:"ETC",BEP20:"BSC",TRC20:"TRX",NEAR:"NEAR",DGB:"DGB",AE:"AE",AR:"AR",ADA:"ADA",CHZ:"CHZ",ABBC:"ABBC",ALGO:"ALGO",APT:"APT",ATOM:"ATOM",AVAXC:"AVAC",AVAXX:"AVAX",BSV:"BCHSV",BEP2:"BNB",CELO:"CELO",CKB:"CKB",CTXC:"CTXC",DASH:"DASH",DCR:"DCR",DOGE:"doge",EGLD:"EGLD",EOS:"EOS",ETHW:"ETHW",EVER:"EVER",FET:"FET",FIL:"FIL",FLOW:"FLOW",GLMR:"GLMR",GRIN:"GRIN",HBAR:"HBAR",HIVE:"HIVE",HYDRA:"HYDRA",ICP:"ICP",ICX:"ICX",IOST:"IOST",IOTA:"IOTA",IOTX:"IOTX",KAVA:"KAVA",KLAY:"KIM",KOMODO:"KMD",KSM:"KSM",LSK:"LSK",LTC:"ltc",MINA:"MINA",MOVR:"MOVR",NANO:"NANO",NEO:"NEO",ONE:"ONE",ONT:"ONT",OPTIMISM:"OP",PLCU:"PLCU",MATIC:"POLYGON",QTUM:"QTUM",REI:"REI",OASIS:"ROSE",RVN:"RVN",SC:"SC",SCRT:"SCRT",SOL:"SOL",STEEM:"STEEM",THETA:"Theta",TRUE:"TRUE",VET:"VET",VSYS:"VSYS",WAVES:"WAVES",WAX:"WAX",XCH:"XCH",XEC:"XEC",NEM:"XEM",XLM:"XLM",XMR:"xmr",XRD:"XRD",XRP:"XRP",XTZ:"XTZ",XVG:"XVG",XYM:"XYM",ZEC:"ZEC",ZEN:"ZEN",ZIL:"ZIL"},accountsByType:{spot:"spot",funding:"wallet",swap:"derivatives",future:"derivatives"},withdraw:{includeFee:!1}},commonCurrencies:{AUTO:"Cube",BCC:"BCC",BDP:"BidiPass",BET:"DAO.Casino",BIT:"BitRewards",BOX:"BOX Token",CPT:"Cryptaur",GET:"Themis",GMT:"GMT Token",HSR:"HC",IQ:"IQ.Cash",LNC:"LinkerCoin",PLA:"PlayChip",PNT:"Penta",SBTC:"Super Bitcoin",STEPN:"GMT",STX:"STOX",TV:"Tokenville",XMT:"MTL",XPNT:"PNT"}})}nonce(){return this.milliseconds()}async fetchMarkets(e={}){const t=await this.publicGetPublicSymbol(e),i=[],s=Object.keys(t);for(let e=0;ea)throw new o.BadRequest(this.id+" setLeverage() leverage should be between 1 and "+a.toString()+" for "+t);const n={symbol:s.id,leverage:e.toString(),margin_balance:this.amountToPrecision(t,r)};return await this.privatePutFuturesAccountIsolatedSymbol(this.extend(n,i))}async fetchDepositWithdrawFees(e=void 0,t={}){await this.loadMarkets();const i=await this.publicGetPublicCurrency(t);return this.parseDepositWithdrawFees(i,e)}parseDepositWithdrawFee(e,t=void 0){const i=this.safeValue(e,"networks",[]),s=this.depositWithdrawFee(e);for(let e=0;e{i.d(t,{A:()=>d});var s=i(1180),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"hollaex",name:"HollaEx",countries:["KR"],rateLimit:250,version:"v2",pro:!0,has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketSellOrder:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:"emulated",fetchDepositAddresses:!0,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,sandbox:!0,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","1h":"1h","4h":"4h","1d":"1d","1w":"1w"},urls:{logo:"https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg",test:{rest:"https://api.sandbox.hollaex.com"},api:{rest:"https://api.hollaex.com"},www:"https://hollaex.com",doc:"https://apidocs.hollaex.com",referral:"https://pro.hollaex.com/signup?affiliation_code=QSWA6G"},precisionMode:o.kb,requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{health:1,constants:1,kit:1,tiers:1,ticker:1,tickers:1,orderbook:1,orderbooks:1,trades:1,chart:1,charts:1,minicharts:1,"oracle/prices":1,"quick-trade":1,"udf/config":1,"udf/history":1,"udf/symbols":1}},private:{get:{user:1,"user/balance":1,"user/deposits":1,"user/withdrawals":1,"user/withdrawal/fee":1,"user/trades":1,orders:1,order:1},post:{"user/withdrawal":1,order:1},delete:{"order/all":1,order:1}}},features:{spot:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!0,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:{marginMode:!1,limit:100,daysBack:1e5,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,limit:100,daysBack:1e5,daysBackCanceled:1,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:1e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},fees:{trading:{tierBased:!0,percentage:!0,taker:.001,maker:.001}},exceptions:{broad:{"Invalid token":r.AuthenticationError,"Order not found":r.OrderNotFound,"Insufficient balance":r.InsufficientFunds,"Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order.":r.OrderImmediatelyFillable},exact:{400:r.BadRequest,403:r.AuthenticationError,404:r.BadRequest,405:r.BadRequest,410:r.BadRequest,429:r.BadRequest,500:r.NetworkError,503:r.NetworkError}},options:{"api-expires":this.parseToInt(this.timeout/1e3),networks:{BTC:"btc",ETH:"eth",ERC20:"eth",TRX:"trx",TRC20:"trx",XRP:"xrp",XLM:"xlm",BNB:"bnb",MATIC:"matic"},networksById:{eth:"ERC20",ETH:"ERC20",ERC20:"ERC20",trx:"TRC20",TRX:"TRC20",TRC20:"TRC20"}}})}async fetchMarkets(e={}){const t=await this.publicGetConstants(e),i=this.safeValue(t,"pairs",{}),s=Object.keys(i),r=[];for(let e=0;e=400&&e<=503){const t=this.id+" "+a,i=this.safeString(o,"message");this.throwBroadlyMatchedException(this.exceptions.broad,i,t);const s=e.toString();this.throwExactlyMatchedException(this.exceptions.exact,s,t)}}}},9946:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(8617),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"htx",name:"HTX",countries:["CN"],rateLimit:100,userAgent:this.userAgents.chrome100,certified:!0,version:"v1",hostname:"api.huobi.pro",pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:void 0,addMargin:void 0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createDepositAddress:void 0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:void 0,fetchBorrowInterest:!0,fetchBorrowRateHistories:void 0,fetchBorrowRateHistory:void 0,fetchCanceledOrders:void 0,fetchClosedOrder:void 0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:void 0,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!0,fetchL3OrderBook:void 0,fetchLastPrices:!0,fetchLedger:!0,fetchLedgerEntry:void 0,fetchLeverage:!1,fetchLeverageTiers:!0,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenInterests:!0,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:void 0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTradingLimits:!0,fetchTransactionFee:void 0,fetchTransactionFees:void 0,fetchTransactions:void 0,fetchTransfers:void 0,fetchWithdrawAddresses:!0,fetchWithdrawal:void 0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:void 0,reduceMargin:void 0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!0,signIn:void 0,transfer:!0,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"60min","4h":"4hour","1d":"1day","1w":"1week","1M":"1mon","1y":"1year"},urls:{logo:"https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg",hostnames:{contract:"api.hbdm.com",spot:"api.huobi.pro",status:{spot:"status.huobigroup.com",future:{inverse:"status-dm.huobigroup.com",linear:"status-linear-swap.huobigroup.com"},swap:{inverse:"status-swap.huobigroup.com",linear:"status-linear-swap.huobigroup.com"}}},api:{status:"https://{hostname}",contract:"https://{hostname}",spot:"https://{hostname}",public:"https://{hostname}",private:"https://{hostname}",v2Public:"https://{hostname}",v2Private:"https://{hostname}"},www:"https://www.huobi.com",referral:{url:"https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223",discount:.15},doc:["https://huobiapi.github.io/docs/spot/v1/en/","https://huobiapi.github.io/docs/dm/v1/en/","https://huobiapi.github.io/docs/coin_margined_swap/v1/en/","https://huobiapi.github.io/docs/usdt_swap/v1/en/","https://www.huobi.com/en-us/opend/newApiPages/"],fees:"https://www.huobi.com/about/fee/"},api:{v2Public:{get:{"reference/currencies":1,"market-status":1}},v2Private:{get:{"account/ledger":1,"account/withdraw/quota":1,"account/withdraw/address":1,"account/deposit/address":1,"account/repayment":5,"reference/transact-fee-rate":1,"account/asset-valuation":.2,"point/account":5,"sub-user/user-list":1,"sub-user/user-state":1,"sub-user/account-list":1,"sub-user/deposit-address":1,"sub-user/query-deposit":1,"user/api-key":1,"user/uid":1,"algo-orders/opening":1,"algo-orders/history":1,"algo-orders/specific":1,"c2c/offers":1,"c2c/offer":1,"c2c/transactions":1,"c2c/repayment":1,"c2c/account":1,"etp/reference":1,"etp/transactions":5,"etp/transaction":5,"etp/rebalance":1,"etp/limit":1},post:{"account/transfer":1,"account/repayment":5,"point/transfer":5,"sub-user/management":1,"sub-user/creation":1,"sub-user/tradable-market":1,"sub-user/transferability":1,"sub-user/api-key-generation":1,"sub-user/api-key-modification":1,"sub-user/api-key-deletion":1,"sub-user/deduct-mode":1,"algo-orders":1,"algo-orders/cancel-all-after":1,"algo-orders/cancellation":1,"c2c/offer":1,"c2c/cancellation":1,"c2c/cancel-all":1,"c2c/repayment":1,"c2c/transfer":1,"etp/creation":5,"etp/redemption":5,"etp/{transactId}/cancel":10,"etp/batch-cancel":50}},public:{get:{"common/symbols":1,"common/currencys":1,"common/timestamp":1,"common/exchange":1,"settings/currencys":1}},private:{get:{"account/accounts":.2,"account/accounts/{id}/balance":.2,"account/accounts/{sub-uid}":1,"account/history":4,"cross-margin/loan-info":1,"margin/loan-info":1,"fee/fee-rate/get":1,"order/openOrders":.4,"order/orders":.4,"order/orders/{id}":.4,"order/orders/{id}/matchresults":.4,"order/orders/getClientOrder":.4,"order/history":1,"order/matchresults":1,"query/deposit-withdraw":1,"margin/loan-orders":.2,"margin/accounts/balance":.2,"cross-margin/loan-orders":1,"cross-margin/accounts/balance":1,"points/actions":1,"points/orders":1,"subuser/aggregate-balance":10,"stable-coin/exchange_rate":1,"stable-coin/quote":1},post:{"account/transfer":1,"futures/transfer":1,"order/batch-orders":.4,"order/orders/place":.2,"order/orders/submitCancelClientOrder":.2,"order/orders/batchCancelOpenOrders":.4,"order/orders/{id}/submitcancel":.2,"order/orders/batchcancel":.4,"dw/withdraw/api/create":1,"dw/withdraw-virtual/{id}/cancel":1,"dw/transfer-in/margin":10,"dw/transfer-out/margin":10,"margin/orders":10,"margin/orders/{id}/repay":10,"cross-margin/transfer-in":1,"cross-margin/transfer-out":1,"cross-margin/orders":1,"cross-margin/orders/{id}/repay":1,"stable-coin/exchange":1,"subuser/transfer":10}},status:{public:{spot:{get:{"api/v2/summary.json":1}},future:{inverse:{get:{"api/v2/summary.json":1}},linear:{get:{"api/v2/summary.json":1}}},swap:{inverse:{get:{"api/v2/summary.json":1}},linear:{get:{"api/v2/summary.json":1}}}}},spot:{public:{get:{"v2/market-status":1,"v1/common/symbols":1,"v1/common/currencys":1,"v2/settings/common/currencies":1,"v2/reference/currencies":1,"v1/common/timestamp":1,"v1/common/exchange":1,"v1/settings/common/chains":1,"v1/settings/common/currencys":1,"v1/settings/common/symbols":1,"v2/settings/common/symbols":1,"v1/settings/common/market-symbols":1,"market/history/candles":1,"market/history/kline":1,"market/detail/merged":1,"market/tickers":1,"market/detail":1,"market/depth":1,"market/trade":1,"market/history/trade":1,"market/etp":1,"v2/etp/reference":1,"v2/etp/rebalance":1}},private:{get:{"v1/account/accounts":.2,"v1/account/accounts/{account-id}/balance":.2,"v2/account/valuation":1,"v2/account/asset-valuation":.2,"v1/account/history":4,"v2/account/ledger":1,"v2/point/account":5,"v2/account/deposit/address":1,"v2/account/withdraw/quota":1,"v2/account/withdraw/address":1,"v2/reference/currencies":1,"v1/query/deposit-withdraw":1,"v1/query/withdraw/client-order-id":1,"v2/user/api-key":1,"v2/user/uid":1,"v2/sub-user/user-list":1,"v2/sub-user/user-state":1,"v2/sub-user/account-list":1,"v2/sub-user/deposit-address":1,"v2/sub-user/query-deposit":1,"v1/subuser/aggregate-balance":10,"v1/account/accounts/{sub-uid}":1,"v1/order/openOrders":.4,"v1/order/orders/{order-id}":.4,"v1/order/orders/getClientOrder":.4,"v1/order/orders/{order-id}/matchresult":.4,"v1/order/orders/{order-id}/matchresults":.4,"v1/order/orders":.4,"v1/order/history":1,"v1/order/matchresults":1,"v2/reference/transact-fee-rate":1,"v2/algo-orders/opening":1,"v2/algo-orders/history":1,"v2/algo-orders/specific":1,"v1/margin/loan-info":1,"v1/margin/loan-orders":.2,"v1/margin/accounts/balance":.2,"v1/cross-margin/loan-info":1,"v1/cross-margin/loan-orders":1,"v1/cross-margin/accounts/balance":1,"v2/account/repayment":5,"v1/stable-coin/quote":1,"v1/stable_coin/exchange_rate":1,"v2/etp/transactions":5,"v2/etp/transaction":5,"v2/etp/limit":1},post:{"v1/account/transfer":1,"v1/futures/transfer":1,"v2/point/transfer":5,"v2/account/transfer":1,"v1/dw/withdraw/api/create":1,"v1/dw/withdraw-virtual/{withdraw-id}/cancel":1,"v2/sub-user/deduct-mode":1,"v2/sub-user/creation":1,"v2/sub-user/management":1,"v2/sub-user/tradable-market":1,"v2/sub-user/transferability":1,"v2/sub-user/api-key-generation":1,"v2/sub-user/api-key-modification":1,"v2/sub-user/api-key-deletion":1,"v1/subuser/transfer":10,"v1/trust/user/active/credit":10,"v1/order/orders/place":.2,"v1/order/batch-orders":.4,"v1/order/auto/place":.2,"v1/order/orders/{order-id}/submitcancel":.2,"v1/order/orders/submitCancelClientOrder":.2,"v1/order/orders/batchCancelOpenOrders":.4,"v1/order/orders/batchcancel":.4,"v2/algo-orders/cancel-all-after":1,"v2/algo-orders":1,"v2/algo-orders/cancellation":1,"v2/account/repayment":5,"v1/dw/transfer-in/margin":10,"v1/dw/transfer-out/margin":10,"v1/margin/orders":10,"v1/margin/orders/{order-id}/repay":10,"v1/cross-margin/transfer-in":1,"v1/cross-margin/transfer-out":1,"v1/cross-margin/orders":1,"v1/cross-margin/orders/{order-id}/repay":1,"v1/stable-coin/exchange":1,"v2/etp/creation":5,"v2/etp/redemption":5,"v2/etp/{transactId}/cancel":10,"v2/etp/batch-cancel":50}}},contract:{public:{get:{"api/v1/timestamp":1,"heartbeat/":1,"api/v1/contract_contract_info":1,"api/v1/contract_index":1,"api/v1/contract_query_elements":1,"api/v1/contract_price_limit":1,"api/v1/contract_open_interest":1,"api/v1/contract_delivery_price":1,"market/depth":1,"market/bbo":1,"market/history/kline":1,"index/market/history/mark_price_kline":1,"market/detail/merged":1,"market/detail/batch_merged":1,"v2/market/detail/batch_merged":1,"market/trade":1,"market/history/trade":1,"api/v1/contract_risk_info":1,"api/v1/contract_insurance_fund":1,"api/v1/contract_adjustfactor":1,"api/v1/contract_his_open_interest":1,"api/v1/contract_ladder_margin":1,"api/v1/contract_api_state":1,"api/v1/contract_elite_account_ratio":1,"api/v1/contract_elite_position_ratio":1,"api/v1/contract_liquidation_orders":1,"api/v1/contract_settlement_records":1,"index/market/history/index":1,"index/market/history/basis":1,"api/v1/contract_estimated_settlement_price":1,"api/v3/contract_liquidation_orders":1,"swap-api/v1/swap_contract_info":1,"swap-api/v1/swap_index":1,"swap-api/v1/swap_query_elements":1,"swap-api/v1/swap_price_limit":1,"swap-api/v1/swap_open_interest":1,"swap-ex/market/depth":1,"swap-ex/market/bbo":1,"swap-ex/market/history/kline":1,"index/market/history/swap_mark_price_kline":1,"swap-ex/market/detail/merged":1,"v2/swap-ex/market/detail/batch_merged":1,"index/market/history/swap_premium_index_kline":1,"swap-ex/market/detail/batch_merged":1,"swap-ex/market/trade":1,"swap-ex/market/history/trade":1,"swap-api/v1/swap_risk_info":1,"swap-api/v1/swap_insurance_fund":1,"swap-api/v1/swap_adjustfactor":1,"swap-api/v1/swap_his_open_interest":1,"swap-api/v1/swap_ladder_margin":1,"swap-api/v1/swap_api_state":1,"swap-api/v1/swap_elite_account_ratio":1,"swap-api/v1/swap_elite_position_ratio":1,"swap-api/v1/swap_estimated_settlement_price":1,"swap-api/v1/swap_liquidation_orders":1,"swap-api/v1/swap_settlement_records":1,"swap-api/v1/swap_funding_rate":1,"swap-api/v1/swap_batch_funding_rate":1,"swap-api/v1/swap_historical_funding_rate":1,"swap-api/v3/swap_liquidation_orders":1,"index/market/history/swap_estimated_rate_kline":1,"index/market/history/swap_basis":1,"linear-swap-api/v1/swap_contract_info":1,"linear-swap-api/v1/swap_index":1,"linear-swap-api/v1/swap_query_elements":1,"linear-swap-api/v1/swap_price_limit":1,"linear-swap-api/v1/swap_open_interest":1,"linear-swap-ex/market/depth":1,"linear-swap-ex/market/bbo":1,"linear-swap-ex/market/history/kline":1,"index/market/history/linear_swap_mark_price_kline":1,"linear-swap-ex/market/detail/merged":1,"linear-swap-ex/market/detail/batch_merged":1,"v2/linear-swap-ex/market/detail/batch_merged":1,"linear-swap-ex/market/trade":1,"linear-swap-ex/market/history/trade":1,"linear-swap-api/v1/swap_risk_info":1,"swap-api/v1/linear-swap-api/v1/swap_insurance_fund":1,"linear-swap-api/v1/swap_adjustfactor":1,"linear-swap-api/v1/swap_cross_adjustfactor":1,"linear-swap-api/v1/swap_his_open_interest":1,"linear-swap-api/v1/swap_ladder_margin":1,"linear-swap-api/v1/swap_cross_ladder_margin":1,"linear-swap-api/v1/swap_api_state":1,"linear-swap-api/v1/swap_cross_transfer_state":1,"linear-swap-api/v1/swap_cross_trade_state":1,"linear-swap-api/v1/swap_elite_account_ratio":1,"linear-swap-api/v1/swap_elite_position_ratio":1,"linear-swap-api/v1/swap_liquidation_orders":1,"linear-swap-api/v1/swap_settlement_records":1,"linear-swap-api/v1/swap_funding_rate":1,"linear-swap-api/v1/swap_batch_funding_rate":1,"linear-swap-api/v1/swap_historical_funding_rate":1,"linear-swap-api/v3/swap_liquidation_orders":1,"index/market/history/linear_swap_premium_index_kline":1,"index/market/history/linear_swap_estimated_rate_kline":1,"index/market/history/linear_swap_basis":1,"linear-swap-api/v1/swap_estimated_settlement_price":1}},private:{get:{"api/v1/contract_sub_auth_list":1,"api/v1/contract_api_trading_status":1,"swap-api/v1/swap_sub_auth_list":1,"swap-api/v1/swap_api_trading_status":1,"linear-swap-api/v1/swap_sub_auth_list":1,"linear-swap-api/v1/swap_api_trading_status":1,"linear-swap-api/v1/swap_cross_position_side":1,"linear-swap-api/v1/swap_position_side":1,"linear-swap-api/v3/unified_account_info":1,"linear-swap-api/v3/fix_position_margin_change_record":1,"linear-swap-api/v3/swap_unified_account_type":1,"linear-swap-api/v3/linear_swap_overview_account_info":1},post:{"api/v1/contract_balance_valuation":1,"api/v1/contract_account_info":1,"api/v1/contract_position_info":1,"api/v1/contract_sub_auth":1,"api/v1/contract_sub_account_list":1,"api/v1/contract_sub_account_info_list":1,"api/v1/contract_sub_account_info":1,"api/v1/contract_sub_position_info":1,"api/v1/contract_financial_record":1,"api/v1/contract_financial_record_exact":1,"api/v1/contract_user_settlement_records":1,"api/v1/contract_order_limit":1,"api/v1/contract_fee":1,"api/v1/contract_transfer_limit":1,"api/v1/contract_position_limit":1,"api/v1/contract_account_position_info":1,"api/v1/contract_master_sub_transfer":1,"api/v1/contract_master_sub_transfer_record":1,"api/v1/contract_available_level_rate":1,"api/v3/contract_financial_record":1,"api/v3/contract_financial_record_exact":1,"api/v1/contract-cancel-after":1,"api/v1/contract_order":1,"api/v1/contract_batchorder":1,"api/v1/contract_cancel":1,"api/v1/contract_cancelall":1,"api/v1/contract_switch_lever_rate":1,"api/v1/lightning_close_position":1,"api/v1/contract_order_info":1,"api/v1/contract_order_detail":1,"api/v1/contract_openorders":1,"api/v1/contract_hisorders":1,"api/v1/contract_hisorders_exact":1,"api/v1/contract_matchresults":1,"api/v1/contract_matchresults_exact":1,"api/v3/contract_hisorders":1,"api/v3/contract_hisorders_exact":1,"api/v3/contract_matchresults":1,"api/v3/contract_matchresults_exact":1,"api/v1/contract_trigger_order":1,"api/v1/contract_trigger_cancel":1,"api/v1/contract_trigger_cancelall":1,"api/v1/contract_trigger_openorders":1,"api/v1/contract_trigger_hisorders":1,"api/v1/contract_tpsl_order":1,"api/v1/contract_tpsl_cancel":1,"api/v1/contract_tpsl_cancelall":1,"api/v1/contract_tpsl_openorders":1,"api/v1/contract_tpsl_hisorders":1,"api/v1/contract_relation_tpsl_order":1,"api/v1/contract_track_order":1,"api/v1/contract_track_cancel":1,"api/v1/contract_track_cancelall":1,"api/v1/contract_track_openorders":1,"api/v1/contract_track_hisorders":1,"swap-api/v1/swap_balance_valuation":1,"swap-api/v1/swap_account_info":1,"swap-api/v1/swap_position_info":1,"swap-api/v1/swap_account_position_info":1,"swap-api/v1/swap_sub_auth":1,"swap-api/v1/swap_sub_account_list":1,"swap-api/v1/swap_sub_account_info_list":1,"swap-api/v1/swap_sub_account_info":1,"swap-api/v1/swap_sub_position_info":1,"swap-api/v1/swap_financial_record":1,"swap-api/v1/swap_financial_record_exact":1,"swap-api/v1/swap_user_settlement_records":1,"swap-api/v1/swap_available_level_rate":1,"swap-api/v1/swap_order_limit":1,"swap-api/v1/swap_fee":1,"swap-api/v1/swap_transfer_limit":1,"swap-api/v1/swap_position_limit":1,"swap-api/v1/swap_master_sub_transfer":1,"swap-api/v1/swap_master_sub_transfer_record":1,"swap-api/v3/swap_financial_record":1,"swap-api/v3/swap_financial_record_exact":1,"swap-api/v1/swap-cancel-after":1,"swap-api/v1/swap_order":1,"swap-api/v1/swap_batchorder":1,"swap-api/v1/swap_cancel":1,"swap-api/v1/swap_cancelall":1,"swap-api/v1/swap_lightning_close_position":1,"swap-api/v1/swap_switch_lever_rate":1,"swap-api/v1/swap_order_info":1,"swap-api/v1/swap_order_detail":1,"swap-api/v1/swap_openorders":1,"swap-api/v1/swap_hisorders":1,"swap-api/v1/swap_hisorders_exact":1,"swap-api/v1/swap_matchresults":1,"swap-api/v1/swap_matchresults_exact":1,"swap-api/v3/swap_matchresults":1,"swap-api/v3/swap_matchresults_exact":1,"swap-api/v3/swap_hisorders":1,"swap-api/v3/swap_hisorders_exact":1,"swap-api/v1/swap_trigger_order":1,"swap-api/v1/swap_trigger_cancel":1,"swap-api/v1/swap_trigger_cancelall":1,"swap-api/v1/swap_trigger_openorders":1,"swap-api/v1/swap_trigger_hisorders":1,"swap-api/v1/swap_tpsl_order":1,"swap-api/v1/swap_tpsl_cancel":1,"swap-api/v1/swap_tpsl_cancelall":1,"swap-api/v1/swap_tpsl_openorders":1,"swap-api/v1/swap_tpsl_hisorders":1,"swap-api/v1/swap_relation_tpsl_order":1,"swap-api/v1/swap_track_order":1,"swap-api/v1/swap_track_cancel":1,"swap-api/v1/swap_track_cancelall":1,"swap-api/v1/swap_track_openorders":1,"swap-api/v1/swap_track_hisorders":1,"linear-swap-api/v1/swap_lever_position_limit":1,"linear-swap-api/v1/swap_cross_lever_position_limit":1,"linear-swap-api/v1/swap_balance_valuation":1,"linear-swap-api/v1/swap_account_info":1,"linear-swap-api/v1/swap_cross_account_info":1,"linear-swap-api/v1/swap_position_info":1,"linear-swap-api/v1/swap_cross_position_info":1,"linear-swap-api/v1/swap_account_position_info":1,"linear-swap-api/v1/swap_cross_account_position_info":1,"linear-swap-api/v1/swap_sub_auth":1,"linear-swap-api/v1/swap_sub_account_list":1,"linear-swap-api/v1/swap_cross_sub_account_list":1,"linear-swap-api/v1/swap_sub_account_info_list":1,"linear-swap-api/v1/swap_cross_sub_account_info_list":1,"linear-swap-api/v1/swap_sub_account_info":1,"linear-swap-api/v1/swap_cross_sub_account_info":1,"linear-swap-api/v1/swap_sub_position_info":1,"linear-swap-api/v1/swap_cross_sub_position_info":1,"linear-swap-api/v1/swap_financial_record":1,"linear-swap-api/v1/swap_financial_record_exact":1,"linear-swap-api/v1/swap_user_settlement_records":1,"linear-swap-api/v1/swap_cross_user_settlement_records":1,"linear-swap-api/v1/swap_available_level_rate":1,"linear-swap-api/v1/swap_cross_available_level_rate":1,"linear-swap-api/v1/swap_order_limit":1,"linear-swap-api/v1/swap_fee":1,"linear-swap-api/v1/swap_transfer_limit":1,"linear-swap-api/v1/swap_cross_transfer_limit":1,"linear-swap-api/v1/swap_position_limit":1,"linear-swap-api/v1/swap_cross_position_limit":1,"linear-swap-api/v1/swap_master_sub_transfer":1,"linear-swap-api/v1/swap_master_sub_transfer_record":1,"linear-swap-api/v1/swap_transfer_inner":1,"linear-swap-api/v3/swap_financial_record":1,"linear-swap-api/v3/swap_financial_record_exact":1,"linear-swap-api/v1/swap_order":1,"linear-swap-api/v1/swap_cross_order":1,"linear-swap-api/v1/swap_batchorder":1,"linear-swap-api/v1/swap_cross_batchorder":1,"linear-swap-api/v1/swap_cancel":1,"linear-swap-api/v1/swap_cross_cancel":1,"linear-swap-api/v1/swap_cancelall":1,"linear-swap-api/v1/swap_cross_cancelall":1,"linear-swap-api/v1/swap_switch_lever_rate":1,"linear-swap-api/v1/swap_cross_switch_lever_rate":1,"linear-swap-api/v1/swap_lightning_close_position":1,"linear-swap-api/v1/swap_cross_lightning_close_position":1,"linear-swap-api/v1/swap_order_info":1,"linear-swap-api/v1/swap_cross_order_info":1,"linear-swap-api/v1/swap_order_detail":1,"linear-swap-api/v1/swap_cross_order_detail":1,"linear-swap-api/v1/swap_openorders":1,"linear-swap-api/v1/swap_cross_openorders":1,"linear-swap-api/v1/swap_hisorders":1,"linear-swap-api/v1/swap_cross_hisorders":1,"linear-swap-api/v1/swap_hisorders_exact":1,"linear-swap-api/v1/swap_cross_hisorders_exact":1,"linear-swap-api/v1/swap_matchresults":1,"linear-swap-api/v1/swap_cross_matchresults":1,"linear-swap-api/v1/swap_matchresults_exact":1,"linear-swap-api/v1/swap_cross_matchresults_exact":1,"linear-swap-api/v1/linear-cancel-after":1,"linear-swap-api/v1/swap_switch_position_mode":1,"linear-swap-api/v1/swap_cross_switch_position_mode":1,"linear-swap-api/v3/swap_matchresults":1,"linear-swap-api/v3/swap_cross_matchresults":1,"linear-swap-api/v3/swap_matchresults_exact":1,"linear-swap-api/v3/swap_cross_matchresults_exact":1,"linear-swap-api/v3/swap_hisorders":1,"linear-swap-api/v3/swap_cross_hisorders":1,"linear-swap-api/v3/swap_hisorders_exact":1,"linear-swap-api/v3/swap_cross_hisorders_exact":1,"linear-swap-api/v3/fix_position_margin_change":1,"linear-swap-api/v3/swap_switch_account_type":1,"linear-swap-api/v3/linear_swap_fee_switch":1,"linear-swap-api/v1/swap_trigger_order":1,"linear-swap-api/v1/swap_cross_trigger_order":1,"linear-swap-api/v1/swap_trigger_cancel":1,"linear-swap-api/v1/swap_cross_trigger_cancel":1,"linear-swap-api/v1/swap_trigger_cancelall":1,"linear-swap-api/v1/swap_cross_trigger_cancelall":1,"linear-swap-api/v1/swap_trigger_openorders":1,"linear-swap-api/v1/swap_cross_trigger_openorders":1,"linear-swap-api/v1/swap_trigger_hisorders":1,"linear-swap-api/v1/swap_cross_trigger_hisorders":1,"linear-swap-api/v1/swap_tpsl_order":1,"linear-swap-api/v1/swap_cross_tpsl_order":1,"linear-swap-api/v1/swap_tpsl_cancel":1,"linear-swap-api/v1/swap_cross_tpsl_cancel":1,"linear-swap-api/v1/swap_tpsl_cancelall":1,"linear-swap-api/v1/swap_cross_tpsl_cancelall":1,"linear-swap-api/v1/swap_tpsl_openorders":1,"linear-swap-api/v1/swap_cross_tpsl_openorders":1,"linear-swap-api/v1/swap_tpsl_hisorders":1,"linear-swap-api/v1/swap_cross_tpsl_hisorders":1,"linear-swap-api/v1/swap_relation_tpsl_order":1,"linear-swap-api/v1/swap_cross_relation_tpsl_order":1,"linear-swap-api/v1/swap_track_order":1,"linear-swap-api/v1/swap_cross_track_order":1,"linear-swap-api/v1/swap_track_cancel":1,"linear-swap-api/v1/swap_cross_track_cancel":1,"linear-swap-api/v1/swap_track_cancelall":1,"linear-swap-api/v1/swap_cross_track_cancelall":1,"linear-swap-api/v1/swap_track_openorders":1,"linear-swap-api/v1/swap_cross_track_openorders":1,"linear-swap-api/v1/swap_track_hisorders":1,"linear-swap-api/v1/swap_cross_track_hisorders":1}}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},exceptions:{broad:{"contract is restricted of closing positions on API. Please contact customer service":r.OnMaintenance,maintain:r.OnMaintenance,"API key has no permission":r.PermissionDenied},exact:{403:r.AuthenticationError,1010:r.AccountNotEnabled,1003:r.AuthenticationError,1013:r.BadSymbol,1017:r.OrderNotFound,1034:r.InvalidOrder,1036:r.InvalidOrder,1039:r.InvalidOrder,1041:r.InvalidOrder,1047:r.InsufficientFunds,1048:r.InsufficientFunds,1061:r.OrderNotFound,1051:r.InvalidOrder,1066:r.BadSymbol,1067:r.InvalidOrder,1094:r.InvalidOrder,1220:r.AccountNotEnabled,1303:r.BadRequest,1461:r.InvalidOrder,4007:r.BadRequest,"bad-request":r.BadRequest,"validation-format-error":r.BadRequest,"validation-constraints-required":r.BadRequest,"base-date-limit-error":r.BadRequest,"api-not-support-temp-addr":r.PermissionDenied,timeout:r.RequestTimeout,"gateway-internal-error":r.ExchangeNotAvailable,"account-frozen-balance-insufficient-error":r.InsufficientFunds,"invalid-amount":r.InvalidOrder,"order-limitorder-amount-min-error":r.InvalidOrder,"order-limitorder-amount-max-error":r.InvalidOrder,"order-marketorder-amount-min-error":r.InvalidOrder,"order-limitorder-price-min-error":r.InvalidOrder,"order-limitorder-price-max-error":r.InvalidOrder,"order-stop-order-hit-trigger":r.InvalidOrder,"order-value-min-error":r.InvalidOrder,"order-invalid-price":r.InvalidOrder,"order-holding-limit-failed":r.InvalidOrder,"order-orderprice-precision-error":r.InvalidOrder,"order-etp-nav-price-max-error":r.InvalidOrder,"order-orderstate-error":r.OrderNotFound,"order-queryorder-invalid":r.OrderNotFound,"order-update-error":r.ExchangeNotAvailable,"api-signature-check-failed":r.AuthenticationError,"api-signature-not-valid":r.AuthenticationError,"base-record-invalid":r.OrderNotFound,"base-symbol-trade-disabled":r.BadSymbol,"base-symbol-error":r.BadSymbol,"system-maintenance":r.OnMaintenance,"base-request-exceed-frequency-limit":r.RateLimitExceeded,"invalid symbol":r.BadSymbol,"symbol trade not open now":r.BadSymbol,"require-symbol":r.BadSymbol,"invalid-address":r.BadRequest,"base-currency-chain-error":r.BadRequest,"dw-insufficient-balance":r.InsufficientFunds,"base-withdraw-fee-error":r.BadRequest,"dw-withdraw-min-limit":r.BadRequest,"request limit":r.RateLimitExceeded}},precisionMode:o.kb,options:{include_OS_certificates:!1,fetchMarkets:{types:{spot:!0,linear:!0,inverse:!0}},timeDifference:0,adjustForTimeDifference:!1,fetchOHLCV:{useHistoricalEndpointForSpot:!0},withdraw:{includeFee:!1},defaultType:"spot",defaultSubType:"linear",defaultNetwork:"ERC20",defaultNetworks:{ETH:"ERC20",BTC:"BTC",USDT:"TRC20"},networks:{TRC20:"TRX",BTC:"BTC",ERC20:"ETH",SOL:"SOLANA",HRC20:"HECO",BEP20:"BSC",XMR:"XMR",LTC:"LTC",XRP:"XRP",XLM:"XLM",CRONOS:"CRO",CRO:"CRO",GLMR:"GLMR",POLYGON:"MATIC",MATIC:"MATIC",BTT:"BTT",CUBE:"CUBE",IOST:"IOST",NEO:"NEO",KLAY:"KLAY",EOS:"EOS",THETA:"THETA",NAS:"NAS",NULS:"NULS",QTUM:"QTUM",FTM:"FTM",CELO:"CELO",DOGE:"DOGE",DOGECHAIN:"DOGECHAIN",NEAR:"NEAR",STEP:"STEP",BITCI:"BITCI",CARDANO:"ADA",ADA:"ADA",ETC:"ETC",LUK:"LUK",MINEPLEX:"MINEPLEX",DASH:"DASH",ZEC:"ZEC",IOTA:"IOTA",NEON3:"NEON3",XEM:"XEM",HC:"HC",LSK:"LSK",DCR:"DCR",BTG:"BTG",STEEM:"STEEM",BTS:"BTS",ICX:"ICX",WAVES:"WAVES",CMT:"CMT",BTM:"BTM",VET:"VET",XZC:"XZC",ACT:"ACT",SMT:"SMT",BCD:"BCD",WAX:"WAX1",WICC:"WICC",ELF:"ELF",ZIL:"ZIL",ELA:"ELA",BCX:"BCX",SBTC:"SBTC",BIFI:"BIFI",CTXC:"CTXC",WAN:"WAN",POLYX:"POLYX",PAI:"PAI",WTC:"WTC",DGB:"DGB",XVG:"XVG",AAC:"AAC",AE:"AE",SEELE:"SEELE",BCV:"BCV",GRS:"GRS",ARDR:"ARDR",NANO:"NANO",ZEN:"ZEN",RBTC:"RBTC",BSV:"BSV",GAS:"GAS",XTZ:"XTZ",LAMB:"LAMB",CVNT1:"CVNT1",DOCK:"DOCK",SC:"SC",KMD:"KMD",ETN:"ETN",TOP:"TOP",IRIS:"IRIS",UGAS:"UGAS",TT:"TT",NEWTON:"NEWTON",VSYS:"VSYS",FSN:"FSN",BHD:"BHD",ONE:"ONE",EM:"EM",CKB:"CKB",EOSS:"EOSS",HIVE:"HIVE",RVN:"RVN",DOT:"DOT",KSM:"KSM",BAND:"BAND",OEP4:"OEP4",NBS:"NBS",FIS:"FIS",AR:"AR",HBAR:"HBAR",FIL:"FIL",MASS:"MASS",KAVA:"KAVA",XYM:"XYM",ENJ:"ENJ",CRUST:"CRUST",ICP:"ICP",CSPR:"CSPR",FLOW:"FLOW",IOTX:"IOTX",LAT:"LAT",APT:"APT",XCH:"XCH",MINA:"MINA",XEC:"ECASH",XPRT:"XPRT",CCA:"ACA",AOTI:"COTI",AKT:"AKT",ARS:"ARS",ASTR:"ASTR",AZERO:"AZERO",BLD:"BLD",BRISE:"BRISE",CORE:"CORE",DESO:"DESO",DFI:"DFI",EGLD:"EGLD",ERG:"ERG",ETHF:"ETHFAIR",ETHW:"ETHW",EVMOS:"EVMOS",FIO:"FIO",FLR:"FLR",FINSCHIA:"FINSCHIA",KMA:"KMA",KYVE:"KYVE",MEV:"MEV",MOVR:"MOVR",NODL:"NODL",OAS:"OAS",OSMO:"OSMO",PAYCOIN:"PAYCOIN",POKT:"POKT",PYG:"PYG",REI:"REI",SCRT:"SCRT",SDN:"SDN",SEI:"SEI",SGB:"SGB",SUI:"SUI",SXP:"SOLAR",SYS:"SYS",TENET:"TENET",TON:"TON",UNQ:"UNQ",UYU:"UYU",WEMIX:"WEMIX",XDC:"XDC",XPLA:"XPLA"},fetchOrdersByStatesMethod:"spot_private_get_v1_order_orders",createMarketBuyOrderRequiresPrice:!0,language:"en-US",broker:{id:"AA03022abc"},accountsByType:{spot:"pro",funding:"pro",future:"futures"},accountsById:{spot:"spot",margin:"margin",otc:"otc",point:"point","super-margin":"super-margin",investment:"investment",borrow:"borrow","grid-trading":"grid-trading","deposit-earning":"deposit-earning","otc-options":"otc-options"},typesByAccount:{pro:"spot",futures:"future"},spot:{stopOrderTypes:{"stop-limit":!0,"buy-stop-limit":!0,"sell-stop-limit":!0,"stop-limit-fok":!0,"buy-stop-limit-fok":!0,"sell-stop-limit-fok":!0},limitOrderTypes:{limit:!0,"buy-limit":!0,"sell-limit":!0,ioc:!0,"buy-ioc":!0,"sell-ioc":!0,"limit-maker":!0,"buy-limit-maker":!0,"sell-limit-maker":!0,"stop-limit":!0,"buy-stop-limit":!0,"sell-stop-limit":!0,"limit-fok":!0,"buy-limit-fok":!0,"sell-limit-fok":!0,"stop-limit-fok":!0,"buy-stop-limit-fok":!0,"sell-stop-limit-fok":!0}}},commonCurrencies:{NGL:"GFNGL",GET:"THEMIS",GTC:"GAMECOM",HIT:"HITCHAIN",PNT:"PENTA",SBTC:"SUPERBITCOIN",SOUL:"SOULSAVER",BIFI:"BITCOINFILE",FUD:"FTX Users Debt"},features:{spot:{sandbox:!0,createOrder:{marginMode:!0,triggerPrice:!0,triggerDirection:!0,triggerPriceType:void 0,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,iceberg:!1,selfTradePrevention:!0,leverage:!0,marketBuyByCost:!0,marketBuyRequiresPrice:!0},createOrders:{max:10},fetchMyTrades:{marginMode:!1,limit:500,daysBack:120,untilDays:2,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,trigger:!0,trailing:!1,limit:500,symbolRequired:!1},fetchOrders:{marginMode:!1,trigger:!0,trailing:!1,limit:500,untilDays:2,daysBack:180,symbolRequired:!1},fetchClosedOrders:{marginMode:!1,trigger:!0,trailing:!1,untilDays:2,limit:500,daysBack:180,daysBackCanceled:1/12,symbolRequired:!1},fetchOHLCV:{limit:1e3}},forDerivatives:{extends:"spot",createOrder:{stopLossPrice:!0,takeProfitPrice:!0,trailing:!0,hedged:!0},createOrders:{max:25},fetchOrder:{marginMode:!0},fetchOpenOrders:{marginMode:!0,trigger:!1,trailing:!1,limit:50},fetchOrders:{marginMode:!0,trigger:!1,trailing:!1,limit:50,daysBack:90},fetchClosedOrders:{marginMode:!0,trigger:!1,trailing:!1,untilDays:2,limit:50,daysBack:90,daysBackCanceled:1/12},fetchOHLCV:{limit:2e3}},swap:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}},future:{linear:{extends:"forDerivatives"},inverse:{extends:"forDerivatives"}}}})}async fetchStatus(e={}){let t;await this.loadMarkets(),[t,e]=this.handleMarketTypeAndParams("fetchStatus",void 0,e);const i=this.handleOption("fetchStatus","enableForContracts",!1);let s,r,a,o;if("spot"!==t&&i){const i=this.safeString(e,"subType",this.options.defaultSubType);"swap"===t?"linear"===i?s=await this.statusPublicSwapLinearGetApiV2SummaryJson():"inverse"===i&&(s=await this.statusPublicSwapInverseGetApiV2SummaryJson()):"future"===t?"linear"===i?s=await this.statusPublicFutureLinearGetApiV2SummaryJson():"inverse"===i&&(s=await this.statusPublicFutureInverseGetApiV2SummaryJson()):"contract"===t&&(s=await this.contractPublicGetHeartbeat())}else"spot"===t&&(s=await this.statusPublicSpotGetApiV2SummaryJson());if("contract"===t){const e=this.safeString(s,"status");r=void 0===e?void 0:"ok"===e?"ok":"maintenance",a=this.safeString(s,"ts")}else{const e=this.safeValue(s,"status",{});r="none"===this.safeString(e,"indicator")?"ok":"maintenance";const t=this.safeValue(s,"page",{}),i=this.safeString(t,"updated_at");a=this.parse8601(i),o=this.safeString(t,"url")}return{status:r,updated:a,eta:void 0,url:o,info:s}}async fetchTime(e={}){const t=this.safeValue(this.options,"fetchTime",{}),i=this.safeString(this.options,"defaultType","spot");let s,r=this.safeString(t,"type",i);return r=this.safeString(e,"type",r),s="future"===r||"swap"===r?await this.contractPublicGetApiV1Timestamp(e):await this.spotPublicGetV1CommonTimestamp(e),this.safeInteger2(s,"data","ts")}parseTradingFee(e,t=void 0){const i=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(i,t),maker:this.safeNumber(e,"actualMakerRate"),taker:this.safeNumber(e,"actualTakerRate"),percentage:void 0,tierBased:void 0}}async fetchTradingFee(e,t={}){await this.loadMarkets();const i=this.market(e),s={symbols:i.id},r=await this.spotPrivateGetV2ReferenceTransactFeeRate(this.extend(s,t)),a=this.safeValue(r,"data",[]),o=this.safeValue(a,0,{});return this.parseTradingFee(o,i)}async fetchTradingLimits(e=void 0,t={}){await this.loadMarkets(),void 0===e&&(e=this.symbols);const i={};for(let s=0;s=0?c=this.safeString(e,"field-cash-amount"):(l=this.safeString2(e,"volume","amount"),c=this.safeStringN(e,["filled-cash-amount","field-cash-amount","trade_turnover"]));const u=this.safeStringN(e,["filled-amount","field-amount","trade_volume"]),f=this.safeString2(e,"price","order_price");let p,m=this.safeString2(e,"filled-fees","field-fees");if(m=this.safeString(e,"fee",m),void 0!==m){let i;const s=this.safeString(e,"fee_asset");i=void 0!==s?this.safeCurrencyCode(s):"sell"===a?t.quote:t.base,p={cost:m,currency:i}}const g=this.safeString(e,"trade_avg_price"),v=this.safeValue(e,"trades"),y=this.safeInteger(e,"reduce_only");let w;return void 0!==y&&(w=0!==y),this.safeOrder({info:e,id:r,clientOrderId:h,timestamp:d,datetime:this.iso8601(d),lastTradeTimestamp:void 0,symbol:t.symbol,type:o,timeInForce:void 0,postOnly:void 0,side:a,price:f,triggerPrice:this.safeString2(e,"stop-price","trigger_price"),average:g,cost:c,amount:l,filled:u,remaining:void 0,status:s,reduceOnly:w,fee:p,trades:v},t)}async createMarketBuyOrderWithCost(e,t,i={}){await this.loadMarkets();if(!this.market(e).spot)throw new r.NotSupported(this.id+" createMarketBuyOrderWithCost() supports spot orders only");return i.createMarketBuyOrderRequiresPrice=!1,await this.createOrder(e,"market","buy",t,void 0,i)}async createTrailingPercentOrder(e,t,i,s,a=void 0,o=void 0,n=void 0,d={}){if(void 0===o)throw new r.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingPercent argument");if(void 0===n)throw new r.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingTriggerPrice argument");return d.trailingPercent=o,d.trailingTriggerPrice=n,await this.createOrder(e,t,i,s,a,d)}async createSpotOrderRequest(e,t,i,s,o=void 0,n={}){await this.loadMarkets(),await this.loadAccounts();const d=this.market(e);let h;[h,n]=this.handleMarginModeAndParams("createOrder",n);const c={"account-id":await this.fetchAccountIdByType(d.type,h,e),symbol:d.id};let l=t.replace("buy-","");l=l.replace("sell-","");const u=this.safeValue(this.options,d.type,{}),f=this.safeStringN(n,["triggerPrice","stopPrice","stop-price"]);if(void 0===f){if(l in this.safeValue(u,"stopOrderTypes",{}))throw new r.ArgumentsRequired(this.id+" createOrder() requires a triggerPrice for a trigger order")}else{const s="sell"===i?"lte":"gte",a=this.safeString(n,"operator",s);if(c["stop-price"]=this.priceToPrecision(e,f),c.operator=a,"limit"===l||"limit-fok"===l)l="stop-"+l;else if("stop-limit"!==l&&"stop-limit-fok"!==l)throw new r.NotSupported(this.id+" createOrder() does not support "+t+" orders")}let p;[p,n]=this.handlePostOnly("market"===l,"limit-maker"===l,n),p&&(l="limit-maker");const m=this.safeString(n,"timeInForce","GTC");"FOK"===m?l+="-fok":"IOC"===m&&(l="ioc"),c.type=i+"-"+l;const g=this.safeString2(n,"clientOrderId","client-order-id");if(void 0===g){const e=this.safeValue(this.options,"broker",{}),t=this.safeString(e,"id");c["client-order-id"]=t+this.uuid()}else c["client-order-id"]=g;if("cross"===h?c.source="super-margin-api":"isolated"===h?c.source="margin-api":"c2c"===h&&(c.source="c2c-margin-api"),"market"===l&&"buy"===i){let t,i=!0;[i,n]=this.handleOptionAndParams(n,"createOrder","createMarketBuyOrderRequiresPrice",!0);const d=this.safeNumber(n,"cost");if(n=this.omit(n,"cost"),void 0!==d)t=this.amountToPrecision(e,d);else if(i){if(void 0===o)throw new r.InvalidOrder(this.id+" createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument");{const i=this.numberToString(s),r=this.numberToString(o);t=this.amountToPrecision(e,a.Y.stringMul(i,r))}}else t=this.amountToPrecision(e,s);c.amount=t}else c.amount=this.amountToPrecision(e,s);return l in this.safeValue(u,"limitOrderTypes",{})&&(c.price=this.priceToPrecision(e,o)),n=this.omit(n,["triggerPrice","stopPrice","stop-price","clientOrderId","client-order-id","operator","timeInForce"]),this.extend(c,n)}createContractOrderRequest(e,t,i,s,r=void 0,o={}){const n={contract_code:this.market(e).id,volume:this.amountToPrecision(e,s),direction:i};let d;[d,o]=this.handlePostOnly("market"===t,"post_only"===t,o),d&&(t="post_only");const h=this.safeString(o,"timeInForce","GTC");"FOK"===h?t="fok":"IOC"===h&&(t="ioc");const c=this.safeNumberN(o,["triggerPrice","stopPrice","trigger_price"]),l=this.safeNumber2(o,"stopLossPrice","sl_trigger_price"),u=this.safeNumber2(o,"takeProfitPrice","tp_trigger_price"),f=this.safeString2(o,"trailingPercent","callback_rate"),p=this.safeNumber(o,"trailingTriggerPrice",r),m=void 0!==f,g=void 0!==l,v=void 0!==u;if(void 0!==c){const t=this.safeString2(o,"triggerType","trigger_type","le");n.trigger_type=t,n.trigger_price=this.priceToPrecision(e,c),void 0!==r&&(n.order_price=this.priceToPrecision(e,r))}else if(g||v)g?(n.sl_order_price_type=t,n.sl_trigger_price=this.priceToPrecision(e,l),void 0!==r&&(n.sl_order_price=this.priceToPrecision(e,r))):(n.tp_order_price_type=t,n.tp_trigger_price=this.priceToPrecision(e,u),void 0!==r&&(n.tp_order_price=this.priceToPrecision(e,r)));else if(m){const e=a.Y.stringDiv(f,"100");n.callback_rate=this.parseToNumeric(e),n.active_price=p,n.order_price_type=this.safeString(o,"order_price_type","formula_price")}else{const i=this.safeInteger2(o,"client_order_id","clientOrderId");void 0!==i&&(n.client_order_id=i,o=this.omit(o,["clientOrderId"])),"limit"!==t&&"ioc"!==t&&"fok"!==t&&"post_only"!==t||(n.price=this.priceToPrecision(e,r))}const y=this.safeBool2(o,"reduceOnly","reduce_only",!1);g||v||(y&&(n.reduce_only=1),n.lever_rate=this.safeIntegerN(o,["leverRate","lever_rate","leverage"],1),m||(n.order_price_type=t));this.safeBool(o,"hedged",!1)&&(n.offset=y?"close":"open");const w=this.safeValue(this.options,"broker",{}),b=this.safeString(w,"id");return n.channel_code=b,o=this.omit(o,["reduceOnly","triggerPrice","stopPrice","stopLossPrice","takeProfitPrice","triggerType","leverRate","timeInForce","leverage","trailingPercent","trailingTriggerPrice","hedged"]),this.extend(n,o)}async createOrder(e,t,i,s,a=void 0,o={}){await this.loadMarkets();const n=this.market(e),d=this.safeNumberN(o,["triggerPrice","stopPrice","trigger_price"]),h=this.safeNumber2(o,"stopLossPrice","sl_trigger_price"),c=this.safeNumber2(o,"takeProfitPrice","tp_trigger_price"),l=void 0!==this.safeNumber(o,"trailingPercent"),u=void 0!==d,f=void 0!==h,p=void 0!==c;let m,g,v;if(n.spot){if(l)throw new r.NotSupported(this.id+" createOrder() does not support trailing orders for spot markets");const n=await this.createSpotOrderRequest(e,t,i,s,a,o);m=await this.spotPrivatePostV1OrderOrdersPlace(n)}else{let d=this.createContractOrderRequest(e,t,i,s,a,o);if(n.linear){let e;[e,d]=this.handleMarginModeAndParams("createOrder",d),e=void 0===e?"cross":e,"isolated"===e?m=u?await this.contractPrivatePostLinearSwapApiV1SwapTriggerOrder(d):f||p?await this.contractPrivatePostLinearSwapApiV1SwapTpslOrder(d):l?await this.contractPrivatePostLinearSwapApiV1SwapTrackOrder(d):await this.contractPrivatePostLinearSwapApiV1SwapOrder(d):"cross"===e&&(m=u?await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOrder(d):f||p?await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOrder(d):l?await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOrder(d):await this.contractPrivatePostLinearSwapApiV1SwapCrossOrder(d))}else if(n.inverse){if(void 0===this.safeString(o,"offset"))throw new r.ArgumentsRequired(this.id+' createOrder () requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets');n.swap?m=u?await this.contractPrivatePostSwapApiV1SwapTriggerOrder(d):f||p?await this.contractPrivatePostSwapApiV1SwapTpslOrder(d):l?await this.contractPrivatePostSwapApiV1SwapTrackOrder(d):await this.contractPrivatePostSwapApiV1SwapOrder(d):n.future&&(m=u?await this.contractPrivatePostApiV1ContractTriggerOrder(d):f||p?await this.contractPrivatePostApiV1ContractTpslOrder(d):l?await this.contractPrivatePostApiV1ContractTrackOrder(d):await this.contractPrivatePostApiV1ContractOrder(d))}}return n.spot?this.safeOrder({info:m,id:this.safeString(m,"data"),timestamp:void 0,datetime:void 0,lastTradeTimestamp:void 0,status:void 0,symbol:void 0,type:t,side:i,price:a,amount:s,filled:void 0,remaining:void 0,cost:void 0,trades:void 0,fee:void 0,clientOrderId:void 0,average:void 0},n):(f?(g=this.safeValue(m,"data",{}),v=this.safeValue(g,"sl_order",{})):p?(g=this.safeValue(m,"data",{}),v=this.safeValue(g,"tp_order",{})):v=this.safeValue(m,"data",{}),this.parseOrder(v,n))}async createOrders(e,t={}){await this.loadMarkets();const i=[];let s,a,o;for(let t=0;t0?this.parseToInt(e/1e3):0};return await this.v2PrivatePostAlgoOrdersCancelAllAfter(this.extend(i,t))}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"address"),s=this.safeString(e,"addressTag"),r=this.safeString(e,"currency");t=this.safeCurrency(r,t);const a=this.safeCurrencyCode(r,t),o=this.safeString(e,"note"),n=this.safeString(e,"chain");return this.checkAddress(i),{currency:a,address:i,tag:s,network:this.networkIdToCode(n),note:o,info:e}}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const i=this.currency(e),s={currency:i.id},r=await this.spotPrivateGetV2AccountDepositAddress(this.extend(s,t)),a=this.safeValue(r,"data",[]),o=this.parseDepositAddresses(a,[i.code],!1);return this.indexBy(o,"network")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e),[s,r]=this.handleNetworkCodeAndParams(t),a=await this.fetchDepositAddressesByNetwork(e,r);return a[this.selectNetworkCodeFromUnifiedNetworks(i.code,s,a)]}async fetchWithdrawAddresses(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.currency(e),a={currency:r.id},o=await this.spotPrivateGetV2AccountWithdrawAddress(this.extend(a,s)),n=this.safeValue(o,"data",[]),d=this.parseDepositAddresses(n,[r.code],!1),h=[];for(let e=0;e100)&&(i=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"deposit",direct:"next",from:0};void 0!==r&&(a.currency=r.id),void 0!==i&&(a.size=i);const o=await this.spotPrivateGetV1QueryDepositWithdraw(this.extend(a,s));return this.parseTransactions(o.data,r,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){let r;(void 0===i||i>100)&&(i=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"withdraw",direct:"next",from:0};void 0!==r&&(a.currency=r.id),void 0!==i&&(a.size=i);const o=await this.spotPrivateGetV1QueryDepositWithdraw(this.extend(a,s));return this.parseTransactions(o.data,r,t,i)}parseTransaction(e,t=void 0){const i=this.safeInteger(e,"created-at"),s=this.safeCurrencyCode(this.safeString(e,"currency"));let r=this.safeString(e,"type");"withdraw"===r&&(r="withdrawal");let o=this.safeString(e,"fee");void 0!==o&&(o=a.Y.stringAbs(o));const n=this.safeString(e,"chain");let d=this.safeString(e,"tx-hash");"ETH"===n&&d.indexOf("0x")<0&&(d="0x"+d);const h="FAST"===this.safeString(e,"sub-type");return{info:e,id:this.safeString2(e,"id","data"),txid:d,timestamp:i,datetime:this.iso8601(i),network:this.networkIdToCode(n),address:this.safeString(e,"address"),addressTo:void 0,addressFrom:void 0,tag:this.safeString(e,"address-tag"),tagTo:void 0,tagFrom:void 0,type:r,amount:this.safeNumber(e,"amount"),currency:s,status:this.parseTransactionStatus(this.safeString(e,"state")),updated:this.safeInteger(e,"updated-at"),comment:void 0,internal:h,fee:{currency:s,cost:this.parseNumber(o),rate:void 0}}}parseTransactionStatus(e){return this.safeString({unknown:"failed",confirming:"pending",confirmed:"ok",safe:"ok",orphan:"failed",submitted:"pending",canceled:"canceled",reexamine:"pending",reject:"failed",pass:"pending","wallet-reject":"failed","confirm-error":"failed",repealed:"failed","wallet-transfer":"pending","pre-transfer":"pending"},e,e)}async withdraw(e,t,i,s=void 0,o={}){[s,o]=this.handleWithdrawTagAndParams(s,o),await this.loadMarkets(),this.checkAddress(i);const n=this.currency(e),d={address:i,currency:n.id.toLowerCase()};let h;void 0!==s&&(d["addr-tag"]=s),[h,o]=this.handleNetworkCodeAndParams(o),void 0!==h&&(d.chain=this.networkCodeToId(h,e)),t=parseFloat(this.currencyToPrecision(e,t,h));const c=this.safeValue(this.options,"withdraw",{});if(this.safeBool(c,"includeFee",!1)){let i=this.safeNumber(o,"fee");if(void 0===i){const e=await this.fetchCurrencies();this.currencies=this.deepExtend(this.currencies,e);const t=this.safeValue(n.networks,h,{});if(i=this.safeNumber(t,"fee"),void 0===i)throw new r.ArgumentsRequired(this.id+' withdraw() function can not find withdraw fee for chosen network. You need to re-load markets with "exchange.loadMarkets(true)", or provide the "fee" parameter')}const s=this.currencyToPrecision(e,i,h);o=this.omit(o,"fee");const c=this.numberToString(t),l=a.Y.stringSub(c,s),u=parseFloat(l);d.fee=parseFloat(s),t=parseFloat(this.currencyToPrecision(e,u,h))}d.amount=t;const l=await this.spotPrivatePostV1DwWithdrawApiCreate(this.extend(d,o));return this.parseTransaction(l,n)}parseTransfer(e,t=void 0){return{info:e,id:this.safeString(e,"data"),timestamp:void 0,datetime:void 0,currency:this.safeCurrencyCode(void 0,t),amount:void 0,fromAccount:void 0,toAccount:void 0,status:void 0}}async transfer(e,t,i,s,a={}){await this.loadMarkets();const o=this.currency(e),n={currency:o.id,amount:parseFloat(this.currencyToPrecision(e,t))};let d;[d,a]=this.handleSubTypeAndParams("transfer",void 0,a);let h=this.convertTypeToAccount(i),c=this.convertTypeToAccount(s);const l="cross"===c,u="cross"===h,f=this.inArray(c,this.ids),p=this.inArray(h,this.ids),m="pro"===h,g="pro"===c;if(m&&g)throw new r.BadRequest(this.id+" transfer () cannot make a transfer between "+i+" and "+s);let v;if("futures"===h||"futures"===c){let e=h+"-to-"+c;e=this.safeString(a,"type",e),n.type=e,v=await this.spotPrivatePostV1FuturesTransfer(this.extend(n,a))}else if(m&&l)v=await this.privatePostCrossMarginTransferIn(this.extend(n,a));else if(u&&g)v=await this.privatePostCrossMarginTransferOut(this.extend(n,a));else if(m&&f)n.symbol=c,v=await this.privatePostDwTransferInMargin(this.extend(n,a));else if(p&&g)n.symbol=h,v=await this.privatePostDwTransferOutMargin(this.extend(n,a));else{if("linear"===d){"swap"===h||"linear-swap"===i?h="linear-swap":c="linear-swap";let e=this.safeString(a,"symbol");a=this.omit(a,"symbol"),void 0!==e?(e=this.marketId(e),n["margin-account"]=e):n["margin-account"]="USDT"}n.from=m?"spot":h,n.to=g?"spot":c,v=await this.v2PrivatePostAccountTransfer(this.extend(n,a))}return this.parseTransfer(v,o)}async fetchIsolatedBorrowRates(e={}){await this.loadMarkets();const t=await this.spotPrivateGetV1MarginLoanInfo(e),i=this.safeValue(t,"data",[]);return this.parseIsolatedBorrowRates(i)}parseIsolatedBorrowRate(e,t=void 0){const i=this.safeString(e,"symbol"),s=this.safeSymbol(i,t),r=this.safeValue(e,"currencies",[]),a=this.safeValue(r,0),o=this.safeValue(r,1),n=this.safeString(a,"currency"),d=this.safeString(o,"currency");return{symbol:s,base:this.safeCurrencyCode(n),baseRate:this.safeNumber(a,"actual-rate"),quote:this.safeCurrencyCode(d),quoteRate:this.safeNumber(o,"actual-rate"),period:864e5,timestamp:void 0,datetime:void 0,info:e}}async fetchFundingRateHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");let a=!1;if([a,s]=this.handleOptionAndParams(s,"fetchFundingRateHistory","paginate"),a)return await this.fetchPaginatedCallCursor("fetchFundingRateHistory",e,t,i,s,"page_index","current_page",1,50);await this.loadMarkets();const o=this.market(e),n={contract_code:o.id};let d;if(o.inverse)d=await this.contractPublicGetSwapApiV1SwapHistoricalFundingRate(this.extend(n,s));else{if(!o.linear)throw new r.NotSupported(this.id+" fetchFundingRateHistory() supports inverse and linear swaps only");d=await this.contractPublicGetLinearSwapApiV1SwapHistoricalFundingRate(this.extend(n,s))}const h=this.safeValue(d,"data"),c=this.safeValue(h,"current_page"),l=this.safeValue(h,"data",[]),u=[];for(let e=0;e0){const t=this.safeString(e,0);i=this.market(t)}}if([s,t]=this.handleMarginModeAndParams("fetchPositions",t,"cross"),[a,t]=this.handleSubTypeAndParams("fetchPositions",i,t,"linear"),[o,t]=this.handleMarketTypeAndParams("fetchPositions",i,t),"spot"===o&&(o="future"),"linear"===a)if("isolated"===s)n=await this.contractPrivatePostLinearSwapApiV1SwapPositionInfo(t);else{if("cross"!==s)throw new r.NotSupported(this.id+" fetchPositions() not support this market type");n=await this.contractPrivatePostLinearSwapApiV1SwapCrossPositionInfo(t)}else if("future"===o)n=await this.contractPrivatePostApiV1ContractPositionInfo(t);else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchPositions() not support this market type");n=await this.contractPrivatePostSwapApiV1SwapPositionInfo(t)}const d=this.safeValue(n,"data",[]),h=this.safeInteger(n,"ts"),c=[];for(let e=0;e0){const t=this.safeString(e,0);i=this.market(t)}}const s={};let r,a,o;[r,t]=this.handleSubTypeAndParams("fetchPositions",i,t,"linear"),[a,t]=this.handleMarketTypeAndParams("fetchPositions",i,t),"future"===a?o=await this.contractPublicGetApiV1ContractOpenInterest(this.extend(s,t)):"inverse"===r?o=await this.contractPublicGetSwapApiV1SwapOpenInterest(this.extend(s,t)):(s.contract_type="swap",o=await this.contractPublicGetLinearSwapApiV1SwapOpenInterest(this.extend(s,t)));const n=this.safeList(o,"data",[]);return this.parseOpenInterests(n,e)}async fetchOpenInterest(e,t={}){await this.loadMarkets();const i=this.market(e);if(!i.contract)throw new r.BadRequest(this.id+" fetchOpenInterest() supports contract markets only");if(i.option)throw new r.NotSupported(this.id+" fetchOpenInterest() does not currently support option markets");const s={contract_code:i.id};let a;i.future?(s.contract_type=this.safeString(i.info,"contract_type"),s.symbol=i.baseId,a=await this.contractPublicGetApiV1ContractOpenInterest(this.extend(s,t))):i.linear?(s.contract_type="swap",a=await this.contractPublicGetLinearSwapApiV1SwapOpenInterest(this.extend(s,t))):a=await this.contractPublicGetSwapApiV1SwapOpenInterest(this.extend(s,t));const o=this.safeValue(a,"data",[]),n=this.parseOpenInterest(o[0],i),d=this.safeInteger(a,"ts");return n.timestamp=d,n.datetime=this.iso8601(d),n}parseOpenInterest(e,t=void 0){const i=this.safeInteger(e,"ts"),s=this.safeNumber(e,"volume"),r=this.safeNumber(e,"value"),a=this.safeString(e,"contract_code");return this.safeOpenInterest({symbol:this.safeSymbol(a,t),baseVolume:s,quoteVolume:r,openInterestAmount:s,openInterestValue:r,timestamp:i,datetime:this.iso8601(i),info:e},t)}async borrowIsolatedMargin(e,t,i,s={}){await this.loadMarkets();const r=this.currency(t),a=this.market(e),o={currency:r.id,amount:this.currencyToPrecision(t,i),symbol:a.id},n=await this.privatePostMarginOrders(this.extend(o,s)),d=this.parseMarginLoan(n,r);return this.extend(d,{amount:i,symbol:e})}async borrowCrossMargin(e,t,i={}){await this.loadMarkets();const s=this.currency(e),r={currency:s.id,amount:this.currencyToPrecision(e,t)},a=await this.privatePostCrossMarginOrders(this.extend(r,i)),o=this.parseMarginLoan(a,s);return this.extend(o,{amount:t})}async repayIsolatedMargin(e,t,i,s={}){await this.loadMarkets();const r=this.currency(t),a=await this.fetchAccountIdByType("spot","isolated",e,s),o={currency:r.id,amount:this.currencyToPrecision(t,i),accountId:a},n=await this.v2PrivatePostAccountRepayment(this.extend(o,s)),d=this.safeValue(n,"Data",[]),h=this.safeValue(d,0),c=this.parseMarginLoan(h,r);return this.extend(c,{amount:i,symbol:e})}async repayCrossMargin(e,t,i={}){await this.loadMarkets();const s=this.currency(e),r=await this.fetchAccountIdByType("spot","cross",void 0,i),a={currency:s.id,amount:this.currencyToPrecision(e,t),accountId:r},o=await this.v2PrivatePostAccountRepayment(this.extend(a,i)),n=this.safeValue(o,"Data",[]),d=this.safeValue(n,0),h=this.parseMarginLoan(d,s);return this.extend(h,{amount:t})}parseMarginLoan(e,t=void 0){const i=this.safeInteger(e,"repayTime");return{id:this.safeString2(e,"repayId","data"),currency:this.safeCurrencyCode(void 0,t),amount:void 0,symbol:void 0,timestamp:i,datetime:this.iso8601(i),info:e}}async fetchSettlementHistory(e=void 0,t=void 0,i=void 0,s={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchSettlementHistory() requires a symbol argument");const a=this.safeInteger(s,"until");s=this.omit(s,["until"]);const o=this.market(e),n={};let d;o.future?n.symbol=o.baseId:n.contract_code=o.id,void 0!==t&&(n.start_at=t),void 0!==i&&(n.page_size=i),void 0!==a&&(n.end_at=a),d=o.swap?o.linear?await this.contractPublicGetLinearSwapApiV1SwapSettlementRecords(this.extend(n,s)):await this.contractPublicGetSwapApiV1SwapSettlementRecords(this.extend(n,s)):await this.contractPublicGetApiV1ContractSettlementRecords(this.extend(n,s));const h=this.safeValue(d,"data"),c=this.safeValue(h,"settlement_record"),l=this.parseSettlements(c,o);return this.sortBy(l,"timestamp")}async fetchDepositWithdrawFees(e=void 0,t={}){await this.loadMarkets();const i=await this.spotPublicGetV2ReferenceCurrencies(t),s=this.safeList(i,"data");return this.parseDepositWithdrawFees(s,e,"currency")}parseDepositWithdrawFee(e,t=void 0){const i=this.safeValue(e,"chains",[]);let s=this.depositWithdrawFee(e);for(let e=0;e{i.d(t,{A:()=>r});var s=i(9946);class r extends s.A{describe(){return this.deepExtend(super.describe(),{id:"huobi",alias:!0})}}},1936:(e,t,i)=>{i.d(t,{A:()=>c});var s=i(9023),r=i(2079),a=i(5147),o=i(1579),n=i(8432),d=i(987),h=i(8283);class c extends s.A{describe(){return this.deepExtend(super.describe(),{id:"hyperliquid",name:"Hyperliquid",countries:[],version:"v1",rateLimit:50,certified:!0,pro:!0,dex:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!0,option:!1,addMargin:!0,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!1,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,editOrders:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchMarginMode:void 0,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenInterests:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!1,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:"emulated",fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!1,repayIsolatedMargin:!1,sandbox:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},hostname:"hyperliquid.xyz",urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/b371bc6c-4a8c-489f-87f4-20a913dd8d4b",api:{public:"https://api.{hostname}",private:"https://api.{hostname}"},test:{public:"https://api.hyperliquid-testnet.xyz",private:"https://api.hyperliquid-testnet.xyz"},www:"https://hyperliquid.xyz",doc:"https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api",fees:"https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees",referral:"https://app.hyperliquid.xyz/"},api:{public:{post:{info:{cost:20,byType:{l2Book:2,allMids:2,clearinghouseState:2,orderStatus:2,spotClearinghouseState:2,exchangeStatus:2}}}},private:{post:{exchange:1}}},fees:{swap:{taker:this.parseNumber("0.00045"),maker:this.parseNumber("0.00015")},spot:{taker:this.parseNumber("0.0007"),maker:this.parseNumber("0.0004")}},requiredCredentials:{apiKey:!1,secret:!1,walletAddress:!0,privateKey:!0},exceptions:{exact:{},broad:{"Price must be divisible by tick size.":r.InvalidOrder,"Order must have minimum value of $10":r.InvalidOrder,"Insufficient margin to place order.":r.InsufficientFunds,"Reduce only order would increase position.":r.InvalidOrder,"Post only order would have immediately matched,":r.InvalidOrder,"Order could not immediately match against any resting orders.":r.InvalidOrder,"Invalid TP/SL price.":r.InvalidOrder,"No liquidity available for market order.":r.InvalidOrder,"Order was never placed, already canceled, or filled.":r.OrderNotFound,"User or API Wallet ":r.InvalidOrder,"Order has invalid size":r.InvalidOrder,"Order price cannot be more than 80% away from the reference price":r.InvalidOrder,"Order has zero size.":r.InvalidOrder,"Insufficient spot balance asset":r.InsufficientFunds,"Insufficient balance for withdrawal":r.InsufficientFunds,"Insufficient balance for token transfer":r.InsufficientFunds}},precisionMode:o.kb,commonCurrencies:{},options:{defaultType:"swap",sandboxMode:!1,defaultSlippage:.05,zeroAddress:"0x0000000000000000000000000000000000000000"},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:{max:1e3},fetchMyTrades:{marginMode:!1,limit:2e3,daysBack:void 0,untilDays:void 0,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:2e3,trigger:!1,trailing:!1,symbolRequired:!0},fetchOrders:{marginMode:!1,limit:2e3,daysBack:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchClosedOrders:{marginMode:!1,limit:2e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:5e3}},spot:{extends:"default"},forPerps:{extends:"default",createOrder:{stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0}},swap:{linear:{extends:"forPerps"},inverse:{extends:"forPerps"}},future:{linear:{extends:"forPerps"},inverse:{extends:"forPerps"}}}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}async fetchCurrencies(e={}){const t=await this.publicPostInfo(this.extend({type:"meta"},e)),i=this.safeList(t,"universe",[]),s={};for(let e=0;e=34?e:this.parseToNumeric(e),user:s},o=await this.publicPostInfo(this.extend(a,i)),n=this.safeDict(o,"order");return this.parseOrder(n,r)}parseOrder(e,t=void 0){if(void 0!==this.safeString(e,"error"))return this.safeOrder({info:e,status:"rejected"});let i=this.safeDictN(e,["order","resting","filled"]);void 0===i&&(i=e);const s=this.safeString(i,"coin");let r;void 0!==s&&(r=this.coinToMarketId(s));const o=(t=void 0===this.safeString(i,"id")?this.safeMarket(r,void 0):this.safeMarket(r,t)).symbol,n=this.safeInteger(i,"timestamp"),d=this.safeString2(e,"status","ccxtStatus");e=this.omit(e,["ccxtStatus"]);let h=this.safeString(i,"side");void 0!==h&&(h="A"===h?"sell":"buy");const c=this.safeString2(i,"origSz","totalSz"),l=this.safeString(i,"sz"),u=this.safeStringUpper(i,"tif");let f;return void 0!==u&&(f="ALO"===u),this.safeOrder({info:e,id:this.safeString(i,"oid"),clientOrderId:this.safeString(i,"cloid"),timestamp:n,datetime:this.iso8601(n),lastTradeTimestamp:void 0,lastUpdateTimestamp:this.safeInteger(e,"statusTimestamp"),symbol:o,type:this.parseOrderType(this.safeStringLower(i,"orderType")),timeInForce:u,postOnly:f,reduceOnly:this.safeBool(i,"reduceOnly"),side:h,price:this.safeString(i,"limitPx"),triggerPrice:this.safeBool(i,"isTrigger")?this.safeNumber(i,"triggerPx"):void 0,amount:c,cost:void 0,average:this.safeString(i,"avgPx"),filled:a.Y.stringSub(c,l),remaining:l,status:this.parseOrderStatus(d),fee:void 0,trades:void 0},t)}parseOrderStatus(e){return this.safeString({triggered:"open",filled:"closed",open:"open",canceled:"canceled",rejected:"rejected",marginCanceled:"canceled"},e,e)}parseOrderType(e){return this.safeString({"stop limit":"limit","stop market":"market"},e,e)}async fetchMyTrades(e=void 0,t=void 0,i=void 0,s={}){let r;[r,s]=this.handlePublicAddress("fetchMyTrades",s),await this.loadMarkets();const a=this.safeMarket(e),o={user:r};void 0!==t?(o.type="userFillsByTime",o.startTime=t):o.type="userFills";const n=this.safeInteger(s,"until");s=this.omit(s,"until"),void 0!==n&&(o.endTime=n);const d=await this.publicPostInfo(this.extend(o,s));return this.parseTrades(d,a,t,i)}parseTrade(e,t=void 0){const i=this.safeInteger(e,"time"),s=this.safeString(e,"px"),r=this.safeString(e,"sz"),a=this.safeString(e,"coin"),o=this.coinToMarketId(a),n=(t=this.safeMarket(o,void 0)).symbol,d=this.safeString(e,"tid");let h=this.safeString(e,"side");void 0!==h&&(h="A"===h?"sell":"buy");const c=this.safeString(e,"fee");let l;const u=this.safeBool(e,"crossed");return void 0!==u&&(l=u?"taker":"maker"),this.safeTrade({info:e,timestamp:i,datetime:this.iso8601(i),symbol:n,id:d,order:this.safeString(e,"oid"),type:void 0,side:h,takerOrMaker:l,price:s,amount:r,cost:void 0,fee:{cost:c,currency:this.safeString(e,"feeToken"),rate:void 0}},t)}async fetchPosition(e,t={}){const i=await this.fetchPositions([e],t);return this.safeDict(i,0,{})}async fetchPositions(e=void 0,t={}){let i;await this.loadMarkets(),[i,t]=this.handlePublicAddress("fetchPositions",t),e=this.marketSymbols(e);const s={type:"clearinghouseState",user:i},r=await this.publicPostInfo(this.extend(s,t)),a=this.safeList(r,"assetPositions",[]),o=[];for(let e=0;e swap transfer");let e,i=this.numberToString(t);[e,a]=this.handleOptionAndParams(a,"transfer","vaultAddress"),e=this.formatVaultAddress(e),void 0!==e&&(i=i+" subaccount:"+e);const d="perp"===s||"swap"===s,h={hyperliquidChain:o?"Testnet":"Mainnet",amount:i,toPerp:d,nonce:n},c=this.buildUsdClassSendSig(h),l={action:{hyperliquidChain:h.hyperliquidChain,signatureChainId:"0x66eee",type:"usdClassTransfer",amount:i,toPerp:d,nonce:n},nonce:n,signature:c};void 0!==e&&(l.vaultAddress=e);return await this.privatePostExchange(l)}if(this.checkAddress(s),void 0!==e&&"USDC"!==(e=e.toUpperCase()))throw new r.NotSupported(this.id+" transfer() only support USDC");const d={hyperliquidChain:o?"Testnet":"Mainnet",destination:s,amount:this.numberToString(t),time:n},h=this.buildUsdSendSig(d),c={action:{hyperliquidChain:d.hyperliquidChain,signatureChainId:"0x66eee",destination:s,amount:t.toString(),time:n,type:"usdSend"},nonce:n,signature:h},l=await this.privatePostExchange(c);return this.parseTransfer(l)}parseTransfer(e,t=void 0){return{info:e,id:void 0,timestamp:void 0,datetime:void 0,currency:void 0,amount:void 0,fromAccount:void 0,toAccount:void 0,status:"ok"}}async withdraw(e,t,i,s=void 0,a={}){if(this.checkRequiredCredentials(),await this.loadMarkets(),this.checkAddress(i),void 0!==e&&"USDC"!==(e=e.toUpperCase()))throw new r.NotSupported(this.id+" withdraw() only support USDC");let o;[o,a]=this.handleOptionAndParams(a,"withdraw","vaultAddress"),o=this.formatVaultAddress(o),a=this.omit(a,"vaultAddress");const n=this.milliseconds();let d,h={};if(void 0!==o)h={type:"vaultTransfer",vaultAddress:"0x"+o,isDeposit:!1,usd:t},d=this.signL1Action(h,n);else{const e={hyperliquidChain:this.safeBool(this.options,"sandboxMode",!1)?"Testnet":"Mainnet",destination:i,amount:t.toString(),time:n};d=this.buildWithdrawSig(e),h={hyperliquidChain:e.hyperliquidChain,signatureChainId:"0x66eee",destination:i,amount:t.toString(),time:n,type:"withdraw3"}}const c={action:h,nonce:n,signature:d},l=await this.privatePostExchange(c);return this.parseTransaction(l)}parseTransaction(e,t=void 0){const i=this.safeInteger(e,"time"),s=this.safeDict(e,"delta",{});let r;const a=this.safeInteger(s,"fee");let o;void 0!==a&&(r={currency:"USDC",cost:a});const n=this.safeString(s,"type");return void 0!==n&&(o="internalTransfer"===n),{info:e,id:void 0,txid:this.safeString(e,"hash"),timestamp:i,datetime:this.iso8601(i),network:void 0,address:void 0,addressTo:this.safeString(s,"destination"),addressFrom:this.safeString(s,"user"),tag:void 0,tagTo:void 0,tagFrom:void 0,type:void 0,amount:this.safeNumber(s,"usdc"),currency:void 0,status:this.safeString(e,"status"),updated:void 0,comment:void 0,internal:o,fee:r}}async fetchTradingFee(e,t={}){let i;await this.loadMarkets(),[i,t]=this.handlePublicAddress("fetchTradingFee",t);const s=this.market(e),r={type:"userFees",user:i},a=await this.publicPostInfo(this.extend(r,t)),o={userCrossRate:this.safeString(a,"userCrossRate"),userAddRate:this.safeString(a,"userAddRate")};return this.parseTradingFee(o,s)}parseTradingFee(e,t=void 0){return{info:e,symbol:this.safeSymbol(void 0,t),maker:this.safeNumber(e,"userAddRate"),taker:this.safeNumber(e,"userCrossRate"),percentage:void 0,tierBased:void 0}}async fetchLedger(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),[r,s]=this.handlePublicAddress("fetchLedger",s);const a={type:"userNonFundingLedgerUpdates",user:r};void 0!==t&&(a.startTime=t);const o=this.safeInteger(s,"until");void 0!==o&&(a.endTime=o,s=this.omit(s,["until"]));const n=await this.publicPostInfo(this.extend(a,s));return this.parseLedger(n,void 0,t,i)}parseLedgerEntry(e,t=void 0){const i=this.safeInteger(e,"time"),s=this.safeDict(e,"delta",{});let r;const a=this.safeInteger(s,"fee");void 0!==a&&(r={currency:"USDC",cost:a});const o=this.safeString(s,"type"),n=this.safeString(s,"usdc");return this.safeLedgerEntry({info:e,id:this.safeString(e,"hash"),direction:void 0,account:void 0,referenceAccount:this.safeString(s,"user"),referenceId:this.safeString(e,"hash"),type:this.parseLedgerEntryType(o),currency:void 0,amount:this.parseNumber(n),timestamp:i,datetime:this.iso8601(i),before:void 0,after:void 0,status:void 0,fee:r},t)}parseLedgerEntryType(e){return this.safeString({internalTransfer:"transfer",accountClassTransfer:"transfer"},e,e)}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),[r,s]=this.handlePublicAddress("fetchDepositsWithdrawals",s);const a={type:"userNonFundingLedgerUpdates",user:r};void 0!==t&&(a.startTime=t);const o=this.safeInteger(s,"until");void 0!==o&&(a.endTime=o,s=this.omit(s,["until"]));const n=await this.publicPostInfo(this.extend(a,s)),d=this.extractTypeFromDelta(n),h=this.filterByArray(d,"type",["deposit"],!1);return this.parseTransactions(h,void 0,t,i)}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),[r,s]=this.handlePublicAddress("fetchDepositsWithdrawals",s);const a={type:"userNonFundingLedgerUpdates",user:r};void 0!==t&&(a.startTime=t);const o=this.safeInteger(s,"until");void 0!==o&&(a.endTime=o,s=this.omit(s,["until"]));const n=await this.publicPostInfo(this.extend(a,s)),d=this.extractTypeFromDelta(n),h=this.filterByArray(d,"type",["withdraw"],!1);return this.parseTransactions(h,void 0,t,i)}async fetchOpenInterests(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e);const i=await this.fetchSwapMarkets();return this.parseOpenInterests(i,e)}async fetchOpenInterest(e,t={}){e=this.symbol(e),await this.loadMarkets();return(await this.fetchOpenInterests([e],t))[e]}parseOpenInterest(e,t=void 0){e=this.safeDict(e,"info",{});const i=this.safeString(e,"name");let s;return void 0!==i&&(s=this.coinToMarketId(i)),this.safeOpenInterest({symbol:this.safeSymbol(s),openInterestAmount:this.safeNumber(e,"openInterest"),openInterestValue:void 0,timestamp:void 0,datetime:void 0,info:e},t)}async fetchFundingHistory(e=void 0,t=void 0,i=void 0,s={}){let r,a;await this.loadMarkets(),void 0!==e&&(r=this.market(e)),[a,s]=this.handlePublicAddress("fetchFundingHistory",s);const o={user:a,type:"userFunding"};void 0!==t&&(o.startTime=t);const n=this.safeInteger(s,"until");s=this.omit(s,"until"),void 0!==n&&(o.endTime=n);const d=await this.publicPostInfo(this.extend(o,s));return this.parseIncomes(d,r,t,i)}parseIncome(e,t=void 0){const i=this.safeString(e,"hash"),s=this.safeInteger(e,"time"),r=this.safeDict(e,"delta"),a=this.safeString(r,"coin")+"/USDC:USDC",o=this.safeMarket(a).symbol,n=this.safeString(r,"usdc"),d=this.safeCurrencyCode("USDC"),h=this.safeNumber(r,"fundingRate");return{info:e,symbol:o,code:d,timestamp:s,datetime:this.iso8601(s),id:i,amount:this.parseNumber(n),rate:h}}extractTypeFromDelta(e=[]){const t=[];for(let i=0;i-1||e.indexOf("@")>-1?e:e+"/USDC:USDC"}handleErrors(e,t,i,s,a,o,n,d,h){if(!n)return;const c=this.safeString(n,"status",""),l=this.safeString(n,"error");let u;if("err"===c)u=this.safeString(n,"response");else if(void 0!==l)u=l;else{const e=this.safeDict(n,"response",{}),t=this.safeDict(e,"data",{}),i=this.safeList(t,"statuses",[]),s=this.safeDict(i,0);u=this.safeString(s,"error")}const f=this.id+" "+o,p=void 0!==u&&""!==u;if(p&&(this.throwExactlyMatchedException(this.exceptions.exact,u,f),this.throwBroadlyMatchedException(this.exceptions.broad,u,f)),p)throw new r.ExchangeError(f)}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){const o=this.implodeHostname(this.urls.api[t])+"/"+e;return"POST"===i&&(r={"Content-Type":"application/json"},a=this.json(s)),{url:o,method:i,body:a,headers:r}}calculateRateLimiterCost(e,t,i,s,r={}){if("byType"in r&&"type"in s){const e=s.type,t=r.byType;if(e in t)return t[e]}return this.safeValue(r,"cost",1)}parseCreateEditOrderArgs(e,t,i,s,r,a=void 0,o={}){const n=this.market(t);let d;[d,o]=this.handleOptionAndParams(o,"createOrder","vaultAddress"),d=this.formatVaultAddress(d);const h={symbol:t=n.symbol,type:i,side:s,amount:r,price:a,params:o},c={};return void 0!==d&&(c.vaultAddress=d),void 0!==e&&(h.id=e),[h,c]}}},4162:(e,t,i)=>{i.d(t,{A:()=>d});var s=i(359),r=i(5147),a=i(1579),o=i(4852),n=i(2079);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"independentreserve",name:"Independent Reserve",countries:["AU","NZ"],rateLimit:1e3,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg",api:{public:"https://api.independentreserve.com/Public",private:"https://api.independentreserve.com/Private"},www:"https://www.independentreserve.com",doc:"https://www.independentreserve.com/API"},api:{public:{get:["GetValidPrimaryCurrencyCodes","GetValidSecondaryCurrencyCodes","GetValidLimitOrderTypes","GetValidMarketOrderTypes","GetValidOrderTypes","GetValidTransactionTypes","GetMarketSummary","GetOrderBook","GetAllOrders","GetTradeHistorySummary","GetRecentTrades","GetFxRates","GetOrderMinimumVolumes","GetCryptoWithdrawalFees","GetCryptoWithdrawalFees2","GetNetworks","GetPrimaryCurrencyConfig2"]},private:{post:["GetOpenOrders","GetClosedOrders","GetClosedFilledOrders","GetOrderDetails","GetAccounts","GetTransactions","GetFiatBankAccounts","GetDigitalCurrencyDepositAddress","GetDigitalCurrencyDepositAddress2","GetDigitalCurrencyDepositAddresses","GetDigitalCurrencyDepositAddresses2","GetTrades","GetBrokerageFees","GetDigitalCurrencyWithdrawal","PlaceLimitOrder","PlaceMarketOrder","CancelOrder","SynchDigitalCurrencyDepositAddressWithBlockchain","RequestFiatWithdrawal","WithdrawFiatCurrency","WithdrawDigitalCurrency","WithdrawCrypto"]}},fees:{trading:{taker:this.parseNumber("0.005"),maker:this.parseNumber("0.005"),percentage:!0,tierBased:!1}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!1,FOK:!1,PO:!1,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:100,daysBack:void 0,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:100,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:100,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:void 0},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{PLA:"PlayChip"},precisionMode:a.kb,options:{defaultNetworks:{USDT:"Ethereum",USDC:"Ethereum",BTC:"Bitcoin",BCH:"BitcoinCash",ETH:"Ethereum",LTC:"Litecoin",XRP:"XrpLedger",ZRX:"Ethereum",EOS:"EosIo",XLM:"Stellar",BAT:"Ethereum",ETC:"EthereumClassic",LINK:"Ethereum",MKR:"Ethereum",DAI:"Ethereum",COMP:"Ethereum",SNX:"Ethereum",YFI:"Ethereum",AAVE:"Ethereum",GRT:"Ethereum",DOT:"Polkadot",UNI:"Ethereum",ADA:"Cardano",MATIC:"Ethereum",DOGE:"Dogecoin",SOL:"Solana",MANA:"Ethereum",SAND:"Ethereum",SHIB:"Ethereum",TRX:"Tron",RENDER:"Solana",WIF:"Solana",RLUSD:"Ethereum",PEPE:"Ethereum"},networks:{BTC:"Bitcoin",ETH:"Ethereum",BCH:"BitcoinCash",LTC:"Litecoin",XRP:"XrpLedger",EOS:"EosIo",XLM:"Stellar",ETC:"EthereumClassic",BSV:"BitcoinSV",DOGE:"Dogecoin",DOT:"Polkadot",ADA:"Cardano",SOL:"Solana",TRX:"Tron"}}})}async fetchMarkets(e={}){const t=this.publicGetGetValidPrimaryCurrencyCodes(e),i=this.publicGetGetValidSecondaryCurrencyCodes(e),s=this.publicGetGetOrderMinimumVolumes(e),[r,a,o]=await Promise.all([t,i,s]),n=[];for(let e=0;e=0?d="buy":h.indexOf("Offer")>=0&&(d="sell"),h.indexOf("Market")>=0?h="market":h.indexOf("Limit")>=0&&(h="limit"));const c=this.parse8601(this.safeString(e,"CreatedTimestampUtc")),l=this.safeString(e,"VolumeFilled"),u=this.safeString(e,"FeePercent");let f;return void 0!==u&&void 0!==l&&(f=r.Y.stringMul(u,l)),this.safeOrder({info:e,id:this.safeString(e,"OrderGuid"),clientOrderId:void 0,timestamp:c,datetime:this.iso8601(c),lastTradeTimestamp:void 0,symbol:i,type:h,timeInForce:void 0,postOnly:void 0,side:d,price:this.safeString(e,"Price"),triggerPrice:void 0,cost:this.safeString(e,"Value"),average:this.safeString(e,"AvgPrice"),amount:this.safeString2(e,"VolumeOrdered","Volume"),filled:l,remaining:this.safeString(e,"Outstanding"),status:this.parseOrderStatus(this.safeString(e,"Status")),fee:{rate:u,cost:f,currency:o},trades:void 0},t)}parseOrderStatus(e){return this.safeString({Open:"open",PartiallyFilled:"open",Filled:"closed",PartiallyFilledAndCancelled:"canceled",Cancelled:"canceled",PartiallyFilledAndExpired:"canceled",Expired:"canceled"},e,e)}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const s=await this.privatePostGetOrderDetails(this.extend({orderGuid:e},i));let r;return void 0!==t&&(r=this.market(t)),this.parseOrder(s,r)}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.ordered({});let a;void 0!==e&&(a=this.market(e),r.primaryCurrencyCode=a.baseId,r.secondaryCurrencyCode=a.quoteId),void 0===i&&(i=50),r.pageIndex=1,r.pageSize=i;const o=await this.privatePostGetOpenOrders(this.extend(r,s)),n=this.safeList(o,"Data",[]);return this.parseOrders(n,a,t,i)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.ordered({});let a;void 0!==e&&(a=this.market(e),r.primaryCurrencyCode=a.baseId,r.secondaryCurrencyCode=a.quoteId),void 0===i&&(i=50),r.pageIndex=1,r.pageSize=i;const o=await this.privatePostGetClosedOrders(this.extend(r,s)),n=this.safeList(o,"Data",[]);return this.parseOrders(n,a,t,i)}async fetchMyTrades(e=void 0,t=void 0,i=50,s={}){await this.loadMarkets();const r=this.safeInteger(s,"pageIndex",1);void 0===i&&(i=50);const a=this.ordered({pageIndex:r,pageSize:i}),o=await this.privatePostGetTrades(this.extend(a,s));let n;return void 0!==e&&(n=this.market(e)),this.parseTrades(o.Data,n,t,i)}parseTrade(e,t=void 0){const i=this.parse8601(e.TradeTimestampUtc),s=this.safeString(e,"TradeGuid"),a=this.safeString(e,"OrderGuid"),o=this.safeString2(e,"Price","SecondaryCurrencyTradePrice"),n=this.safeString2(e,"VolumeTraded","PrimaryCurrencyAmount"),d=this.parseNumber(o),h=this.parseNumber(n),c=this.parseNumber(r.Y.stringMul(o,n)),l=this.safeString(e,"PrimaryCurrencyCode"),u=this.safeString(e,"SecondaryCurrencyCode");let f;void 0!==l&&void 0!==u&&(f=l+"/"+u);const p=this.safeSymbol(f,t,"/");let m=this.safeString(e,"OrderType");return void 0!==m&&(m.indexOf("Bid")>=0?m="buy":m.indexOf("Offer")>=0&&(m="sell")),this.safeTrade({id:s,info:e,timestamp:i,datetime:this.iso8601(i),symbol:p,order:a,type:void 0,side:m,takerOrMaker:void 0,price:d,amount:h,cost:c,fee:void 0},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a={primaryCurrencyCode:r.baseId,secondaryCurrencyCode:r.quoteId,numberOfRecentTradesToRetrieve:50},o=await this.publicGetGetRecentTrades(this.extend(a,s));return this.parseTrades(o.Trades,r,t,i)}async fetchTradingFees(e={}){await this.loadMarkets();const t=await this.privatePostGetBrokerageFees(e),i={};for(let e=0;e{i.d(t,{A:()=>d});var s=i(4558),r=i(2079),a=i(1579),o=i(5147),n=i(7481);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"indodax",name:"INDODAX",countries:["ID"],rateLimit:50,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!1,fetchDepositAddress:"emulated",fetchDepositAddresses:!0,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransactionFees:!1,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},version:"2.0",urls:{logo:"https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg",api:{public:"https://indodax.com",private:"https://indodax.com/tapi"},www:"https://www.indodax.com",doc:"https://github.com/btcid/indodax-official-api-docs",referral:"https://indodax.com/ref/testbitcoincoid/1"},api:{public:{get:{"api/server_time":5,"api/pairs":5,"api/price_increments":5,"api/summaries":5,"api/ticker/{pair}":5,"api/ticker_all":5,"api/trades/{pair}":5,"api/depth/{pair}":5,"tradingview/history_v2":5}},private:{post:{getInfo:4,transHistory:4,trade:1,tradeHistory:4,openOrders:4,orderHistory:4,getOrder:4,cancelOrder:4,withdrawFee:4,withdrawCoin:4,listDownline:4,checkDownline:4,createVoucher:4}}},fees:{trading:{tierBased:!1,percentage:!0,maker:0,taker:.003}},exceptions:{exact:{invalid_pair:r.BadSymbol,"Insufficient balance.":r.InsufficientFunds,"invalid order.":r.OrderNotFound,"Invalid credentials. API not found or session has expired.":r.AuthenticationError,"Invalid credentials. Bad sign.":r.AuthenticationError},broad:{"Minimum price":r.InvalidOrder,"Minimum order":r.InvalidOrder}},options:{recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,networks:{XLM:"Stellar Token",BSC:"bep20",TRC20:"trc20",MATIC:"polygon"},timeframes:{"1m":"1","15m":"15","30m":"30","1h":"60","4h":"240","1d":"1D","3d":"3D","1w":"1W"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!1,takeProfitPrice:!1,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!1,PO:!1,GTD:!1},hedged:!1,selfTradePrevention:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,iceberg:!1},createOrders:void 0,fetchMyTrades:void 0,fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:1e5,daysBackCanceled:1,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:2e3}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},commonCurrencies:{STR:"XLM",BCHABC:"BCH",BCHSV:"BSV",DRK:"DASH",NEM:"XEM"},precisionMode:a.kb})}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=await this.publicGetApiServerTime(e);return this.safeInteger(t,"server_time")}async fetchMarkets(e={}){const t=await this.publicGetApiPairs(e),i=[];for(let e=0;e=0){e=[];const i=t.split(",");for(let t=0;t{i.d(t,{A:()=>h});var s=i(2459),r=i(2079),a=i(5147),o=i(1579),n=i(4852),d=i(7481);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"kraken",name:"Kraken",countries:["US"],version:"0",rateLimit:1e3,certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,createTrailingPercentOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLedgerEntry:!0,fetchLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderTrades:"emulated",fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchWithdrawals:!0,setLeverage:!1,setMarginMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":1,"5m":5,"15m":15,"30m":30,"1h":60,"4h":240,"1d":1440,"1w":10080,"2w":21600},urls:{logo:"https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg",api:{public:"https://api.kraken.com",private:"https://api.kraken.com",zendesk:"https://kraken.zendesk.com/api/v2/help_center/en-us/articles"},www:"https://www.kraken.com",doc:"https://docs.kraken.com/rest/",fees:"https://www.kraken.com/en-us/features/fee-schedule"},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0026"),maker:this.parseNumber("0.0016"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0026")],[this.parseNumber("50000"),this.parseNumber("0.0024")],[this.parseNumber("100000"),this.parseNumber("0.0022")],[this.parseNumber("250000"),this.parseNumber("0.0020")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("2500000"),this.parseNumber("0.0014")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.0001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0016")],[this.parseNumber("50000"),this.parseNumber("0.0014")],[this.parseNumber("100000"),this.parseNumber("0.0012")],[this.parseNumber("250000"),this.parseNumber("0.0010")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0002")],[this.parseNumber("10000000"),this.parseNumber("0.0")]]}}},handleContentTypeApplicationZip:!0,api:{zendesk:{get:["360000292886","201893608"]},public:{get:{Assets:1,AssetPairs:1,Depth:1.2,OHLC:1.2,Spread:1,SystemStatus:1,Ticker:1,Time:1,Trades:1.2}},private:{post:{AddOrder:0,AddOrderBatch:0,AddExport:3,AmendOrder:0,Balance:3,CancelAll:3,CancelAllOrdersAfter:3,CancelOrder:0,CancelOrderBatch:0,ClosedOrders:3,DepositAddresses:3,DepositMethods:3,DepositStatus:3,EditOrder:0,ExportStatus:3,GetWebSocketsToken:3,Ledgers:6,OpenOrders:3,OpenPositions:3,QueryLedgers:3,QueryOrders:3,QueryTrades:3,RetrieveExport:3,RemoveExport:3,BalanceEx:3,TradeBalance:3,TradesHistory:6,TradeVolume:3,Withdraw:3,WithdrawCancel:3,WithdrawInfo:3,WithdrawMethods:3,WithdrawAddresses:3,WithdrawStatus:3,WalletTransfer:3,CreateSubaccount:3,AccountTransfer:3,"Earn/Allocate":3,"Earn/Deallocate":3,"Earn/AllocateStatus":3,"Earn/DeallocateStatus":3,"Earn/Strategies":3,"Earn/Allocations":3}}},commonCurrencies:{LUNA:"LUNC",LUNA2:"LUNA",REPV2:"REP",REP:"REPV1",UST:"USTC",XBT:"BTC",XDG:"DOGE"},options:{timeDifference:0,adjustForTimeDifference:!1,marketsByAltname:{},delistedMarketsById:{},inactiveCurrencies:["CAD","USD","JPY","GBP"],networks:{ETH:"ERC20",TRX:"TRC20"},depositMethods:{"1INCH":"1inch (1INCH)",AAVE:"Aave",ADA:"ADA",ALGO:"Algorand",ANKR:"ANKR (ANKR)",ANT:"Aragon (ANT)",ATOM:"Cosmos",AXS:"Axie Infinity Shards (AXS)",BADGER:"Bager DAO (BADGER)",BAL:"Balancer (BAL)",BAND:"Band Protocol (BAND)",BAT:"BAT",BCH:"Bitcoin Cash",BNC:"Bifrost (BNC)",BNT:"Bancor (BNT)",BTC:"Bitcoin",CHZ:"Chiliz (CHZ)",COMP:"Compound (COMP)",CQT:"\tCovalent Query Token (CQT)",CRV:"Curve DAO Token (CRV)",CTSI:"Cartesi (CTSI)",DAI:"Dai",DASH:"Dash",DOGE:"Dogecoin",DOT:"Polkadot",DYDX:"dYdX (DYDX)",ENJ:"Enjin Coin (ENJ)",EOS:"EOS",ETC:"Ether Classic (Hex)",ETH:"Ether (Hex)",EWT:"Energy Web Token",FEE:"Kraken Fee Credit",FIL:"Filecoin",FLOW:"Flow",GHST:"Aavegotchi (GHST)",GNO:"GNO",GRT:"GRT",ICX:"Icon",INJ:"Injective Protocol (INJ)",KAR:"Karura (KAR)",KAVA:"Kava",KEEP:"Keep Token (KEEP)",KNC:"Kyber Network (KNC)",KSM:"Kusama",LINK:"Link",LPT:"Livepeer Token (LPT)",LRC:"Loopring (LRC)",LSK:"Lisk",LTC:"Litecoin",MANA:"MANA",MATIC:"Polygon (MATIC)",MINA:"Mina",MIR:"Mirror Protocol (MIR)",MKR:"Maker (MKR)",MLN:"MLN",MOVR:"Moonriver (MOVR)",NANO:"NANO",OCEAN:"OCEAN",OGN:"Origin Protocol (OGN)",OMG:"OMG",OXT:"Orchid (OXT)",OXY:"Oxygen (OXY)",PAXG:"PAX (Gold)",PERP:"Perpetual Protocol (PERP)",PHA:"Phala (PHA)",QTUM:"QTUM",RARI:"Rarible (RARI)",RAY:"Raydium (RAY)",REN:"Ren Protocol (REN)",REP:"REPv2",REPV1:"REP",SAND:"The Sandbox (SAND)",SC:"Siacoin",SDN:"Shiden (SDN)",SOL:"Solana",SNX:"Synthetix Network (SNX)",SRM:"Serum",STORJ:"Storj (STORJ)",SUSHI:"Sushiswap (SUSHI)",TBTC:"tBTC",TRX:"Tron",UNI:"UNI",USDC:"USDC",USDT:"Tether USD (ERC20)","USDT-TRC20":"Tether USD (TRC20)",WAVES:"Waves",WBTC:"Wrapped Bitcoin (WBTC)",XLM:"Stellar XLM",XMR:"Monero",XRP:"Ripple XRP",XTZ:"XTZ",YFI:"YFI",ZEC:"Zcash (Transparent)",ZRX:"0x (ZRX)"},withdrawMethods:{Lightning:"Lightning",Bitcoin:"BTC",Ripple:"XRP",Litecoin:"LTC",Dogecoin:"DOGE",Stellar:"XLM",Ethereum:"ERC20","Arbitrum One":"Arbitrum",Polygon:"MATIC","Arbitrum Nova":"Arbitrum",Optimism:"Optimism","zkSync Era":"zkSync","Ethereum Classic":"ETC",Zcash:"ZEC",Monero:"XMR",Tron:"TRC20",Solana:"SOL",EOS:"EOS","Bitcoin Cash":"BCH",Cardano:"ADA",Qtum:"QTUM",Tezos:"XTZ",Cosmos:"ATOM",Nano:"NANO",Siacoin:"SC",Lisk:"LSK",Waves:"WAVES",ICON:"ICX",Algorand:"ALGO","Polygon - USDC.e":"MATIC","Arbitrum One - USDC.e":"Arbitrum",Polkadot:"DOT",Kava:"KAVA",Filecoin:"FIL",Kusama:"KSM",Flow:"FLOW","Energy Web":"EW",Mina:"MINA",Centrifuge:"CFG",Karura:"KAR",Moonriver:"MOVR",Shiden:"SDN",Khala:"PHA","Bifrost Kusama":"BNC",Songbird:"SGB","Terra classic":"LUNC",KILT:"KILT",Basilisk:"BSX",Flare:"FLR","Avalanche C-Chain":"AVAX",Kintsugi:"KINT",Altair:"AIR",Moonbeam:"GLMR",Acala:"ACA",Astar:"ASTR",Akash:"AKT",Robonomics:"XRT",Fantom:"FTM",Elrond:"EGLD",THORchain:"RUNE",Secret:"SCRT",Near:"NEAR","Internet Computer Protocol":"ICP",Picasso:"PICA","Crust Shadow":"CSM",Integritee:"TEER","Parallel Finance":"PARA",HydraDX:"HDX",Interlay:"INTR","Fetch.ai":"FET",NYM:"NYM","Terra 2.0":"LUNA2",Juno:"JUNO",Nodle:"NODL",Stacks:"STX","Ethereum PoW":"ETHW",Aptos:"APT",Sui:"SUI",Genshiro:"GENS",Aventus:"AVT",Sei:"SEI",OriginTrail:"OTP",Celestia:"TIA"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!1,triggerPrice:!1,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!0,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!0,iceberg:!0},createOrders:void 0,fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:void 0,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:void 0,daysBack:void 0,daysBackCanceled:void 0,untilDays:1e5,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:720}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}},precisionMode:o.kb,exceptions:{exact:{"EQuery:Invalid asset pair":r.BadSymbol,"EAPI:Invalid key":r.AuthenticationError,"EFunding:Unknown withdraw key":r.InvalidAddress,"EFunding:Invalid amount":r.InsufficientFunds,"EService:Unavailable":r.ExchangeNotAvailable,"EDatabase:Internal error":r.ExchangeNotAvailable,"EService:Busy":r.ExchangeNotAvailable,"EQuery:Unknown asset":r.BadSymbol,"EAPI:Rate limit exceeded":r.DDoSProtection,"EOrder:Rate limit exceeded":r.DDoSProtection,"EGeneral:Internal error":r.ExchangeNotAvailable,"EGeneral:Temporary lockout":r.DDoSProtection,"EGeneral:Permission denied":r.PermissionDenied,"EGeneral:Invalid arguments:price":r.InvalidOrder,"EOrder:Unknown order":r.InvalidOrder,"EOrder:Invalid price:Invalid price argument":r.InvalidOrder,"EOrder:Order minimum not met":r.InvalidOrder,"EOrder:Insufficient funds":r.InsufficientFunds,"EGeneral:Invalid arguments":r.BadRequest,"ESession:Invalid session":r.AuthenticationError,"EAPI:Invalid nonce":r.InvalidNonce,"EFunding:No funding method":r.BadRequest,"EFunding:Unknown asset":r.BadSymbol,"EService:Market in post_only mode":r.OnMaintenance,"EGeneral:Too many requests":r.DDoSProtection,"ETrade:User Locked":r.AccountSuspended},broad:{":Invalid order":r.InvalidOrder,":Invalid arguments:volume":r.InvalidOrder,":Invalid arguments:viqc":r.InvalidOrder,":Invalid nonce":r.InvalidNonce,":IInsufficient funds":r.InsufficientFunds,":Cancel pending":r.CancelPending,":Rate limit exceeded":r.RateLimitExceeded}}})}feeToPrecision(e,t){return this.decimalToPrecision(t,o.R3,this.markets[e].precision.amount,this.precisionMode)}async fetchMarkets(e={}){const t=[];t.push(this.publicGetAssetPairs(e)),this.options.adjustForTimeDifference&&t.push(this.loadTimeDifference());const i=(await Promise.all(t))[0],s=this.safeDict(i,"result",{}),r=this.safeDict(this.options,"cachedCurrencies",{}),o=Object.keys(s),n=[];for(let e=0;eO&&(O=t)}const P="online"===this.safeString(i,"status");n.push({id:t,wsId:this.safeString(i,"wsname"),symbol:c+"/"+l,base:c,quote:l,settle:void 0,baseId:d,quoteId:h,settleId:void 0,altname:i.altname,type:"spot",spot:T,margin:k>0,swap:!1,future:!1,option:!1,active:P,contract:!1,linear:void 0,inverse:void 0,taker:w,maker:m,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:O,price:S},limits:{leverage:{min:this.parseNumber("1"),max:this.safeNumber(b,k-1,1)},amount:{min:this.safeNumber(i,"ordermin"),max:void 0},price:{min:void 0,max:void 0},cost:{min:this.safeNumber(i,"costmin"),max:void 0}},created:void 0,info:i})}return this.options.marketsByAltname=this.indexBy(n,"altname"),n}safeCurrency(e,t=void 0){return void 0!==e&&e.length>3&&(0!==e.indexOf("X")&&0!==e.indexOf("Z")||e.indexOf(".")>0||"ZEUS"===e||(e=e.slice(1))),super.safeCurrency(e,t)}async fetchStatus(e={}){const t=await this.publicGetSystemStatus(e),i=this.safeDict(t,"result");return{status:"online"===this.safeString(i,"status")?"ok":"maintenance",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchCurrencies(e={}){const t=await this.publicGetAssets(e),i=this.safeValue(t,"result",{}),s=Object.keys(i),r={};for(let e=0;e=0;r[o]=this.safeCurrencyStructure({id:t,code:o,info:a,name:this.safeString(a,"altname"),active:"enabled"===this.safeString(a,"status"),type:n?"fiat":"crypto",deposit:void 0,withdraw:void 0,fee:void 0,precision:this.parseNumber(this.parsePrecision(this.safeString(a,"decimals"))),limits:{amount:{min:void 0,max:void 0},withdraw:{min:void 0,max:void 0}},networks:{}})}return r}safeCurrencyCode(e,t=void 0){if(void 0===e)return e;if(e.indexOf(".")>0){const i=e.split("."),s=this.safeString(i,0),r=this.safeString(i,1);return super.safeCurrencyCode(s,t)+"."+r}return super.safeCurrencyCode(e,t)}async fetchTradingFee(e,t={}){await this.loadMarkets();const i=this.market(e),s={pair:i.id,"fee-info":!0},r=await this.privatePostTradeVolume(this.extend(s,t)),a=this.safeValue(r,"result",{});return this.parseTradingFee(a,i)}parseTradingFee(e,t){const i=this.safeValue(e,"fees_maker",{}),s=this.safeValue(e,"fees",{}),r=this.safeValue(i,t.id,{}),o=this.safeValue(s,t.id,{});return{info:e,symbol:t.symbol,maker:this.parseNumber(a.Y.stringDiv(this.safeString(r,"fee"),"100")),taker:this.parseNumber(a.Y.stringDiv(this.safeString(o,"fee"),"100")),percentage:!0,tierBased:!0}}parseBidAsk(e,t=0,i=1,s=2){return[this.safeNumber(e,t),this.safeNumber(e,i),this.safeInteger(e,2)]}async fetchOrderBook(e,t=void 0,i={}){await this.loadMarkets();const s=this.market(e),r={pair:s.id};void 0!==t&&(r.count=t);const a=await this.publicGetDepth(this.extend(r,i)),o=this.safeValue(a,"result",{});let n=this.safeValue(o,s.id);const d=this.safeValue(s,"info",{}),h=this.safeValue(d,"wsname");return void 0!==h&&(n=this.safeValue(o,h,n)),this.parseOrderBook(n,e)}parseTicker(e,t=void 0){const i=this.safeSymbol(void 0,t),s=this.safeValue(e,"v",[]),r=this.safeString(s,1),o=this.safeValue(e,"p",[]),n=this.safeString(o,1),d=a.Y.stringMul(r,n),h=this.safeValue(e,"c",[]),c=this.safeString(h,0),l=this.safeValue(e,"h",[]),u=this.safeValue(e,"l",[]),f=this.safeValue(e,"b",[]),p=this.safeValue(e,"a",[]);return this.safeTicker({symbol:i,timestamp:void 0,datetime:void 0,high:this.safeString(l,1),low:this.safeString(u,1),bid:this.safeString(f,0),bidVolume:this.safeString(f,2),ask:this.safeString(p,0),askVolume:this.safeString(p,2),vwap:n,open:this.safeString(e,"o"),close:c,last:c,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:r,quoteVolume:d,info:e},t)}async fetchTickers(e=void 0,t={}){await this.loadMarkets();const i={};if(void 0!==e){e=this.marketSymbols(e);const t=[];for(let i=0;i6&&(n=this.safeString(e,6))}else if("string"==typeof e)n=e;else if("ordertxid"in e){const c=this.safeString(e,"pair"),l=this.findMarketByAltnameOrId(c);if(void 0!==l?t=l:void 0!==c&&(t=this.getDelistedMarketById(c)),d=this.safeString(e,"ordertxid"),n=this.safeString2(e,"id","postxid"),i=this.safeTimestamp(e,"time"),s=this.safeString(e,"type"),r=this.safeString(e,"ordertype"),a=this.safeString(e,"price"),o=this.safeString(e,"vol"),"fee"in e){let i;void 0!==t&&(i=t.quote),h={cost:this.safeString(e,"fee"),currency:i}}}void 0!==t&&(c=t.symbol);const l=this.safeString(e,"cost"),u=this.safeBool(e,"maker");let f;return void 0!==u&&(f=u?"maker":"taker"),this.safeTrade({id:n,order:d,info:e,timestamp:i,datetime:this.iso8601(i),symbol:c,type:r,side:s,takerOrMaker:f,price:a,amount:o,cost:l,fee:h},t)}async fetchTrades(e,t=void 0,i=void 0,s={}){await this.loadMarkets();const r=this.market(e),a=r.id,o={pair:a};void 0!==t&&(o.since=this.numberToString(this.parseToInt(t/1e3))),void 0!==i&&(o.count=i);const n=(await this.publicGetTrades(this.extend(o,s))).result,d=n[a],h=d.length;if(h<=0)return[];const c=d[h-1],l=this.safeString(n,"last");return c.push(l),d[h-1]=c,this.parseTrades(d,r,t,i)}parseBalance(e){const t=this.safeValue(e,"result",{}),i={info:e,timestamp:void 0,datetime:void 0},s=Object.keys(t);for(let e=0;e-1,h=await this.privatePostAddOrder(this.extend(n[0],n[1])),c=this.safeDict(h,"result");return c.usingCost=d,this.parseOrder(c)}findMarketByAltnameOrId(e){const t=this.safeValue(this.options,"marketsByAltname",{});return e in t?t[e]:this.safeMarket(e)}getDelistedMarketById(e){if(void 0===e)return e;let t=this.safeValue(this.options.delistedMarketsById,e);if(void 0!==t)return t;let i=3,s=3,r=6;8===e.length?(i=4,s=4,r=8):7===e.length&&(i=4,s=4,r=7);const a=e.slice(0,i),o=e.slice(s,r),n=this.safeCurrencyCode(a),d=this.safeCurrencyCode(o);return t={symbol:n+"/"+d,base:n,quote:d,baseId:a,quoteId:o},this.options.delistedMarketsById[e]=t,t}parseOrderStatus(e){return this.safeString({pending:"open",open:"open",closed:"closed",canceled:"canceled",expired:"expired"},e,e)}parseOrderType(e){return this.safeString({"take-profit":"market","stop-loss":"market","stop-loss-limit":"limit","take-profit-limit":"limit","trailing-stop-limit":"limit"},e,e)}parseOrder(e,t=void 0){const i=this.safeBool(e,"usingCost",!1);e=this.omit(e,"usingCost");const s=this.safeDict(e,"descr",{}),r=this.safeDict(e,"descr");let o,n,d,h,c,l,u,f;if(o=void 0!==r?this.safeString(r,"order"):this.safeString(e,"descr"),void 0!==o){const e=o.split(" ");n=this.safeString(e,0),i?u=this.safeString(e,1):l=this.safeString(e,1),h=this.safeString(e,2);const t=this.safeString(e,4),s=this.safeString(e,5);d="limit"===t||"market"===t?t:t+" "+s,"stop loss"===d||"take profit"===d?(f=this.safeString(e,6),c=this.safeString(e,9)):"limit"===d&&(c=this.safeString(e,5))}n=this.safeString(s,"type",n),d=this.safeString(s,"ordertype",d),h=this.safeString(s,"pair",h);const p=this.findMarketByAltnameOrId(h);let m;void 0!==p?t=p:void 0!==h&&(t=this.getDelistedMarketById(h));const g=this.safeTimestamp(e,"opentm");l=this.safeString(e,"vol",l);const v=this.safeString(e,"vol_exec");let y;c=this.safeString(s,"price",c),void 0!==c&&(c.endsWith("%")||a.Y.stringEquals(c,"0.00000")||a.Y.stringEquals(c,"0"))&&(c=void 0),void 0===c&&(c=this.safeString(s,"price2"),c=this.safeString2(e,"limitprice","price",c));const w=this.safeString(e,"oflags","");let b=w.indexOf("post")>-1;const k=this.safeNumber(e,"price");if(void 0!==t&&(m=t.symbol,"fee"in e)){y={cost:this.safeString(e,"fee"),rate:void 0},w.indexOf("fciq")>=0?y.currency=t.quote:w.indexOf("fcib")>=0&&(y.currency=t.base)}const S=this.parseOrderStatus(this.safeString(e,"status"));let O=this.safeStringN(e,["id","txid","order_id","amend_id"]);if(void 0===O||O.startsWith("[")){const t=this.safeList(e,"txid");O=this.safeString(t,0)}const T=this.safeString(e,"userref"),P=this.safeString(e,"cl_ord_id",T),I=this.safeValue(e,"trades",[]),M=[];for(let e=0;e-1;if(b&&(void 0!==k||O)){s.volume=void 0===k&&void 0!==r?this.costToPrecision(t,this.numberToString(r)):this.costToPrecision(t,k);const e=void 0!==S?S+",viqc":"viqc";s.oflags=e}else!w||v||y||(s.price=this.priceToPrecision(t,a));const T=this.safeBool2(o,"reduceOnly","reduce_only");if(u)c?(s.price=this.priceToPrecision(t,d),s.ordertype=w?"stop-loss-limit":"stop-loss"):l&&(s.price=this.priceToPrecision(t,h),s.ordertype=w?"take-profit-limit":"take-profit"),w&&(s.price2=this.priceToPrecision(t,a));else if(v||y){let e;void 0!==p&&(e=p.endsWith("%")?"+"+p:"+"+p+"%");const t=void 0!==f?"+"+f:void 0,i=this.safeString(o,"offset","-"),r=void 0!==m?i+this.numberToString(m):void 0,a=this.safeString(o,"trigger","last");if(s.trigger=a,w||void 0!==m||void 0!==g)if(s.ordertype="trailing-stop-limit",void 0!==g){const t=g.endsWith("%")?i+g:i+g+"%";s.price=e,s.price2=t}else void 0!==m&&(s.price=t,s.price2=r);else s.ordertype="trailing-stop",s.price=void 0!==p?e:t}T&&(s.reduce_only="createOrderWs"===e||"true");let P=this.safeDict(o,"close");if(void 0!==P){P=this.extend({},P);const e=this.safeValue(P,"price");void 0!==e&&(P.price=this.priceToPrecision(t,e));const i=this.safeValue(P,"price2");void 0!==i&&(P.price2=this.priceToPrecision(t,i)),s.close=P}const I=this.safeString2(o,"timeInForce","timeinforce");void 0!==I&&(s.timeinforce=I);const M="market"===i;let x;if([x,o]=this.handlePostOnly(M,!1,o),x){const e=void 0!==S?S+",post":"post";s.oflags=e}return void 0===S||"oflags"in s||(s.oflags=S),[s,o=this.omit(o,["timeInForce","reduceOnly","stopLossPrice","takeProfitPrice","trailingAmount","trailingPercent","trailingLimitAmount","trailingLimitPercent","offset"])]}async editOrder(e,t,i,s,a=void 0,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);if(!d.spot)throw new r.NotSupported(this.id+" editOrder() does not support "+d.type+" orders, only spot orders are accepted");let h={txid:e};const c=this.safeString2(n,"clientOrderId","cl_ord_id");void 0!==c&&(h.cl_ord_id=c,n=this.omit(n,["clientOrderId","cl_ord_id"]),h=this.omit(h,"txid"));const l="market"===i;let u;[u,n]=this.handlePostOnly(l,!1,n),u&&(h.post_only="true"),void 0!==a&&(h.order_qty=this.amountToPrecision(t,a)),void 0!==o&&(h.limit_price=this.priceToPrecision(t,o));let f=this.safeStringN(n,["stopLossPrice","takeProfitPrice","trailingAmount","trailingPercent","trailingLimitAmount","trailingLimitPercent"]);if(void 0!==f){const e=this.safeString(n,"offset");n=this.omit(n,["stopLossPrice","takeProfitPrice","trailingAmount","trailingPercent","trailingLimitAmount","trailingLimitPercent","offset"]),void 0!==e?(f=e+f,h.trigger_price=f):h.trigger_price=this.priceToPrecision(t,f)}const p=await this.privatePostAmendOrder(this.extend(h,n)),m=this.safeDict(p,"result",{});return this.parseOrder(m,d)}async fetchOrder(e,t=void 0,i={}){await this.loadMarkets();const s=this.safeValue2(i,"userref","clientOrderId"),a={trades:!0,txid:e};let o=i;void 0!==s&&(a.userref=s,o=this.omit(i,["userref","clientOrderId"]));const n=await this.privatePostQueryOrders(this.extend(a,o)),d=this.safeValue(n,"result",[]);if(!(e in d))throw new r.OrderNotFound(this.id+" fetchOrder() could not find order id "+e);return this.parseOrder(this.extend({id:e},d[e]))}async fetchOrderTrades(e,t=void 0,i=void 0,s=void 0,a={}){const o=this.safeValue(a,"trades"),n=[];if(void 0===o)throw new r.ArgumentsRequired(this.id+" fetchOrderTrades() requires a unified order structure in the params argument or a 'trades' param (an array of trade id strings)");for(let e=0;e=0)throw new r.OrderNotFound(this.id+" cancelOrder() error "+this.last_http_response);throw e}return this.safeOrder({info:s})}async cancelOrders(e,t=void 0,i={}){const s={orders:e},r=await this.privatePostCancelOrderBatch(this.extend(s,i));return[this.safeOrder({info:r})]}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const i=await this.privatePostCancelAll(t);return[this.safeOrder({info:i})]}async cancelAllOrdersAfter(e,t={}){if(e>864e5)throw new r.BadRequest(this.id+" cancelAllOrdersAfter timeout should be less than 86400000 milliseconds");await this.loadMarkets();const i={timeout:e>0?this.parseToInt(e/1e3):0};return await this.privatePostCancelAllOrdersAfter(this.extend(i,t))}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();const r={};void 0!==t&&(r.start=this.parseToInt(t/1e3));const a=this.safeInteger(s,"userref");void 0!==a&&(r.userref=a,s=this.omit(s,"userref"));const o=this.safeString(s,"clientOrderId");void 0!==o&&(r.cl_ord_id=o,s=this.omit(s,"clientOrderId"));const n=await this.privatePostOpenOrders(this.extend(r,s));let d;void 0!==e&&(d=this.market(e));const h=this.safeDict(n,"result",{}),c=this.safeDict(h,"open",{}),l=[],u=Object.keys(c);for(let e=0;e0){const e=i[s-1];e.next_cursor=t,i[s-1]=e}return i}async createDepositAddress(e,t={}){return await this.fetchDepositAddress(e,this.extend({new:"true"},t))}async fetchDepositMethods(e,t={}){await this.loadMarkets();const i={asset:this.currency(e).id},s=await this.privatePostDepositMethods(this.extend(i,t));return this.safeValue(s,"result")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const i=this.currency(e);let s=this.safeStringUpper(t,"network");const a=this.safeValue(this.options,"networks",{});s=this.safeString(a,s,s),t=this.omit(t,"network"),"USDT"===e&&"TRC20"===s&&(e=e+"-"+s);const o=this.safeValue(this.options,"depositMethods",{}),n=this.safeString(o,e);let d=this.safeString(t,"method",n);if(void 0===d){const t=await this.fetchDepositMethods(e);if(void 0!==s)for(let e=0;e=0){d=i;break}}if(void 0===d){const e=this.safeValue(t,0,{});d=this.safeString(e,"method")}}const h={asset:i.id,method:d},c=await this.privatePostDepositAddresses(this.extend(h,t)),l=this.safeValue(c,"result",[]),u=this.safeValue(l,0,{});if(void 0===u)throw new r.InvalidAddress(this.id+" privatePostDepositAddresses() returned no addresses for "+e);return this.parseDepositAddress(u,i)}parseDepositAddress(e,t=void 0){const i=this.safeString(e,"address"),s=this.safeString(e,"tag"),r=(t=this.safeCurrency(void 0,t)).code;return this.checkAddress(i),{info:e,currency:r,network:void 0,address:i,tag:s}}async withdraw(e,t,i,s=void 0,a={}){if([s,a]=this.handleWithdrawTagAndParams(s,a),this.checkAddress(i),"key"in a){await this.loadMarkets();const s=this.currency(e),r={asset:s.id,amount:t,address:i},o=await this.privatePostWithdraw(this.extend(r,a)),n=this.safeDict(o,"result",{});return this.parseTransaction(n,s)}throw new r.ExchangeError(this.id+" withdraw() requires a 'key' parameter (withdrawal key name, as set up on your account)")}async fetchPositions(e=void 0,t={}){await this.loadMarkets();const i=await this.privatePostOpenPositions(this.extend({docalcs:"true",consolidation:"market"},t));e=this.marketSymbols(e);const s=this.safeList(i,"result"),r=this.parsePositions(s,e);return this.filterByArrayPositions(r,"symbol",e,!1)}parsePosition(e,t=void 0){const i=this.safeString(e,"pair"),s="buy"===this.safeString(e,"type")?"long":"short";return this.safePosition({info:e,id:void 0,symbol:this.safeSymbol(i,t),notional:void 0,marginMode:void 0,liquidationPrice:void 0,entryPrice:void 0,unrealizedPnl:this.safeNumber(e,"net"),realizedPnl:void 0,percentage:void 0,contracts:this.safeNumber(e,"vol"),contractSize:void 0,markPrice:void 0,lastPrice:void 0,side:s,hedged:void 0,timestamp:void 0,datetime:void 0,lastUpdateTimestamp:void 0,maintenanceMargin:void 0,maintenanceMarginPercentage:void 0,collateral:void 0,initialMargin:this.safeNumber(e,"margin"),initialMarginPercentage:void 0,leverage:this.safeNumber(e,"leverage"),marginRatio:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}parseAccountType(e){return this.safeString({spot:"Spot Wallet",swap:"Futures Wallet",future:"Futures Wallet"},e,e)}async transferOut(e,t,i={}){return await this.transfer(e,t,"spot","swap",i)}async transfer(e,t,i,s,a={}){await this.loadMarkets();const o=this.currency(e);i=this.parseAccountType(i),s=this.parseAccountType(s);const n={amount:this.currencyToPrecision(e,t),from:i,to:s,asset:o.id};if("Spot Wallet"!==i)throw new r.BadRequest(this.id+" transfer cannot transfer from "+i+" to "+s+". Use krakenfutures instead to transfer from the futures account.");const d=await this.privatePostWalletTransfer(this.extend(n,a)),h=this.parseTransfer(d,o);return this.extend(h,{amount:t,fromAccount:i,toAccount:s})}parseTransfer(e,t=void 0){const i=this.safeValue(e,"result",{});return{info:e,id:this.safeString(i,"refid"),timestamp:void 0,datetime:void 0,currency:this.safeString(t,"code"),amount:void 0,fromAccount:void 0,toAccount:void 0,status:"sucess"}}sign(e,t="public",i="GET",s={},r=void 0,a=void 0){let o="/"+this.version+"/"+t+"/"+e;if("public"===t)Object.keys(s).length&&(o+="?"+this.urlencodeNested(s));else if("private"===t){const t=this.safeString(s,"price");let i=!1;void 0!==t&&(i=!!t.endsWith("%"));const h="CancelOrderBatch"===e;this.checkRequiredCredentials();const c=this.nonce().toString();a=h||i?this.json(this.extend({nonce:c},s)):this.urlencodeNested(this.extend({nonce:c},s));const l=this.encode(c+a),u=this.hash(l,n.s,"binary"),f=this.encode(o),p=this.binaryConcat(f,u),m=this.base64ToBinary(this.secret),g=this.hmac(p,m,d.Zf,"base64");(r={"API-Key":this.apiKey,"API-Sign":g})["Content-Type"]=h||i?"application/json":"application/x-www-form-urlencoded"}else o="/"+e;return o=this.urls.api[t]+o,{url:o,method:i,body:a,headers:r}}nonce(){return this.milliseconds()-this.options.timeDifference}handleErrors(e,t,i,s,a,o,n,d,h){if(520===e)throw new r.ExchangeNotAvailable(this.id+" "+e.toString()+" "+t);if(void 0!==n&&"{"===o[0]&&"string"!=typeof n&&"error"in n){if(n.error.length){const e=this.id+" "+o;for(let t=0;t{i.d(t,{A:()=>h});var s=i(1359),r=i(1579),a=i(2079),o=i(5147),n=i(4852),d=i(7481);class h extends s.A{describe(){return this.deepExtend(super.describe(),{id:"krakenfutures",name:"Kraken Futures",countries:["US"],version:"v3",userAgent:void 0,rateLimit:600,pro:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,createMarketOrder:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:void 0,fetchFundingRate:"emulated",fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!1,fetchOrderBook:!0,fetchOrders:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchTickers:!0,fetchTrades:!0,sandbox:!0,setLeverage:!0,setMarginMode:!1,transfer:!0},urls:{test:{public:"https://demo-futures.kraken.com/derivatives/api/",private:"https://demo-futures.kraken.com/derivatives/api/",charts:"https://demo-futures.kraken.com/api/charts/",history:"https://demo-futures.kraken.com/api/history/",www:"https://demo-futures.kraken.com"},logo:"https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg",api:{charts:"https://futures.kraken.com/api/charts/",history:"https://futures.kraken.com/api/history/",feeschedules:"https://futures.kraken.com/api/feeschedules/",public:"https://futures.kraken.com/derivatives/api/",private:"https://futures.kraken.com/derivatives/api/"},www:"https://futures.kraken.com/",doc:["https://docs.futures.kraken.com/#introduction"],fees:"https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures",referral:void 0},api:{public:{get:["feeschedules","instruments","orderbook","tickers","history","historicalfundingrates"]},private:{get:["feeschedules/volumes","openpositions","notifications","accounts","openorders","recentorders","fills","transfers","leveragepreferences","pnlpreferences","assignmentprogram/current","assignmentprogram/history"],post:["sendorder","editorder","cancelorder","transfer","batchorder","cancelallorders","cancelallordersafter","withdrawal","assignmentprogram/add","assignmentprogram/delete"],put:["leveragepreferences","pnlpreferences"]},charts:{get:["{price_type}/{symbol}/{interval}"]},history:{get:["orders","executions","triggers","accountlogcsv","account-log","market/{symbol}/orders","market/{symbol}/executions"]}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0005"),maker:this.parseNumber("0.0002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0005")],[this.parseNumber("100000"),this.parseNumber("0.0004")],[this.parseNumber("1000000"),this.parseNumber("0.0003")],[this.parseNumber("5000000"),this.parseNumber("0.00025")],[this.parseNumber("10000000"),this.parseNumber("0.0002")],[this.parseNumber("20000000"),this.parseNumber("0.00015")],[this.parseNumber("50000000"),this.parseNumber("0.000125")],[this.parseNumber("100000000"),this.parseNumber("0.0001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0002")],[this.parseNumber("100000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.000125")],[this.parseNumber("5000000"),this.parseNumber("0.0001")],[this.parseNumber("10000000"),this.parseNumber("0.000075")],[this.parseNumber("20000000"),this.parseNumber("0.00005")],[this.parseNumber("50000000"),this.parseNumber("0.000025")],[this.parseNumber("100000000"),this.parseNumber("0")]]}}},exceptions:{exact:{apiLimitExceeded:a.RateLimitExceeded,marketUnavailable:a.ContractUnavailable,requiredArgumentMissing:a.BadRequest,unavailable:a.ExchangeNotAvailable,authenticationError:a.AuthenticationError,accountInactive:a.ExchangeError,invalidAccount:a.BadRequest,invalidAmount:a.BadRequest,insufficientFunds:a.InsufficientFunds,"Bad Request":a.BadRequest,Unavailable:a.ExchangeNotAvailable,invalidUnit:a.BadRequest,"Json Parse Error":a.ExchangeError,nonceBelowThreshold:a.InvalidNonce,nonceDuplicate:a.InvalidNonce,notFound:a.BadRequest,"Server Error":a.ExchangeError,unknownError:a.ExchangeError},broad:{invalidArgument:a.BadRequest,nonceBelowThreshold:a.InvalidNonce,nonceDuplicate:a.InvalidNonce}},precisionMode:r.kb,options:{access:{history:{GET:{orders:"private",executions:"private",triggers:"private",accountlogcsv:"private"}}},settlementCurrencies:{flex:["USDT","BTC","USD","GBP","EUR","USDC"]},symbol:{quoteIds:["USD","XBT"],reversed:!1},versions:{public:{GET:{historicalfundingrates:"v4"}},charts:{GET:{"{price_type}/{symbol}/{interval}":"v1"}},history:{GET:{orders:"v2",executions:"v2",triggers:"v2",accountlogcsv:"v2"}}},fetchTrades:{method:"historyGetMarketSymbolExecutions"}},features:{default:{sandbox:!0,createOrder:{marginMode:!1,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!1,marketBuyRequiresPrice:!1,selfTradePrevention:!1,iceberg:!1},createOrders:{max:100},fetchMyTrades:{marginMode:!1,limit:void 0,daysBack:void 0,untilDays:1e5,symbolRequired:!1},fetchOrder:void 0,fetchOpenOrders:{marginMode:!1,limit:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:void 0,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!1,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:5e3}},spot:void 0,swap:{linear:{extends:"default"},inverse:{extends:"default"}},future:{linear:{extends:"default"},inverse:{extends:"default"}}},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","4h":"4h","12h":"12h","1d":"1d","1w":"1w"}})}async fetchMarkets(e={}){const t=await this.publicGetInstruments(e),i=this.safeValue(t,"instruments",[]),s=[];for(let e=0;e=0;let d,h,c;if(n)o="index";else{d=a.indexOf("_vanilla")>=0,h=!d;const e=this.safeString(t,"lastTradingTime");o=void 0===e?"swap":"future",c=this.parse8601(e)}const l="swap"===o,u="future"===o;let f=r;const p=r.split("_"),m=this.safeString(p,1),g=m.slice(0,m.length-3),v="usd",y=this.safeCurrencyCode(g),w=this.safeCurrencyCode(v);let b,k;const S=this.safeString(t,"contractValueTradePrecision"),O=this.parseNumber(this.integerPrecisionToAmount(S)),T=this.safeNumber(t,"tickSize"),P=l||u||n;if(l||u){"futures_inverse"===this.safeString(t,"type")?(b=y,k=g,h=!0):(b=w,k=v,h=!1),d=!h,f=y+"/"+w+":"+b,u&&(f=f+"-"+this.yymmdd(c))}s.push({id:r,symbol:f,base:y,quote:w,settle:b,baseId:g,quoteId:v,settleId:k,type:o,spot:!1,margin:!1,swap:l,future:u,option:!1,index:n,active:void 0,contract:P,linear:d,inverse:h,contractSize:this.safeNumber(t,"contractSize"),maintenanceMarginRate:void 0,expiry:c,expiryDatetime:this.iso8601(c),strike:void 0,optionType:void 0,precision:{amount:O,price:T},limits:{leverage:{min:void 0,max:void 0},amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:this.parse8601(this.safeString(t,"openingDate")),info:t})}const r=this.options.settlementCurrencies.flex,a=[];for(let e=0;e=0?m="taker":g.indexOf("maker")>=0&&(m="maker"));if("takerOrder"in e){i=this.safeInteger(e,"timestamp");const t=this.safeDict(e,"takerOrder",{});void 0!==t&&(c=this.safeStringLower(t,"direction"),m="taker")}return this.safeTrade({info:e,id:a,symbol:this.safeString(t,"symbol"),timestamp:i,datetime:this.iso8601(i),order:d,type:n,side:c,takerOrMaker:m,price:s,amount:p?r:void 0,cost:f,fee:void 0})}createOrderRequest(e,t,i,s,r=void 0,a={}){const o=this.market(e);e=o.symbol,t=this.safeString(a,"orderType",t);const n=this.safeString(a,"timeInForce");let d=!1;[d,a]=this.handlePostOnly("market"===t,"post"===t,a),d?t="post":"ioc"===n?t="ioc":"limit"===t?t="lmt":"market"===t&&(t="mkt");const h={symbol:o.id,side:i,size:this.amountToPrecision(e,s)},c=this.safeString2(a,"clientOrderId","cliOrdId");void 0!==c&&(h.cliOrdId=c);const l=this.safeString2(a,"triggerPrice","stopPrice"),u=void 0!==l,f=this.safeString(a,"stopLossPrice"),p=this.safeString(a,"takeProfitPrice"),m=void 0!==f,g=void 0!==p,v=m||g,y=this.safeString(a,"triggerSignal","last");let w=this.safeValue(a,"reduceOnly");return(v||u)&&(h.triggerSignal=y),u?(t="stp",h.stopPrice=this.priceToPrecision(e,l)):v&&(w=!0,m?(t="stp",h.stopPrice=this.priceToPrecision(e,f)):g&&(t="take_profit",h.stopPrice=this.priceToPrecision(e,p))),w&&(h.reduceOnly=!0),h.orderType=t,void 0!==r&&(h.limitPrice=this.priceToPrecision(e,r)),a=this.omit(a,["clientOrderId","timeInForce","triggerPrice","stopLossPrice","takeProfitPrice"]),this.extend(h,a)}async createOrder(e,t,i,s,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.createOrderRequest(e,t,i,s,r,a),d=await this.privatePostSendorder(n),h=this.safeValue(d,"sendStatus"),c=this.safeString(h,"status");return this.verifyOrderActionSuccess(c,"createOrder",["filled"]),this.parseOrder(h,o)}async createOrders(e,t={}){await this.loadMarkets();const i=[];for(let s=0;s0)for(let e=0;e0?this.parseToInt(e/1e3):0};return await this.privatePostCancelallordersafter(this.extend(i,t))}async fetchOpenOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privateGetOpenorders(s),o=this.safeList(a,"openOrders",[]);return this.parseOrders(o,r,t,i)}async fetchClosedOrders(e=void 0,t=void 0,i=void 0,s={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a={};void 0!==i&&(a.count=i),void 0!==t&&(a.from=t);const o=await this.historyGetOrders(this.extend(a,s)),n=this.safeList(o,"elements",[]),d=[];for(let e=0;e0){let e="0.0";for(let t=0;t1)continue;const c=this.account();if(i)c.total=this.safeString(d,"quantity"),c.free=this.safeString(d,"available");else if(s)c.used="0.0",c.total=d;else{const t=this.safeValue(e,"auxiliary");c.free=this.safeString(t,"af"),c.total=this.safeString(t,"pv")}a[h]=c}return this.safeBalance(a)}async fetchFundingRates(e=void 0,t={}){await this.loadMarkets();const i=this.marketIds(e),s=await this.publicGetTickers(t),r=this.safeList(s,"tickers",[]),a=[];for(let e=0;e{i.d(t,{A:()=>d});var s=i(3548),r=i(2079),a=i(5147),o=i(1579),n=i(4852);class d extends s.A{describe(){return this.deepExtend(super.describe(),{id:"kucoin",name:"KuCoin",countries:["SC"],rateLimit:10,version:"v2",certified:!0,pro:!0,comment:"Platform 2.0",quoteJsonNumbers:!1,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!0,fetchBorrowRateHistory:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:!0,fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!0,fetchLedger:!0,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrice:!0,fetchMarkPrices:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrdersByStatus:!0,fetchOrderTrades:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransfers:!1,fetchWithdrawals:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg",referral:"https://www.kucoin.com/ucenter/signup?rcode=E5wkqe",api:{public:"https://api.kucoin.com",private:"https://api.kucoin.com",futuresPrivate:"https://api-futures.kucoin.com",futuresPublic:"https://api-futures.kucoin.com",webExchange:"https://kucoin.com/_api",broker:"https://api-broker.kucoin.com",earn:"https://api.kucoin.com"},www:"https://www.kucoin.com",doc:["https://docs.kucoin.com"]},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{public:{get:{currencies:4.5,"currencies/{currency}":4.5,symbols:6,"market/orderbook/level1":3,"market/allTickers":22.5,"market/stats":22.5,markets:4.5,"market/orderbook/level{level}_{limit}":6,"market/orderbook/level2_20":3,"market/orderbook/level2_100":6,"market/histories":4.5,"market/candles":4.5,prices:4.5,timestamp:4.5,status:4.5,"mark-price/{symbol}/current":3,"mark-price/all-symbols":3,"margin/config":25,announcements:20},post:{"bullet-public":15}},private:{get:{"user-info":30,accounts:7.5,"accounts/{accountId}":7.5,"accounts/ledgers":3,"hf/accounts/ledgers":2,"hf/margin/account/ledgers":2,"transaction-history":3,"sub/user":30,"sub-accounts/{subUserId}":22.5,"sub-accounts":30,"sub/api-key":30,"margin/account":40,"margin/accounts":15,"isolated/accounts":15,"deposit-addresses":7.5,deposits:7.5,"hist-deposits":7.5,withdrawals:30,"hist-withdrawals":30,"withdrawals/quotas":30,"accounts/transferable":30,"transfer-list":30,"base-fee":3,"trade-fees":3,"market/orderbook/level{level}":3,"market/orderbook/level2":3,"market/orderbook/level3":3,"hf/accounts/opened":2,"hf/orders/active":2,"hf/orders/active/symbols":2,"hf/margin/order/active/symbols":2,"hf/orders/done":2,"hf/orders/{orderId}":2,"hf/orders/client-order/{clientOid}":2,"hf/orders/dead-cancel-all/query":2,"hf/fills":2,orders:2,"limit/orders":3,"orders/{orderId}":2,"order/client-order/{clientOid}":3,fills:10,"limit/fills":20,"stop-order":8,"stop-order/{orderId}":3,"stop-order/queryOrderByClientOid":3,"oco/order/{orderId}":2,"oco/order/details/{orderId}":2,"oco/client-order/{clientOid}":2,"oco/orders":2,"hf/margin/orders/active":4,"hf/margin/orders/done":10,"hf/margin/orders/{orderId}":4,"hf/margin/orders/client-order/{clientOid}":5,"hf/margin/fills":5,"etf/info":25,"margin/currencies":20,"risk/limit/strategy":20,"isolated/symbols":20,"margin/symbols":5,"isolated/account/{symbol}":50,"margin/borrow":15,"margin/repay":15,"margin/interest":20,"project/list":10,"project/marketInterestRate":7.5,"redeem/orders":10,"purchase/orders":10,"broker/api/rebase/download":3,"migrate/user/account/status":3,"affiliate/inviter/statistics":30},post:{"sub/user/created":22.5,"sub/api-key":30,"sub/api-key/update":45,"deposit-addresses":30,withdrawals:7.5,"accounts/universal-transfer":6,"accounts/sub-transfer":45,"accounts/inner-transfer":15,"transfer-out":30,"transfer-in":30,"hf/orders":1,"hf/orders/test":1,"hf/orders/sync":1,"hf/orders/multi":1,"hf/orders/multi/sync":1,"hf/orders/alter":3,"hf/orders/dead-cancel-all":2,orders:2,"orders/test":2,"orders/multi":3,"stop-order":2,"oco/order":2,"hf/margin/order":5,"hf/margin/order/test":5,"margin/order":5,"margin/order/test":5,"margin/borrow":15,"margin/repay":10,purchase:15,redeem:15,"lend/purchase/update":10,"bullet-private":10,"position/update-user-leverage":5,"deposit-address/create":20},delete:{"sub/api-key":45,"withdrawals/{withdrawalId}":30,"hf/orders/{orderId}":1,"hf/orders/sync/{orderId}":1,"hf/orders/client-order/{clientOid}":1,"hf/orders/sync/client-order/{clientOid}":1,"hf/orders/cancel/{orderId}":2,"hf/orders":2,"hf/orders/cancelAll":30,"orders/{orderId}":3,"order/client-order/{clientOid}":5,orders:20,"stop-order/{orderId}":3,"stop-order/cancelOrderByClientOid":5,"stop-order/cancel":3,"oco/order/{orderId}":3,"oco/client-order/{clientOid}":3,"oco/orders":3,"hf/margin/orders/{orderId}":5,"hf/margin/orders/client-order/{clientOid}":5,"hf/margin/orders":10}},futuresPublic:{get:{"contracts/active":4.5,"contracts/{symbol}":4.5,ticker:3,"level2/snapshot":4.5,"level2/depth20":7.5,"level2/depth100":15,"trade/history":7.5,"kline/query":4.5,"interest/query":7.5,"index/query":3,"mark-price/{symbol}/current":4.5,"premium/query":4.5,"trade-statistics":4.5,"funding-rate/{symbol}/current":3,"contract/funding-rates":7.5,timestamp:3,status:6,"level2/message/query":1.3953},post:{"bullet-public":15}},futuresPrivate:{get:{"transaction-history":3,"account-overview":7.5,"account-overview-all":9,"transfer-list":30,orders:3,stopOrders:9,recentDoneOrders:7.5,"orders/{orderId}":7.5,"orders/byClientOid":7.5,fills:7.5,recentFills:4.5,openOrderStatistics:15,position:3,positions:3,"margin/maxWithdrawMargin":15,"contracts/risk-limit/{symbol}":7.5,"funding-history":7.5},post:{"transfer-out":30,"transfer-in":30,orders:3,"orders/test":3,"orders/multi":4.5,"position/margin/auto-deposit-status":6,"margin/withdrawMargin":15,"position/margin/deposit-margin":6,"position/risk-limit-level/change":6,"bullet-private":15},delete:{"orders/{orderId}":1.5,"orders/client-order/{clientOid}":1.5,orders:45,stopOrders:22.5}},webExchange:{get:{"currency/currency/chain-info":1}},broker:{get:{"broker/nd/info":2,"broker/nd/account":2,"broker/nd/account/apikey":2,"broker/nd/rebase/download":3,"asset/ndbroker/deposit/list":1,"broker/nd/transfer/detail":1,"broker/nd/deposit/detail":1,"broker/nd/withdraw/detail":1},post:{"broker/nd/transfer":1,"broker/nd/account":3,"broker/nd/account/apikey":3,"broker/nd/account/update-apikey":3},delete:{"broker/nd/account/apikey":3}},earn:{get:{"otc-loan/loan":1,"otc-loan/accounts":1,"earn/redeem-preview":7.5,"earn/saving/products":7.5,"earn/hold-assets":7.5,"earn/promotion/products":7.5,"earn/kcs-staking/products":7.5,"earn/staking/products":7.5,"earn/eth-staking/products":7.5},post:{"earn/orders":7.5},delete:{"earn/orders":7.5}}},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","2h":"2hour","4h":"4hour","6h":"6hour","8h":"8hour","12h":"12hour","1d":"1day","1w":"1week","1M":"1month"},precisionMode:o.kb,exceptions:{exact:{"The order does not exist.":r.OrderNotFound,"order not exist":r.OrderNotFound,"order not exist.":r.OrderNotFound,order_not_exist:r.OrderNotFound,order_not_exist_or_not_allow_to_cancel:r.InvalidOrder,"Order size below the minimum requirement.":r.InvalidOrder,"The withdrawal amount is below the minimum requirement.":r.ExchangeError,"Unsuccessful! Exceeded the max. funds out-transfer limit":r.InsufficientFunds,"The amount increment is invalid.":r.BadRequest,"The quantity is below the minimum requirement.":r.InvalidOrder,400:r.BadRequest,401:r.AuthenticationError,403:r.NotSupported,404:r.NotSupported,405:r.NotSupported,415:r.NotSupported,429:r.RateLimitExceeded,500:r.ExchangeNotAvailable,503:r.ExchangeNotAvailable,101030:r.PermissionDenied,103e3:r.InvalidOrder,130101:r.BadRequest,130102:r.ExchangeError,130103:r.OrderNotFound,130104:r.ExchangeError,130105:r.InsufficientFunds,130106:r.NotSupported,130107:r.ExchangeError,130108:r.OrderNotFound,130201:r.PermissionDenied,130202:r.ExchangeError,130203:r.InsufficientFunds,130204:r.BadRequest,130301:r.InsufficientFunds,130302:r.PermissionDenied,130303:r.NotSupported,130304:r.NotSupported,130305:r.NotSupported,130306:r.NotSupported,130307:r.NotSupported,130308:r.InvalidOrder,130309:r.InvalidOrder,130310:r.ExchangeError,130311:r.InvalidOrder,130312:r.InvalidOrder,130313:r.InvalidOrder,130314:r.InvalidOrder,130315:r.NotSupported,126e3:r.ExchangeError,126001:r.NotSupported,126002:r.ExchangeError,126003:r.InvalidOrder,126004:r.ExchangeError,126005:r.PermissionDenied,126006:r.ExchangeError,126007:r.ExchangeError,126009:r.ExchangeError,126010:r.ExchangeError,126011:r.ExchangeError,126013:r.InsufficientFunds,126015:r.ExchangeError,126021:r.NotSupported,126022:r.InvalidOrder,126027:r.InvalidOrder,126028:r.InvalidOrder,126029:r.InvalidOrder,126030:r.InvalidOrder,126033:r.InvalidOrder,126034:r.InvalidOrder,126036:r.InvalidOrder,126037:r.ExchangeError,126038:r.ExchangeError,126039:r.ExchangeError,126041:r.ExchangeError,126042:r.ExchangeError,126043:r.OrderNotFound,126044:r.InvalidOrder,126045:r.NotSupported,126046:r.NotSupported,126047:r.PermissionDenied,126048:r.PermissionDenied,135005:r.ExchangeError,135018:r.ExchangeError,200004:r.InsufficientFunds,210014:r.InvalidOrder,210021:r.InsufficientFunds,230003:r.InsufficientFunds,26e4:r.InvalidAddress,260100:r.InsufficientFunds,3e5:r.InvalidOrder,4e5:r.BadSymbol,400001:r.AuthenticationError,400002:r.InvalidNonce,400003:r.AuthenticationError,400004:r.AuthenticationError,400005:r.AuthenticationError,400006:r.AuthenticationError,400007:r.AuthenticationError,400008:r.NotSupported,400100:r.InsufficientFunds,400200:r.InvalidOrder,400330:r.InvalidOrder,400350:r.InvalidOrder,400370:r.InvalidOrder,400400:r.BadRequest,400401:r.AuthenticationError,400500:r.InvalidOrder,400600:r.BadSymbol,400760:r.InvalidOrder,401e3:r.BadRequest,408e3:r.BadRequest,411100:r.AccountSuspended,415e3:r.BadRequest,400303:r.PermissionDenied,5e5:r.ExchangeNotAvailable,260220:r.InvalidAddress,600100:r.InsufficientFunds,600101:r.InvalidOrder,900014:r.BadRequest},broad:{"Exceeded the access frequency":r.RateLimitExceeded,"require more permission":r.PermissionDenied}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("50"),this.parseNumber("0.001")],[this.parseNumber("200"),this.parseNumber("0.0009")],[this.parseNumber("500"),this.parseNumber("0.0008")],[this.parseNumber("1000"),this.parseNumber("0.0007")],[this.parseNumber("2000"),this.parseNumber("0.0007")],[this.parseNumber("4000"),this.parseNumber("0.0006")],[this.parseNumber("8000"),this.parseNumber("0.0005")],[this.parseNumber("15000"),this.parseNumber("0.00045")],[this.parseNumber("25000"),this.parseNumber("0.0004")],[this.parseNumber("40000"),this.parseNumber("0.00035")],[this.parseNumber("60000"),this.parseNumber("0.0003")],[this.parseNumber("80000"),this.parseNumber("0.00025")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("50"),this.parseNumber("0.0009")],[this.parseNumber("200"),this.parseNumber("0.0007")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0003")],[this.parseNumber("2000"),this.parseNumber("0")],[this.parseNumber("4000"),this.parseNumber("0")],[this.parseNumber("8000"),this.parseNumber("0")],[this.parseNumber("15000"),this.parseNumber("-0.00005")],[this.parseNumber("25000"),this.parseNumber("-0.00005")],[this.parseNumber("40000"),this.parseNumber("-0.00005")],[this.parseNumber("60000"),this.parseNumber("-0.00005")],[this.parseNumber("80000"),this.parseNumber("-0.00005")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}},commonCurrencies:{BIFI:"BIFIF",VAI:"VAIOT",WAX:"WAXP",ALT:"APTOSLAUNCHTOKEN",KALT:"ALT",FUD:"FTX Users' Debt"},options:{hf:void 0,version:"v1",symbolSeparator:"-",fetchMyTradesMethod:"private_get_fills",timeDifference:0,adjustForTimeDifference:!1,fetchCurrencies:{webApiEnable:!0,webApiRetries:1,webApiMuteFailure:!0},fetchMarkets:{fetchTickersFees:!0},withdraw:{includeFee:!1},versions:{public:{GET:{currencies:"v3","currencies/{currency}":"v3",symbols:"v2","mark-price/all-symbols":"v3",announcements:"v3"}},private:{GET:{"user-info":"v2","hf/margin/account/ledgers":"v3","sub/user":"v2","sub-accounts":"v2","margin/accounts":"v3","isolated/accounts":"v3","deposit-addresses":"v1","market/orderbook/level2":"v3","market/orderbook/level3":"v3","market/orderbook/level{level}":"v3","oco/order/{orderId}":"v3","oco/order/details/{orderId}":"v3","oco/client-order/{clientOid}":"v3","oco/orders":"v3","hf/margin/orders/active":"v3","hf/margin/order/active/symbols":"v3","hf/margin/orders/done":"v3","hf/margin/orders/{orderId}":"v3","hf/margin/orders/client-order/{clientOid}":"v3","hf/margin/fills":"v3","etf/info":"v3","margin/currencies":"v3","margin/borrow":"v3","margin/repay":"v3","margin/interest":"v3","project/list":"v3","project/marketInterestRate":"v3","redeem/orders":"v3","purchase/orders":"v3","migrate/user/account/status":"v3","margin/symbols":"v3","affiliate/inviter/statistics":"v2","asset/ndbroker/deposit/list":"v1"},POST:{"sub/user/created":"v2","accounts/universal-transfer":"v3","accounts/sub-transfer":"v2","accounts/inner-transfer":"v2","transfer-out":"v3","deposit-address/create":"v3","oco/order":"v3","hf/margin/order":"v3","hf/margin/order/test":"v3","margin/borrow":"v3","margin/repay":"v3",purchase:"v3",redeem:"v3","lend/purchase/update":"v3","position/update-user-leverage":"v3",withdrawals:"v3"},DELETE:{"hf/margin/orders/{orderId}":"v3","hf/margin/orders/client-order/{clientOid}":"v3","hf/margin/orders":"v3","oco/order/{orderId}":"v3","oco/client-order/{clientOid}":"v3","oco/orders":"v3"}},futuresPrivate:{POST:{"transfer-out":"v3"}}},partner:{spot:{id:"ccxt",key:"9e58cc35-5b5e-4133-92ec-166e3f077cb8"},future:{id:"ccxtfutures",key:"1b327198-f30c-4f14-a0ac-918871282f15"}},accountsByType:{spot:"trade",margin:"margin",cross:"margin",isolated:"isolated",main:"main",funding:"main",future:"contract",swap:"contract",mining:"pool",hf:"trade_hf"},networks:{BRC20:"btc",BTCNATIVESEGWIT:"bech32",ERC20:"eth",TRC20:"trx",HRC20:"heco",MATIC:"matic",KCC:"kcc",SOL:"sol",ALGO:"algo",EOS:"eos",BEP20:"bsc",BEP2:"bnb",ARBONE:"arbitrum",AVAXX:"avax",AVAXC:"avaxc",TLOS:"tlos",CFX:"cfx",ACA:"aca",OP:"optimism",ONT:"ont",GLMR:"glmr",CSPR:"cspr",KLAY:"klay",XRD:"xrd",RVN:"rvn",NEAR:"near",APT:"aptos",ETHW:"ethw",TON:"ton",BCH:"bch",BSV:"bchsv",BCHA:"bchabc",OSMO:"osmo",NANO:"nano",XLM:"xlm",VET:"vet",IOST:"iost",ZIL:"zil",XRP:"xrp",TOMO:"tomo",XMR:"xmr",COTI:"coti",XTZ:"xtz",ADA:"ada",WAX:"waxp",THETA:"theta",ONE:"one",IOTEX:"iotx",NULS:"nuls",KSM:"ksm",LTC:"ltc",WAVES:"waves",DOT:"dot",STEEM:"steem",QTUM:"qtum",DOGE:"doge",FIL:"fil",XYM:"xym",FLUX:"flux",ATOM:"atom",XDC:"xdc",KDA:"kda",ICP:"icp",CELO:"celo",LSK:"lsk",VSYS:"vsys",KAR:"kar",XCH:"xch",FLOW:"flow",BAND:"band",EGLD:"egld",HBAR:"hbar",XPR:"xpr",AR:"ar",FTM:"ftm",KAVA:"kava",KMA:"kma",XEC:"xec",IOTA:"iota",HNT:"hnt",ASTR:"astr",PDEX:"pdex",METIS:"metis",ZEC:"zec",POKT:"pokt",OASYS:"oas",OASIS:"oasis",ETC:"etc",AKT:"akt",FSN:"fsn",SCRT:"scrt",CFG:"cfg",ICX:"icx",KMD:"kmd",NEM:"NEM",STX:"stx",DGB:"dgb",DCR:"dcr",CKB:"ckb",ELA:"ela",HYDRA:"hydra",BTM:"btm",KARDIA:"kai",SXP:"sxp",NEBL:"nebl",ZEN:"zen",SDN:"sdn",LTO:"lto",WEMIX:"wemix",EVER:"ever",BNC:"bnc",BNCDOT:"bncdot",AION:"aion",GRIN:"grin",LOKI:"loki",QKC:"qkc",TT:"TT",PIVX:"pivx",SERO:"sero",METER:"meter",STATEMINE:"statemine",DVPN:"dvpn",XPRT:"xprt",MOVR:"movr",ERGO:"ergo",ABBC:"abbc",DIVI:"divi",PURA:"pura",DFI:"dfi",NEON3:"neon3",DOCK:"dock",TRUE:"true",CS:"cs",ORAI:"orai",BASE:"base"},marginModes:{cross:"MARGIN_TRADE",isolated:"MARGIN_ISOLATED_TRADE",spot:"TRADE"}},features:{spot:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:void 0,triggerDirection:!1,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:void 0,timeInForce:{IOC:!0,FOK:!0,PO:!0,GTD:!0},hedged:!1,trailing:!1,leverage:!1,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!0,iceberg:!0},createOrders:{max:5},fetchMyTrades:{marginMode:!0,limit:void 0,daysBack:void 0,untilDays:7,symbolRequired:!0},fetchOrder:{marginMode:!1,trigger:!0,trailing:!1,symbolRequired:!0},fetchOpenOrders:{marginMode:!0,limit:500,trigger:!0,trailing:!1,symbolRequired:!0},fetchOrders:void 0,fetchClosedOrders:{marginMode:!0,limit:500,daysBack:void 0,daysBackCanceled:void 0,untilDays:7,trigger:!0,trailing:!1,symbolRequired:!0},fetchOHLCV:{limit:1500}},swap:{linear:void 0,inverse:void 0},future:{linear:void 0,inverse:void 0}}})}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=await this.publicGetTimestamp(e);return this.safeInteger(t,"data")}async fetchStatus(e={}){const t=await this.publicGetStatus(e),i=this.safeDict(t,"data",{});return{status:"open"===this.safeString(i,"status")?"ok":"maintenance",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){let t;[t,e]=this.handleOptionAndParams(e,"fetchMarkets","fetchTickersFees",!0);const i=[];i.push(this.publicGetSymbols(e));const s=this.checkRequiredCredentials(!1),r=s&&this.safeBool(e,"marginables",!0);r&&(i.push(this.privateGetMarginSymbols(e)),i.push(this.privateGetIsolatedSymbols(e))),t&&i.push(this.publicGetMarketAllTickers(e)),s&&i.push(this.loadMigrationStatus());const o=await Promise.all(i),n=this.safeList(o[0],"data"),d=r?this.safeDict(o[1],"data",{}):{},h=this.safeList(d,"items",[]),c=this.indexBy(h,"symbol"),l=r?o[2]:{},u=this.safeList(l,"data",[]),f=this.indexBy(u,"symbol"),p=r?3:1,m=this.safeDict(o,p,{}),g=this.safeList(this.safeDict(m,"data",{}),"ticker",[]),v=this.indexBy(g,"symbol"),y=[];for(let e=0;e1&&void 0===r&&e[1].length>1&&(r=e[1]),n=e[0]}let d=void 0===n?"withdrawal":"deposit";const h=this.safeString(e,"status");let c;const l=this.safeString(e,"fee");if(void 0!==l){let e;void 0!==o&&(e=a.Y.stringDiv(l,o)),c={cost:this.parseNumber(l),rate:this.parseNumber(e),currency:s}}let u=this.safeInteger2(e,"createdAt","createAt"),f=this.safeInteger(e,"updatedAt");!("createdAt"in e)&&(d="address"in e?"withdrawal":"deposit",void 0!==u&&(u*=1e3),void 0!==f&&(f*=1e3));const p=this.safeBool(e,"isInner"),m=this.safeString(e,"memo");return{info:e,id:this.safeString2(e,"id","withdrawalId"),timestamp:u,datetime:this.iso8601(u),network:this.networkIdToCode(this.safeString(e,"chain")),address:r,addressTo:r,addressFrom:void 0,tag:m,tagTo:m,tagFrom:void 0,currency:s,amount:this.parseNumber(o),txid:n,type:d,status:this.parseTransactionStatus(h),comment:this.safeString(e,"remark"),internal:p,fee:c,updated:f}}async fetchDeposits(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchDeposits","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchDeposits",e,t,i,s);let a,o,n={};void 0!==e&&(a=this.currency(e),n.currency=a.id),void 0!==i&&(n.pageSize=i),[n,s]=this.handleUntilOption("endAt",n,s),void 0!==t&&t<1550448e6?(n.startAt=this.parseToInt(t/1e3),o=await this.privateGetHistDeposits(this.extend(n,s))):(void 0!==t&&(n.startAt=t),o=await this.privateGetDeposits(this.extend(n,s)));const d=this.safeDict(o,"data",{}),h=this.safeList(d,"items",[]);return this.parseTransactions(h,a,t,i,{type:"deposit"})}async fetchWithdrawals(e=void 0,t=void 0,i=void 0,s={}){await this.loadMarkets();let r=!1;if([r,s]=this.handleOptionAndParams(s,"fetchWithdrawals","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchWithdrawals",e,t,i,s);let a,o,n={};void 0!==e&&(a=this.currency(e),n.currency=a.id),void 0!==i&&(n.pageSize=i),[n,s]=this.handleUntilOption("endAt",n,s),void 0!==t&&t<1550448e6?(n.startAt=this.parseToInt(t/1e3),o=await this.privateGetHistWithdrawals(this.extend(n,s))):(void 0!==t&&(n.startAt=t),o=await this.privateGetWithdrawals(this.extend(n,s)));const d=this.safeDict(o,"data",{}),h=this.safeList(d,"items",[]);return this.parseTransactions(h,a,t,i,{type:"withdrawal"})}parseBalanceHelper(e){const t=this.account();t.used=this.safeString2(e,"holdBalance","hold"),t.free=this.safeString2(e,"availableBalance","available"),t.total=this.safeString2(e,"totalBalance","total");const i=this.safeString(e,"liability"),s=this.safeString(e,"interest");return t.debt=a.Y.stringAdd(i,s),t}async fetchBalance(e={}){await this.loadMarkets();const t=this.safeString(e,"code");let i;void 0!==t&&(i=this.currency(t));const s=this.safeString2(this.options,"fetchBalance","defaultType","spot"),r=this.safeString(e,"type",s),a=this.safeDict(this.options,"accountsByType");let o,n=this.safeString(a,r,r);e=this.omit(e,"type"),[o,e]=this.handleHfAndParams(e),o&&"main"!==n&&(n="trade_hf");const[d,h]=this.handleMarginModeAndParams("fetchBalance",e);let c;const l={},u="isolated"===d||"isolated"===n,f="cross"===d||"margin"===n;let p;u?(void 0!==i&&(l.balanceCurrency=i.id),c=await this.privateGetIsolatedAccounts(this.extend(l,h))):f?c=await this.privateGetMarginAccount(this.extend(l,h)):(void 0!==i&&(l.currency=i.id),l.type=n,c=await this.privateGetAccounts(this.extend(l,h)));const m={info:c,timestamp:void 0,datetime:void 0};if(u){p=this.safeDict(c,"data",{});const e=this.safeValue(p,"assets",p);for(let t=0;t{i.d(t,{A:()=>n});var s=i(2079),r=i(5147),a=i(1579),o=i(3942);class n extends o.A{describe(){return this.deepExtend(super.describe(),{id:"kucoinfutures",name:"KuCoin Futures",countries:["SC"],rateLimit:75,version:"v1",certified:!0,pro:!0,comment:"Platform 2.0",quoteJsonNumbers:!1,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:!1,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,closePositions:!1,createDepositAddress:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingInterval:!0,fetchFundingIntervals:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!0,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMarkPrice:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTransactionFee:!1,fetchWithdrawals:!0,setLeverage:!1,setMarginMode:!0,transfer:!0,withdraw:void 0},urls:{logo:"https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg",doc:["https://docs.kucoin.com/futures","https://docs.kucoin.com"],www:"https://futures.kucoin.com/",referral:"https://futures.kucoin.com/?rcode=E5wkqe",api:{public:"https://openapi-v2.kucoin.com",private:"https://openapi-v2.kucoin.com",futuresPrivate:"https://api-futures.kucoin.com",futuresPublic:"https://api-futures.kucoin.com",webExchange:"https://futures.kucoin.com/_api/web-front"}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{futuresPublic:{get:{"contracts/active":1,"contracts/{symbol}":1,"contracts/risk-limit/{symbol}":1,ticker:1,allTickers:1,"level2/snapshot":1.33,"level2/depth{limit}":1,"level2/message/query":1,"level3/message/query":1,"level3/snapshot":1,"trade/history":1,"interest/query":1,"index/query":1,"mark-price/{symbol}/current":1,"premium/query":1,"funding-rate/{symbol}/current":1,timestamp:1,status:1,"kline/query":1},post:{"bullet-public":1}},futuresPrivate:{get:{"account-overview":1.33,"transaction-history":4.44,"deposit-address":1,"deposit-list":1,"withdrawals/quotas":1,"withdrawal-list":1,"transfer-list":1,orders:1.33,stopOrders:1,recentDoneOrders:1,"orders/{orderId}":1,"orders/byClientOid":1,fills:4.44,recentFills:4.44,openOrderStatistics:1,position:1,positions:4.44,"funding-history":4.44,"sub/api-key":1,"trade-statistics":1,"trade-fees":1,"history-positions":1,getMaxOpenSize:1,getCrossUserLeverage:1,"position/getMarginMode":1},post:{withdrawals:1,"transfer-out":1,"transfer-in":1,orders:1.33,"st-orders":1.33,"orders/test":1.33,"position/margin/auto-deposit-status":1,"position/margin/deposit-margin":1,"position/risk-limit-level/change":1,"bullet-private":1,"sub/api-key":1,"sub/api-key/update":1,changeCrossUserLeverage:1,"position/changeMarginMode":1},delete:{"withdrawals/{withdrawalId}":1,"cancel/transfer-out":1,"orders/{orderId}":1,orders:4.44,stopOrders:1,"sub/api-key":1,"orders/client-order/{clientOid}":1,"orders/multi-cancel":20}},webExchange:{get:{"contract/{symbol}/funding-rates":1}}},precisionMode:a.kb,exceptions:{exact:{400:s.BadRequest,401:s.AuthenticationError,403:s.NotSupported,404:s.NotSupported,405:s.NotSupported,415:s.BadRequest,429:s.RateLimitExceeded,500:s.ExchangeNotAvailable,503:s.ExchangeNotAvailable,100001:s.InvalidOrder,100004:s.BadRequest,101030:s.PermissionDenied,200004:s.InsufficientFunds,230003:s.InsufficientFunds,260100:s.InsufficientFunds,300003:s.InsufficientFunds,300012:s.InvalidOrder,400001:s.AuthenticationError,400002:s.InvalidNonce,400003:s.AuthenticationError,400004:s.AuthenticationError,400005:s.AuthenticationError,400006:s.AuthenticationError,400007:s.AuthenticationError,404e3:s.NotSupported,400100:s.BadRequest,411100:s.AccountSuspended,5e5:s.ExchangeNotAvailable,300009:s.InvalidOrder},broad:{"Position does not exist":s.OrderNotFound}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0006"),maker:this.parseNumber("0.0002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0006")],[this.parseNumber("50"),this.parseNumber("0.0006")],[this.parseNumber("200"),this.parseNumber("0.0006")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0004")],[this.parseNumber("2000"),this.parseNumber("0.0004")],[this.parseNumber("4000"),this.parseNumber("0.00038")],[this.parseNumber("8000"),this.parseNumber("0.00035")],[this.parseNumber("15000"),this.parseNumber("0.00032")],[this.parseNumber("25000"),this.parseNumber("0.0003")],[this.parseNumber("40000"),this.parseNumber("0.0003")],[this.parseNumber("60000"),this.parseNumber("0.0003")],[this.parseNumber("80000"),this.parseNumber("0.0003")]],maker:[[this.parseNumber("0"),this.parseNumber("0.02")],[this.parseNumber("50"),this.parseNumber("0.015")],[this.parseNumber("200"),this.parseNumber("0.01")],[this.parseNumber("500"),this.parseNumber("0.01")],[this.parseNumber("1000"),this.parseNumber("0.01")],[this.parseNumber("2000"),this.parseNumber("0")],[this.parseNumber("4000"),this.parseNumber("0")],[this.parseNumber("8000"),this.parseNumber("0")],[this.parseNumber("15000"),this.parseNumber("-0.003")],[this.parseNumber("25000"),this.parseNumber("-0.006")],[this.parseNumber("40000"),this.parseNumber("-0.009")],[this.parseNumber("60000"),this.parseNumber("-0.012")],[this.parseNumber("80000"),this.parseNumber("-0.015")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}},commonCurrencies:{HOT:"HOTNOW",EDGE:"DADI",WAX:"WAXP",TRY:"Trias",VAI:"VAIOT",XBT:"BTC"},timeframes:{"1m":1,"3m":void 0,"5m":5,"15m":15,"30m":30,"1h":60,"2h":120,"4h":240,"6h":void 0,"8h":480,"12h":720,"1d":1440,"1w":10080},options:{version:"v1",symbolSeparator:"-",defaultType:"swap",code:"USDT",marginModes:{},marginTypes:{},versions:{futuresPrivate:{GET:{getMaxOpenSize:"v2",getCrossUserLeverage:"v2","position/getMarginMode":"v2"},POST:{"transfer-out":"v2",changeCrossUserLeverage:"v2","position/changeMarginMode":"v2"}},futuresPublic:{GET:{"level3/snapshot":"v2"}}},networks:{OMNI:"omni",ERC20:"eth",TRC20:"trx"}},features:{spot:void 0,forDerivs:{sandbox:!1,createOrder:{marginMode:!0,triggerPrice:!0,triggerPriceType:{last:!0,mark:!0,index:!0},triggerDirection:!0,stopLossPrice:!0,takeProfitPrice:!0,attachedStopLossTakeProfit:{triggerPriceType:void 0,price:!0},timeInForce:{IOC:!0,FOK:!1,PO:!0,GTD:!1},hedged:!1,trailing:!1,leverage:!0,marketBuyByCost:!0,marketBuyRequiresPrice:!1,selfTradePrevention:!0,iceberg:!0},createOrders:{max:20},fetchMyTrades:{marginMode:!0,limit:1e3,daysBack:void 0,untilDays:7,symbolRequired:!1},fetchOrder:{marginMode:!1,trigger:!1,trailing:!1,symbolRequired:!1},fetchOpenOrders:{marginMode:!1,limit:1e3,trigger:!0,trailing:!1,symbolRequired:!1},fetchOrders:void 0,fetchClosedOrders:{marginMode:!1,limit:1e3,daysBack:void 0,daysBackCanceled:void 0,untilDays:void 0,trigger:!0,trailing:!1,symbolRequired:!1},fetchOHLCV:{limit:500}},swap:{linear:{extends:"forDerivs"},inverse:{extends:"forDerivs"}},future:{linear:{extends:"forDerivs"},inverse:{extends:"forDerivs"}}}})}async fetchStatus(e={}){const t=await this.futuresPublicGetStatus(e),i=this.safeValue(t,"data",{});return{status:"open"===this.safeString(i,"status")?"ok":"maintenance",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=await this.futuresPublicGetContractsActive(e),i=[],s=this.safeValue(t,"data",[]);for(let e=0;e-1?"long":"short");const d=r.Y.stringAbs(this.safeString(e,"posCost")),h=this.safeString(e,"posInit"),c=r.Y.stringDiv(h,d),l=this.safeString(e,"unrealisedPnl"),u=this.safeValue(e,"crossMode");let f;return void 0!==u&&(f=u?"cross":"isolated"),this.safePosition({info:e,id:this.safeString2(e,"id","positionId"),symbol:this.safeString(t,"symbol"),timestamp:s,datetime:this.iso8601(s),lastUpdateTimestamp:this.safeInteger(e,"closeTime"),initialMargin:this.parseNumber(h),initialMarginPercentage:this.parseNumber(c),maintenanceMargin:this.safeNumber(e,"posMaint"),maintenanceMarginPercentage:this.safeNumber(e,"maintMarginReq"),entryPrice:this.safeNumber2(e,"avgEntryPrice","openPrice"),notional:this.parseNumber(d),leverage:this.safeNumber2(e,"realLeverage","leverage"),unrealizedPnl:this.parseNumber(l),contracts:this.parseNumber(r.Y.stringAbs(a)),contractSize:this.safeValue(t,"contractSize"),realizedPnl:this.safeNumber2(e,"realisedPnl","pnl"),marginRatio:void 0,liquidationPrice:this.safeNumber(e,"liquidationPrice"),markPrice:this.safeNumber(e,"markPrice"),lastPrice:void 0,collateral:this.safeNumber(e,"maintMargin"),marginMode:f,side:o,percentage:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}async createOrder(e,t,i,s,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeBool(a,"test",!1);a=this.omit(a,"test");const d=void 0!==this.safeValue(a,"stopLoss")||void 0!==this.safeValue(a,"takeProfit"),h=this.createContractOrderRequest(e,t,i,s,r,a);let c;c=n?await this.futuresPrivatePostOrdersTest(h):d?await this.futuresPrivatePostStOrders(h):await this.futuresPrivatePostOrders(h);const l=this.safeDict(c,"data",{});return this.parseOrder(l,o)}async createOrders(e,t={}){await this.loadMarkets();const i=[];for(let t=0;t