ccxt 4.4.97 → 4.4.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +5 -1
- package/dist/cjs/src/abstract/alpaca.js +1 -1
- package/dist/cjs/src/abstract/apex.js +1 -1
- package/dist/cjs/src/abstract/ascendex.js +1 -1
- package/dist/cjs/src/abstract/bigone.js +1 -1
- package/dist/cjs/src/abstract/binance.js +1 -1
- package/dist/cjs/src/abstract/bingx.js +1 -1
- package/dist/cjs/src/abstract/bit2c.js +1 -1
- package/dist/cjs/src/abstract/bitbank.js +1 -1
- package/dist/cjs/src/abstract/bitbns.js +1 -1
- package/dist/cjs/src/abstract/bitfinex.js +1 -1
- package/dist/cjs/src/abstract/bitflyer.js +1 -1
- package/dist/cjs/src/abstract/bitget.js +1 -1
- package/dist/cjs/src/abstract/bithumb.js +1 -1
- package/dist/cjs/src/abstract/bitmart.js +1 -1
- package/dist/cjs/src/abstract/bitmex.js +1 -1
- package/dist/cjs/src/abstract/bitopro.js +1 -1
- package/dist/cjs/src/abstract/bitrue.js +1 -1
- package/dist/cjs/src/abstract/bitso.js +1 -1
- package/dist/cjs/src/abstract/bitstamp.js +1 -1
- package/dist/cjs/src/abstract/bitteam.js +1 -1
- package/dist/cjs/src/abstract/bittrade.js +1 -1
- package/dist/cjs/src/abstract/bitvavo.js +1 -1
- package/dist/cjs/src/abstract/blockchaincom.js +1 -1
- package/dist/cjs/src/abstract/blofin.js +1 -1
- package/dist/cjs/src/abstract/btcalpha.js +1 -1
- package/dist/cjs/src/abstract/btcbox.js +1 -1
- package/dist/cjs/src/abstract/btcmarkets.js +1 -1
- package/dist/cjs/src/abstract/btcturk.js +1 -1
- package/dist/cjs/src/abstract/bybit.js +1 -1
- package/dist/cjs/src/abstract/cex.js +1 -1
- package/dist/cjs/src/abstract/coinbase.js +1 -1
- package/dist/cjs/src/abstract/coinbaseexchange.js +1 -1
- package/dist/cjs/src/abstract/coinbaseinternational.js +1 -1
- package/dist/cjs/src/abstract/coincatch.js +1 -1
- package/dist/cjs/src/abstract/coincheck.js +1 -1
- package/dist/cjs/src/abstract/coinex.js +1 -1
- package/dist/cjs/src/abstract/coinmate.js +1 -1
- package/dist/cjs/src/abstract/coinmetro.js +1 -1
- package/dist/cjs/src/abstract/coinone.js +1 -1
- package/dist/cjs/src/abstract/coinsph.js +1 -1
- package/dist/cjs/src/abstract/coinspot.js +1 -1
- package/dist/cjs/src/abstract/cryptocom.js +1 -1
- package/dist/cjs/src/abstract/cryptomus.js +1 -1
- package/dist/cjs/src/abstract/defx.js +1 -1
- package/dist/cjs/src/abstract/delta.js +1 -1
- package/dist/cjs/src/abstract/deribit.js +1 -1
- package/dist/cjs/src/abstract/derive.js +1 -1
- package/dist/cjs/src/abstract/digifinex.js +1 -1
- package/dist/cjs/src/abstract/ellipx.js +1 -1
- package/dist/cjs/src/abstract/exmo.js +1 -1
- package/dist/cjs/src/abstract/foxbit.js +1 -1
- package/dist/cjs/src/abstract/gate.js +1 -1
- package/dist/cjs/src/abstract/gemini.js +1 -1
- package/dist/cjs/src/abstract/hashkey.js +1 -1
- package/dist/cjs/src/abstract/hibachi.js +9 -0
- package/dist/cjs/src/abstract/hitbtc.js +1 -1
- package/dist/cjs/src/abstract/hollaex.js +1 -1
- package/dist/cjs/src/abstract/htx.js +1 -1
- package/dist/cjs/src/abstract/hyperliquid.js +1 -1
- package/dist/cjs/src/abstract/independentreserve.js +1 -1
- package/dist/cjs/src/abstract/indodax.js +1 -1
- package/dist/cjs/src/abstract/kraken.js +1 -1
- package/dist/cjs/src/abstract/krakenfutures.js +1 -1
- package/dist/cjs/src/abstract/kucoin.js +1 -1
- package/dist/cjs/src/abstract/kucoinfutures.js +1 -1
- package/dist/cjs/src/abstract/latoken.js +1 -1
- package/dist/cjs/src/abstract/lbank.js +1 -1
- package/dist/cjs/src/abstract/luno.js +1 -1
- package/dist/cjs/src/abstract/mercado.js +1 -1
- package/dist/cjs/src/abstract/mexc.js +1 -1
- package/dist/cjs/src/abstract/modetrade.js +1 -1
- package/dist/cjs/src/abstract/ndax.js +1 -1
- package/dist/cjs/src/abstract/novadax.js +1 -1
- package/dist/cjs/src/abstract/oceanex.js +1 -1
- package/dist/cjs/src/abstract/okcoin.js +1 -1
- package/dist/cjs/src/abstract/okx.js +1 -1
- package/dist/cjs/src/abstract/onetrading.js +1 -1
- package/dist/cjs/src/abstract/oxfun.js +1 -1
- package/dist/cjs/src/abstract/p2b.js +1 -1
- package/dist/cjs/src/abstract/paradex.js +1 -1
- package/dist/cjs/src/abstract/paymium.js +1 -1
- package/dist/cjs/src/abstract/phemex.js +1 -1
- package/dist/cjs/src/abstract/poloniex.js +1 -1
- package/dist/cjs/src/abstract/probit.js +1 -1
- package/dist/cjs/src/abstract/timex.js +1 -1
- package/dist/cjs/src/abstract/tokocrypto.js +1 -1
- package/dist/cjs/src/abstract/tradeogre.js +1 -1
- package/dist/cjs/src/abstract/upbit.js +1 -1
- package/dist/cjs/src/abstract/vertex.js +1 -1
- package/dist/cjs/src/abstract/wavesexchange.js +1 -1
- package/dist/cjs/src/abstract/whitebit.js +1 -1
- package/dist/cjs/src/abstract/woo.js +1 -1
- package/dist/cjs/src/abstract/woofipro.js +1 -1
- package/dist/cjs/src/abstract/xt.js +1 -1
- package/dist/cjs/src/abstract/yobit.js +1 -1
- package/dist/cjs/src/abstract/zaif.js +1 -1
- package/dist/cjs/src/abstract/zonda.js +1 -1
- package/dist/cjs/src/alpaca.js +1 -1
- package/dist/cjs/src/apex.js +1 -1
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Precise.js +0 -6
- package/dist/cjs/src/base/errors.js +8 -7
- package/dist/cjs/src/base/functions/crypto.js +1 -1
- package/dist/cjs/src/base/functions/encode.js +1 -1
- package/dist/cjs/src/base/functions/misc.js +0 -1
- package/dist/cjs/src/base/functions/number.js +0 -6
- package/dist/cjs/src/base/functions/platform.js +0 -6
- package/dist/cjs/src/base/functions/rsa.js +0 -1
- package/dist/cjs/src/base/functions/string.js +0 -6
- package/dist/cjs/src/base/functions/throttle.js +1 -1
- package/dist/cjs/src/base/functions/time.js +0 -6
- package/dist/cjs/src/base/functions/totp.js +0 -1
- package/dist/cjs/src/base/functions/type.js +0 -6
- package/dist/cjs/src/base/functions.js +1 -1
- package/dist/cjs/src/base/ws/Cache.js +0 -6
- package/dist/cjs/src/base/ws/Client.js +0 -1
- package/dist/cjs/src/base/ws/Future.js +1 -1
- package/dist/cjs/src/base/ws/OrderBook.js +1 -1
- package/dist/cjs/src/base/ws/OrderBookSide.js +0 -6
- package/dist/cjs/src/base/ws/WsClient.js +1 -1
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bigone.js +1 -1
- package/dist/cjs/src/binance.js +9 -7
- package/dist/cjs/src/binancecoinm.js +1 -1
- package/dist/cjs/src/binanceus.js +1 -1
- package/dist/cjs/src/binanceusdm.js +1 -1
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bit2c.js +1 -1
- package/dist/cjs/src/bitbank.js +1 -1
- package/dist/cjs/src/bitbns.js +1 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitflyer.js +1 -1
- package/dist/cjs/src/bitget.js +2150 -535
- package/dist/cjs/src/bithumb.js +1 -1
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/bitopro.js +1 -1
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/bitteam.js +1 -1
- package/dist/cjs/src/bittrade.js +1 -1
- package/dist/cjs/src/blockchaincom.js +1 -1
- package/dist/cjs/src/blofin.js +1 -1
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcbox.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +7 -2
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coinbaseadvanced.js +1 -1
- package/dist/cjs/src/coincatch.js +1 -1
- package/dist/cjs/src/coincheck.js +1 -1
- package/dist/cjs/src/coinex.js +68 -4
- package/dist/cjs/src/coinmate.js +1 -1
- package/dist/cjs/src/coinmetro.js +3 -4
- package/dist/cjs/src/coinone.js +1 -1
- package/dist/cjs/src/coinsph.js +0 -1
- package/dist/cjs/src/coinspot.js +1 -1
- package/dist/cjs/src/cryptocom.js +3 -2
- package/dist/cjs/src/cryptomus.js +1 -1
- package/dist/cjs/src/defx.js +1 -1
- package/dist/cjs/src/delta.js +1 -1
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/derive.js +1 -1
- package/dist/cjs/src/digifinex.js +1 -1
- package/dist/cjs/src/ellipx.js +1 -1
- package/dist/cjs/src/exmo.js +1 -1
- package/dist/cjs/src/fmfwio.js +1 -1
- package/dist/cjs/src/foxbit.js +1 -1
- package/dist/cjs/src/gate.js +2 -3
- package/dist/cjs/src/gateio.js +1 -1
- package/dist/cjs/src/gemini.js +1 -1
- package/dist/cjs/src/hashkey.js +1 -1
- package/dist/cjs/src/hibachi.js +2136 -0
- package/dist/cjs/src/hitbtc.js +0 -1
- package/dist/cjs/src/hollaex.js +1 -1
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/huobi.js +1 -1
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/independentreserve.js +1 -1
- package/dist/cjs/src/indodax.js +1 -1
- package/dist/cjs/src/kraken.js +1 -1
- package/dist/cjs/src/krakenfutures.js +1 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/latoken.js +1 -1
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/luno.js +1 -1
- package/dist/cjs/src/mercado.js +1 -1
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/modetrade.js +1 -1
- package/dist/cjs/src/myokx.js +1 -1
- package/dist/cjs/src/ndax.js +9 -1
- package/dist/cjs/src/novadax.js +35 -1
- package/dist/cjs/src/oceanex.js +1 -1
- package/dist/cjs/src/okcoin.js +1 -1
- package/dist/cjs/src/okx.js +2 -1
- package/dist/cjs/src/okxus.js +1 -1
- package/dist/cjs/src/onetrading.js +1 -1
- package/dist/cjs/src/oxfun.js +1 -1
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/paradex.js +1 -1
- package/dist/cjs/src/paymium.js +1 -1
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/apex.js +1 -1
- package/dist/cjs/src/pro/ascendex.js +1 -1
- package/dist/cjs/src/pro/bequant.js +1 -1
- package/dist/cjs/src/pro/binance.js +2 -5
- package/dist/cjs/src/pro/binancecoinm.js +1 -1
- package/dist/cjs/src/pro/binanceus.js +1 -1
- package/dist/cjs/src/pro/binanceusdm.js +1 -1
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +1 -1
- package/dist/cjs/src/pro/bitget.js +2 -2
- package/dist/cjs/src/pro/bithumb.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +2 -2
- package/dist/cjs/src/pro/bitrue.js +1 -1
- package/dist/cjs/src/pro/bitstamp.js +2 -2
- package/dist/cjs/src/pro/bitvavo.js +3 -1
- package/dist/cjs/src/pro/blockchaincom.js +1 -1
- package/dist/cjs/src/pro/blofin.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/cex.js +2 -1
- package/dist/cjs/src/pro/coinbase.js +1 -1
- package/dist/cjs/src/pro/coinbaseadvanced.js +1 -1
- package/dist/cjs/src/pro/coinbaseexchange.js +3 -3
- package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
- package/dist/cjs/src/pro/coincatch.js +1 -1
- package/dist/cjs/src/pro/coincheck.js +1 -1
- package/dist/cjs/src/pro/coinex.js +1 -1
- package/dist/cjs/src/pro/coinone.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/defx.js +1 -1
- package/dist/cjs/src/pro/deribit.js +1 -1
- package/dist/cjs/src/pro/exmo.js +1 -1
- package/dist/cjs/src/pro/gate.js +2 -2
- package/dist/cjs/src/pro/gateio.js +1 -1
- package/dist/cjs/src/pro/gemini.js +1 -1
- package/dist/cjs/src/pro/hashkey.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +1 -1
- package/dist/cjs/src/pro/hollaex.js +1 -1
- package/dist/cjs/src/pro/htx.js +2 -2
- package/dist/cjs/src/pro/huobi.js +1 -1
- package/dist/cjs/src/pro/hyperliquid.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +3 -2
- package/dist/cjs/src/pro/kucoin.js +2 -1
- package/dist/cjs/src/pro/kucoinfutures.js +2 -1
- package/dist/cjs/src/pro/lbank.js +0 -1
- package/dist/cjs/src/pro/luno.js +1 -1
- package/dist/cjs/src/pro/mexc.js +1 -1
- package/dist/cjs/src/pro/myokx.js +1 -1
- package/dist/cjs/src/pro/ndax.js +1 -1
- package/dist/cjs/src/pro/okcoin.js +1 -1
- package/dist/cjs/src/pro/okx.js +4 -4
- package/dist/cjs/src/pro/okxus.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +1 -1
- package/dist/cjs/src/pro/oxfun.js +1 -1
- package/dist/cjs/src/pro/p2b.js +1 -1
- package/dist/cjs/src/pro/paradex.js +1 -1
- package/dist/cjs/src/pro/phemex.js +1 -1
- package/dist/cjs/src/pro/poloniex.js +1 -1
- package/dist/cjs/src/pro/probit.js +1 -1
- package/dist/cjs/src/pro/tradeogre.js +1 -1
- package/dist/cjs/src/pro/upbit.js +1 -1
- package/dist/cjs/src/pro/whitebit.js +1 -1
- package/dist/cjs/src/pro/xt.js +1 -1
- package/dist/cjs/src/probit.js +1 -1
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/null.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/string.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +0 -1
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/index.js +10 -1
- package/dist/cjs/src/static_dependencies/ethers/interface.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/typed.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +13 -1
- package/dist/cjs/src/static_dependencies/ethers/utils/data.js +6 -1
- package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +9 -1
- package/dist/cjs/src/static_dependencies/ethers/utils/events.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +7 -1
- package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +5 -1
- package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +0 -6
- package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +8 -1
- package/dist/cjs/src/static_dependencies/fflake/browser.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -6
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -6
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -6
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -6
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -6
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -6
- package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +0 -6
- package/dist/cjs/src/static_dependencies/noble-curves/_shortw_utils.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/curve.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/modular.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/montgomery.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/utils.js +0 -6
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/ed25519.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/p256.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/secp256k1.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/_assert.js +0 -6
- package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/_u64.js +0 -6
- package/dist/cjs/src/static_dependencies/noble-hashes/crypto.js +0 -6
- package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/md5.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/sha1.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/sha256.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/sha512.js +0 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +1 -1
- package/dist/cjs/src/static_dependencies/node-fetch/body.js +5 -1
- package/dist/cjs/src/static_dependencies/node-fetch/errors/abort-error.js +0 -1
- package/dist/cjs/src/static_dependencies/node-fetch/errors/base.js +0 -6
- package/dist/cjs/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -1
- package/dist/cjs/src/static_dependencies/node-fetch/headers.js +5 -1
- package/dist/cjs/src/static_dependencies/node-fetch/index.js +7 -1
- package/dist/cjs/src/static_dependencies/node-fetch/request.js +7 -1
- package/dist/cjs/src/static_dependencies/node-fetch/response.js +5 -1
- package/dist/cjs/src/static_dependencies/node-fetch/utils/get-search.js +0 -6
- package/dist/cjs/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -6
- package/dist/cjs/src/static_dependencies/node-fetch/utils/is.js +0 -6
- package/dist/cjs/src/static_dependencies/node-fetch/utils/referrer.js +0 -1
- package/dist/cjs/src/static_dependencies/proxies/agent-base/index.js +0 -1
- package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -1
- package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -1
- package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -6
- package/dist/cjs/src/static_dependencies/scure-base/index.js +0 -6
- package/dist/cjs/src/static_dependencies/scure-starknet/index.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/constants.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +0 -6
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +1 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +4 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +3 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/num.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +0 -1
- package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +1 -1
- package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +0 -6
- package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +0 -6
- package/dist/cjs/src/timex.js +0 -1
- package/dist/cjs/src/tokocrypto.js +1 -1
- package/dist/cjs/src/tradeogre.js +1 -1
- package/dist/cjs/src/upbit.js +1 -1
- package/dist/cjs/src/vertex.js +1 -1
- package/dist/cjs/src/wavesexchange.js +1 -1
- package/dist/cjs/src/whitebit.js +1 -1
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/woofipro.js +1 -1
- package/dist/cjs/src/xt.js +1 -1
- package/dist/cjs/src/yobit.js +1 -1
- package/dist/cjs/src/zaif.js +1 -1
- package/dist/cjs/src/zonda.js +1 -1
- package/js/ccxt.d.ts +6 -3
- package/js/ccxt.js +5 -3
- package/js/src/abstract/bitget.d.ts +6 -0
- package/js/src/abstract/hibachi.d.ts +29 -0
- package/js/src/abstract/hibachi.js +5 -0
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/errorHierarchy.d.ts +1 -0
- package/js/src/base/errorHierarchy.js +1 -0
- package/js/src/base/errors.d.ts +5 -1
- package/js/src/base/errors.js +8 -2
- package/js/src/binance.js +8 -6
- package/js/src/bitget.d.ts +73 -7
- package/js/src/bitget.js +2149 -534
- package/js/src/bybit.js +6 -1
- package/js/src/coinbaseexchange.d.ts +1 -1
- package/js/src/coinex.d.ts +10 -0
- package/js/src/coinex.js +67 -3
- package/js/src/coinmetro.js +2 -3
- package/js/src/cryptocom.js +2 -1
- package/js/src/gate.js +1 -2
- package/js/src/hibachi.d.ts +346 -0
- package/js/src/hibachi.js +2131 -0
- package/js/src/ndax.js +8 -0
- package/js/src/novadax.js +34 -0
- package/js/src/okx.js +2 -1
- package/js/src/pro/alpaca.d.ts +2 -2
- package/js/src/pro/apex.d.ts +2 -2
- package/js/src/pro/ascendex.d.ts +2 -2
- package/js/src/pro/binance.d.ts +2 -2
- package/js/src/pro/binance.js +2 -5
- package/js/src/pro/bitget.d.ts +2 -2
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bithumb.d.ts +2 -2
- package/js/src/pro/bitmart.d.ts +2 -2
- package/js/src/pro/bitmex.d.ts +3 -3
- package/js/src/pro/bitmex.js +1 -1
- package/js/src/pro/bitstamp.d.ts +2 -2
- package/js/src/pro/bitstamp.js +1 -1
- package/js/src/pro/bittrade.d.ts +2 -2
- package/js/src/pro/bitvavo.d.ts +2 -2
- package/js/src/pro/bitvavo.js +2 -0
- package/js/src/pro/bybit.d.ts +4 -4
- package/js/src/pro/cex.d.ts +2 -2
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/coinbaseexchange.d.ts +4 -4
- package/js/src/pro/coinbaseexchange.js +2 -2
- package/js/src/pro/coinbaseinternational.d.ts +2 -2
- package/js/src/pro/coincatch.d.ts +2 -2
- package/js/src/pro/coinone.d.ts +2 -2
- package/js/src/pro/cryptocom.d.ts +2 -2
- package/js/src/pro/derive.d.ts +2 -2
- package/js/src/pro/gate.d.ts +3 -3
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/hollaex.d.ts +2 -2
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +1 -1
- package/js/src/pro/hyperliquid.d.ts +2 -2
- package/js/src/pro/kraken.d.ts +2 -2
- package/js/src/pro/krakenfutures.d.ts +3 -3
- package/js/src/pro/krakenfutures.js +2 -1
- package/js/src/pro/kucoin.d.ts +2 -2
- package/js/src/pro/kucoin.js +1 -0
- package/js/src/pro/kucoinfutures.d.ts +2 -2
- package/js/src/pro/kucoinfutures.js +1 -0
- package/js/src/pro/modetrade.d.ts +2 -2
- package/js/src/pro/okcoin.d.ts +2 -2
- package/js/src/pro/okx.d.ts +4 -4
- package/js/src/pro/okx.js +3 -3
- package/js/src/pro/onetrading.d.ts +2 -2
- package/js/src/pro/p2b.d.ts +2 -2
- package/js/src/pro/paradex.d.ts +2 -2
- package/js/src/pro/poloniex.d.ts +2 -2
- package/js/src/pro/probit.d.ts +2 -2
- package/js/src/pro/vertex.d.ts +2 -2
- package/js/src/pro/whitebit.d.ts +2 -2
- package/js/src/pro/woo.d.ts +2 -2
- package/js/src/pro/woofipro.d.ts +2 -2
- package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +0 -1
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- package/package.json +2 -2
package/js/src/bitget.js
CHANGED
|
@@ -802,6 +802,7 @@ export default class bitget extends Exchange {
|
|
|
802
802
|
'get': {
|
|
803
803
|
'v3/account/assets': 1,
|
|
804
804
|
'v3/account/settings': 1,
|
|
805
|
+
'v3/account/deposit-records': 2,
|
|
805
806
|
'v3/account/financial-records': 1,
|
|
806
807
|
'v3/account/repayable-coins': 2,
|
|
807
808
|
'v3/account/payment-coins': 2,
|
|
@@ -820,7 +821,9 @@ export default class bitget extends Exchange {
|
|
|
820
821
|
'v3/position/history-position': 1,
|
|
821
822
|
'v3/trade/order-info': 1,
|
|
822
823
|
'v3/trade/unfilled-orders': 1,
|
|
824
|
+
'v3/trade/unfilled-strategy-orders': 1,
|
|
823
825
|
'v3/trade/history-orders': 1,
|
|
826
|
+
'v3/trade/history-strategy-orders': 1,
|
|
824
827
|
'v3/trade/fills': 1,
|
|
825
828
|
'v3/user/sub-list': 2,
|
|
826
829
|
'v3/user/sub-api-list': 2,
|
|
@@ -834,8 +837,11 @@ export default class bitget extends Exchange {
|
|
|
834
837
|
'v3/account/max-open-available': 4,
|
|
835
838
|
'v3/ins-loan/bind-uid': 6.6667,
|
|
836
839
|
'v3/trade/place-order': 2,
|
|
840
|
+
'v3/trade/place-strategy-order': 2,
|
|
837
841
|
'v3/trade/modify-order': 2,
|
|
842
|
+
'v3/trade/modify-strategy-order': 2,
|
|
838
843
|
'v3/trade/cancel-order': 2,
|
|
844
|
+
'v3/trade/cancel-strategy-order': 2,
|
|
839
845
|
'v3/trade/place-batch': 4,
|
|
840
846
|
'v3/trade/batch-modify-order': 2,
|
|
841
847
|
'v3/trade/cancel-batch': 4,
|
|
@@ -881,6 +887,7 @@ export default class bitget extends Exchange {
|
|
|
881
887
|
// '0': ExchangeError, // 200 successful,when the order placement / cancellation / operation is successful
|
|
882
888
|
'4001': ExchangeError,
|
|
883
889
|
'4002': ExchangeError,
|
|
890
|
+
'40020': BadRequest,
|
|
884
891
|
// --------------------------------------------------------
|
|
885
892
|
'30001': AuthenticationError,
|
|
886
893
|
'30002': AuthenticationError,
|
|
@@ -1425,6 +1432,19 @@ export default class bitget extends Exchange {
|
|
|
1425
1432
|
'1w': '1Wutc',
|
|
1426
1433
|
'1M': '1Mutc',
|
|
1427
1434
|
},
|
|
1435
|
+
'uta': {
|
|
1436
|
+
'1m': '1m',
|
|
1437
|
+
'3m': '3m',
|
|
1438
|
+
'5m': '5m',
|
|
1439
|
+
'15m': '15m',
|
|
1440
|
+
'30m': '30m',
|
|
1441
|
+
'1h': '1H',
|
|
1442
|
+
'2h': '2H',
|
|
1443
|
+
'4h': '4H',
|
|
1444
|
+
'6h': '6H',
|
|
1445
|
+
'12h': '12H',
|
|
1446
|
+
'1d': '1D',
|
|
1447
|
+
},
|
|
1428
1448
|
},
|
|
1429
1449
|
'fetchMarkets': {
|
|
1430
1450
|
'types': ['spot', 'swap'], // there is future markets but they use the same endpoints as swap
|
|
@@ -1514,7 +1534,6 @@ export default class bitget extends Exchange {
|
|
|
1514
1534
|
'ERC20': 'ERC20',
|
|
1515
1535
|
'BEP20': 'BSC',
|
|
1516
1536
|
// 'BEP20': 'BEP20', // different for BEP20
|
|
1517
|
-
'BSC': 'BEP20',
|
|
1518
1537
|
'ATOM': 'ATOM',
|
|
1519
1538
|
'ACA': 'AcalaToken',
|
|
1520
1539
|
'APT': 'Aptos',
|
|
@@ -1768,10 +1787,20 @@ export default class bitget extends Exchange {
|
|
|
1768
1787
|
defaultProductType = (subType === 'linear') ? 'USDT-FUTURES' : 'COIN-FUTURES';
|
|
1769
1788
|
// }
|
|
1770
1789
|
}
|
|
1771
|
-
let productType = this.
|
|
1790
|
+
let productType = this.safeString2(params, 'productType', 'category', defaultProductType);
|
|
1772
1791
|
if ((productType === undefined) && (market !== undefined)) {
|
|
1773
1792
|
const settle = market['settle'];
|
|
1774
|
-
if (
|
|
1793
|
+
if (market['spot']) {
|
|
1794
|
+
let marginMode = undefined;
|
|
1795
|
+
[marginMode, params] = this.handleMarginModeAndParams('handleProductTypeAndParams', params);
|
|
1796
|
+
if (marginMode !== undefined) {
|
|
1797
|
+
productType = 'MARGIN';
|
|
1798
|
+
}
|
|
1799
|
+
else {
|
|
1800
|
+
productType = 'SPOT';
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
else if (settle === 'USDT') {
|
|
1775
1804
|
productType = 'USDT-FUTURES';
|
|
1776
1805
|
}
|
|
1777
1806
|
else if (settle === 'USDC') {
|
|
@@ -1791,9 +1820,9 @@ export default class bitget extends Exchange {
|
|
|
1791
1820
|
}
|
|
1792
1821
|
}
|
|
1793
1822
|
if (productType === undefined) {
|
|
1794
|
-
throw new ArgumentsRequired(this.id + ' requires a productType param, one of "USDT-FUTURES", "USDC-FUTURES", "COIN-FUTURES", "SUSDT-FUTURES", "SUSDC-FUTURES"
|
|
1823
|
+
throw new ArgumentsRequired(this.id + ' requires a productType param, one of "USDT-FUTURES", "USDC-FUTURES", "COIN-FUTURES", "SUSDT-FUTURES", "SUSDC-FUTURES", "SCOIN-FUTURES" or for uta only "SPOT"');
|
|
1795
1824
|
}
|
|
1796
|
-
params = this.omit(params, 'productType');
|
|
1825
|
+
params = this.omit(params, ['productType', 'category']);
|
|
1797
1826
|
return [productType, params];
|
|
1798
1827
|
}
|
|
1799
1828
|
/**
|
|
@@ -1826,9 +1855,9 @@ export default class bitget extends Exchange {
|
|
|
1826
1855
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Symbols
|
|
1827
1856
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts
|
|
1828
1857
|
* @see https://www.bitget.com/api-doc/margin/common/support-currencies
|
|
1829
|
-
* @see https://www.bitget.
|
|
1858
|
+
* @see https://www.bitget.com/api-doc/uta/public/Instruments
|
|
1830
1859
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1831
|
-
* @param {
|
|
1860
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
1832
1861
|
* @returns {object[]} an array of objects representing market data
|
|
1833
1862
|
*/
|
|
1834
1863
|
async fetchMarkets(params = {}) {
|
|
@@ -2474,11 +2503,13 @@ export default class bitget extends Exchange {
|
|
|
2474
2503
|
* @see https://www.bitget.com/api-doc/contract/position/Get-Query-Position-Lever
|
|
2475
2504
|
* @see https://www.bitget.com/api-doc/margin/cross/account/Cross-Tier-Data
|
|
2476
2505
|
* @see https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Tier-Data
|
|
2506
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Position-Tier-Data
|
|
2477
2507
|
* @param {string} symbol unified market symbol
|
|
2478
2508
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2479
2509
|
* @param {string} [params.marginMode] for spot margin 'cross' or 'isolated', default is 'isolated'
|
|
2480
2510
|
* @param {string} [params.code] required for cross spot margin
|
|
2481
|
-
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
2511
|
+
* @param {string} [params.productType] *contract and uta only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
2512
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
2482
2513
|
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
2483
2514
|
*/
|
|
2484
2515
|
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
@@ -2487,10 +2518,22 @@ export default class bitget extends Exchange {
|
|
|
2487
2518
|
const request = {};
|
|
2488
2519
|
let response = undefined;
|
|
2489
2520
|
let marginMode = undefined;
|
|
2521
|
+
let productType = undefined;
|
|
2522
|
+
let uta = undefined;
|
|
2490
2523
|
[marginMode, params] = this.handleMarginModeAndParams('fetchMarketLeverageTiers', params, 'isolated');
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2524
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
2525
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchMarketLeverageTiers', 'uta', false);
|
|
2526
|
+
if (uta) {
|
|
2527
|
+
if (productType === 'SPOT') {
|
|
2528
|
+
if (marginMode !== undefined) {
|
|
2529
|
+
productType = 'MARGIN';
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
request['symbol'] = market['id'];
|
|
2533
|
+
request['category'] = productType;
|
|
2534
|
+
response = await this.publicUtaGetV3MarketPositionTier(this.extend(request, params));
|
|
2535
|
+
}
|
|
2536
|
+
else if ((market['swap']) || (market['future'])) {
|
|
2494
2537
|
request['productType'] = productType;
|
|
2495
2538
|
request['symbol'] = market['id'];
|
|
2496
2539
|
response = await this.publicMixGetV2MixMarketQueryPositionLever(this.extend(request, params));
|
|
@@ -2569,6 +2612,23 @@ export default class bitget extends Exchange {
|
|
|
2569
2612
|
// ]
|
|
2570
2613
|
// }
|
|
2571
2614
|
//
|
|
2615
|
+
// uta
|
|
2616
|
+
//
|
|
2617
|
+
// {
|
|
2618
|
+
// "code": "00000",
|
|
2619
|
+
// "msg": "success",
|
|
2620
|
+
// "requestTime": 1752735673127,
|
|
2621
|
+
// "data": [
|
|
2622
|
+
// {
|
|
2623
|
+
// "tier": "1",
|
|
2624
|
+
// "minTierValue": "0",
|
|
2625
|
+
// "maxTierValue": "150000",
|
|
2626
|
+
// "leverage": "125",
|
|
2627
|
+
// "mmr": "0.004"
|
|
2628
|
+
// },
|
|
2629
|
+
// ]
|
|
2630
|
+
// }
|
|
2631
|
+
//
|
|
2572
2632
|
const result = this.safeValue(response, 'data', []);
|
|
2573
2633
|
return this.parseMarketLeverageTiers(result, market);
|
|
2574
2634
|
}
|
|
@@ -2609,15 +2669,25 @@ export default class bitget extends Exchange {
|
|
|
2609
2669
|
// "maintainMarginRate": "0.1"
|
|
2610
2670
|
// }
|
|
2611
2671
|
//
|
|
2672
|
+
// uta
|
|
2673
|
+
//
|
|
2674
|
+
// {
|
|
2675
|
+
// "tier": "1",
|
|
2676
|
+
// "minTierValue": "0",
|
|
2677
|
+
// "maxTierValue": "150000",
|
|
2678
|
+
// "leverage": "125",
|
|
2679
|
+
// "mmr": "0.004"
|
|
2680
|
+
// }
|
|
2681
|
+
//
|
|
2612
2682
|
const tiers = [];
|
|
2613
2683
|
let minNotional = 0;
|
|
2614
2684
|
for (let i = 0; i < info.length; i++) {
|
|
2615
2685
|
const item = info[i];
|
|
2616
|
-
const minimumNotional = this.
|
|
2686
|
+
const minimumNotional = this.safeNumber2(item, 'startUnit', 'minTierValue');
|
|
2617
2687
|
if (minimumNotional !== undefined) {
|
|
2618
2688
|
minNotional = minimumNotional;
|
|
2619
2689
|
}
|
|
2620
|
-
const maxNotional = this.safeNumberN(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount']);
|
|
2690
|
+
const maxNotional = this.safeNumberN(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount', 'maxTierValue']);
|
|
2621
2691
|
const marginCurrency = this.safeString2(item, 'coin', 'baseCoin');
|
|
2622
2692
|
const currencyId = (marginCurrency !== undefined) ? marginCurrency : market['base'];
|
|
2623
2693
|
const marketId = this.safeString(item, 'symbol');
|
|
@@ -2627,7 +2697,7 @@ export default class bitget extends Exchange {
|
|
|
2627
2697
|
'currency': this.safeCurrencyCode(currencyId),
|
|
2628
2698
|
'minNotional': minNotional,
|
|
2629
2699
|
'maxNotional': maxNotional,
|
|
2630
|
-
'maintenanceMarginRate': this.
|
|
2700
|
+
'maintenanceMarginRate': this.safeNumberN(item, ['keepMarginRate', 'maintainMarginRate', 'mmr']),
|
|
2631
2701
|
'maxLeverage': this.safeNumber(item, 'leverage'),
|
|
2632
2702
|
'info': item,
|
|
2633
2703
|
});
|
|
@@ -2986,9 +3056,11 @@ export default class bitget extends Exchange {
|
|
|
2986
3056
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
2987
3057
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Orderbook
|
|
2988
3058
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Merge-Depth
|
|
3059
|
+
* @see https://www.bitget.com/api-doc/uta/public/OrderBook
|
|
2989
3060
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2990
3061
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2991
3062
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3063
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
2992
3064
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2993
3065
|
*/
|
|
2994
3066
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
@@ -3000,13 +3072,19 @@ export default class bitget extends Exchange {
|
|
|
3000
3072
|
if (limit !== undefined) {
|
|
3001
3073
|
request['limit'] = limit;
|
|
3002
3074
|
}
|
|
3075
|
+
let productType = undefined;
|
|
3076
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3003
3077
|
let response = undefined;
|
|
3004
|
-
|
|
3078
|
+
let uta = undefined;
|
|
3079
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchOrderBook', 'uta', false);
|
|
3080
|
+
if (uta) {
|
|
3081
|
+
request['category'] = productType;
|
|
3082
|
+
response = await this.publicUtaGetV3MarketOrderbook(this.extend(request, params));
|
|
3083
|
+
}
|
|
3084
|
+
else if (market['spot']) {
|
|
3005
3085
|
response = await this.publicSpotGetV2SpotMarketOrderbook(this.extend(request, params));
|
|
3006
3086
|
}
|
|
3007
3087
|
else {
|
|
3008
|
-
let productType = undefined;
|
|
3009
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3010
3088
|
request['productType'] = productType;
|
|
3011
3089
|
response = await this.publicMixGetV2MixMarketMergeDepth(this.extend(request, params));
|
|
3012
3090
|
}
|
|
@@ -3022,9 +3100,24 @@ export default class bitget extends Exchange {
|
|
|
3022
3100
|
// }
|
|
3023
3101
|
// }
|
|
3024
3102
|
//
|
|
3103
|
+
// uta
|
|
3104
|
+
//
|
|
3105
|
+
// {
|
|
3106
|
+
// "code": "00000",
|
|
3107
|
+
// "msg": "success",
|
|
3108
|
+
// "requestTime": 1750329437753,
|
|
3109
|
+
// "data": {
|
|
3110
|
+
// "a": [ [ 104992.60, 0.018411 ] ],
|
|
3111
|
+
// "b":[ [104927.40, 0.229914 ] ],
|
|
3112
|
+
// "ts": "1750329437763"
|
|
3113
|
+
// }
|
|
3114
|
+
// }
|
|
3115
|
+
//
|
|
3025
3116
|
const data = this.safeValue(response, 'data', {});
|
|
3117
|
+
const bidsKey = uta ? 'b' : 'bids';
|
|
3118
|
+
const asksKey = uta ? 'a' : 'asks';
|
|
3026
3119
|
const timestamp = this.safeInteger(data, 'ts');
|
|
3027
|
-
return this.parseOrderBook(data, market['symbol'], timestamp);
|
|
3120
|
+
return this.parseOrderBook(data, market['symbol'], timestamp, bidsKey, asksKey);
|
|
3028
3121
|
}
|
|
3029
3122
|
parseTicker(ticker, market = undefined) {
|
|
3030
3123
|
//
|
|
@@ -3036,7 +3129,7 @@ export default class bitget extends Exchange {
|
|
|
3036
3129
|
// "ts": "1695793390482"
|
|
3037
3130
|
// }
|
|
3038
3131
|
//
|
|
3039
|
-
// spot
|
|
3132
|
+
// spot
|
|
3040
3133
|
//
|
|
3041
3134
|
// {
|
|
3042
3135
|
// "open": "37202.46",
|
|
@@ -3057,92 +3150,118 @@ export default class bitget extends Exchange {
|
|
|
3057
3150
|
// "change24h": "0.00321"
|
|
3058
3151
|
// }
|
|
3059
3152
|
//
|
|
3060
|
-
// swap and future
|
|
3153
|
+
// swap and future
|
|
3061
3154
|
//
|
|
3062
3155
|
// {
|
|
3063
3156
|
// "symbol": "BTCUSDT",
|
|
3064
|
-
// "lastPr": "
|
|
3065
|
-
// "askPr": "
|
|
3066
|
-
// "bidPr": "
|
|
3067
|
-
// "bidSz": "
|
|
3068
|
-
// "askSz": "
|
|
3069
|
-
// "high24h": "
|
|
3070
|
-
// "low24h": "
|
|
3071
|
-
// "ts": "
|
|
3072
|
-
// "change24h": "0.
|
|
3073
|
-
// "baseVolume": "
|
|
3074
|
-
// "quoteVolume": "
|
|
3075
|
-
// "usdtVolume": "
|
|
3076
|
-
// "openUtc": "
|
|
3077
|
-
// "changeUtc24h": "0.
|
|
3078
|
-
// "indexPrice": "
|
|
3079
|
-
// "fundingRate": "0.
|
|
3080
|
-
// "holdingAmount": "
|
|
3157
|
+
// "lastPr": "104823.8",
|
|
3158
|
+
// "askPr": "104823.8",
|
|
3159
|
+
// "bidPr": "104823.5",
|
|
3160
|
+
// "bidSz": "0.703",
|
|
3161
|
+
// "askSz": "13.894",
|
|
3162
|
+
// "high24h": "105289.3",
|
|
3163
|
+
// "low24h": "103447.9",
|
|
3164
|
+
// "ts": "1750332210370",
|
|
3165
|
+
// "change24h": "0.00471",
|
|
3166
|
+
// "baseVolume": "79089.5675",
|
|
3167
|
+
// "quoteVolume": "8274870921.80485",
|
|
3168
|
+
// "usdtVolume": "8274870921.80485",
|
|
3169
|
+
// "openUtc": "104833",
|
|
3170
|
+
// "changeUtc24h": "-0.00009",
|
|
3171
|
+
// "indexPrice": "104881.953125",
|
|
3172
|
+
// "fundingRate": "-0.000014",
|
|
3173
|
+
// "holdingAmount": "7452.6421",
|
|
3081
3174
|
// "deliveryStartTime": null,
|
|
3082
3175
|
// "deliveryTime": null,
|
|
3083
3176
|
// "deliveryStatus": "",
|
|
3084
|
-
// "open24h": "
|
|
3177
|
+
// "open24h": "104332.3",
|
|
3178
|
+
// "markPrice": "104824.2"
|
|
3179
|
+
// }
|
|
3180
|
+
//
|
|
3181
|
+
// spot uta
|
|
3182
|
+
//
|
|
3183
|
+
// {
|
|
3184
|
+
// "category": "SPOT",
|
|
3185
|
+
// "symbol": "BTCUSDT",
|
|
3186
|
+
// "ts": "1750330651972",
|
|
3187
|
+
// "lastPrice": "104900.2",
|
|
3188
|
+
// "openPrice24h": "104321.2",
|
|
3189
|
+
// "highPrice24h": "107956.8",
|
|
3190
|
+
// "lowPrice24h": "103600.1",
|
|
3191
|
+
// "ask1Price": "104945.8",
|
|
3192
|
+
// "bid1Price": "104880.6",
|
|
3193
|
+
// "bid1Size": "0.266534",
|
|
3194
|
+
// "ask1Size": "0.014001",
|
|
3195
|
+
// "price24hPcnt": "0.00555",
|
|
3196
|
+
// "volume24h": "355.941109",
|
|
3197
|
+
// "turnover24h": "37302936.008134"
|
|
3085
3198
|
// }
|
|
3086
3199
|
//
|
|
3087
|
-
// swap and future
|
|
3200
|
+
// swap and future uta
|
|
3088
3201
|
//
|
|
3089
3202
|
// {
|
|
3090
|
-
// "
|
|
3091
|
-
// "symbol": "
|
|
3092
|
-
// "
|
|
3093
|
-
// "
|
|
3094
|
-
// "
|
|
3095
|
-
// "
|
|
3096
|
-
// "
|
|
3097
|
-
// "
|
|
3098
|
-
// "
|
|
3099
|
-
// "
|
|
3100
|
-
// "
|
|
3101
|
-
// "
|
|
3102
|
-
// "
|
|
3103
|
-
// "
|
|
3104
|
-
// "
|
|
3105
|
-
// "
|
|
3203
|
+
// "category": "USDT-FUTURES",
|
|
3204
|
+
// "symbol": "BTCUSDT",
|
|
3205
|
+
// "ts": "1750332730472",
|
|
3206
|
+
// "lastPrice": "104738",
|
|
3207
|
+
// "openPrice24h": "104374",
|
|
3208
|
+
// "highPrice24h": "105289.3",
|
|
3209
|
+
// "lowPrice24h": "103447.9",
|
|
3210
|
+
// "ask1Price": "104738",
|
|
3211
|
+
// "bid1Price": "104737.7",
|
|
3212
|
+
// "bid1Size": "2.036",
|
|
3213
|
+
// "ask1Size": "8.094",
|
|
3214
|
+
// "price24hPcnt": "0.00349",
|
|
3215
|
+
// "volume24h": "79101.6477",
|
|
3216
|
+
// "turnover24h": "8276293391.45973",
|
|
3217
|
+
// "indexPrice": "104785.956168",
|
|
3218
|
+
// "markPrice": "104738",
|
|
3219
|
+
// "fundingRate": "-0.000007",
|
|
3220
|
+
// "openInterest": "7465.5938",
|
|
3221
|
+
// "deliveryStartTime": "",
|
|
3222
|
+
// "deliveryTime": "",
|
|
3223
|
+
// "deliveryStatus": ""
|
|
3106
3224
|
// }
|
|
3107
3225
|
//
|
|
3108
3226
|
const marketId = this.safeString(ticker, 'symbol');
|
|
3109
|
-
const close = this.
|
|
3227
|
+
const close = this.safeString2(ticker, 'lastPr', 'lastPrice');
|
|
3110
3228
|
const timestamp = this.safeIntegerOmitZero(ticker, 'ts'); // exchange bitget provided 0
|
|
3111
3229
|
const change = this.safeString(ticker, 'change24h');
|
|
3112
|
-
const
|
|
3113
|
-
const
|
|
3114
|
-
let
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
symbol = this.safeSymbol(marketId, market, undefined, 'contract');
|
|
3118
|
-
openValue = open24;
|
|
3230
|
+
const category = this.safeString(ticker, 'category');
|
|
3231
|
+
const markPrice = this.safeString(ticker, 'markPrice');
|
|
3232
|
+
let marketType;
|
|
3233
|
+
if ((markPrice !== undefined) && (category !== 'SPOT')) {
|
|
3234
|
+
marketType = 'contract';
|
|
3119
3235
|
}
|
|
3120
3236
|
else {
|
|
3121
|
-
|
|
3122
|
-
|
|
3237
|
+
marketType = 'spot';
|
|
3238
|
+
}
|
|
3239
|
+
let percentage = this.safeString(ticker, 'price24hPcnt');
|
|
3240
|
+
if (percentage === undefined) {
|
|
3241
|
+
percentage = Precise.stringMul(change, '100');
|
|
3123
3242
|
}
|
|
3124
3243
|
return this.safeTicker({
|
|
3125
|
-
'symbol':
|
|
3244
|
+
'symbol': this.safeSymbol(marketId, market, undefined, marketType),
|
|
3126
3245
|
'timestamp': timestamp,
|
|
3127
3246
|
'datetime': this.iso8601(timestamp),
|
|
3128
|
-
'high': this.
|
|
3129
|
-
'low': this.
|
|
3130
|
-
'bid': this.
|
|
3131
|
-
'bidVolume': this.
|
|
3132
|
-
'ask': this.
|
|
3133
|
-
'askVolume': this.
|
|
3247
|
+
'high': this.safeString2(ticker, 'high24h', 'highPrice24h'),
|
|
3248
|
+
'low': this.safeString2(ticker, 'low24h', 'lowPrice24h'),
|
|
3249
|
+
'bid': this.safeString2(ticker, 'bidPr', 'bid1Price'),
|
|
3250
|
+
'bidVolume': this.safeString2(ticker, 'bidSz', 'bid1Size'),
|
|
3251
|
+
'ask': this.safeString2(ticker, 'askPr', 'ask1Price'),
|
|
3252
|
+
'askVolume': this.safeString2(ticker, 'askSz', 'ask1Size'),
|
|
3134
3253
|
'vwap': undefined,
|
|
3135
|
-
'open':
|
|
3254
|
+
'open': this.safeStringN(ticker, ['open', 'open24h', 'openPrice24h']),
|
|
3136
3255
|
'close': close,
|
|
3137
3256
|
'last': close,
|
|
3138
3257
|
'previousClose': undefined,
|
|
3139
3258
|
'change': change,
|
|
3140
|
-
'percentage':
|
|
3259
|
+
'percentage': percentage,
|
|
3141
3260
|
'average': undefined,
|
|
3142
|
-
'baseVolume': this.
|
|
3143
|
-
'quoteVolume': this.
|
|
3261
|
+
'baseVolume': this.safeString2(ticker, 'baseVolume', 'volume24h'),
|
|
3262
|
+
'quoteVolume': this.safeString2(ticker, 'quoteVolume', 'turnover24h'),
|
|
3144
3263
|
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
3145
|
-
'markPrice':
|
|
3264
|
+
'markPrice': markPrice,
|
|
3146
3265
|
'info': ticker,
|
|
3147
3266
|
}, market);
|
|
3148
3267
|
}
|
|
@@ -3152,8 +3271,10 @@ export default class bitget extends Exchange {
|
|
|
3152
3271
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
3153
3272
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Tickers
|
|
3154
3273
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Ticker
|
|
3274
|
+
* @see https://www.bitget.com/api-doc/uta/public/Tickers
|
|
3155
3275
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
3156
3276
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3277
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
3157
3278
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3158
3279
|
*/
|
|
3159
3280
|
async fetchTicker(symbol, params = {}) {
|
|
@@ -3162,13 +3283,19 @@ export default class bitget extends Exchange {
|
|
|
3162
3283
|
const request = {
|
|
3163
3284
|
'symbol': market['id'],
|
|
3164
3285
|
};
|
|
3286
|
+
let productType = undefined;
|
|
3287
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3165
3288
|
let response = undefined;
|
|
3166
|
-
|
|
3289
|
+
let uta = undefined;
|
|
3290
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchTicker', 'uta', false);
|
|
3291
|
+
if (uta) {
|
|
3292
|
+
request['category'] = productType;
|
|
3293
|
+
response = await this.publicUtaGetV3MarketTickers(this.extend(request, params));
|
|
3294
|
+
}
|
|
3295
|
+
else if (market['spot']) {
|
|
3167
3296
|
response = await this.publicSpotGetV2SpotMarketTickers(this.extend(request, params));
|
|
3168
3297
|
}
|
|
3169
3298
|
else {
|
|
3170
|
-
let productType = undefined;
|
|
3171
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3172
3299
|
request['productType'] = productType;
|
|
3173
3300
|
response = await this.publicMixGetV2MixMarketTicker(this.extend(request, params));
|
|
3174
3301
|
}
|
|
@@ -3203,34 +3330,94 @@ export default class bitget extends Exchange {
|
|
|
3203
3330
|
//
|
|
3204
3331
|
// swap and future
|
|
3205
3332
|
//
|
|
3206
|
-
//
|
|
3333
|
+
// {
|
|
3207
3334
|
// "code": "00000",
|
|
3208
3335
|
// "msg": "success",
|
|
3209
|
-
// "requestTime":
|
|
3336
|
+
// "requestTime": 1750332210369,
|
|
3210
3337
|
// "data": [
|
|
3211
3338
|
// {
|
|
3212
3339
|
// "symbol": "BTCUSDT",
|
|
3213
|
-
// "lastPr": "
|
|
3214
|
-
// "askPr": "
|
|
3215
|
-
// "bidPr": "
|
|
3216
|
-
// "bidSz": "
|
|
3217
|
-
// "askSz": "
|
|
3218
|
-
// "high24h": "
|
|
3219
|
-
// "low24h": "
|
|
3220
|
-
// "ts": "
|
|
3221
|
-
// "change24h": "0.
|
|
3222
|
-
// "baseVolume": "
|
|
3223
|
-
// "quoteVolume": "
|
|
3224
|
-
// "usdtVolume": "
|
|
3225
|
-
// "openUtc": "
|
|
3226
|
-
// "changeUtc24h": "0.
|
|
3227
|
-
// "indexPrice": "
|
|
3228
|
-
// "fundingRate": "0.
|
|
3229
|
-
// "holdingAmount": "
|
|
3340
|
+
// "lastPr": "104823.8",
|
|
3341
|
+
// "askPr": "104823.8",
|
|
3342
|
+
// "bidPr": "104823.5",
|
|
3343
|
+
// "bidSz": "0.703",
|
|
3344
|
+
// "askSz": "13.894",
|
|
3345
|
+
// "high24h": "105289.3",
|
|
3346
|
+
// "low24h": "103447.9",
|
|
3347
|
+
// "ts": "1750332210370",
|
|
3348
|
+
// "change24h": "0.00471",
|
|
3349
|
+
// "baseVolume": "79089.5675",
|
|
3350
|
+
// "quoteVolume": "8274870921.80485",
|
|
3351
|
+
// "usdtVolume": "8274870921.80485",
|
|
3352
|
+
// "openUtc": "104833",
|
|
3353
|
+
// "changeUtc24h": "-0.00009",
|
|
3354
|
+
// "indexPrice": "104881.953125",
|
|
3355
|
+
// "fundingRate": "-0.000014",
|
|
3356
|
+
// "holdingAmount": "7452.6421",
|
|
3230
3357
|
// "deliveryStartTime": null,
|
|
3231
3358
|
// "deliveryTime": null,
|
|
3232
3359
|
// "deliveryStatus": "",
|
|
3233
|
-
// "open24h": "
|
|
3360
|
+
// "open24h": "104332.3",
|
|
3361
|
+
// "markPrice": "104824.2"
|
|
3362
|
+
// }
|
|
3363
|
+
// ]
|
|
3364
|
+
// }
|
|
3365
|
+
//
|
|
3366
|
+
// spot uta
|
|
3367
|
+
//
|
|
3368
|
+
// {
|
|
3369
|
+
// "code": "00000",
|
|
3370
|
+
// "msg": "success",
|
|
3371
|
+
// "requestTime": 1750330653575,
|
|
3372
|
+
// "data": [
|
|
3373
|
+
// {
|
|
3374
|
+
// "category": "SPOT",
|
|
3375
|
+
// "symbol": "BTCUSDT",
|
|
3376
|
+
// "ts": "1750330651972",
|
|
3377
|
+
// "lastPrice": "104900.2",
|
|
3378
|
+
// "openPrice24h": "104321.2",
|
|
3379
|
+
// "highPrice24h": "107956.8",
|
|
3380
|
+
// "lowPrice24h": "103600.1",
|
|
3381
|
+
// "ask1Price": "104945.8",
|
|
3382
|
+
// "bid1Price": "104880.6",
|
|
3383
|
+
// "bid1Size": "0.266534",
|
|
3384
|
+
// "ask1Size": "0.014001",
|
|
3385
|
+
// "price24hPcnt": "0.00555",
|
|
3386
|
+
// "volume24h": "355.941109",
|
|
3387
|
+
// "turnover24h": "37302936.008134"
|
|
3388
|
+
// }
|
|
3389
|
+
// ]
|
|
3390
|
+
// }
|
|
3391
|
+
//
|
|
3392
|
+
// swap and future uta
|
|
3393
|
+
//
|
|
3394
|
+
// {
|
|
3395
|
+
// "code": "00000",
|
|
3396
|
+
// "msg": "success",
|
|
3397
|
+
// "requestTime": 1750332731203,
|
|
3398
|
+
// "data": [
|
|
3399
|
+
// {
|
|
3400
|
+
// "category": "USDT-FUTURES",
|
|
3401
|
+
// "symbol": "BTCUSDT",
|
|
3402
|
+
// "ts": "1750332730472",
|
|
3403
|
+
// "lastPrice": "104738",
|
|
3404
|
+
// "openPrice24h": "104374",
|
|
3405
|
+
// "highPrice24h": "105289.3",
|
|
3406
|
+
// "lowPrice24h": "103447.9",
|
|
3407
|
+
// "ask1Price": "104738",
|
|
3408
|
+
// "bid1Price": "104737.7",
|
|
3409
|
+
// "bid1Size": "2.036",
|
|
3410
|
+
// "ask1Size": "8.094",
|
|
3411
|
+
// "price24hPcnt": "0.00349",
|
|
3412
|
+
// "volume24h": "79101.6477",
|
|
3413
|
+
// "turnover24h": "8276293391.45973",
|
|
3414
|
+
// "indexPrice": "104785.956168",
|
|
3415
|
+
// "markPrice": "104738",
|
|
3416
|
+
// "fundingRate": "-0.000007",
|
|
3417
|
+
// "openInterest": "7465.5938",
|
|
3418
|
+
// "deliveryStartTime": "",
|
|
3419
|
+
// "deliveryTime": "",
|
|
3420
|
+
// "deliveryStatus": ""
|
|
3234
3421
|
// }
|
|
3235
3422
|
// ]
|
|
3236
3423
|
// }
|
|
@@ -3272,8 +3459,10 @@ export default class bitget extends Exchange {
|
|
|
3272
3459
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
3273
3460
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Tickers
|
|
3274
3461
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
|
|
3462
|
+
* @see https://www.bitget.com/api-doc/uta/public/Tickers
|
|
3275
3463
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
3276
3464
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3465
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
3277
3466
|
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
3278
3467
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
3279
3468
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -3296,7 +3485,17 @@ export default class bitget extends Exchange {
|
|
|
3296
3485
|
let productType = undefined;
|
|
3297
3486
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3298
3487
|
// only if passedSubType && productType is undefined, then use spot
|
|
3299
|
-
|
|
3488
|
+
let uta = undefined;
|
|
3489
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchTickers', 'uta', false);
|
|
3490
|
+
if (uta) {
|
|
3491
|
+
const symbolsLength = symbols.length;
|
|
3492
|
+
if ((symbols !== undefined) && (symbolsLength === 1)) {
|
|
3493
|
+
request['symbol'] = market['id'];
|
|
3494
|
+
}
|
|
3495
|
+
request['category'] = productType;
|
|
3496
|
+
response = await this.publicUtaGetV3MarketTickers(this.extend(request, params));
|
|
3497
|
+
}
|
|
3498
|
+
else if (type === 'spot' && passedSubType === undefined) {
|
|
3300
3499
|
response = await this.publicSpotGetV2SpotMarketTickers(this.extend(request, params));
|
|
3301
3500
|
}
|
|
3302
3501
|
else {
|
|
@@ -3360,6 +3559,65 @@ export default class bitget extends Exchange {
|
|
|
3360
3559
|
// ]
|
|
3361
3560
|
// }
|
|
3362
3561
|
//
|
|
3562
|
+
// spot uta
|
|
3563
|
+
//
|
|
3564
|
+
// {
|
|
3565
|
+
// "code": "00000",
|
|
3566
|
+
// "msg": "success",
|
|
3567
|
+
// "requestTime": 1750330653575,
|
|
3568
|
+
// "data": [
|
|
3569
|
+
// {
|
|
3570
|
+
// "category": "SPOT",
|
|
3571
|
+
// "symbol": "BTCUSDT",
|
|
3572
|
+
// "ts": "1750330651972",
|
|
3573
|
+
// "lastPrice": "104900.2",
|
|
3574
|
+
// "openPrice24h": "104321.2",
|
|
3575
|
+
// "highPrice24h": "107956.8",
|
|
3576
|
+
// "lowPrice24h": "103600.1",
|
|
3577
|
+
// "ask1Price": "104945.8",
|
|
3578
|
+
// "bid1Price": "104880.6",
|
|
3579
|
+
// "bid1Size": "0.266534",
|
|
3580
|
+
// "ask1Size": "0.014001",
|
|
3581
|
+
// "price24hPcnt": "0.00555",
|
|
3582
|
+
// "volume24h": "355.941109",
|
|
3583
|
+
// "turnover24h": "37302936.008134"
|
|
3584
|
+
// }
|
|
3585
|
+
// ]
|
|
3586
|
+
// }
|
|
3587
|
+
//
|
|
3588
|
+
// swap and future uta
|
|
3589
|
+
//
|
|
3590
|
+
// {
|
|
3591
|
+
// "code": "00000",
|
|
3592
|
+
// "msg": "success",
|
|
3593
|
+
// "requestTime": 1750332731203,
|
|
3594
|
+
// "data": [
|
|
3595
|
+
// {
|
|
3596
|
+
// "category": "USDT-FUTURES",
|
|
3597
|
+
// "symbol": "BTCUSDT",
|
|
3598
|
+
// "ts": "1750332730472",
|
|
3599
|
+
// "lastPrice": "104738",
|
|
3600
|
+
// "openPrice24h": "104374",
|
|
3601
|
+
// "highPrice24h": "105289.3",
|
|
3602
|
+
// "lowPrice24h": "103447.9",
|
|
3603
|
+
// "ask1Price": "104738",
|
|
3604
|
+
// "bid1Price": "104737.7",
|
|
3605
|
+
// "bid1Size": "2.036",
|
|
3606
|
+
// "ask1Size": "8.094",
|
|
3607
|
+
// "price24hPcnt": "0.00349",
|
|
3608
|
+
// "volume24h": "79101.6477",
|
|
3609
|
+
// "turnover24h": "8276293391.45973",
|
|
3610
|
+
// "indexPrice": "104785.956168",
|
|
3611
|
+
// "markPrice": "104738",
|
|
3612
|
+
// "fundingRate": "-0.000007",
|
|
3613
|
+
// "openInterest": "7465.5938",
|
|
3614
|
+
// "deliveryStartTime": "",
|
|
3615
|
+
// "deliveryTime": "",
|
|
3616
|
+
// "deliveryStatus": ""
|
|
3617
|
+
// }
|
|
3618
|
+
// ]
|
|
3619
|
+
// }
|
|
3620
|
+
//
|
|
3363
3621
|
const data = this.safeList(response, 'data', []);
|
|
3364
3622
|
return this.parseTickers(data, symbols);
|
|
3365
3623
|
}
|
|
@@ -3446,19 +3704,53 @@ export default class bitget extends Exchange {
|
|
|
3446
3704
|
// "cTime": "1700720700342"
|
|
3447
3705
|
// }
|
|
3448
3706
|
//
|
|
3707
|
+
// uta fetchTrades
|
|
3708
|
+
//
|
|
3709
|
+
// {
|
|
3710
|
+
// "execId": "1319896716324937729",
|
|
3711
|
+
// "price": "105909.1",
|
|
3712
|
+
// "size": "6.3090",
|
|
3713
|
+
// "side": "sell",
|
|
3714
|
+
// "ts": "1750413820344"
|
|
3715
|
+
// }
|
|
3716
|
+
//
|
|
3717
|
+
// uta fetchMyTrades
|
|
3718
|
+
//
|
|
3719
|
+
// {
|
|
3720
|
+
// "execId": "1322441401010528257",
|
|
3721
|
+
// "orderId": "1322441400976261120",
|
|
3722
|
+
// "category": "USDT-FUTURES",
|
|
3723
|
+
// "symbol": "BTCUSDT",
|
|
3724
|
+
// "orderType": "market",
|
|
3725
|
+
// "side": "sell",
|
|
3726
|
+
// "execPrice": "107005.4",
|
|
3727
|
+
// "execQty": "0.0001",
|
|
3728
|
+
// "execValue": "10.7005",
|
|
3729
|
+
// "tradeScope": "taker",
|
|
3730
|
+
// "feeDetail": [{
|
|
3731
|
+
// "feeCoin": "USDT",
|
|
3732
|
+
// "fee":"0.00642032"
|
|
3733
|
+
// }],
|
|
3734
|
+
// "createdTime": "1751020520451",
|
|
3735
|
+
// "updatedTime": "1751020520458",
|
|
3736
|
+
// "execPnl": "0.00017"
|
|
3737
|
+
// }
|
|
3738
|
+
//
|
|
3449
3739
|
const marketId = this.safeString(trade, 'symbol');
|
|
3450
3740
|
const symbol = this.safeSymbol(marketId, market);
|
|
3451
|
-
const timestamp = this.
|
|
3741
|
+
const timestamp = this.safeIntegerN(trade, ['cTime', 'ts', 'createdTime']);
|
|
3452
3742
|
let fee = undefined;
|
|
3453
3743
|
const feeDetail = this.safeValue(trade, 'feeDetail');
|
|
3454
3744
|
const posMode = this.safeString(trade, 'posMode');
|
|
3455
|
-
const
|
|
3745
|
+
const category = this.safeString(trade, 'category');
|
|
3746
|
+
const isFeeStructure = (posMode !== undefined) || (category !== undefined);
|
|
3747
|
+
const feeStructure = isFeeStructure ? feeDetail[0] : feeDetail;
|
|
3456
3748
|
if (feeStructure !== undefined) {
|
|
3457
3749
|
const currencyCode = this.safeCurrencyCode(this.safeString(feeStructure, 'feeCoin'));
|
|
3458
3750
|
fee = {
|
|
3459
3751
|
'currency': currencyCode,
|
|
3460
3752
|
};
|
|
3461
|
-
const feeCostString = this.
|
|
3753
|
+
const feeCostString = this.safeString2(feeStructure, 'totalFee', 'fee');
|
|
3462
3754
|
const deduction = this.safeString(feeStructure, 'deduction') === 'yes' ? true : false;
|
|
3463
3755
|
if (deduction) {
|
|
3464
3756
|
fee['cost'] = feeCostString;
|
|
@@ -3469,15 +3761,15 @@ export default class bitget extends Exchange {
|
|
|
3469
3761
|
}
|
|
3470
3762
|
return this.safeTrade({
|
|
3471
3763
|
'info': trade,
|
|
3472
|
-
'id': this.
|
|
3764
|
+
'id': this.safeString2(trade, 'tradeId', 'execId'),
|
|
3473
3765
|
'order': this.safeString(trade, 'orderId'),
|
|
3474
3766
|
'symbol': symbol,
|
|
3475
3767
|
'side': this.safeStringLower(trade, 'side'),
|
|
3476
3768
|
'type': this.safeString(trade, 'orderType'),
|
|
3477
3769
|
'takerOrMaker': this.safeString(trade, 'tradeScope'),
|
|
3478
|
-
'price': this.
|
|
3479
|
-
'amount': this.
|
|
3480
|
-
'cost': this.
|
|
3770
|
+
'price': this.safeStringN(trade, ['priceAvg', 'price', 'execPrice']),
|
|
3771
|
+
'amount': this.safeStringN(trade, ['baseVolume', 'size', 'execQty']),
|
|
3772
|
+
'cost': this.safeStringN(trade, ['quoteVolume', 'amount', 'execValue']),
|
|
3481
3773
|
'timestamp': timestamp,
|
|
3482
3774
|
'datetime': this.iso8601(timestamp),
|
|
3483
3775
|
'fee': fee,
|
|
@@ -3491,10 +3783,12 @@ export default class bitget extends Exchange {
|
|
|
3491
3783
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Market-Trades
|
|
3492
3784
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Recent-Fills
|
|
3493
3785
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Fills-History
|
|
3786
|
+
* @see https://www.bitget.com/api-doc/uta/public/Fills
|
|
3494
3787
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
3495
3788
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
3496
3789
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
3497
3790
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3791
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
3498
3792
|
* @param {int} [params.until] *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* the latest time in ms to fetch trades for
|
|
3499
3793
|
* @param {boolean} [params.paginate] *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
3500
3794
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
@@ -3510,8 +3804,13 @@ export default class bitget extends Exchange {
|
|
|
3510
3804
|
let request = {
|
|
3511
3805
|
'symbol': market['id'],
|
|
3512
3806
|
};
|
|
3807
|
+
let uta = undefined;
|
|
3808
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchTrades', 'uta', false);
|
|
3513
3809
|
if (limit !== undefined) {
|
|
3514
|
-
if (
|
|
3810
|
+
if (uta) {
|
|
3811
|
+
request['limit'] = Math.min(limit, 100);
|
|
3812
|
+
}
|
|
3813
|
+
else if (market['contract']) {
|
|
3515
3814
|
request['limit'] = Math.min(limit, 1000);
|
|
3516
3815
|
}
|
|
3517
3816
|
else {
|
|
@@ -3520,7 +3819,20 @@ export default class bitget extends Exchange {
|
|
|
3520
3819
|
}
|
|
3521
3820
|
const options = this.safeValue(this.options, 'fetchTrades', {});
|
|
3522
3821
|
let response = undefined;
|
|
3523
|
-
|
|
3822
|
+
let productType = undefined;
|
|
3823
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3824
|
+
if (uta) {
|
|
3825
|
+
if (productType === 'SPOT') {
|
|
3826
|
+
let marginMode = undefined;
|
|
3827
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTrades', params);
|
|
3828
|
+
if (marginMode !== undefined) {
|
|
3829
|
+
productType = 'MARGIN';
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
request['category'] = productType;
|
|
3833
|
+
response = await this.publicUtaGetV3MarketFills(this.extend(request, params));
|
|
3834
|
+
}
|
|
3835
|
+
else if (market['spot']) {
|
|
3524
3836
|
const spotOptions = this.safeValue(options, 'spot', {});
|
|
3525
3837
|
const defaultSpotMethod = this.safeString(spotOptions, 'method', 'publicSpotGetV2SpotMarketFillsHistory');
|
|
3526
3838
|
const spotMethod = this.safeString(params, 'method', defaultSpotMethod);
|
|
@@ -3541,8 +3853,6 @@ export default class bitget extends Exchange {
|
|
|
3541
3853
|
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetV2MixMarketFillsHistory');
|
|
3542
3854
|
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
3543
3855
|
params = this.omit(params, 'method');
|
|
3544
|
-
let productType = undefined;
|
|
3545
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3546
3856
|
request['productType'] = productType;
|
|
3547
3857
|
if (swapMethod === 'publicMixGetV2MixMarketFillsHistory') {
|
|
3548
3858
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
@@ -3592,6 +3902,23 @@ export default class bitget extends Exchange {
|
|
|
3592
3902
|
// ]
|
|
3593
3903
|
// }
|
|
3594
3904
|
//
|
|
3905
|
+
// uta
|
|
3906
|
+
//
|
|
3907
|
+
// {
|
|
3908
|
+
// "code": "00000",
|
|
3909
|
+
// "msg": "success",
|
|
3910
|
+
// "requestTime": 1750413823980,
|
|
3911
|
+
// "data": [
|
|
3912
|
+
// {
|
|
3913
|
+
// "execId": "1319896716324937729",
|
|
3914
|
+
// "price": "105909.1",
|
|
3915
|
+
// "size": "6.3090",
|
|
3916
|
+
// "side": "sell",
|
|
3917
|
+
// "ts": "1750413820344"
|
|
3918
|
+
// }
|
|
3919
|
+
// ]
|
|
3920
|
+
// }
|
|
3921
|
+
//
|
|
3595
3922
|
const data = this.safeList(response, 'data', []);
|
|
3596
3923
|
return this.parseTrades(data, market, since, limit);
|
|
3597
3924
|
}
|
|
@@ -3783,13 +4110,15 @@ export default class bitget extends Exchange {
|
|
|
3783
4110
|
// "1399132.341"
|
|
3784
4111
|
// ]
|
|
3785
4112
|
//
|
|
4113
|
+
const inverse = this.safeBool(market, 'inverse');
|
|
4114
|
+
const volumeIndex = inverse ? 6 : 5;
|
|
3786
4115
|
return [
|
|
3787
4116
|
this.safeInteger(ohlcv, 0),
|
|
3788
4117
|
this.safeNumber(ohlcv, 1),
|
|
3789
4118
|
this.safeNumber(ohlcv, 2),
|
|
3790
4119
|
this.safeNumber(ohlcv, 3),
|
|
3791
4120
|
this.safeNumber(ohlcv, 4),
|
|
3792
|
-
this.safeNumber(ohlcv,
|
|
4121
|
+
this.safeNumber(ohlcv, volumeIndex),
|
|
3793
4122
|
];
|
|
3794
4123
|
}
|
|
3795
4124
|
/**
|
|
@@ -3802,11 +4131,13 @@ export default class bitget extends Exchange {
|
|
|
3802
4131
|
* @see https://www.bitget.com/api-doc/contract/market/Get-History-Candle-Data
|
|
3803
4132
|
* @see https://www.bitget.com/api-doc/contract/market/Get-History-Index-Candle-Data
|
|
3804
4133
|
* @see https://www.bitget.com/api-doc/contract/market/Get-History-Mark-Candle-Data
|
|
4134
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Candle-Data
|
|
3805
4135
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
3806
4136
|
* @param {string} timeframe the length of time each candle represents
|
|
3807
4137
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
3808
4138
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
3809
4139
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4140
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
3810
4141
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
3811
4142
|
* @param {boolean} [params.useHistoryEndpoint] whether to force to use historical endpoint (it has max limit of 200)
|
|
3812
4143
|
* @param {boolean} [params.useHistoryEndpointForPagination] whether to force to use historical endpoint for pagination (default true)
|
|
@@ -3828,12 +4159,22 @@ export default class bitget extends Exchange {
|
|
|
3828
4159
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, limitForPagination);
|
|
3829
4160
|
}
|
|
3830
4161
|
const market = this.market(symbol);
|
|
3831
|
-
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3832
|
-
const timeframes = this.options['timeframes'][marketType];
|
|
3833
4162
|
const request = {
|
|
3834
4163
|
'symbol': market['id'],
|
|
3835
|
-
'granularity': this.safeString(timeframes, timeframe, timeframe),
|
|
3836
4164
|
};
|
|
4165
|
+
let marketType = undefined;
|
|
4166
|
+
let timeframes = undefined;
|
|
4167
|
+
let uta = undefined;
|
|
4168
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'uta', false);
|
|
4169
|
+
if (uta) {
|
|
4170
|
+
timeframes = this.options['timeframes']['uta'];
|
|
4171
|
+
request['interval'] = this.safeString(timeframes, timeframe, timeframe);
|
|
4172
|
+
}
|
|
4173
|
+
else {
|
|
4174
|
+
marketType = market['spot'] ? 'spot' : 'swap';
|
|
4175
|
+
timeframes = this.options['timeframes'][marketType];
|
|
4176
|
+
request['granularity'] = this.safeString(timeframes, timeframe, timeframe);
|
|
4177
|
+
}
|
|
3837
4178
|
const msInDay = 86400000;
|
|
3838
4179
|
const now = this.milliseconds();
|
|
3839
4180
|
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
@@ -3903,24 +4244,48 @@ export default class bitget extends Exchange {
|
|
|
3903
4244
|
request['limit'] = limit;
|
|
3904
4245
|
// make request
|
|
3905
4246
|
let response = undefined;
|
|
3906
|
-
|
|
4247
|
+
let productType = undefined;
|
|
4248
|
+
let priceType = undefined;
|
|
4249
|
+
[priceType, params] = this.handleParamString(params, 'price');
|
|
4250
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
4251
|
+
if (uta) {
|
|
4252
|
+
if (priceType !== undefined) {
|
|
4253
|
+
if (priceType === 'mark') {
|
|
4254
|
+
request['type'] = 'MARK';
|
|
4255
|
+
}
|
|
4256
|
+
else if (priceType === 'index') {
|
|
4257
|
+
request['type'] = 'INDEX';
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
request['category'] = productType;
|
|
4261
|
+
response = await this.publicUtaGetV3MarketCandles(this.extend(request, params));
|
|
4262
|
+
}
|
|
4263
|
+
else if (market['spot']) {
|
|
3907
4264
|
// checks if we need history endpoint
|
|
3908
4265
|
if (historicalEndpointNeeded) {
|
|
3909
4266
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
3910
4267
|
}
|
|
3911
4268
|
else {
|
|
4269
|
+
if (!limitDefined) {
|
|
4270
|
+
request['limit'] = 1000;
|
|
4271
|
+
limit = 1000;
|
|
4272
|
+
}
|
|
3912
4273
|
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
3913
4274
|
}
|
|
3914
4275
|
}
|
|
3915
4276
|
else {
|
|
3916
|
-
let priceType = undefined;
|
|
3917
|
-
[priceType, params] = this.handleParamString(params, 'price');
|
|
3918
|
-
let productType = undefined;
|
|
3919
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3920
4277
|
request['productType'] = productType;
|
|
3921
4278
|
const extended = this.extend(request, params);
|
|
3922
|
-
|
|
3923
|
-
|
|
4279
|
+
if (!historicalEndpointNeeded && (priceType === 'mark' || priceType === 'index')) {
|
|
4280
|
+
if (!limitDefined) {
|
|
4281
|
+
extended['limit'] = 1000;
|
|
4282
|
+
limit = 1000;
|
|
4283
|
+
}
|
|
4284
|
+
// Recent endpoint for mark/index prices
|
|
4285
|
+
// https://www.bitget.com/api-doc/contract/market/Get-Candle-Data
|
|
4286
|
+
response = await this.publicMixGetV2MixMarketCandles(this.extend({ 'kLineType': priceType }, extended));
|
|
4287
|
+
}
|
|
4288
|
+
else if (priceType === 'mark') {
|
|
3924
4289
|
response = await this.publicMixGetV2MixMarketHistoryMarkCandles(extended);
|
|
3925
4290
|
}
|
|
3926
4291
|
else if (priceType === 'index') {
|
|
@@ -3931,6 +4296,10 @@ export default class bitget extends Exchange {
|
|
|
3931
4296
|
response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
|
|
3932
4297
|
}
|
|
3933
4298
|
else {
|
|
4299
|
+
if (!limitDefined) {
|
|
4300
|
+
extended['limit'] = 1000;
|
|
4301
|
+
limit = 1000;
|
|
4302
|
+
}
|
|
3934
4303
|
response = await this.publicMixGetV2MixMarketCandles(extended);
|
|
3935
4304
|
}
|
|
3936
4305
|
}
|
|
@@ -3952,8 +4321,10 @@ export default class bitget extends Exchange {
|
|
|
3952
4321
|
* @see https://www.bitget.com/api-doc/margin/isolated/account/Get-Isolated-Assets
|
|
3953
4322
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets
|
|
3954
4323
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets
|
|
4324
|
+
* @see https://www.bitget.com/api-doc/uta/account/Get-Account
|
|
3955
4325
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3956
4326
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
4327
|
+
* @param {string} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
3957
4328
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3958
4329
|
*/
|
|
3959
4330
|
async fetchBalance(params = {}) {
|
|
@@ -3962,9 +4333,17 @@ export default class bitget extends Exchange {
|
|
|
3962
4333
|
let marketType = undefined;
|
|
3963
4334
|
let marginMode = undefined;
|
|
3964
4335
|
let response = undefined;
|
|
4336
|
+
let uta = undefined;
|
|
4337
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchBalance', 'uta', false);
|
|
3965
4338
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
3966
4339
|
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
3967
|
-
if (
|
|
4340
|
+
if (uta) {
|
|
4341
|
+
response = await this.privateUtaGetV3AccountAssets(this.extend(request, params));
|
|
4342
|
+
const results = this.safeDict(response, 'data', {});
|
|
4343
|
+
const assets = this.safeList(results, 'assets', []);
|
|
4344
|
+
return this.parseUtaBalance(assets);
|
|
4345
|
+
}
|
|
4346
|
+
else if ((marketType === 'swap') || (marketType === 'future')) {
|
|
3968
4347
|
let productType = undefined;
|
|
3969
4348
|
[productType, params] = this.handleProductTypeAndParams(undefined, params);
|
|
3970
4349
|
request['productType'] = productType;
|
|
@@ -4069,9 +4448,67 @@ export default class bitget extends Exchange {
|
|
|
4069
4448
|
// ]
|
|
4070
4449
|
// }
|
|
4071
4450
|
//
|
|
4451
|
+
// uta
|
|
4452
|
+
//
|
|
4453
|
+
// {
|
|
4454
|
+
// "code": "00000",
|
|
4455
|
+
// "msg": "success",
|
|
4456
|
+
// "requestTime": 1749980065089,
|
|
4457
|
+
// "data": {
|
|
4458
|
+
// "accountEquity": "11.13919278",
|
|
4459
|
+
// "usdtEquity": "11.13921165",
|
|
4460
|
+
// "btcEquity": "0.00011256",
|
|
4461
|
+
// "unrealisedPnl": "0",
|
|
4462
|
+
// "usdtUnrealisedPnl": "0",
|
|
4463
|
+
// "btcUnrealizedPnl": "0",
|
|
4464
|
+
// "effEquity": "6.19299777",
|
|
4465
|
+
// "mmr": "0",
|
|
4466
|
+
// "imr": "0",
|
|
4467
|
+
// "mgnRatio": "0",
|
|
4468
|
+
// "positionMgnRatio": "0",
|
|
4469
|
+
// "assets": [
|
|
4470
|
+
// {
|
|
4471
|
+
// "coin": "USDT",
|
|
4472
|
+
// "equity": "6.19300826",
|
|
4473
|
+
// "usdValue": "6.19299777",
|
|
4474
|
+
// "balance": "6.19300826",
|
|
4475
|
+
// "available": "6.19300826",
|
|
4476
|
+
// "debt": "0",
|
|
4477
|
+
// "locked": "0"
|
|
4478
|
+
// }
|
|
4479
|
+
// ]
|
|
4480
|
+
// }
|
|
4481
|
+
// }
|
|
4482
|
+
//
|
|
4072
4483
|
const data = this.safeValue(response, 'data', []);
|
|
4073
4484
|
return this.parseBalance(data);
|
|
4074
4485
|
}
|
|
4486
|
+
parseUtaBalance(balance) {
|
|
4487
|
+
const result = { 'info': balance };
|
|
4488
|
+
//
|
|
4489
|
+
// {
|
|
4490
|
+
// "coin": "USDT",
|
|
4491
|
+
// "equity": "6.19300826",
|
|
4492
|
+
// "usdValue": "6.19299777",
|
|
4493
|
+
// "balance": "6.19300826",
|
|
4494
|
+
// "available": "6.19300826",
|
|
4495
|
+
// "debt": "0",
|
|
4496
|
+
// "locked": "0"
|
|
4497
|
+
// }
|
|
4498
|
+
//
|
|
4499
|
+
for (let i = 0; i < balance.length; i++) {
|
|
4500
|
+
const entry = balance[i];
|
|
4501
|
+
const account = this.account();
|
|
4502
|
+
const currencyId = this.safeString(entry, 'coin');
|
|
4503
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
4504
|
+
account['debt'] = this.safeString(entry, 'debt');
|
|
4505
|
+
account['used'] = this.safeString(entry, 'locked');
|
|
4506
|
+
account['free'] = this.safeString(entry, 'available');
|
|
4507
|
+
account['total'] = this.safeString(entry, 'balance');
|
|
4508
|
+
result[code] = account;
|
|
4509
|
+
}
|
|
4510
|
+
return this.safeBalance(result);
|
|
4511
|
+
}
|
|
4075
4512
|
parseBalance(balance) {
|
|
4076
4513
|
const result = { 'info': balance };
|
|
4077
4514
|
//
|
|
@@ -4210,7 +4647,7 @@ export default class bitget extends Exchange {
|
|
|
4210
4647
|
// },
|
|
4211
4648
|
// ]
|
|
4212
4649
|
//
|
|
4213
|
-
// spot, swap, future
|
|
4650
|
+
// spot, swap, future, spot margin and uta: cancelOrder, cancelOrders, cancelAllOrders
|
|
4214
4651
|
//
|
|
4215
4652
|
// {
|
|
4216
4653
|
// "orderId": "1098758604547850241",
|
|
@@ -4339,6 +4776,66 @@ export default class bitget extends Exchange {
|
|
|
4339
4776
|
// "stopLossTriggerType": "fill_price",
|
|
4340
4777
|
// }
|
|
4341
4778
|
//
|
|
4779
|
+
// uta: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
|
4780
|
+
//
|
|
4781
|
+
// {
|
|
4782
|
+
// "orderId": "1320244799629316096",
|
|
4783
|
+
// "clientOid": "1320244799633510400",
|
|
4784
|
+
// "category": "USDT-FUTURES",
|
|
4785
|
+
// "symbol": "BTCUSDT",
|
|
4786
|
+
// "orderType": "limit",
|
|
4787
|
+
// "side": "buy",
|
|
4788
|
+
// "price": "50000",
|
|
4789
|
+
// "qty": "0.001",
|
|
4790
|
+
// "amount": "0",
|
|
4791
|
+
// "cumExecQty": "0",
|
|
4792
|
+
// "cumExecValue": "0",
|
|
4793
|
+
// "avgPrice": "0",
|
|
4794
|
+
// "timeInForce": "gtc",
|
|
4795
|
+
// "orderStatus": "live",
|
|
4796
|
+
// "posSide": "long",
|
|
4797
|
+
// "holdMode": "hedge_mode",
|
|
4798
|
+
// "reduceOnly": "NO",
|
|
4799
|
+
// "feeDetail": [{
|
|
4800
|
+
// "feeCoin": "",
|
|
4801
|
+
// "fee": ""
|
|
4802
|
+
// }],
|
|
4803
|
+
// "createdTime": "1750496809871",
|
|
4804
|
+
// "updatedTime": "1750496809886",
|
|
4805
|
+
// "cancelReason": "",
|
|
4806
|
+
// "execType": "normal",
|
|
4807
|
+
// "stpMode": "none",
|
|
4808
|
+
// "tpTriggerBy": null,
|
|
4809
|
+
// "slTriggerBy": null,
|
|
4810
|
+
// "takeProfit": null,
|
|
4811
|
+
// "stopLoss": null,
|
|
4812
|
+
// "tpOrderType": null,
|
|
4813
|
+
// "slOrderType": null,
|
|
4814
|
+
// "tpLimitPrice": null,
|
|
4815
|
+
// "slLimitPrice": null
|
|
4816
|
+
// }
|
|
4817
|
+
//
|
|
4818
|
+
// uta trigger: fetchClosedOrders, fetchCanceledOrders
|
|
4819
|
+
//
|
|
4820
|
+
// {
|
|
4821
|
+
// "orderId": "1330984742276198400",
|
|
4822
|
+
// "clientOid": "1330984742276198400",
|
|
4823
|
+
// "symbol": "BTCUSDT",
|
|
4824
|
+
// "category": "USDT-FUTURES",
|
|
4825
|
+
// "qty": "0.001",
|
|
4826
|
+
// "posSide": "long",
|
|
4827
|
+
// "tpTriggerBy": "market",
|
|
4828
|
+
// "slTriggerBy": "mark",
|
|
4829
|
+
// "takeProfit": "",
|
|
4830
|
+
// "stopLoss": "112000",
|
|
4831
|
+
// "tpOrderType": "market",
|
|
4832
|
+
// "slOrderType": "limit",
|
|
4833
|
+
// "tpLimitPrice": "",
|
|
4834
|
+
// "slLimitPrice": "111000",
|
|
4835
|
+
// "createdTime": "1753057411736",
|
|
4836
|
+
// "updatedTime": "1753058267412"
|
|
4837
|
+
// }
|
|
4838
|
+
//
|
|
4342
4839
|
const errorMessage = this.safeString(order, 'errorMsg');
|
|
4343
4840
|
if (errorMessage !== undefined) {
|
|
4344
4841
|
return this.safeOrder({
|
|
@@ -4348,17 +4845,17 @@ export default class bitget extends Exchange {
|
|
|
4348
4845
|
'status': 'rejected',
|
|
4349
4846
|
}, market);
|
|
4350
4847
|
}
|
|
4351
|
-
const
|
|
4848
|
+
const posSide = this.safeString(order, 'posSide');
|
|
4849
|
+
const isContractOrder = (posSide !== undefined);
|
|
4352
4850
|
let marketType = isContractOrder ? 'contract' : 'spot';
|
|
4353
4851
|
if (market !== undefined) {
|
|
4354
4852
|
marketType = market['type'];
|
|
4355
4853
|
}
|
|
4356
4854
|
const marketId = this.safeString(order, 'symbol');
|
|
4357
4855
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
4358
|
-
const timestamp = this.
|
|
4359
|
-
const updateTimestamp = this.
|
|
4360
|
-
|
|
4361
|
-
rawStatus = this.safeString(order, 'planStatus', rawStatus);
|
|
4856
|
+
const timestamp = this.safeIntegerN(order, ['cTime', 'ctime', 'createdTime']);
|
|
4857
|
+
const updateTimestamp = this.safeInteger2(order, 'uTime', 'updatedTime');
|
|
4858
|
+
const rawStatus = this.safeStringN(order, ['status', 'state', 'orderStatus', 'planStatus']);
|
|
4362
4859
|
let fee = undefined;
|
|
4363
4860
|
const feeCostString = this.safeString(order, 'fee');
|
|
4364
4861
|
if (feeCostString !== undefined) {
|
|
@@ -4369,24 +4866,35 @@ export default class bitget extends Exchange {
|
|
|
4369
4866
|
};
|
|
4370
4867
|
}
|
|
4371
4868
|
const feeDetail = this.safeValue(order, 'feeDetail');
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
const
|
|
4375
|
-
|
|
4376
|
-
for (let i = 0; i < feeValues.length; i++) {
|
|
4377
|
-
const feeValue = feeValues[i];
|
|
4378
|
-
if (this.safeValue(feeValue, 'feeCoinCode') !== undefined) {
|
|
4379
|
-
feeObject = feeValue;
|
|
4380
|
-
break;
|
|
4381
|
-
}
|
|
4382
|
-
}
|
|
4869
|
+
const uta = this.safeString(order, 'category') !== undefined;
|
|
4870
|
+
if (uta) {
|
|
4871
|
+
const feeResult = this.safeDict(feeDetail, 0, {});
|
|
4872
|
+
const utaFee = this.safeString(feeResult, 'fee');
|
|
4383
4873
|
fee = {
|
|
4384
|
-
'cost': this.parseNumber(Precise.stringNeg(
|
|
4385
|
-
'currency':
|
|
4874
|
+
'cost': this.parseNumber(Precise.stringNeg(utaFee)),
|
|
4875
|
+
'currency': market['settle'],
|
|
4386
4876
|
};
|
|
4387
4877
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4878
|
+
else {
|
|
4879
|
+
if (feeDetail !== undefined) {
|
|
4880
|
+
const parsedFeeDetail = JSON.parse(feeDetail);
|
|
4881
|
+
const feeValues = Object.values(parsedFeeDetail);
|
|
4882
|
+
let feeObject = undefined;
|
|
4883
|
+
for (let i = 0; i < feeValues.length; i++) {
|
|
4884
|
+
const feeValue = feeValues[i];
|
|
4885
|
+
if (this.safeValue(feeValue, 'feeCoinCode') !== undefined) {
|
|
4886
|
+
feeObject = feeValue;
|
|
4887
|
+
break;
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4890
|
+
fee = {
|
|
4891
|
+
'cost': this.parseNumber(Precise.stringNeg(this.safeString(feeObject, 'totalFee'))),
|
|
4892
|
+
'currency': this.safeCurrencyCode(this.safeString(feeObject, 'feeCoinCode')),
|
|
4893
|
+
};
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
let postOnly = undefined;
|
|
4897
|
+
let timeInForce = this.safeStringUpper2(order, 'force', 'timeInForce');
|
|
4390
4898
|
if (timeInForce === 'POST_ONLY') {
|
|
4391
4899
|
postOnly = true;
|
|
4392
4900
|
timeInForce = 'PO';
|
|
@@ -4405,7 +4913,7 @@ export default class bitget extends Exchange {
|
|
|
4405
4913
|
average = this.safeString(order, 'basePrice');
|
|
4406
4914
|
}
|
|
4407
4915
|
else {
|
|
4408
|
-
price = this.
|
|
4916
|
+
price = this.safeStringN(order, ['price', 'executePrice', 'slLimitPrice', 'tpLimitPrice']);
|
|
4409
4917
|
average = this.safeString(order, 'priceAvg');
|
|
4410
4918
|
}
|
|
4411
4919
|
let size = undefined;
|
|
@@ -4417,8 +4925,8 @@ export default class bitget extends Exchange {
|
|
|
4417
4925
|
filled = this.safeString(order, 'size');
|
|
4418
4926
|
}
|
|
4419
4927
|
else {
|
|
4420
|
-
size = this.
|
|
4421
|
-
filled = this.
|
|
4928
|
+
size = this.safeString2(order, 'size', 'qty');
|
|
4929
|
+
filled = this.safeString2(order, 'baseVolume', 'cumExecQty');
|
|
4422
4930
|
}
|
|
4423
4931
|
let side = this.safeString(order, 'side');
|
|
4424
4932
|
const posMode = this.safeString(order, 'posMode');
|
|
@@ -4454,8 +4962,8 @@ export default class bitget extends Exchange {
|
|
|
4454
4962
|
'postOnly': postOnly,
|
|
4455
4963
|
'reduceOnly': reduceOnly,
|
|
4456
4964
|
'triggerPrice': this.safeNumber(order, 'triggerPrice'),
|
|
4457
|
-
'takeProfitPrice': this.
|
|
4458
|
-
'stopLossPrice': this.
|
|
4965
|
+
'takeProfitPrice': this.safeNumberN(order, ['presetStopSurplusPrice', 'stopSurplusTriggerPrice', 'takeProfit']),
|
|
4966
|
+
'stopLossPrice': this.safeNumberN(order, ['presetStopLossPrice', 'stopLossTriggerPrice', 'stopLoss']),
|
|
4459
4967
|
'status': this.parseOrderStatus(rawStatus),
|
|
4460
4968
|
'fee': fee,
|
|
4461
4969
|
'trades': undefined,
|
|
@@ -4495,6 +5003,8 @@ export default class bitget extends Exchange {
|
|
|
4495
5003
|
* @see https://www.bitget.com/api-doc/contract/plan/Place-Plan-Order
|
|
4496
5004
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order
|
|
4497
5005
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order
|
|
5006
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Place-Order
|
|
5007
|
+
* @see https://www.bitget.com/api-doc/uta/strategy/Place-Strategy-Order
|
|
4498
5008
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
4499
5009
|
* @param {string} type 'market' or 'limit'
|
|
4500
5010
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -4523,6 +5033,8 @@ export default class bitget extends Exchange {
|
|
|
4523
5033
|
* @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
|
|
4524
5034
|
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode, default is false
|
|
4525
5035
|
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
5036
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5037
|
+
* @param {string} [params.posSide] *uta only* hedged two-way position side, long or short
|
|
4526
5038
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4527
5039
|
*/
|
|
4528
5040
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -4539,31 +5051,44 @@ export default class bitget extends Exchange {
|
|
|
4539
5051
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4540
5052
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4541
5053
|
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
4542
|
-
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
4543
5054
|
let response = undefined;
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
response = await this.
|
|
4550
|
-
}
|
|
4551
|
-
else if (marginMode === 'cross') {
|
|
4552
|
-
response = await this.privateMarginPostV2MarginCrossedPlaceOrder(request);
|
|
5055
|
+
let uta = undefined;
|
|
5056
|
+
[uta, params] = this.handleOptionAndParams(params, 'createOrder', 'uta', false);
|
|
5057
|
+
if (uta) {
|
|
5058
|
+
const request = this.createUtaOrderRequest(symbol, type, side, amount, price, params);
|
|
5059
|
+
if (isStopLossOrTakeProfitTrigger) {
|
|
5060
|
+
response = await this.privateUtaPostV3TradePlaceStrategyOrder(request);
|
|
4553
5061
|
}
|
|
4554
5062
|
else {
|
|
4555
|
-
response = await this.
|
|
5063
|
+
response = await this.privateUtaPostV3TradePlaceOrder(request);
|
|
4556
5064
|
}
|
|
4557
5065
|
}
|
|
4558
5066
|
else {
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
5067
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
5068
|
+
if (market['spot']) {
|
|
5069
|
+
if (isTriggerOrder) {
|
|
5070
|
+
response = await this.privateSpotPostV2SpotTradePlacePlanOrder(request);
|
|
5071
|
+
}
|
|
5072
|
+
else if (marginMode === 'isolated') {
|
|
5073
|
+
response = await this.privateMarginPostV2MarginIsolatedPlaceOrder(request);
|
|
5074
|
+
}
|
|
5075
|
+
else if (marginMode === 'cross') {
|
|
5076
|
+
response = await this.privateMarginPostV2MarginCrossedPlaceOrder(request);
|
|
5077
|
+
}
|
|
5078
|
+
else {
|
|
5079
|
+
response = await this.privateSpotPostV2SpotTradePlaceOrder(request);
|
|
5080
|
+
}
|
|
4564
5081
|
}
|
|
4565
5082
|
else {
|
|
4566
|
-
|
|
5083
|
+
if (isTriggerOrder || isTrailingPercentOrder) {
|
|
5084
|
+
response = await this.privateMixPostV2MixOrderPlacePlanOrder(request);
|
|
5085
|
+
}
|
|
5086
|
+
else if (isStopLossOrTakeProfitTrigger) {
|
|
5087
|
+
response = await this.privateMixPostV2MixOrderPlaceTpslOrder(request);
|
|
5088
|
+
}
|
|
5089
|
+
else {
|
|
5090
|
+
response = await this.privateMixPostV2MixOrderPlaceOrder(request);
|
|
5091
|
+
}
|
|
4567
5092
|
}
|
|
4568
5093
|
}
|
|
4569
5094
|
//
|
|
@@ -4580,6 +5105,133 @@ export default class bitget extends Exchange {
|
|
|
4580
5105
|
const data = this.safeDict(response, 'data', {});
|
|
4581
5106
|
return this.parseOrder(data, market);
|
|
4582
5107
|
}
|
|
5108
|
+
createUtaOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
5109
|
+
const market = this.market(symbol);
|
|
5110
|
+
let productType = undefined;
|
|
5111
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5112
|
+
if (productType === 'SPOT') {
|
|
5113
|
+
let marginMode = undefined;
|
|
5114
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
5115
|
+
if (marginMode !== undefined) {
|
|
5116
|
+
productType = 'MARGIN';
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
const request = {
|
|
5120
|
+
'category': productType,
|
|
5121
|
+
'symbol': market['id'],
|
|
5122
|
+
'qty': this.amountToPrecision(symbol, amount),
|
|
5123
|
+
'side': side,
|
|
5124
|
+
};
|
|
5125
|
+
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
5126
|
+
if (clientOrderId !== undefined) {
|
|
5127
|
+
request['clientOid'] = clientOrderId;
|
|
5128
|
+
params = this.omit(params, 'clientOrderId');
|
|
5129
|
+
}
|
|
5130
|
+
const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
|
|
5131
|
+
const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
|
|
5132
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
5133
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
5134
|
+
const isStopLoss = stopLoss !== undefined;
|
|
5135
|
+
const isTakeProfit = takeProfit !== undefined;
|
|
5136
|
+
const isStopLossTrigger = stopLossTriggerPrice !== undefined;
|
|
5137
|
+
const isTakeProfitTrigger = takeProfitTriggerPrice !== undefined;
|
|
5138
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTrigger || isTakeProfitTrigger;
|
|
5139
|
+
if (isStopLossOrTakeProfitTrigger) {
|
|
5140
|
+
if (isStopLossTrigger) {
|
|
5141
|
+
const slType = this.safeString(params, 'slTriggerBy', 'mark');
|
|
5142
|
+
request['slTriggerBy'] = slType;
|
|
5143
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
5144
|
+
if (price !== undefined) {
|
|
5145
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
5146
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'limit');
|
|
5147
|
+
}
|
|
5148
|
+
else {
|
|
5149
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'market');
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
else if (isTakeProfitTrigger) {
|
|
5153
|
+
const tpType = this.safeString(params, 'tpTriggerBy', 'mark');
|
|
5154
|
+
request['tpTriggerBy'] = tpType;
|
|
5155
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
5156
|
+
if (price !== undefined) {
|
|
5157
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
5158
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'limit');
|
|
5159
|
+
}
|
|
5160
|
+
else {
|
|
5161
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'market');
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
params = this.omit(params, ['stopLossPrice', 'takeProfitPrice']);
|
|
5165
|
+
}
|
|
5166
|
+
else {
|
|
5167
|
+
if (isStopLoss) {
|
|
5168
|
+
const slTriggerPrice = this.safeNumber2(stopLoss, 'triggerPrice', 'stopPrice');
|
|
5169
|
+
const slLimitPrice = this.safeNumber(stopLoss, 'price');
|
|
5170
|
+
request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
|
|
5171
|
+
if (slLimitPrice !== undefined) {
|
|
5172
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, slLimitPrice);
|
|
5173
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'limit');
|
|
5174
|
+
}
|
|
5175
|
+
else {
|
|
5176
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'market');
|
|
5177
|
+
}
|
|
5178
|
+
}
|
|
5179
|
+
if (isTakeProfit) {
|
|
5180
|
+
const tpTriggerPrice = this.safeNumber2(takeProfit, 'triggerPrice', 'stopPrice');
|
|
5181
|
+
const tpLimitPrice = this.safeNumber(takeProfit, 'price');
|
|
5182
|
+
request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
5183
|
+
if (tpLimitPrice !== undefined) {
|
|
5184
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, tpLimitPrice);
|
|
5185
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'limit');
|
|
5186
|
+
}
|
|
5187
|
+
else {
|
|
5188
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'market');
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5191
|
+
const isMarketOrder = type === 'market';
|
|
5192
|
+
if (!isMarketOrder) {
|
|
5193
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
5194
|
+
}
|
|
5195
|
+
request['orderType'] = type;
|
|
5196
|
+
const exchangeSpecificTifParam = this.safeString(params, 'timeInForce');
|
|
5197
|
+
let postOnly = undefined;
|
|
5198
|
+
[postOnly, params] = this.handlePostOnly(isMarketOrder, exchangeSpecificTifParam === 'post_only', params);
|
|
5199
|
+
const defaultTimeInForce = this.safeStringUpper(this.options, 'defaultTimeInForce');
|
|
5200
|
+
const timeInForce = this.safeStringUpper(params, 'timeInForce', defaultTimeInForce);
|
|
5201
|
+
if (postOnly) {
|
|
5202
|
+
request['timeInForce'] = 'post_only';
|
|
5203
|
+
}
|
|
5204
|
+
else if (timeInForce === 'GTC') {
|
|
5205
|
+
request['timeInForce'] = 'gtc';
|
|
5206
|
+
}
|
|
5207
|
+
else if (timeInForce === 'FOK') {
|
|
5208
|
+
request['timeInForce'] = 'fok';
|
|
5209
|
+
}
|
|
5210
|
+
else if (timeInForce === 'IOC') {
|
|
5211
|
+
request['timeInForce'] = 'ioc';
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
5215
|
+
let hedged = undefined;
|
|
5216
|
+
[hedged, params] = this.handleParamBool(params, 'hedged', false);
|
|
5217
|
+
if (reduceOnly) {
|
|
5218
|
+
if (hedged || isStopLossOrTakeProfitTrigger) {
|
|
5219
|
+
const reduceOnlyPosSide = (side === 'sell') ? 'long' : 'short';
|
|
5220
|
+
request['posSide'] = reduceOnlyPosSide;
|
|
5221
|
+
}
|
|
5222
|
+
else if (!isStopLossOrTakeProfitTrigger) {
|
|
5223
|
+
request['reduceOnly'] = 'yes';
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
else {
|
|
5227
|
+
if (hedged) {
|
|
5228
|
+
const posSide = (side === 'buy') ? 'long' : 'short';
|
|
5229
|
+
request['posSide'] = posSide;
|
|
5230
|
+
}
|
|
5231
|
+
}
|
|
5232
|
+
params = this.omit(params, ['stopLoss', 'takeProfit', 'postOnly', 'reduceOnly', 'hedged']);
|
|
5233
|
+
return this.extend(request, params);
|
|
5234
|
+
}
|
|
4583
5235
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
4584
5236
|
const market = this.market(symbol);
|
|
4585
5237
|
let marketType = undefined;
|
|
@@ -4663,17 +5315,17 @@ export default class bitget extends Exchange {
|
|
|
4663
5315
|
request['executePrice'] = this.priceToPrecision(symbol, price);
|
|
4664
5316
|
}
|
|
4665
5317
|
if (isStopLoss) {
|
|
4666
|
-
const slTriggerPrice = this.
|
|
5318
|
+
const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice');
|
|
4667
5319
|
request['stopLossTriggerPrice'] = this.priceToPrecision(symbol, slTriggerPrice);
|
|
4668
|
-
const slPrice = this.
|
|
5320
|
+
const slPrice = this.safeString(stopLoss, 'price');
|
|
4669
5321
|
request['stopLossExecutePrice'] = this.priceToPrecision(symbol, slPrice);
|
|
4670
5322
|
const slType = this.safeString(stopLoss, 'type', 'mark_price');
|
|
4671
5323
|
request['stopLossTriggerType'] = slType;
|
|
4672
5324
|
}
|
|
4673
5325
|
if (isTakeProfit) {
|
|
4674
|
-
const tpTriggerPrice = this.
|
|
5326
|
+
const tpTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice');
|
|
4675
5327
|
request['stopSurplusTriggerPrice'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
4676
|
-
const tpPrice = this.
|
|
5328
|
+
const tpPrice = this.safeString(takeProfit, 'price');
|
|
4677
5329
|
request['stopSurplusExecutePrice'] = this.priceToPrecision(symbol, tpPrice);
|
|
4678
5330
|
const tpType = this.safeString(takeProfit, 'type', 'mark_price');
|
|
4679
5331
|
request['stopSurplusTriggerType'] = tpType;
|
|
@@ -4802,6 +5454,60 @@ export default class bitget extends Exchange {
|
|
|
4802
5454
|
}
|
|
4803
5455
|
return this.extend(request, params);
|
|
4804
5456
|
}
|
|
5457
|
+
async createUtaOrders(orders, params = {}) {
|
|
5458
|
+
await this.loadMarkets();
|
|
5459
|
+
const ordersRequests = [];
|
|
5460
|
+
let symbol = undefined;
|
|
5461
|
+
let marginMode = undefined;
|
|
5462
|
+
for (let i = 0; i < orders.length; i++) {
|
|
5463
|
+
const rawOrder = orders[i];
|
|
5464
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
5465
|
+
if (symbol === undefined) {
|
|
5466
|
+
symbol = marketId;
|
|
5467
|
+
}
|
|
5468
|
+
else {
|
|
5469
|
+
if (symbol !== marketId) {
|
|
5470
|
+
throw new BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
const type = this.safeString(rawOrder, 'type');
|
|
5474
|
+
const side = this.safeString(rawOrder, 'side');
|
|
5475
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
5476
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
5477
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
5478
|
+
const marginResult = this.handleMarginModeAndParams('createOrders', orderParams);
|
|
5479
|
+
const currentMarginMode = marginResult[0];
|
|
5480
|
+
if (currentMarginMode !== undefined) {
|
|
5481
|
+
if (marginMode === undefined) {
|
|
5482
|
+
marginMode = currentMarginMode;
|
|
5483
|
+
}
|
|
5484
|
+
else {
|
|
5485
|
+
if (marginMode !== currentMarginMode) {
|
|
5486
|
+
throw new BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
|
|
5487
|
+
}
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
const orderRequest = this.createUtaOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
5491
|
+
ordersRequests.push(orderRequest);
|
|
5492
|
+
}
|
|
5493
|
+
const market = this.market(symbol);
|
|
5494
|
+
const response = await this.privateUtaPostV3TradePlaceBatch(ordersRequests);
|
|
5495
|
+
//
|
|
5496
|
+
// {
|
|
5497
|
+
// "code": "00000",
|
|
5498
|
+
// "msg": "success",
|
|
5499
|
+
// "requestTime": 1752810184560,
|
|
5500
|
+
// "data": [
|
|
5501
|
+
// {
|
|
5502
|
+
// "orderId": "1329947796441513984",
|
|
5503
|
+
// "clientOid": "1329947796483457024"
|
|
5504
|
+
// },
|
|
5505
|
+
// ]
|
|
5506
|
+
// }
|
|
5507
|
+
//
|
|
5508
|
+
const data = this.safeList(response, 'data', []);
|
|
5509
|
+
return this.parseOrders(data, market);
|
|
5510
|
+
}
|
|
4805
5511
|
/**
|
|
4806
5512
|
* @method
|
|
4807
5513
|
* @name bitget#createOrders
|
|
@@ -4810,12 +5516,19 @@ export default class bitget extends Exchange {
|
|
|
4810
5516
|
* @see https://www.bitget.com/api-doc/contract/trade/Batch-Order
|
|
4811
5517
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Order
|
|
4812
5518
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Order
|
|
5519
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Place-Batch
|
|
4813
5520
|
* @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
|
|
4814
5521
|
* @param {object} [params] extra parameters specific to the api endpoint
|
|
5522
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
4815
5523
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4816
5524
|
*/
|
|
4817
5525
|
async createOrders(orders, params = {}) {
|
|
4818
5526
|
await this.loadMarkets();
|
|
5527
|
+
let uta = undefined;
|
|
5528
|
+
[uta, params] = this.handleOptionAndParams(params, 'createOrders', 'uta', false);
|
|
5529
|
+
if (uta) {
|
|
5530
|
+
return await this.createUtaOrders(orders, params);
|
|
5531
|
+
}
|
|
4819
5532
|
const ordersRequests = [];
|
|
4820
5533
|
let symbol = undefined;
|
|
4821
5534
|
let marginMode = undefined;
|
|
@@ -4914,6 +5627,8 @@ export default class bitget extends Exchange {
|
|
|
4914
5627
|
* @see https://www.bitget.com/api-doc/contract/trade/Modify-Order
|
|
4915
5628
|
* @see https://www.bitget.com/api-doc/contract/plan/Modify-Tpsl-Order
|
|
4916
5629
|
* @see https://www.bitget.com/api-doc/contract/plan/Modify-Plan-Order
|
|
5630
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Modify-Order
|
|
5631
|
+
* @see https://www.bitget.com/api-doc/uta/strategy/Modify-Strategy-Order
|
|
4917
5632
|
* @param {string} id cancel order id
|
|
4918
5633
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
4919
5634
|
* @param {string} type 'market' or 'limit'
|
|
@@ -4935,6 +5650,7 @@ export default class bitget extends Exchange {
|
|
|
4935
5650
|
* @param {string} [params.trailingPercent] *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
|
|
4936
5651
|
* @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
|
|
4937
5652
|
* @param {string} [params.newTriggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
|
|
5653
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
4938
5654
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4939
5655
|
*/
|
|
4940
5656
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -4966,7 +5682,50 @@ export default class bitget extends Exchange {
|
|
|
4966
5682
|
}
|
|
4967
5683
|
params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent']);
|
|
4968
5684
|
let response = undefined;
|
|
4969
|
-
|
|
5685
|
+
let productType = undefined;
|
|
5686
|
+
let uta = undefined;
|
|
5687
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5688
|
+
[uta, params] = this.handleOptionAndParams(params, 'editOrder', 'uta', false);
|
|
5689
|
+
if (uta) {
|
|
5690
|
+
if (amount !== undefined) {
|
|
5691
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
5692
|
+
}
|
|
5693
|
+
if (isStopLossOrder || isTakeProfitOrder) {
|
|
5694
|
+
if (isStopLossOrder) {
|
|
5695
|
+
const slType = this.safeString(params, 'slTriggerBy', 'mark');
|
|
5696
|
+
request['slTriggerBy'] = slType;
|
|
5697
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
5698
|
+
if (price !== undefined) {
|
|
5699
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
5700
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'limit');
|
|
5701
|
+
}
|
|
5702
|
+
else {
|
|
5703
|
+
request['slOrderType'] = this.safeString(params, 'slOrderType', 'market');
|
|
5704
|
+
}
|
|
5705
|
+
}
|
|
5706
|
+
else if (isTakeProfitOrder) {
|
|
5707
|
+
const tpType = this.safeString(params, 'tpTriggerBy', 'mark');
|
|
5708
|
+
request['tpTriggerBy'] = tpType;
|
|
5709
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
5710
|
+
if (price !== undefined) {
|
|
5711
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
5712
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'limit');
|
|
5713
|
+
}
|
|
5714
|
+
else {
|
|
5715
|
+
request['tpOrderType'] = this.safeString(params, 'tpOrderType', 'market');
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
params = this.omit(params, ['stopLossPrice', 'takeProfitPrice']);
|
|
5719
|
+
response = await this.privateUtaPostV3TradeModifyStrategyOrder(this.extend(request, params));
|
|
5720
|
+
}
|
|
5721
|
+
else {
|
|
5722
|
+
if (price !== undefined) {
|
|
5723
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
5724
|
+
}
|
|
5725
|
+
response = await this.privateUtaPostV3TradeModifyOrder(this.extend(request, params));
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
else if (market['spot']) {
|
|
4970
5729
|
if (triggerPrice === undefined) {
|
|
4971
5730
|
throw new NotSupported(this.id + ' editOrder() only supports plan/trigger spot orders');
|
|
4972
5731
|
}
|
|
@@ -4995,8 +5754,6 @@ export default class bitget extends Exchange {
|
|
|
4995
5754
|
throw new NotSupported(this.id + ' editOrder() does not support ' + market['type'] + ' orders');
|
|
4996
5755
|
}
|
|
4997
5756
|
request['symbol'] = market['id'];
|
|
4998
|
-
let productType = undefined;
|
|
4999
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5000
5757
|
request['productType'] = productType;
|
|
5001
5758
|
if (!isTakeProfitOrder && !isStopLossOrder) {
|
|
5002
5759
|
request['newSize'] = this.amountToPrecision(symbol, amount);
|
|
@@ -5088,6 +5845,8 @@ export default class bitget extends Exchange {
|
|
|
5088
5845
|
* @see https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order
|
|
5089
5846
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Cross-Cancel-Order
|
|
5090
5847
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Cancel-Order
|
|
5848
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Cancel-Order
|
|
5849
|
+
* @see https://www.bitget.com/api-doc/uta/strategy/Cancel-Strategy-Order
|
|
5091
5850
|
* @param {string} id order id
|
|
5092
5851
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5093
5852
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -5095,6 +5854,7 @@ export default class bitget extends Exchange {
|
|
|
5095
5854
|
* @param {boolean} [params.trigger] set to true for canceling trigger orders
|
|
5096
5855
|
* @param {string} [params.planType] *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
|
|
5097
5856
|
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
5857
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5098
5858
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5099
5859
|
*/
|
|
5100
5860
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -5116,7 +5876,18 @@ export default class bitget extends Exchange {
|
|
|
5116
5876
|
if (!((market['swap'] || market['future']) && trigger)) {
|
|
5117
5877
|
request['orderId'] = id;
|
|
5118
5878
|
}
|
|
5119
|
-
|
|
5879
|
+
let uta = undefined;
|
|
5880
|
+
[uta, params] = this.handleOptionAndParams(params, 'cancelOrder', 'uta', false);
|
|
5881
|
+
if (uta) {
|
|
5882
|
+
request['orderId'] = id;
|
|
5883
|
+
if (trigger) {
|
|
5884
|
+
response = await this.privateUtaPostV3TradeCancelStrategyOrder(this.extend(request, params));
|
|
5885
|
+
}
|
|
5886
|
+
else {
|
|
5887
|
+
response = await this.privateUtaPostV3TradeCancelOrder(this.extend(request, params));
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
else if ((market['swap']) || (market['future'])) {
|
|
5120
5891
|
let productType = undefined;
|
|
5121
5892
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5122
5893
|
request['productType'] = productType;
|
|
@@ -5202,17 +5973,66 @@ export default class bitget extends Exchange {
|
|
|
5202
5973
|
// }
|
|
5203
5974
|
// }
|
|
5204
5975
|
//
|
|
5976
|
+
// uta trigger
|
|
5977
|
+
//
|
|
5978
|
+
// {
|
|
5979
|
+
// "code": "00000",
|
|
5980
|
+
// "msg": "success",
|
|
5981
|
+
// "requestTime": "1753058267399",
|
|
5982
|
+
// "data": null
|
|
5983
|
+
// }
|
|
5984
|
+
//
|
|
5205
5985
|
const data = this.safeValue(response, 'data', {});
|
|
5206
5986
|
let order = undefined;
|
|
5207
|
-
if ((market['swap'] || market['future']) && trigger) {
|
|
5987
|
+
if ((market['swap'] || market['future']) && trigger && !uta) {
|
|
5208
5988
|
const orderInfo = this.safeValue(data, 'successList', []);
|
|
5209
5989
|
order = orderInfo[0];
|
|
5210
5990
|
}
|
|
5211
5991
|
else {
|
|
5212
|
-
|
|
5992
|
+
if (uta && trigger) {
|
|
5993
|
+
order = response;
|
|
5994
|
+
}
|
|
5995
|
+
else {
|
|
5996
|
+
order = data;
|
|
5997
|
+
}
|
|
5213
5998
|
}
|
|
5214
5999
|
return this.parseOrder(order, market);
|
|
5215
6000
|
}
|
|
6001
|
+
async cancelUtaOrders(ids, symbol = undefined, params = {}) {
|
|
6002
|
+
if (symbol === undefined) {
|
|
6003
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
6004
|
+
}
|
|
6005
|
+
await this.loadMarkets();
|
|
6006
|
+
const market = this.market(symbol);
|
|
6007
|
+
let productType = undefined;
|
|
6008
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6009
|
+
const requestList = [];
|
|
6010
|
+
for (let i = 0; i < ids.length; i++) {
|
|
6011
|
+
const individualId = ids[i];
|
|
6012
|
+
const order = {
|
|
6013
|
+
'orderId': individualId,
|
|
6014
|
+
'symbol': market['id'],
|
|
6015
|
+
'category': productType,
|
|
6016
|
+
};
|
|
6017
|
+
requestList.push(order);
|
|
6018
|
+
}
|
|
6019
|
+
const response = await this.privateUtaPostV3TradeCancelBatch(requestList);
|
|
6020
|
+
//
|
|
6021
|
+
// {
|
|
6022
|
+
// "code": "00000",
|
|
6023
|
+
// "msg": "success",
|
|
6024
|
+
// "requestTime": 1752813731517,
|
|
6025
|
+
// "data": [
|
|
6026
|
+
// {
|
|
6027
|
+
// "orderId": "1329948909442023424",
|
|
6028
|
+
// "clientOid": "1329948909446217728"
|
|
6029
|
+
// },
|
|
6030
|
+
// ]
|
|
6031
|
+
// }
|
|
6032
|
+
//
|
|
6033
|
+
const data = this.safeList(response, 'data', []);
|
|
6034
|
+
return this.parseOrders(data, market);
|
|
6035
|
+
}
|
|
5216
6036
|
/**
|
|
5217
6037
|
* @method
|
|
5218
6038
|
* @name bitget#cancelOrders
|
|
@@ -5222,11 +6042,13 @@ export default class bitget extends Exchange {
|
|
|
5222
6042
|
* @see https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order
|
|
5223
6043
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Cancel-Order
|
|
5224
6044
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Cancel-Orders
|
|
6045
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Cancel-Batch
|
|
5225
6046
|
* @param {string[]} ids order ids
|
|
5226
6047
|
* @param {string} symbol unified market symbol, default is undefined
|
|
5227
6048
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5228
6049
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
5229
6050
|
* @param {boolean} [params.trigger] *contract only* set to true for canceling trigger orders
|
|
6051
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5230
6052
|
* @returns {object} an array of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5231
6053
|
*/
|
|
5232
6054
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
@@ -5235,6 +6057,11 @@ export default class bitget extends Exchange {
|
|
|
5235
6057
|
}
|
|
5236
6058
|
await this.loadMarkets();
|
|
5237
6059
|
const market = this.market(symbol);
|
|
6060
|
+
let uta = undefined;
|
|
6061
|
+
[uta, params] = this.handleOptionAndParams(params, 'cancelOrders', 'uta', false);
|
|
6062
|
+
if (uta) {
|
|
6063
|
+
return await this.cancelUtaOrders(ids, symbol, params);
|
|
6064
|
+
}
|
|
5238
6065
|
let marginMode = undefined;
|
|
5239
6066
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
5240
6067
|
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
@@ -5310,10 +6137,12 @@ export default class bitget extends Exchange {
|
|
|
5310
6137
|
* @see https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders
|
|
5311
6138
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
|
5312
6139
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
|
6140
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Cancel-All-Order
|
|
5313
6141
|
* @param {string} symbol unified market symbol
|
|
5314
6142
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5315
6143
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
5316
6144
|
* @param {boolean} [params.trigger] *contract only* set to true for canceling trigger orders
|
|
6145
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5317
6146
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5318
6147
|
*/
|
|
5319
6148
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -5324,13 +6153,41 @@ export default class bitget extends Exchange {
|
|
|
5324
6153
|
const market = this.market(symbol);
|
|
5325
6154
|
let marginMode = undefined;
|
|
5326
6155
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
6156
|
+
let productType = undefined;
|
|
6157
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5327
6158
|
const request = {
|
|
5328
6159
|
'symbol': market['id'],
|
|
5329
6160
|
};
|
|
5330
6161
|
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5331
6162
|
params = this.omit(params, ['stop', 'trigger']);
|
|
5332
6163
|
let response = undefined;
|
|
5333
|
-
|
|
6164
|
+
let uta = undefined;
|
|
6165
|
+
[uta, params] = this.handleOptionAndParams(params, 'cancelAllOrders', 'uta', false);
|
|
6166
|
+
if (uta) {
|
|
6167
|
+
if (productType === 'SPOT') {
|
|
6168
|
+
if (marginMode !== undefined) {
|
|
6169
|
+
productType = 'MARGIN';
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
request['category'] = productType;
|
|
6173
|
+
response = await this.privateUtaPostV3TradeCancelSymbolOrder(this.extend(request, params));
|
|
6174
|
+
//
|
|
6175
|
+
// {
|
|
6176
|
+
// "code": "00000",
|
|
6177
|
+
// "msg": "success",
|
|
6178
|
+
// "requestTime": 1750751578138,
|
|
6179
|
+
// "data": {
|
|
6180
|
+
// "list": [
|
|
6181
|
+
// {
|
|
6182
|
+
// "orderId": "1321313242969427968",
|
|
6183
|
+
// "clientOid": "1321313242969427969"
|
|
6184
|
+
// }
|
|
6185
|
+
// ]
|
|
6186
|
+
// }
|
|
6187
|
+
// }
|
|
6188
|
+
//
|
|
6189
|
+
}
|
|
6190
|
+
else if (market['spot']) {
|
|
5334
6191
|
if (marginMode !== undefined) {
|
|
5335
6192
|
if (marginMode === 'cross') {
|
|
5336
6193
|
response = await this.privateMarginPostMarginV1CrossOrderBatchCancelOrder(this.extend(request, params));
|
|
@@ -5389,8 +6246,6 @@ export default class bitget extends Exchange {
|
|
|
5389
6246
|
}
|
|
5390
6247
|
}
|
|
5391
6248
|
else {
|
|
5392
|
-
let productType = undefined;
|
|
5393
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5394
6249
|
request['productType'] = productType;
|
|
5395
6250
|
if (trigger) {
|
|
5396
6251
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
@@ -5414,9 +6269,15 @@ export default class bitget extends Exchange {
|
|
|
5414
6269
|
// }
|
|
5415
6270
|
}
|
|
5416
6271
|
const data = this.safeDict(response, 'data');
|
|
5417
|
-
const resultList = this.
|
|
6272
|
+
const resultList = this.safeListN(data, ['resultList', 'successList', 'list']);
|
|
5418
6273
|
const failureList = this.safeList2(data, 'failure', 'failureList');
|
|
5419
|
-
|
|
6274
|
+
let responseList = undefined;
|
|
6275
|
+
if ((resultList !== undefined) && (failureList !== undefined)) {
|
|
6276
|
+
responseList = this.arrayConcat(resultList, failureList);
|
|
6277
|
+
}
|
|
6278
|
+
else {
|
|
6279
|
+
responseList = resultList;
|
|
6280
|
+
}
|
|
5420
6281
|
return this.parseOrders(responseList);
|
|
5421
6282
|
}
|
|
5422
6283
|
/**
|
|
@@ -5425,9 +6286,11 @@ export default class bitget extends Exchange {
|
|
|
5425
6286
|
* @description fetches information on an order made by the user
|
|
5426
6287
|
* @see https://www.bitget.com/api-doc/spot/trade/Get-Order-Info
|
|
5427
6288
|
* @see https://www.bitget.com/api-doc/contract/trade/Get-Order-Details
|
|
6289
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Order-Details
|
|
5428
6290
|
* @param {string} id the order id
|
|
5429
6291
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5430
6292
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6293
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5431
6294
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5432
6295
|
*/
|
|
5433
6296
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -5440,7 +6303,12 @@ export default class bitget extends Exchange {
|
|
|
5440
6303
|
'orderId': id,
|
|
5441
6304
|
};
|
|
5442
6305
|
let response = undefined;
|
|
5443
|
-
|
|
6306
|
+
let uta = undefined;
|
|
6307
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchOrder', 'uta', false);
|
|
6308
|
+
if (uta) {
|
|
6309
|
+
response = await this.privateUtaGetV3TradeOrderInfo(this.extend(request, params));
|
|
6310
|
+
}
|
|
6311
|
+
else if (market['spot']) {
|
|
5444
6312
|
response = await this.privateSpotGetV2SpotTradeOrderInfo(this.extend(request, params));
|
|
5445
6313
|
}
|
|
5446
6314
|
else if (market['swap'] || market['future']) {
|
|
@@ -5520,7 +6388,51 @@ export default class bitget extends Exchange {
|
|
|
5520
6388
|
// }
|
|
5521
6389
|
// }
|
|
5522
6390
|
//
|
|
5523
|
-
|
|
6391
|
+
// uta
|
|
6392
|
+
//
|
|
6393
|
+
// {
|
|
6394
|
+
// "code": "00000",
|
|
6395
|
+
// "msg": "success",
|
|
6396
|
+
// "requestTime": 1750496858333,
|
|
6397
|
+
// "data": {
|
|
6398
|
+
// "orderId": "1320244799629316096",
|
|
6399
|
+
// "clientOid": "1320244799633510400",
|
|
6400
|
+
// "category": "USDT-FUTURES",
|
|
6401
|
+
// "symbol": "BTCUSDT",
|
|
6402
|
+
// "orderType": "limit",
|
|
6403
|
+
// "side": "buy",
|
|
6404
|
+
// "price": "50000",
|
|
6405
|
+
// "qty": "0.001",
|
|
6406
|
+
// "amount": "0",
|
|
6407
|
+
// "cumExecQty": "0",
|
|
6408
|
+
// "cumExecValue": "0",
|
|
6409
|
+
// "avgPrice": "0",
|
|
6410
|
+
// "timeInForce": "gtc",
|
|
6411
|
+
// "orderStatus": "live",
|
|
6412
|
+
// "posSide": "long",
|
|
6413
|
+
// "holdMode": "hedge_mode",
|
|
6414
|
+
// "reduceOnly": "NO",
|
|
6415
|
+
// "feeDetail": [{
|
|
6416
|
+
// "feeCoin": "",
|
|
6417
|
+
// "fee": ""
|
|
6418
|
+
// }],
|
|
6419
|
+
// "createdTime": "1750496809871",
|
|
6420
|
+
// "updatedTime": "1750496809886",
|
|
6421
|
+
// "cancelReason": "",
|
|
6422
|
+
// "execType": "normal",
|
|
6423
|
+
// "stpMode": "none",
|
|
6424
|
+
// "tpTriggerBy": null,
|
|
6425
|
+
// "slTriggerBy": null,
|
|
6426
|
+
// "takeProfit": null,
|
|
6427
|
+
// "stopLoss": null,
|
|
6428
|
+
// "tpOrderType": null,
|
|
6429
|
+
// "slOrderType": null,
|
|
6430
|
+
// "tpLimitPrice": null,
|
|
6431
|
+
// "slLimitPrice": null
|
|
6432
|
+
// }
|
|
6433
|
+
// }
|
|
6434
|
+
//
|
|
6435
|
+
if (!uta && (typeof response === 'string')) {
|
|
5524
6436
|
response = JSON.parse(response);
|
|
5525
6437
|
}
|
|
5526
6438
|
const data = this.safeDict(response, 'data');
|
|
@@ -5530,6 +6442,10 @@ export default class bitget extends Exchange {
|
|
|
5530
6442
|
}
|
|
5531
6443
|
}
|
|
5532
6444
|
const dataList = this.safeList(response, 'data', []);
|
|
6445
|
+
const dataListLength = dataList.length;
|
|
6446
|
+
if (dataListLength === 0) {
|
|
6447
|
+
throw new OrderNotFound(this.id + ' fetchOrder() could not find order id ' + id + ' in ' + this.json(response));
|
|
6448
|
+
}
|
|
5533
6449
|
const first = this.safeDict(dataList, 0, {});
|
|
5534
6450
|
return this.parseOrder(first, market);
|
|
5535
6451
|
// const first = this.safeDict (data, 0, data);
|
|
@@ -5545,6 +6461,7 @@ export default class bitget extends Exchange {
|
|
|
5545
6461
|
* @see https://www.bitget.com/api-doc/contract/plan/get-orders-plan-pending
|
|
5546
6462
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Open-Orders
|
|
5547
6463
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Open-Orders
|
|
6464
|
+
* @see https://www.bitget.com/api-doc/uta/strategy/Get-Unfilled-Strategy-Orders
|
|
5548
6465
|
* @param {string} symbol unified market symbol
|
|
5549
6466
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
5550
6467
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -5555,6 +6472,7 @@ export default class bitget extends Exchange {
|
|
|
5555
6472
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5556
6473
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5557
6474
|
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
6475
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5558
6476
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5559
6477
|
*/
|
|
5560
6478
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -5564,6 +6482,8 @@ export default class bitget extends Exchange {
|
|
|
5564
6482
|
let request = {};
|
|
5565
6483
|
let marginMode = undefined;
|
|
5566
6484
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
6485
|
+
let uta = undefined;
|
|
6486
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'uta', false);
|
|
5567
6487
|
if (symbol !== undefined) {
|
|
5568
6488
|
market = this.market(symbol);
|
|
5569
6489
|
request['symbol'] = market['id'];
|
|
@@ -5579,22 +6499,28 @@ export default class bitget extends Exchange {
|
|
|
5579
6499
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
5580
6500
|
if (paginate) {
|
|
5581
6501
|
let cursorReceived = undefined;
|
|
5582
|
-
|
|
6502
|
+
let cursorSent = undefined;
|
|
6503
|
+
if (uta) {
|
|
6504
|
+
cursorReceived = 'cursor';
|
|
6505
|
+
cursorSent = 'cursor';
|
|
6506
|
+
}
|
|
6507
|
+
else if (type === 'spot') {
|
|
5583
6508
|
if (marginMode !== undefined) {
|
|
5584
6509
|
cursorReceived = 'minId';
|
|
6510
|
+
cursorSent = 'idLessThan';
|
|
5585
6511
|
}
|
|
5586
6512
|
}
|
|
5587
6513
|
else {
|
|
5588
6514
|
cursorReceived = 'endId';
|
|
6515
|
+
cursorSent = 'idLessThan';
|
|
5589
6516
|
}
|
|
5590
|
-
return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived,
|
|
6517
|
+
return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, cursorSent);
|
|
5591
6518
|
}
|
|
5592
6519
|
let response = undefined;
|
|
5593
6520
|
const trailing = this.safeBool(params, 'trailing');
|
|
5594
6521
|
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5595
6522
|
const planTypeDefined = this.safeString(params, 'planType') !== undefined;
|
|
5596
6523
|
const isTrigger = (trigger || planTypeDefined);
|
|
5597
|
-
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
5598
6524
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5599
6525
|
if (since !== undefined) {
|
|
5600
6526
|
request['startTime'] = since;
|
|
@@ -5602,53 +6528,66 @@ export default class bitget extends Exchange {
|
|
|
5602
6528
|
if (limit !== undefined) {
|
|
5603
6529
|
request['limit'] = limit;
|
|
5604
6530
|
}
|
|
5605
|
-
if ((type === 'swap') || (type === 'future') || (marginMode !== undefined)) {
|
|
6531
|
+
if (!uta && ((type === 'swap') || (type === 'future') || (marginMode !== undefined))) {
|
|
5606
6532
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
5607
6533
|
params = this.omit(params, 'clientOrderId');
|
|
5608
6534
|
if (clientOrderId !== undefined) {
|
|
5609
6535
|
request['clientOid'] = clientOrderId;
|
|
5610
6536
|
}
|
|
5611
6537
|
}
|
|
5612
|
-
let
|
|
5613
|
-
|
|
5614
|
-
|
|
6538
|
+
let productType = undefined;
|
|
6539
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6540
|
+
params = this.omit(params, ['type', 'stop', 'trigger', 'trailing']);
|
|
6541
|
+
if (uta) {
|
|
6542
|
+
if (type === 'spot') {
|
|
6543
|
+
if (marginMode !== undefined) {
|
|
6544
|
+
productType = 'MARGIN';
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
request['category'] = productType;
|
|
6548
|
+
if (trigger) {
|
|
6549
|
+
response = await this.privateUtaGetV3TradeUnfilledStrategyOrders(this.extend(request, params));
|
|
6550
|
+
}
|
|
6551
|
+
else {
|
|
6552
|
+
response = await this.privateUtaGetV3TradeUnfilledOrders(this.extend(request, params));
|
|
6553
|
+
}
|
|
6554
|
+
}
|
|
6555
|
+
else if (type === 'spot') {
|
|
5615
6556
|
if (marginMode !== undefined) {
|
|
5616
6557
|
if (since === undefined) {
|
|
5617
6558
|
since = this.milliseconds() - 7776000000;
|
|
5618
6559
|
request['startTime'] = since;
|
|
5619
6560
|
}
|
|
5620
6561
|
if (marginMode === 'isolated') {
|
|
5621
|
-
response = await this.privateMarginGetV2MarginIsolatedOpenOrders(this.extend(request,
|
|
6562
|
+
response = await this.privateMarginGetV2MarginIsolatedOpenOrders(this.extend(request, params));
|
|
5622
6563
|
}
|
|
5623
6564
|
else if (marginMode === 'cross') {
|
|
5624
|
-
response = await this.privateMarginGetV2MarginCrossedOpenOrders(this.extend(request,
|
|
6565
|
+
response = await this.privateMarginGetV2MarginCrossedOpenOrders(this.extend(request, params));
|
|
5625
6566
|
}
|
|
5626
6567
|
}
|
|
5627
6568
|
else {
|
|
5628
6569
|
if (trigger) {
|
|
5629
|
-
response = await this.privateSpotGetV2SpotTradeCurrentPlanOrder(this.extend(request,
|
|
6570
|
+
response = await this.privateSpotGetV2SpotTradeCurrentPlanOrder(this.extend(request, params));
|
|
5630
6571
|
}
|
|
5631
6572
|
else {
|
|
5632
|
-
response = await this.privateSpotGetV2SpotTradeUnfilledOrders(this.extend(request,
|
|
6573
|
+
response = await this.privateSpotGetV2SpotTradeUnfilledOrders(this.extend(request, params));
|
|
5633
6574
|
}
|
|
5634
6575
|
}
|
|
5635
6576
|
}
|
|
5636
6577
|
else {
|
|
5637
|
-
let productType = undefined;
|
|
5638
|
-
[productType, query] = this.handleProductTypeAndParams(market, query);
|
|
5639
6578
|
request['productType'] = productType;
|
|
5640
6579
|
if (trailing) {
|
|
5641
6580
|
const planType = this.safeString(params, 'planType', 'track_plan');
|
|
5642
6581
|
request['planType'] = planType;
|
|
5643
|
-
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request,
|
|
6582
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, params));
|
|
5644
6583
|
}
|
|
5645
6584
|
else if (isTrigger) {
|
|
5646
|
-
const planType = this.safeString(
|
|
6585
|
+
const planType = this.safeString(params, 'planType', 'normal_plan');
|
|
5647
6586
|
request['planType'] = planType;
|
|
5648
|
-
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request,
|
|
6587
|
+
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, params));
|
|
5649
6588
|
}
|
|
5650
6589
|
else {
|
|
5651
|
-
response = await this.privateMixGetV2MixOrderOrdersPending(this.extend(request,
|
|
6590
|
+
response = await this.privateMixGetV2MixOrderOrdersPending(this.extend(request, params));
|
|
5652
6591
|
}
|
|
5653
6592
|
}
|
|
5654
6593
|
//
|
|
@@ -5826,8 +6765,95 @@ export default class bitget extends Exchange {
|
|
|
5826
6765
|
// }
|
|
5827
6766
|
// }
|
|
5828
6767
|
//
|
|
6768
|
+
// uta
|
|
6769
|
+
//
|
|
6770
|
+
// {
|
|
6771
|
+
// "code": "00000",
|
|
6772
|
+
// "msg": "success",
|
|
6773
|
+
// "requestTime": 1750753395850,
|
|
6774
|
+
// "data": {
|
|
6775
|
+
// "list": [
|
|
6776
|
+
// {
|
|
6777
|
+
// "orderId": "1321320757371228160",
|
|
6778
|
+
// "clientOid": "1321320757371228161",
|
|
6779
|
+
// "category": "USDT-FUTURES",
|
|
6780
|
+
// "symbol": "BTCUSDT",
|
|
6781
|
+
// "orderType": "limit",
|
|
6782
|
+
// "side": "buy",
|
|
6783
|
+
// "price": "50000",
|
|
6784
|
+
// "qty": "0.001",
|
|
6785
|
+
// "amount": "0",
|
|
6786
|
+
// "cumExecQty": "0",
|
|
6787
|
+
// "cumExecValue": "0",
|
|
6788
|
+
// "avgPrice": "0",
|
|
6789
|
+
// "timeInForce": "gtc",
|
|
6790
|
+
// "orderStatus": "live",
|
|
6791
|
+
// "posSide": "long",
|
|
6792
|
+
// "holdMode": "hedge_mode",
|
|
6793
|
+
// "reduceOnly": "NO",
|
|
6794
|
+
// "feeDetail": [
|
|
6795
|
+
// {
|
|
6796
|
+
// "feeCoin": "",
|
|
6797
|
+
// "fee": ""
|
|
6798
|
+
// }
|
|
6799
|
+
// ],
|
|
6800
|
+
// "createdTime": "1750753338186",
|
|
6801
|
+
// "updatedTime": "1750753338203",
|
|
6802
|
+
// "stpMode": "none",
|
|
6803
|
+
// "tpTriggerBy": null,
|
|
6804
|
+
// "slTriggerBy": null,
|
|
6805
|
+
// "takeProfit": null,
|
|
6806
|
+
// "stopLoss": null,
|
|
6807
|
+
// "tpOrderType": null,
|
|
6808
|
+
// "slOrderType": null,
|
|
6809
|
+
// "tpLimitPrice": null,
|
|
6810
|
+
// "slLimitPrice": null
|
|
6811
|
+
// }
|
|
6812
|
+
// ],
|
|
6813
|
+
// "cursor": "1321320757371228160"
|
|
6814
|
+
// }
|
|
6815
|
+
// }
|
|
6816
|
+
//
|
|
6817
|
+
// uta trigger
|
|
6818
|
+
//
|
|
6819
|
+
// {
|
|
6820
|
+
// "code": "00000",
|
|
6821
|
+
// "msg": "success",
|
|
6822
|
+
// "requestTime": 1753057527060,
|
|
6823
|
+
// "data": [
|
|
6824
|
+
// {
|
|
6825
|
+
// "orderId": "1330984742276198400",
|
|
6826
|
+
// "clientOid": "1330984742276198400",
|
|
6827
|
+
// "symbol": "BTCUSDT",
|
|
6828
|
+
// "category": "USDT-FUTURES",
|
|
6829
|
+
// "qty": "0.001",
|
|
6830
|
+
// "posSide": "long",
|
|
6831
|
+
// "tpTriggerBy": "market",
|
|
6832
|
+
// "slTriggerBy": "mark",
|
|
6833
|
+
// "takeProfit": "",
|
|
6834
|
+
// "stopLoss":"114000",
|
|
6835
|
+
// "tpOrderType": "market",
|
|
6836
|
+
// "slOrderType": "limit",
|
|
6837
|
+
// "tpLimitPrice": "",
|
|
6838
|
+
// "slLimitPrice": "113000",
|
|
6839
|
+
// "createdTime": "1753057411736",
|
|
6840
|
+
// "updatedTime": "1753057411747"
|
|
6841
|
+
// }
|
|
6842
|
+
// ]
|
|
6843
|
+
// }
|
|
6844
|
+
//
|
|
5829
6845
|
const data = this.safeValue(response, 'data');
|
|
5830
|
-
if (
|
|
6846
|
+
if (uta) {
|
|
6847
|
+
let result = undefined;
|
|
6848
|
+
if (trigger) {
|
|
6849
|
+
result = this.safeList(response, 'data', []);
|
|
6850
|
+
}
|
|
6851
|
+
else {
|
|
6852
|
+
result = this.safeList(data, 'list', []);
|
|
6853
|
+
}
|
|
6854
|
+
return this.parseOrders(result, market, since, limit);
|
|
6855
|
+
}
|
|
6856
|
+
else if (type === 'spot') {
|
|
5831
6857
|
if ((marginMode !== undefined) || trigger) {
|
|
5832
6858
|
const resultList = this.safeList(data, 'orderList', []);
|
|
5833
6859
|
return this.parseOrders(resultList, market, since, limit);
|
|
@@ -5849,6 +6875,7 @@ export default class bitget extends Exchange {
|
|
|
5849
6875
|
* @see https://www.bitget.com/api-doc/contract/plan/orders-plan-history
|
|
5850
6876
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History
|
|
5851
6877
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History
|
|
6878
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Order-History
|
|
5852
6879
|
* @param {string} symbol unified market symbol of the closed orders
|
|
5853
6880
|
* @param {int} [since] timestamp in ms of the earliest order
|
|
5854
6881
|
* @param {int} [limit] the max number of closed orders to return
|
|
@@ -5876,6 +6903,7 @@ export default class bitget extends Exchange {
|
|
|
5876
6903
|
* @see https://www.bitget.com/api-doc/contract/plan/orders-plan-history
|
|
5877
6904
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History
|
|
5878
6905
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History
|
|
6906
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Order-History
|
|
5879
6907
|
* @param {string} symbol unified market symbol of the canceled orders
|
|
5880
6908
|
* @param {int} [since] timestamp in ms of the earliest order
|
|
5881
6909
|
* @param {int} [limit] the max number of canceled orders to return
|
|
@@ -5902,6 +6930,8 @@ export default class bitget extends Exchange {
|
|
|
5902
6930
|
* @see https://www.bitget.com/api-doc/contract/plan/orders-plan-history
|
|
5903
6931
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History
|
|
5904
6932
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History
|
|
6933
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Order-History
|
|
6934
|
+
* @see https://www.bitget.com/api-doc/uta/strategy/Get-History-Strategy-Orders
|
|
5905
6935
|
* @description fetches information on multiple canceled and closed orders made by the user
|
|
5906
6936
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
5907
6937
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -5913,9 +6943,15 @@ export default class bitget extends Exchange {
|
|
|
5913
6943
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5914
6944
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5915
6945
|
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
6946
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
5916
6947
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5917
6948
|
*/
|
|
5918
6949
|
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6950
|
+
let uta = undefined;
|
|
6951
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'uta', false);
|
|
6952
|
+
if (uta) {
|
|
6953
|
+
return await this.fetchUtaCanceledAndClosedOrders(symbol, since, limit, params);
|
|
6954
|
+
}
|
|
5919
6955
|
await this.loadMarkets();
|
|
5920
6956
|
let market = undefined;
|
|
5921
6957
|
let request = {};
|
|
@@ -6204,6 +7240,132 @@ export default class bitget extends Exchange {
|
|
|
6204
7240
|
const orders = this.safeList(response, 'data', []);
|
|
6205
7241
|
return this.parseOrders(orders, market, since, limit);
|
|
6206
7242
|
}
|
|
7243
|
+
async fetchUtaCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7244
|
+
await this.loadMarkets();
|
|
7245
|
+
let market = undefined;
|
|
7246
|
+
if (symbol !== undefined) {
|
|
7247
|
+
market = this.market(symbol);
|
|
7248
|
+
}
|
|
7249
|
+
let productType = undefined;
|
|
7250
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7251
|
+
if (productType === 'SPOT') {
|
|
7252
|
+
let marginMode = undefined;
|
|
7253
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchCanceledAndClosedOrders', params);
|
|
7254
|
+
if (marginMode !== undefined) {
|
|
7255
|
+
productType = 'MARGIN';
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7258
|
+
let request = {
|
|
7259
|
+
'category': productType,
|
|
7260
|
+
};
|
|
7261
|
+
let paginate = false;
|
|
7262
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
|
|
7263
|
+
if (paginate) {
|
|
7264
|
+
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'cursor', 'cursor');
|
|
7265
|
+
}
|
|
7266
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
7267
|
+
if (since !== undefined) {
|
|
7268
|
+
request['startTime'] = since;
|
|
7269
|
+
}
|
|
7270
|
+
if (limit !== undefined) {
|
|
7271
|
+
request['limit'] = limit;
|
|
7272
|
+
}
|
|
7273
|
+
let response = undefined;
|
|
7274
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
7275
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
7276
|
+
if (trigger) {
|
|
7277
|
+
response = await this.privateUtaGetV3TradeHistoryStrategyOrders(this.extend(request, params));
|
|
7278
|
+
}
|
|
7279
|
+
else {
|
|
7280
|
+
response = await this.privateUtaGetV3TradeHistoryOrders(this.extend(request, params));
|
|
7281
|
+
}
|
|
7282
|
+
//
|
|
7283
|
+
// uta
|
|
7284
|
+
//
|
|
7285
|
+
// {
|
|
7286
|
+
// "code": "00000",
|
|
7287
|
+
// "msg": "success",
|
|
7288
|
+
// "requestTime": 1752531592855,
|
|
7289
|
+
// "data": {
|
|
7290
|
+
// "list": [
|
|
7291
|
+
// {
|
|
7292
|
+
// "orderId": "1322441400976261120",
|
|
7293
|
+
// "clientOid": "1322441400976261121",
|
|
7294
|
+
// "category": "USDT-FUTURES",
|
|
7295
|
+
// "symbol": "BTCUSDT",
|
|
7296
|
+
// "orderType": "market",
|
|
7297
|
+
// "side": "sell",
|
|
7298
|
+
// "price": "0",
|
|
7299
|
+
// "qty": "0.0001",
|
|
7300
|
+
// "amount": "0",
|
|
7301
|
+
// "cumExecQty": "0.0001",
|
|
7302
|
+
// "cumExecValue": "10.7005",
|
|
7303
|
+
// "avgPrice": "107005.4",
|
|
7304
|
+
// "timeInForce": "gtc",
|
|
7305
|
+
// "orderStatus": "filled",
|
|
7306
|
+
// "posSide": "long",
|
|
7307
|
+
// "holdMode": "hedge_mode",
|
|
7308
|
+
// "reduceOnly": "NO",
|
|
7309
|
+
// "feeDetail": [
|
|
7310
|
+
// {
|
|
7311
|
+
// "feeCoin": "USDT",
|
|
7312
|
+
// "fee": "0.00642032"
|
|
7313
|
+
// }
|
|
7314
|
+
// ],
|
|
7315
|
+
// "createdTime": "1751020520442",
|
|
7316
|
+
// "updatedTime": "1751020520457",
|
|
7317
|
+
// "cancelReason": "",
|
|
7318
|
+
// "execType": "normal",
|
|
7319
|
+
// "stpMode": "none",
|
|
7320
|
+
// "tpTriggerBy": null,
|
|
7321
|
+
// "slTriggerBy": null,
|
|
7322
|
+
// "takeProfit": null,
|
|
7323
|
+
// "stopLoss": null,
|
|
7324
|
+
// "tpOrderType": null,
|
|
7325
|
+
// "slOrderType": null,
|
|
7326
|
+
// "tpLimitPrice": null,
|
|
7327
|
+
// "slLimitPrice": null
|
|
7328
|
+
// },
|
|
7329
|
+
// ],
|
|
7330
|
+
// "cursor": "1322441328637100035"
|
|
7331
|
+
// }
|
|
7332
|
+
// }
|
|
7333
|
+
//
|
|
7334
|
+
// uta trigger
|
|
7335
|
+
//
|
|
7336
|
+
// {
|
|
7337
|
+
// "code": "00000",
|
|
7338
|
+
// "msg": "success",
|
|
7339
|
+
// "requestTime": 1753058447920,
|
|
7340
|
+
// "data": {
|
|
7341
|
+
// "list": [
|
|
7342
|
+
// {
|
|
7343
|
+
// "orderId": "1330984742276198400",
|
|
7344
|
+
// "clientOid": "1330984742276198400",
|
|
7345
|
+
// "symbol": "BTCUSDT",
|
|
7346
|
+
// "category": "USDT-FUTURES",
|
|
7347
|
+
// "qty": "0.001",
|
|
7348
|
+
// "posSide": "long",
|
|
7349
|
+
// "tpTriggerBy": "market",
|
|
7350
|
+
// "slTriggerBy": "mark",
|
|
7351
|
+
// "takeProfit": "",
|
|
7352
|
+
// "stopLoss": "112000",
|
|
7353
|
+
// "tpOrderType": "market",
|
|
7354
|
+
// "slOrderType": "limit",
|
|
7355
|
+
// "tpLimitPrice": "",
|
|
7356
|
+
// "slLimitPrice": "111000",
|
|
7357
|
+
// "createdTime": "1753057411736",
|
|
7358
|
+
// "updatedTime": "1753058267412"
|
|
7359
|
+
// },
|
|
7360
|
+
// ],
|
|
7361
|
+
// "cursor": 1330960754317619202
|
|
7362
|
+
// }
|
|
7363
|
+
// }
|
|
7364
|
+
//
|
|
7365
|
+
const data = this.safeDict(response, 'data', {});
|
|
7366
|
+
const orders = this.safeList(data, 'list', []);
|
|
7367
|
+
return this.parseOrders(orders, market, since, limit);
|
|
7368
|
+
}
|
|
6207
7369
|
/**
|
|
6208
7370
|
* @method
|
|
6209
7371
|
* @name bitget#fetchLedger
|
|
@@ -6430,69 +7592,84 @@ export default class bitget extends Exchange {
|
|
|
6430
7592
|
* @see https://www.bitget.com/api-doc/contract/trade/Get-Order-Fills
|
|
6431
7593
|
* @see https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-Fills
|
|
6432
7594
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Transaction-Details
|
|
7595
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Order-Fills
|
|
6433
7596
|
* @param {string} symbol unified market symbol
|
|
6434
7597
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
6435
7598
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
6436
7599
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6437
7600
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
7601
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
6438
7602
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6439
7603
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
6440
7604
|
*/
|
|
6441
7605
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6442
|
-
|
|
7606
|
+
let uta = undefined;
|
|
7607
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'uta', false);
|
|
7608
|
+
if (!uta && (symbol === undefined)) {
|
|
6443
7609
|
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
6444
7610
|
}
|
|
6445
7611
|
await this.loadMarkets();
|
|
6446
7612
|
const market = this.market(symbol);
|
|
6447
|
-
let
|
|
6448
|
-
[
|
|
7613
|
+
let request = {};
|
|
7614
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
7615
|
+
if (since !== undefined) {
|
|
7616
|
+
request['startTime'] = since;
|
|
7617
|
+
}
|
|
7618
|
+
if (limit !== undefined) {
|
|
7619
|
+
request['limit'] = limit;
|
|
7620
|
+
}
|
|
6449
7621
|
let paginate = false;
|
|
7622
|
+
let marginMode = undefined;
|
|
6450
7623
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
7624
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
6451
7625
|
if (paginate) {
|
|
6452
7626
|
let cursorReceived = undefined;
|
|
6453
|
-
|
|
7627
|
+
let cursorSent = undefined;
|
|
7628
|
+
if (uta) {
|
|
7629
|
+
cursorReceived = 'cursor';
|
|
7630
|
+
cursorSent = 'cursor';
|
|
7631
|
+
}
|
|
7632
|
+
else if (market['spot']) {
|
|
6454
7633
|
if (marginMode !== undefined) {
|
|
6455
7634
|
cursorReceived = 'minId';
|
|
7635
|
+
cursorSent = 'idLessThan';
|
|
6456
7636
|
}
|
|
6457
7637
|
}
|
|
6458
7638
|
else {
|
|
6459
7639
|
cursorReceived = 'endId';
|
|
7640
|
+
cursorSent = 'idLessThan';
|
|
6460
7641
|
}
|
|
6461
|
-
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, cursorReceived,
|
|
7642
|
+
return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, cursorReceived, cursorSent);
|
|
6462
7643
|
}
|
|
6463
7644
|
let response = undefined;
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
};
|
|
6467
|
-
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
6468
|
-
if (since !== undefined) {
|
|
6469
|
-
request['startTime'] = since;
|
|
6470
|
-
}
|
|
6471
|
-
if (limit !== undefined) {
|
|
6472
|
-
request['limit'] = limit;
|
|
7645
|
+
if (uta) {
|
|
7646
|
+
response = await this.privateUtaGetV3TradeFills(this.extend(request, params));
|
|
6473
7647
|
}
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
7648
|
+
else {
|
|
7649
|
+
request['symbol'] = market['id'];
|
|
7650
|
+
if (market['spot']) {
|
|
7651
|
+
if (marginMode !== undefined) {
|
|
7652
|
+
if (since === undefined) {
|
|
7653
|
+
request['startTime'] = this.milliseconds() - 7776000000;
|
|
7654
|
+
}
|
|
7655
|
+
if (marginMode === 'isolated') {
|
|
7656
|
+
response = await this.privateMarginGetV2MarginIsolatedFills(this.extend(request, params));
|
|
7657
|
+
}
|
|
7658
|
+
else if (marginMode === 'cross') {
|
|
7659
|
+
response = await this.privateMarginGetV2MarginCrossedFills(this.extend(request, params));
|
|
7660
|
+
}
|
|
6481
7661
|
}
|
|
6482
|
-
else
|
|
6483
|
-
response = await this.
|
|
7662
|
+
else {
|
|
7663
|
+
response = await this.privateSpotGetV2SpotTradeFills(this.extend(request, params));
|
|
6484
7664
|
}
|
|
6485
7665
|
}
|
|
6486
7666
|
else {
|
|
6487
|
-
|
|
7667
|
+
let productType = undefined;
|
|
7668
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7669
|
+
request['productType'] = productType;
|
|
7670
|
+
response = await this.privateMixGetV2MixOrderFills(this.extend(request, params));
|
|
6488
7671
|
}
|
|
6489
7672
|
}
|
|
6490
|
-
else {
|
|
6491
|
-
let productType = undefined;
|
|
6492
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6493
|
-
request['productType'] = productType;
|
|
6494
|
-
response = await this.privateMixGetV2MixOrderFills(this.extend(request, params));
|
|
6495
|
-
}
|
|
6496
7673
|
//
|
|
6497
7674
|
// spot
|
|
6498
7675
|
//
|
|
@@ -6592,10 +7769,46 @@ export default class bitget extends Exchange {
|
|
|
6592
7769
|
// }
|
|
6593
7770
|
// }
|
|
6594
7771
|
//
|
|
7772
|
+
// uta
|
|
7773
|
+
//
|
|
7774
|
+
// {
|
|
7775
|
+
// "code": "00000",
|
|
7776
|
+
// "msg": "success",
|
|
7777
|
+
// "requestTime": 1751099666579,
|
|
7778
|
+
// "data": {
|
|
7779
|
+
// "list": [
|
|
7780
|
+
// {
|
|
7781
|
+
// "execId": "1322441401010528257",
|
|
7782
|
+
// "orderId": "1322441400976261120",
|
|
7783
|
+
// "category": "USDT-FUTURES",
|
|
7784
|
+
// "symbol": "BTCUSDT",
|
|
7785
|
+
// "orderType": "market",
|
|
7786
|
+
// "side": "sell",
|
|
7787
|
+
// "execPrice": "107005.4",
|
|
7788
|
+
// "execQty": "0.0001",
|
|
7789
|
+
// "execValue": "10.7005",
|
|
7790
|
+
// "tradeScope": "taker",
|
|
7791
|
+
// "feeDetail": [{
|
|
7792
|
+
// "feeCoin": "USDT",
|
|
7793
|
+
// "fee":"0.00642032"
|
|
7794
|
+
// }],
|
|
7795
|
+
// "createdTime": "1751020520451",
|
|
7796
|
+
// "updatedTime": "1751020520458",
|
|
7797
|
+
// "execPnl": "0.00017"
|
|
7798
|
+
// },
|
|
7799
|
+
// ],
|
|
7800
|
+
// "cursor": "1322061241878880257"
|
|
7801
|
+
// }
|
|
7802
|
+
// }
|
|
7803
|
+
//
|
|
6595
7804
|
const data = this.safeValue(response, 'data');
|
|
6596
|
-
if (
|
|
6597
|
-
const
|
|
6598
|
-
return this.parseTrades(
|
|
7805
|
+
if (uta) {
|
|
7806
|
+
const fills = this.safeList(data, 'list', []);
|
|
7807
|
+
return this.parseTrades(fills, market, since, limit);
|
|
7808
|
+
}
|
|
7809
|
+
else if ((market['swap'] || (market['future']))) {
|
|
7810
|
+
const fills = this.safeList(data, 'fillList', []);
|
|
7811
|
+
return this.parseTrades(fills, market, since, limit);
|
|
6599
7812
|
}
|
|
6600
7813
|
else if (marginMode !== undefined) {
|
|
6601
7814
|
const fills = this.safeList(data, 'fills', []);
|
|
@@ -6608,8 +7821,10 @@ export default class bitget extends Exchange {
|
|
|
6608
7821
|
* @name bitget#fetchPosition
|
|
6609
7822
|
* @description fetch data on a single open contract trade position
|
|
6610
7823
|
* @see https://www.bitget.com/api-doc/contract/position/get-single-position
|
|
7824
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Position
|
|
6611
7825
|
* @param {string} symbol unified market symbol of the market the position is held in
|
|
6612
7826
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7827
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
6613
7828
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
6614
7829
|
*/
|
|
6615
7830
|
async fetchPosition(symbol, params = {}) {
|
|
@@ -6619,42 +7834,92 @@ export default class bitget extends Exchange {
|
|
|
6619
7834
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6620
7835
|
const request = {
|
|
6621
7836
|
'symbol': market['id'],
|
|
6622
|
-
'marginCoin': market['settleId'],
|
|
6623
|
-
'productType': productType,
|
|
6624
7837
|
};
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
7838
|
+
let response = undefined;
|
|
7839
|
+
let uta = undefined;
|
|
7840
|
+
let result = undefined;
|
|
7841
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchPosition', 'uta', false);
|
|
7842
|
+
if (uta) {
|
|
7843
|
+
request['category'] = productType;
|
|
7844
|
+
response = await this.privateUtaGetV3PositionCurrentPosition(this.extend(request, params));
|
|
7845
|
+
//
|
|
7846
|
+
// {
|
|
7847
|
+
// "code": "00000",
|
|
7848
|
+
// "msg": "success",
|
|
7849
|
+
// "requestTime": 1750929905423,
|
|
7850
|
+
// "data": {
|
|
7851
|
+
// "list": [
|
|
7852
|
+
// {
|
|
7853
|
+
// "category": "USDT-FUTURES",
|
|
7854
|
+
// "symbol": "BTCUSDT",
|
|
7855
|
+
// "marginCoin": "USDT",
|
|
7856
|
+
// "holdMode": "hedge_mode",
|
|
7857
|
+
// "posSide": "long",
|
|
7858
|
+
// "marginMode": "crossed",
|
|
7859
|
+
// "positionBalance": "5.435199",
|
|
7860
|
+
// "available": "0.001",
|
|
7861
|
+
// "frozen": "0",
|
|
7862
|
+
// "total": "0.001",
|
|
7863
|
+
// "leverage": "20",
|
|
7864
|
+
// "curRealisedPnl": "0",
|
|
7865
|
+
// "avgPrice": "107410.3",
|
|
7866
|
+
// "positionStatus": "normal",
|
|
7867
|
+
// "unrealisedPnl": "0.0047",
|
|
7868
|
+
// "liquidationPrice": "0",
|
|
7869
|
+
// "mmr": "0.004",
|
|
7870
|
+
// "profitRate": "0.0008647337475591",
|
|
7871
|
+
// "markPrice": "107415.3",
|
|
7872
|
+
// "breakEvenPrice": "107539.2",
|
|
7873
|
+
// "totalFunding": "0",
|
|
7874
|
+
// "openFeeTotal": "-0.06444618",
|
|
7875
|
+
// "closeFeeTotal": "0",
|
|
7876
|
+
// "createdTime": "1750495670699",
|
|
7877
|
+
// "updatedTime": "1750929883465"
|
|
7878
|
+
// }
|
|
7879
|
+
// ]
|
|
7880
|
+
// }
|
|
7881
|
+
// }
|
|
7882
|
+
//
|
|
7883
|
+
const data = this.safeDict(response, 'data', {});
|
|
7884
|
+
result = this.safeList(data, 'list', []);
|
|
7885
|
+
}
|
|
7886
|
+
else {
|
|
7887
|
+
request['marginCoin'] = market['settleId'];
|
|
7888
|
+
request['productType'] = productType;
|
|
7889
|
+
response = await this.privateMixGetV2MixPositionSinglePosition(this.extend(request, params));
|
|
7890
|
+
//
|
|
7891
|
+
// {
|
|
7892
|
+
// "code": "00000",
|
|
7893
|
+
// "msg": "success",
|
|
7894
|
+
// "requestTime": 1700807531673,
|
|
7895
|
+
// "data": [
|
|
7896
|
+
// {
|
|
7897
|
+
// "marginCoin": "USDT",
|
|
7898
|
+
// "symbol": "BTCUSDT",
|
|
7899
|
+
// "holdSide": "long",
|
|
7900
|
+
// "openDelegateSize": "0",
|
|
7901
|
+
// "marginSize": "3.73555",
|
|
7902
|
+
// "available": "0.002",
|
|
7903
|
+
// "locked": "0",
|
|
7904
|
+
// "total": "0.002",
|
|
7905
|
+
// "leverage": "20",
|
|
7906
|
+
// "achievedProfits": "0",
|
|
7907
|
+
// "openPriceAvg": "37355.5",
|
|
7908
|
+
// "marginMode": "crossed",
|
|
7909
|
+
// "posMode": "hedge_mode",
|
|
7910
|
+
// "unrealizedPL": "0.007",
|
|
7911
|
+
// "liquidationPrice": "31724.970702417",
|
|
7912
|
+
// "keepMarginRate": "0.004",
|
|
7913
|
+
// "markPrice": "37359",
|
|
7914
|
+
// "marginRatio": "0.029599540355",
|
|
7915
|
+
// "cTime": "1700807507275"
|
|
7916
|
+
// }
|
|
7917
|
+
// ]
|
|
7918
|
+
// }
|
|
7919
|
+
//
|
|
7920
|
+
result = this.safeList(response, 'data', []);
|
|
7921
|
+
}
|
|
7922
|
+
const first = this.safeDict(result, 0, {});
|
|
6658
7923
|
return this.parsePosition(first, market);
|
|
6659
7924
|
}
|
|
6660
7925
|
/**
|
|
@@ -6834,6 +8099,36 @@ export default class bitget extends Exchange {
|
|
|
6834
8099
|
// "cTime": "1700807507275"
|
|
6835
8100
|
// }
|
|
6836
8101
|
//
|
|
8102
|
+
// uta: fetchPosition
|
|
8103
|
+
//
|
|
8104
|
+
// {
|
|
8105
|
+
// "category": "USDT-FUTURES",
|
|
8106
|
+
// "symbol": "BTCUSDT",
|
|
8107
|
+
// "marginCoin": "USDT",
|
|
8108
|
+
// "holdMode": "hedge_mode",
|
|
8109
|
+
// "posSide": "long",
|
|
8110
|
+
// "marginMode": "crossed",
|
|
8111
|
+
// "positionBalance": "5.435199",
|
|
8112
|
+
// "available": "0.001",
|
|
8113
|
+
// "frozen": "0",
|
|
8114
|
+
// "total": "0.001",
|
|
8115
|
+
// "leverage": "20",
|
|
8116
|
+
// "curRealisedPnl": "0",
|
|
8117
|
+
// "avgPrice": "107410.3",
|
|
8118
|
+
// "positionStatus": "normal",
|
|
8119
|
+
// "unrealisedPnl": "0.0047",
|
|
8120
|
+
// "liquidationPrice": "0",
|
|
8121
|
+
// "mmr": "0.004",
|
|
8122
|
+
// "profitRate": "0.0008647337475591",
|
|
8123
|
+
// "markPrice": "107415.3",
|
|
8124
|
+
// "breakEvenPrice": "107539.2",
|
|
8125
|
+
// "totalFunding": "0",
|
|
8126
|
+
// "openFeeTotal": "-0.06444618",
|
|
8127
|
+
// "closeFeeTotal": "0",
|
|
8128
|
+
// "createdTime": "1750495670699",
|
|
8129
|
+
// "updatedTime": "1750929883465"
|
|
8130
|
+
// }
|
|
8131
|
+
//
|
|
6837
8132
|
// fetchPositions: privateMixGetV2MixPositionAllPosition
|
|
6838
8133
|
//
|
|
6839
8134
|
// {
|
|
@@ -6885,15 +8180,38 @@ export default class bitget extends Exchange {
|
|
|
6885
8180
|
// "clientOid": "1120923953904893956"
|
|
6886
8181
|
// }
|
|
6887
8182
|
//
|
|
8183
|
+
// uta: fetchPositionsHistory
|
|
8184
|
+
//
|
|
8185
|
+
// {
|
|
8186
|
+
// "positionId": "1322441328637100049",
|
|
8187
|
+
// "category": "USDT-FUTURES",
|
|
8188
|
+
// "symbol": "BTCUSDT",
|
|
8189
|
+
// "marginCoin": "USDT",
|
|
8190
|
+
// "holdMode": "hedge_mode",
|
|
8191
|
+
// "posSide": "long",
|
|
8192
|
+
// "marginMode": "crossed",
|
|
8193
|
+
// "openPriceAvg": "107003.7",
|
|
8194
|
+
// "closePriceAvg": "107005.4",
|
|
8195
|
+
// "openTotalPos": "0.0001",
|
|
8196
|
+
// "closeTotalPos": "0.0001",
|
|
8197
|
+
// "cumRealisedPnl": "0.00017",
|
|
8198
|
+
// "netProfit": "-0.01267055",
|
|
8199
|
+
// "totalFunding": "0",
|
|
8200
|
+
// "openFeeTotal": "-0.00642022",
|
|
8201
|
+
// "closeFeeTotal": "-0.00642032",
|
|
8202
|
+
// "createdTime": "1751020503195",
|
|
8203
|
+
// "updatedTime": "1751020520458"
|
|
8204
|
+
// }
|
|
8205
|
+
//
|
|
6888
8206
|
const marketId = this.safeString(position, 'symbol');
|
|
6889
8207
|
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
6890
8208
|
const symbol = market['symbol'];
|
|
6891
|
-
const timestamp = this.
|
|
8209
|
+
const timestamp = this.safeIntegerN(position, ['cTime', 'ctime', 'createdTime']);
|
|
6892
8210
|
let marginMode = this.safeString(position, 'marginMode');
|
|
6893
8211
|
let collateral = undefined;
|
|
6894
8212
|
let initialMargin = undefined;
|
|
6895
|
-
const unrealizedPnl = this.
|
|
6896
|
-
const rawCollateral = this.
|
|
8213
|
+
const unrealizedPnl = this.safeString2(position, 'unrealizedPL', 'unrealisedPnl');
|
|
8214
|
+
const rawCollateral = this.safeString2(position, 'marginSize', 'positionBalance');
|
|
6897
8215
|
if (marginMode === 'isolated') {
|
|
6898
8216
|
collateral = Precise.stringAdd(rawCollateral, unrealizedPnl);
|
|
6899
8217
|
}
|
|
@@ -6901,7 +8219,7 @@ export default class bitget extends Exchange {
|
|
|
6901
8219
|
marginMode = 'cross';
|
|
6902
8220
|
initialMargin = rawCollateral;
|
|
6903
8221
|
}
|
|
6904
|
-
const holdMode = this.
|
|
8222
|
+
const holdMode = this.safeString2(position, 'posMode', 'holdMode');
|
|
6905
8223
|
let hedged = undefined;
|
|
6906
8224
|
if (holdMode === 'hedge_mode') {
|
|
6907
8225
|
hedged = true;
|
|
@@ -6909,12 +8227,12 @@ export default class bitget extends Exchange {
|
|
|
6909
8227
|
else if (holdMode === 'one_way_mode') {
|
|
6910
8228
|
hedged = false;
|
|
6911
8229
|
}
|
|
6912
|
-
const side = this.
|
|
8230
|
+
const side = this.safeString2(position, 'holdSide', 'posSide');
|
|
6913
8231
|
const leverage = this.safeString(position, 'leverage');
|
|
6914
8232
|
const contractSizeNumber = this.safeValue(market, 'contractSize');
|
|
6915
8233
|
const contractSize = this.numberToString(contractSizeNumber);
|
|
6916
|
-
const baseAmount = this.
|
|
6917
|
-
const entryPrice = this.
|
|
8234
|
+
const baseAmount = this.safeString2(position, 'total', 'openTotalPos');
|
|
8235
|
+
const entryPrice = this.safeStringN(position, ['openPriceAvg', 'openAvgPrice', 'avgPrice']);
|
|
6918
8236
|
const maintenanceMarginPercentage = this.safeString(position, 'keepMarginRate');
|
|
6919
8237
|
const openNotional = Precise.stringMul(entryPrice, baseAmount);
|
|
6920
8238
|
if (initialMargin === undefined) {
|
|
@@ -6952,31 +8270,31 @@ export default class bitget extends Exchange {
|
|
|
6952
8270
|
const percentage = Precise.stringMul(Precise.stringDiv(unrealizedPnl, initialMargin, 4), '100');
|
|
6953
8271
|
return this.safePosition({
|
|
6954
8272
|
'info': position,
|
|
6955
|
-
'id': this.
|
|
8273
|
+
'id': this.safeString2(position, 'orderId', 'positionId'),
|
|
6956
8274
|
'symbol': symbol,
|
|
6957
8275
|
'notional': this.parseNumber(notional),
|
|
6958
8276
|
'marginMode': marginMode,
|
|
6959
8277
|
'liquidationPrice': liquidationPrice,
|
|
6960
8278
|
'entryPrice': this.parseNumber(entryPrice),
|
|
6961
8279
|
'unrealizedPnl': this.parseNumber(unrealizedPnl),
|
|
6962
|
-
'realizedPnl': this.
|
|
8280
|
+
'realizedPnl': this.safeNumberN(position, ['pnl', 'curRealisedPnl', 'cumRealisedPnl']),
|
|
6963
8281
|
'percentage': this.parseNumber(percentage),
|
|
6964
8282
|
'contracts': contracts,
|
|
6965
8283
|
'contractSize': contractSizeNumber,
|
|
6966
8284
|
'markPrice': this.parseNumber(markPrice),
|
|
6967
|
-
'lastPrice': this.
|
|
8285
|
+
'lastPrice': this.safeNumber2(position, 'closeAvgPrice', 'closePriceAvg'),
|
|
6968
8286
|
'side': side,
|
|
6969
8287
|
'hedged': hedged,
|
|
6970
8288
|
'timestamp': timestamp,
|
|
6971
8289
|
'datetime': this.iso8601(timestamp),
|
|
6972
|
-
'lastUpdateTimestamp': this.
|
|
8290
|
+
'lastUpdateTimestamp': this.safeInteger2(position, 'utime', 'updatedTime'),
|
|
6973
8291
|
'maintenanceMargin': this.parseNumber(maintenanceMargin),
|
|
6974
8292
|
'maintenanceMarginPercentage': this.parseNumber(maintenanceMarginPercentage),
|
|
6975
8293
|
'collateral': this.parseNumber(collateral),
|
|
6976
8294
|
'initialMargin': this.parseNumber(initialMargin),
|
|
6977
8295
|
'initialMarginPercentage': this.parseNumber(initialMarginPercentage),
|
|
6978
8296
|
'leverage': this.parseNumber(leverage),
|
|
6979
|
-
'marginRatio': this.
|
|
8297
|
+
'marginRatio': this.safeNumber2(position, 'marginRatio', 'mmr'),
|
|
6980
8298
|
'stopLossPrice': undefined,
|
|
6981
8299
|
'takeProfitPrice': undefined,
|
|
6982
8300
|
});
|
|
@@ -6986,10 +8304,12 @@ export default class bitget extends Exchange {
|
|
|
6986
8304
|
* @name bitget#fetchFundingRateHistory
|
|
6987
8305
|
* @description fetches historical funding rate prices
|
|
6988
8306
|
* @see https://www.bitget.com/api-doc/contract/market/Get-History-Funding-Rate
|
|
8307
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-History-Funding-Rate
|
|
6989
8308
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
6990
8309
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
6991
8310
|
* @param {int} [limit] the maximum amount of funding rate structures to fetch
|
|
6992
8311
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8312
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
6993
8313
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6994
8314
|
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
6995
8315
|
*/
|
|
@@ -6998,45 +8318,74 @@ export default class bitget extends Exchange {
|
|
|
6998
8318
|
throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
6999
8319
|
}
|
|
7000
8320
|
await this.loadMarkets();
|
|
7001
|
-
let paginate = false;
|
|
7002
|
-
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
7003
|
-
if (paginate) {
|
|
7004
|
-
return await this.fetchPaginatedCallIncremental('fetchFundingRateHistory', symbol, since, limit, params, 'pageNo', 100);
|
|
7005
|
-
}
|
|
7006
8321
|
const market = this.market(symbol);
|
|
7007
|
-
let productType = undefined;
|
|
7008
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7009
8322
|
const request = {
|
|
7010
8323
|
'symbol': market['id'],
|
|
7011
|
-
'productType': productType,
|
|
7012
|
-
// 'pageSize': limit, // default 20
|
|
7013
|
-
// 'pageNo': 1,
|
|
7014
8324
|
};
|
|
7015
|
-
|
|
7016
|
-
|
|
8325
|
+
let productType = undefined;
|
|
8326
|
+
let uta = undefined;
|
|
8327
|
+
let response = undefined;
|
|
8328
|
+
let result = undefined;
|
|
8329
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
8330
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'uta', false);
|
|
8331
|
+
if (uta) {
|
|
8332
|
+
if (limit !== undefined) {
|
|
8333
|
+
request['limit'] = limit;
|
|
8334
|
+
}
|
|
8335
|
+
request['category'] = productType;
|
|
8336
|
+
response = await this.publicUtaGetV3MarketHistoryFundRate(this.extend(request, params));
|
|
8337
|
+
//
|
|
8338
|
+
// {
|
|
8339
|
+
// "code": "00000",
|
|
8340
|
+
// "msg": "success",
|
|
8341
|
+
// "requestTime": 1750435113658,
|
|
8342
|
+
// "data": {
|
|
8343
|
+
// "resultList": [
|
|
8344
|
+
// {
|
|
8345
|
+
// "symbol": "BTCUSDT",
|
|
8346
|
+
// "fundingRate": "-0.000017",
|
|
8347
|
+
// "fundingRateTimestamp": "1750431600000"
|
|
8348
|
+
// },
|
|
8349
|
+
// ]
|
|
8350
|
+
// }
|
|
8351
|
+
// }
|
|
8352
|
+
//
|
|
8353
|
+
const data = this.safeDict(response, 'data', {});
|
|
8354
|
+
result = this.safeList(data, 'resultList', []);
|
|
8355
|
+
}
|
|
8356
|
+
else {
|
|
8357
|
+
let paginate = false;
|
|
8358
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
8359
|
+
if (paginate) {
|
|
8360
|
+
return await this.fetchPaginatedCallIncremental('fetchFundingRateHistory', symbol, since, limit, params, 'pageNo', 100);
|
|
8361
|
+
}
|
|
8362
|
+
if (limit !== undefined) {
|
|
8363
|
+
request['pageSize'] = limit;
|
|
8364
|
+
}
|
|
8365
|
+
request['productType'] = productType;
|
|
8366
|
+
response = await this.publicMixGetV2MixMarketHistoryFundRate(this.extend(request, params));
|
|
8367
|
+
//
|
|
8368
|
+
// {
|
|
8369
|
+
// "code": "00000",
|
|
8370
|
+
// "msg": "success",
|
|
8371
|
+
// "requestTime": 1652406728393,
|
|
8372
|
+
// "data": [
|
|
8373
|
+
// {
|
|
8374
|
+
// "symbol": "BTCUSDT",
|
|
8375
|
+
// "fundingRate": "-0.0003",
|
|
8376
|
+
// "fundingTime": "1652396400000"
|
|
8377
|
+
// },
|
|
8378
|
+
// ]
|
|
8379
|
+
// }
|
|
8380
|
+
//
|
|
8381
|
+
result = this.safeList(response, 'data', []);
|
|
7017
8382
|
}
|
|
7018
|
-
const response = await this.publicMixGetV2MixMarketHistoryFundRate(this.extend(request, params));
|
|
7019
|
-
//
|
|
7020
|
-
// {
|
|
7021
|
-
// "code": "00000",
|
|
7022
|
-
// "msg": "success",
|
|
7023
|
-
// "requestTime": 1652406728393,
|
|
7024
|
-
// "data": [
|
|
7025
|
-
// {
|
|
7026
|
-
// "symbol": "BTCUSDT",
|
|
7027
|
-
// "fundingRate": "-0.0003",
|
|
7028
|
-
// "fundingTime": "1652396400000"
|
|
7029
|
-
// },
|
|
7030
|
-
// ]
|
|
7031
|
-
// }
|
|
7032
|
-
//
|
|
7033
|
-
const data = this.safeValue(response, 'data', []);
|
|
7034
8383
|
const rates = [];
|
|
7035
|
-
for (let i = 0; i <
|
|
7036
|
-
const entry =
|
|
8384
|
+
for (let i = 0; i < result.length; i++) {
|
|
8385
|
+
const entry = result[i];
|
|
7037
8386
|
const marketId = this.safeString(entry, 'symbol');
|
|
7038
8387
|
const symbolInner = this.safeSymbol(marketId, market);
|
|
7039
|
-
const timestamp = this.
|
|
8388
|
+
const timestamp = this.safeInteger2(entry, 'fundingTime', 'fundingRateTimestamp');
|
|
7040
8389
|
rates.push({
|
|
7041
8390
|
'info': entry,
|
|
7042
8391
|
'symbol': symbolInner,
|
|
@@ -7054,8 +8403,10 @@ export default class bitget extends Exchange {
|
|
|
7054
8403
|
* @description fetch the current funding rate
|
|
7055
8404
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
|
7056
8405
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
|
|
8406
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate
|
|
7057
8407
|
* @param {string} symbol unified market symbol
|
|
7058
8408
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8409
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
7059
8410
|
* @param {string} [params.method] either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime'
|
|
7060
8411
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
7061
8412
|
*/
|
|
@@ -7069,24 +8420,23 @@ export default class bitget extends Exchange {
|
|
|
7069
8420
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7070
8421
|
const request = {
|
|
7071
8422
|
'symbol': market['id'],
|
|
7072
|
-
'productType': productType,
|
|
7073
8423
|
};
|
|
7074
|
-
let
|
|
7075
|
-
[method, params] = this.handleOptionAndParams(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate');
|
|
8424
|
+
let uta = undefined;
|
|
7076
8425
|
let response = undefined;
|
|
7077
|
-
|
|
7078
|
-
|
|
8426
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchFundingRate', 'uta', false);
|
|
8427
|
+
if (uta) {
|
|
8428
|
+
response = await this.publicUtaGetV3MarketCurrentFundRate(this.extend(request, params));
|
|
7079
8429
|
//
|
|
7080
8430
|
// {
|
|
7081
8431
|
// "code": "00000",
|
|
7082
8432
|
// "msg": "success",
|
|
7083
|
-
// "requestTime":
|
|
8433
|
+
// "requestTime": 1750897372153,
|
|
7084
8434
|
// "data": [
|
|
7085
8435
|
// {
|
|
7086
8436
|
// "symbol": "BTCUSDT",
|
|
7087
|
-
// "fundingRate": "
|
|
8437
|
+
// "fundingRate": "0.00001",
|
|
7088
8438
|
// "fundingRateInterval": "8",
|
|
7089
|
-
// "nextUpdate": "
|
|
8439
|
+
// "nextUpdate": "1750924800000",
|
|
7090
8440
|
// "minFundingRate": "-0.003",
|
|
7091
8441
|
// "maxFundingRate": "0.003"
|
|
7092
8442
|
// }
|
|
@@ -7094,22 +8444,47 @@ export default class bitget extends Exchange {
|
|
|
7094
8444
|
// }
|
|
7095
8445
|
//
|
|
7096
8446
|
}
|
|
7097
|
-
else
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
8447
|
+
else {
|
|
8448
|
+
request['productType'] = productType;
|
|
8449
|
+
let method = undefined;
|
|
8450
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate');
|
|
8451
|
+
if (method === 'publicMixGetV2MixMarketCurrentFundRate') {
|
|
8452
|
+
response = await this.publicMixGetV2MixMarketCurrentFundRate(this.extend(request, params));
|
|
8453
|
+
//
|
|
8454
|
+
// {
|
|
8455
|
+
// "code": "00000",
|
|
8456
|
+
// "msg": "success",
|
|
8457
|
+
// "requestTime": 1745500709429,
|
|
8458
|
+
// "data": [
|
|
8459
|
+
// {
|
|
8460
|
+
// "symbol": "BTCUSDT",
|
|
8461
|
+
// "fundingRate": "-0.000013",
|
|
8462
|
+
// "fundingRateInterval": "8",
|
|
8463
|
+
// "nextUpdate": "1745510400000",
|
|
8464
|
+
// "minFundingRate": "-0.003",
|
|
8465
|
+
// "maxFundingRate": "0.003"
|
|
8466
|
+
// }
|
|
8467
|
+
// ]
|
|
8468
|
+
// }
|
|
8469
|
+
//
|
|
8470
|
+
}
|
|
8471
|
+
else if (method === 'publicMixGetV2MixMarketFundingTime') {
|
|
8472
|
+
response = await this.publicMixGetV2MixMarketFundingTime(this.extend(request, params));
|
|
8473
|
+
//
|
|
8474
|
+
// {
|
|
8475
|
+
// "code": "00000",
|
|
8476
|
+
// "msg": "success",
|
|
8477
|
+
// "requestTime": 1745402092428,
|
|
8478
|
+
// "data": [
|
|
8479
|
+
// {
|
|
8480
|
+
// "symbol": "BTCUSDT",
|
|
8481
|
+
// "nextFundingTime": "1745424000000",
|
|
8482
|
+
// "ratePeriod": "8"
|
|
8483
|
+
// }
|
|
8484
|
+
// ]
|
|
8485
|
+
// }
|
|
8486
|
+
//
|
|
8487
|
+
}
|
|
7113
8488
|
}
|
|
7114
8489
|
const data = this.safeList(response, 'data', []);
|
|
7115
8490
|
return this.parseFundingRate(data[0], market);
|
|
@@ -7175,7 +8550,7 @@ export default class bitget extends Exchange {
|
|
|
7175
8550
|
}
|
|
7176
8551
|
parseFundingRate(contract, market = undefined) {
|
|
7177
8552
|
//
|
|
7178
|
-
// fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate
|
|
8553
|
+
// fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate, publicUtaGetV3MarketCurrentFundRate
|
|
7179
8554
|
//
|
|
7180
8555
|
// {
|
|
7181
8556
|
// "symbol": "BTCUSDT",
|
|
@@ -7533,10 +8908,13 @@ export default class bitget extends Exchange {
|
|
|
7533
8908
|
* @name bitget#setLeverage
|
|
7534
8909
|
* @description set the level of leverage for a market
|
|
7535
8910
|
* @see https://www.bitget.com/api-doc/contract/account/Change-Leverage
|
|
8911
|
+
* @see https://www.bitget.com/api-doc/uta/account/Change-Leverage
|
|
7536
8912
|
* @param {int} leverage the rate of leverage
|
|
7537
8913
|
* @param {string} symbol unified market symbol
|
|
7538
8914
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7539
8915
|
* @param {string} [params.holdSide] *isolated only* position direction, 'long' or 'short'
|
|
8916
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
8917
|
+
* @param {boolean} [params.posSide] required for uta isolated margin, long or short
|
|
7540
8918
|
* @returns {object} response from the exchange
|
|
7541
8919
|
*/
|
|
7542
8920
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
@@ -7549,27 +8927,51 @@ export default class bitget extends Exchange {
|
|
|
7549
8927
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7550
8928
|
const request = {
|
|
7551
8929
|
'symbol': market['id'],
|
|
7552
|
-
'marginCoin': market['settleId'],
|
|
7553
8930
|
'leverage': this.numberToString(leverage),
|
|
7554
|
-
'productType': productType,
|
|
7555
|
-
// 'holdSide': 'long',
|
|
7556
8931
|
};
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
8932
|
+
let uta = undefined;
|
|
8933
|
+
let response = undefined;
|
|
8934
|
+
[uta, params] = this.handleOptionAndParams(params, 'setLeverage', 'uta', false);
|
|
8935
|
+
if (uta) {
|
|
8936
|
+
if (productType === 'SPOT') {
|
|
8937
|
+
let marginMode = undefined;
|
|
8938
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTrades', params);
|
|
8939
|
+
if (marginMode !== undefined) {
|
|
8940
|
+
productType = 'MARGIN';
|
|
8941
|
+
}
|
|
8942
|
+
}
|
|
8943
|
+
request['coin'] = market['settleId'];
|
|
8944
|
+
request['category'] = productType;
|
|
8945
|
+
response = await this.privateUtaPostV3AccountSetLeverage(this.extend(request, params));
|
|
8946
|
+
//
|
|
8947
|
+
// {
|
|
8948
|
+
// "code": "00000",
|
|
8949
|
+
// "msg": "success",
|
|
8950
|
+
// "requestTime": 1752815940833,
|
|
8951
|
+
// "data": "success"
|
|
8952
|
+
// }
|
|
8953
|
+
//
|
|
8954
|
+
}
|
|
8955
|
+
else {
|
|
8956
|
+
request['marginCoin'] = market['settleId'];
|
|
8957
|
+
request['productType'] = productType;
|
|
8958
|
+
response = await this.privateMixPostV2MixAccountSetLeverage(this.extend(request, params));
|
|
8959
|
+
//
|
|
8960
|
+
// {
|
|
8961
|
+
// "code": "00000",
|
|
8962
|
+
// "msg": "success",
|
|
8963
|
+
// "requestTime": 1700864711517,
|
|
8964
|
+
// "data": {
|
|
8965
|
+
// "symbol": "BTCUSDT",
|
|
8966
|
+
// "marginCoin": "USDT",
|
|
8967
|
+
// "longLeverage": "25",
|
|
8968
|
+
// "shortLeverage": "25",
|
|
8969
|
+
// "crossMarginLeverage": "25",
|
|
8970
|
+
// "marginMode": "crossed"
|
|
8971
|
+
// }
|
|
8972
|
+
// }
|
|
8973
|
+
//
|
|
8974
|
+
}
|
|
7573
8975
|
return response;
|
|
7574
8976
|
}
|
|
7575
8977
|
/**
|
|
@@ -7625,36 +9027,54 @@ export default class bitget extends Exchange {
|
|
|
7625
9027
|
* @name bitget#setPositionMode
|
|
7626
9028
|
* @description set hedged to true or false for a market
|
|
7627
9029
|
* @see https://www.bitget.com/api-doc/contract/account/Change-Hold-Mode
|
|
9030
|
+
* @see https://www.bitget.com/api-doc/uta/account/Change-Position-Mode
|
|
7628
9031
|
* @param {bool} hedged set to true to use dualSidePosition
|
|
7629
9032
|
* @param {string} symbol not used by bitget setPositionMode ()
|
|
7630
9033
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7631
|
-
* @param {string} [params.productType] required if symbol is undefined: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
9034
|
+
* @param {string} [params.productType] required if not uta and symbol is undefined: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
9035
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
7632
9036
|
* @returns {object} response from the exchange
|
|
7633
9037
|
*/
|
|
7634
9038
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
7635
9039
|
await this.loadMarkets();
|
|
7636
9040
|
const posMode = hedged ? 'hedge_mode' : 'one_way_mode';
|
|
9041
|
+
const request = {};
|
|
7637
9042
|
let market = undefined;
|
|
7638
9043
|
if (symbol !== undefined) {
|
|
7639
9044
|
market = this.market(symbol);
|
|
7640
9045
|
}
|
|
7641
9046
|
let productType = undefined;
|
|
9047
|
+
let uta = undefined;
|
|
9048
|
+
let response = undefined;
|
|
7642
9049
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
'
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
9050
|
+
[uta, params] = this.handleOptionAndParams(params, 'setPositionMode', 'uta', false);
|
|
9051
|
+
if (uta) {
|
|
9052
|
+
request['holdMode'] = posMode;
|
|
9053
|
+
response = await this.privateUtaPostV3AccountSetHoldMode(this.extend(request, params));
|
|
9054
|
+
//
|
|
9055
|
+
// {
|
|
9056
|
+
// "code": "00000",
|
|
9057
|
+
// "msg": "success",
|
|
9058
|
+
// "requestTime": 1752816734592,
|
|
9059
|
+
// "data": "success"
|
|
9060
|
+
// }
|
|
9061
|
+
//
|
|
9062
|
+
}
|
|
9063
|
+
else {
|
|
9064
|
+
request['posMode'] = posMode;
|
|
9065
|
+
request['productType'] = productType;
|
|
9066
|
+
response = await this.privateMixPostV2MixAccountSetPositionMode(this.extend(request, params));
|
|
9067
|
+
//
|
|
9068
|
+
// {
|
|
9069
|
+
// "code": "00000",
|
|
9070
|
+
// "msg": "success",
|
|
9071
|
+
// "requestTime": 1700865608009,
|
|
9072
|
+
// "data": {
|
|
9073
|
+
// "posMode": "hedge_mode"
|
|
9074
|
+
// }
|
|
9075
|
+
// }
|
|
9076
|
+
//
|
|
9077
|
+
}
|
|
7658
9078
|
return response;
|
|
7659
9079
|
}
|
|
7660
9080
|
/**
|
|
@@ -7662,8 +9082,10 @@ export default class bitget extends Exchange {
|
|
|
7662
9082
|
* @name bitget#fetchOpenInterest
|
|
7663
9083
|
* @description retrieves the open interest of a contract trading pair
|
|
7664
9084
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Open-Interest
|
|
9085
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Open-Interest
|
|
7665
9086
|
* @param {string} symbol unified CCXT market symbol
|
|
7666
9087
|
* @param {object} [params] exchange specific parameters
|
|
9088
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
7667
9089
|
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7668
9090
|
*/
|
|
7669
9091
|
async fetchOpenInterest(symbol, params = {}) {
|
|
@@ -7672,33 +9094,60 @@ export default class bitget extends Exchange {
|
|
|
7672
9094
|
if (!market['contract']) {
|
|
7673
9095
|
throw new BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
|
|
7674
9096
|
}
|
|
7675
|
-
let productType = undefined;
|
|
7676
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7677
|
-
const request = {
|
|
7678
|
-
'symbol': market['id'],
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
9097
|
+
let productType = undefined;
|
|
9098
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
9099
|
+
const request = {
|
|
9100
|
+
'symbol': market['id'],
|
|
9101
|
+
};
|
|
9102
|
+
let uta = undefined;
|
|
9103
|
+
let response = undefined;
|
|
9104
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchOpenInterest', 'uta', false);
|
|
9105
|
+
if (uta) {
|
|
9106
|
+
request['category'] = productType;
|
|
9107
|
+
response = await this.publicUtaGetV3MarketOpenInterest(this.extend(request, params));
|
|
9108
|
+
//
|
|
9109
|
+
// {
|
|
9110
|
+
// "code": "00000",
|
|
9111
|
+
// "msg": "success",
|
|
9112
|
+
// "requestTime": 1751101221545,
|
|
9113
|
+
// "data": {
|
|
9114
|
+
// "list": [
|
|
9115
|
+
// {
|
|
9116
|
+
// "symbol": "BTCUSDT",
|
|
9117
|
+
// "openInterest": "18166.3583"
|
|
9118
|
+
// }
|
|
9119
|
+
// ],
|
|
9120
|
+
// "ts": "1751101220993"
|
|
9121
|
+
// }
|
|
9122
|
+
// }
|
|
9123
|
+
//
|
|
9124
|
+
}
|
|
9125
|
+
else {
|
|
9126
|
+
request['productType'] = productType;
|
|
9127
|
+
response = await this.publicMixGetV2MixMarketOpenInterest(this.extend(request, params));
|
|
9128
|
+
//
|
|
9129
|
+
// {
|
|
9130
|
+
// "code": "00000",
|
|
9131
|
+
// "msg": "success",
|
|
9132
|
+
// "requestTime": 1700866041022,
|
|
9133
|
+
// "data": {
|
|
9134
|
+
// "openInterestList": [
|
|
9135
|
+
// {
|
|
9136
|
+
// "symbol": "BTCUSDT",
|
|
9137
|
+
// "size": "52234.134"
|
|
9138
|
+
// }
|
|
9139
|
+
// ],
|
|
9140
|
+
// "ts": "1700866041023"
|
|
9141
|
+
// }
|
|
9142
|
+
// }
|
|
9143
|
+
//
|
|
9144
|
+
}
|
|
7698
9145
|
const data = this.safeDict(response, 'data', {});
|
|
7699
9146
|
return this.parseOpenInterest(data, market);
|
|
7700
9147
|
}
|
|
7701
9148
|
parseOpenInterest(interest, market = undefined) {
|
|
9149
|
+
//
|
|
9150
|
+
// default
|
|
7702
9151
|
//
|
|
7703
9152
|
// {
|
|
7704
9153
|
// "openInterestList": [
|
|
@@ -7710,12 +9159,24 @@ export default class bitget extends Exchange {
|
|
|
7710
9159
|
// "ts": "1700866041023"
|
|
7711
9160
|
// }
|
|
7712
9161
|
//
|
|
7713
|
-
|
|
9162
|
+
// uta
|
|
9163
|
+
//
|
|
9164
|
+
// {
|
|
9165
|
+
// "list": [
|
|
9166
|
+
// {
|
|
9167
|
+
// "symbol": "BTCUSDT",
|
|
9168
|
+
// "openInterest": "18166.3583"
|
|
9169
|
+
// }
|
|
9170
|
+
// ],
|
|
9171
|
+
// "ts": "1751101220993"
|
|
9172
|
+
// }
|
|
9173
|
+
//
|
|
9174
|
+
const data = this.safeList2(interest, 'openInterestList', 'list', []);
|
|
7714
9175
|
const timestamp = this.safeInteger(interest, 'ts');
|
|
7715
9176
|
const marketId = this.safeString(data[0], 'symbol');
|
|
7716
9177
|
return this.safeOpenInterest({
|
|
7717
9178
|
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
7718
|
-
'openInterestAmount': this.
|
|
9179
|
+
'openInterestAmount': this.safeNumber2(data[0], 'size', 'openInterest'),
|
|
7719
9180
|
'openInterestValue': undefined,
|
|
7720
9181
|
'timestamp': timestamp,
|
|
7721
9182
|
'datetime': this.iso8601(timestamp),
|
|
@@ -8454,9 +9915,10 @@ export default class bitget extends Exchange {
|
|
|
8454
9915
|
* @name bitget#fetchCrossBorrowRate
|
|
8455
9916
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
8456
9917
|
* @see https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Margin-Interest-Rate-And-Borrowable
|
|
9918
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Margin-Loans
|
|
8457
9919
|
* @param {string} code unified currency code
|
|
8458
9920
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8459
|
-
* @param {
|
|
9921
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
8460
9922
|
* @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
|
|
8461
9923
|
*/
|
|
8462
9924
|
async fetchCrossBorrowRate(code, params = {}) {
|
|
@@ -8465,40 +9927,64 @@ export default class bitget extends Exchange {
|
|
|
8465
9927
|
const request = {
|
|
8466
9928
|
'coin': currency['id'],
|
|
8467
9929
|
};
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
9930
|
+
let uta = undefined;
|
|
9931
|
+
let response = undefined;
|
|
9932
|
+
let result = undefined;
|
|
9933
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchCrossBorrowRate', 'uta', false);
|
|
9934
|
+
if (uta) {
|
|
9935
|
+
response = await this.publicUtaGetV3MarketMarginLoans(this.extend(request, params));
|
|
9936
|
+
//
|
|
9937
|
+
// {
|
|
9938
|
+
// "code": "00000",
|
|
9939
|
+
// "msg": "success",
|
|
9940
|
+
// "requestTime": 1752817798893,
|
|
9941
|
+
// "data": {
|
|
9942
|
+
// "dailyInterest": "0.00100008",
|
|
9943
|
+
// "annualInterest": "0.3650292",
|
|
9944
|
+
// "limit": "100"
|
|
9945
|
+
// }
|
|
9946
|
+
// }
|
|
9947
|
+
//
|
|
9948
|
+
result = this.safeDict(response, 'data', {});
|
|
9949
|
+
}
|
|
9950
|
+
else {
|
|
9951
|
+
response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
|
|
9952
|
+
//
|
|
9953
|
+
// {
|
|
9954
|
+
// "code": "00000",
|
|
9955
|
+
// "msg": "success",
|
|
9956
|
+
// "requestTime": 1700879047861,
|
|
9957
|
+
// "data": [
|
|
9958
|
+
// {
|
|
9959
|
+
// "coin": "BTC",
|
|
9960
|
+
// "leverage": "3",
|
|
9961
|
+
// "transferable": true,
|
|
9962
|
+
// "borrowable": true,
|
|
9963
|
+
// "dailyInterestRate": "0.00007",
|
|
9964
|
+
// "annualInterestRate": "0.02555",
|
|
9965
|
+
// "maxBorrowableAmount": "26",
|
|
9966
|
+
// "vipList": [
|
|
9967
|
+
// {"level":"0","limit":"26","dailyInterestRate":"0.00007","annualInterestRate":"0.02555","discountRate":"1"},
|
|
9968
|
+
// {"level":"1","limit":"26.78","dailyInterestRate":"0.0000679","annualInterestRate":"0.0247835","discountRate":"0.97"},
|
|
9969
|
+
// {"level":"2","limit":"28.08","dailyInterestRate":"0.0000644","annualInterestRate":"0.023506","discountRate":"0.92"},
|
|
9970
|
+
// {"level":"3","limit":"30.16","dailyInterestRate":"0.0000602","annualInterestRate":"0.021973","discountRate":"0.86"},
|
|
9971
|
+
// {"level":"4","limit":"34.58","dailyInterestRate":"0.0000525","annualInterestRate":"0.0191625","discountRate":"0.75"},
|
|
9972
|
+
// {"level":"5","limit":"43.16","dailyInterestRate":"0.000042","annualInterestRate":"0.01533","discountRate":"0.6"}
|
|
9973
|
+
// ]
|
|
9974
|
+
// }
|
|
9975
|
+
// ]
|
|
9976
|
+
// }
|
|
9977
|
+
//
|
|
9978
|
+
const data = this.safeValue(response, 'data', []);
|
|
9979
|
+
result = this.safeValue(data, 0, {});
|
|
9980
|
+
}
|
|
8495
9981
|
const timestamp = this.safeInteger(response, 'requestTime');
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
first['timestamp'] = timestamp;
|
|
8499
|
-
return this.parseBorrowRate(first, currency);
|
|
9982
|
+
result['timestamp'] = timestamp;
|
|
9983
|
+
return this.parseBorrowRate(result, currency);
|
|
8500
9984
|
}
|
|
8501
9985
|
parseBorrowRate(info, currency = undefined) {
|
|
9986
|
+
//
|
|
9987
|
+
// default
|
|
8502
9988
|
//
|
|
8503
9989
|
// {
|
|
8504
9990
|
// "coin": "BTC",
|
|
@@ -8518,11 +10004,19 @@ export default class bitget extends Exchange {
|
|
|
8518
10004
|
// ]
|
|
8519
10005
|
// }
|
|
8520
10006
|
//
|
|
10007
|
+
// uta
|
|
10008
|
+
//
|
|
10009
|
+
// {
|
|
10010
|
+
// "dailyInterest": "0.00100008",
|
|
10011
|
+
// "annualInterest": "0.3650292",
|
|
10012
|
+
// "limit": "100"
|
|
10013
|
+
// }
|
|
10014
|
+
//
|
|
8521
10015
|
const currencyId = this.safeString(info, 'coin');
|
|
8522
10016
|
const timestamp = this.safeInteger(info, 'timestamp');
|
|
8523
10017
|
return {
|
|
8524
10018
|
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
8525
|
-
'rate': this.
|
|
10019
|
+
'rate': this.safeNumber2(info, 'dailyInterestRate', 'dailyInterest'),
|
|
8526
10020
|
'period': 86400000,
|
|
8527
10021
|
'timestamp': timestamp,
|
|
8528
10022
|
'datetime': this.iso8601(timestamp),
|
|
@@ -8687,43 +10181,72 @@ export default class bitget extends Exchange {
|
|
|
8687
10181
|
* @name bitget#closePosition
|
|
8688
10182
|
* @description closes an open position for a market
|
|
8689
10183
|
* @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
|
|
10184
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Close-All-Positions
|
|
8690
10185
|
* @param {string} symbol unified CCXT market symbol
|
|
8691
10186
|
* @param {string} [side] one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short'
|
|
8692
10187
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10188
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
8693
10189
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
8694
10190
|
*/
|
|
8695
10191
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
8696
10192
|
await this.loadMarkets();
|
|
8697
10193
|
const market = this.market(symbol);
|
|
8698
|
-
let productType = undefined;
|
|
8699
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
8700
10194
|
const request = {
|
|
8701
10195
|
'symbol': market['id'],
|
|
8702
|
-
'productType': productType,
|
|
8703
10196
|
};
|
|
8704
|
-
|
|
8705
|
-
|
|
10197
|
+
let productType = undefined;
|
|
10198
|
+
let uta = undefined;
|
|
10199
|
+
let response = undefined;
|
|
10200
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
10201
|
+
[uta, params] = this.handleOptionAndParams(params, 'closePosition', 'uta', false);
|
|
10202
|
+
if (uta) {
|
|
10203
|
+
if (side !== undefined) {
|
|
10204
|
+
request['posSide'] = side;
|
|
10205
|
+
}
|
|
10206
|
+
request['category'] = productType;
|
|
10207
|
+
response = await this.privateUtaPostV3TradeClosePositions(this.extend(request, params));
|
|
10208
|
+
//
|
|
10209
|
+
// {
|
|
10210
|
+
// "code": "00000",
|
|
10211
|
+
// "msg": "success",
|
|
10212
|
+
// "requestTime": 1751020218384,
|
|
10213
|
+
// "data": {
|
|
10214
|
+
// "list": [
|
|
10215
|
+
// {
|
|
10216
|
+
// "orderId": "1322440134099320832",
|
|
10217
|
+
// "clientOid": "1322440134099320833"
|
|
10218
|
+
// }
|
|
10219
|
+
// ]
|
|
10220
|
+
// }
|
|
10221
|
+
// }
|
|
10222
|
+
//
|
|
10223
|
+
}
|
|
10224
|
+
else {
|
|
10225
|
+
if (side !== undefined) {
|
|
10226
|
+
request['holdSide'] = side;
|
|
10227
|
+
}
|
|
10228
|
+
request['productType'] = productType;
|
|
10229
|
+
response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
|
|
10230
|
+
//
|
|
10231
|
+
// {
|
|
10232
|
+
// "code": "00000",
|
|
10233
|
+
// "msg": "success",
|
|
10234
|
+
// "requestTime": 1702975017017,
|
|
10235
|
+
// "data": {
|
|
10236
|
+
// "successList": [
|
|
10237
|
+
// {
|
|
10238
|
+
// "orderId": "1120923953904893955",
|
|
10239
|
+
// "clientOid": "1120923953904893956"
|
|
10240
|
+
// }
|
|
10241
|
+
// ],
|
|
10242
|
+
// "failureList": [],
|
|
10243
|
+
// "result": false
|
|
10244
|
+
// }
|
|
10245
|
+
// }
|
|
10246
|
+
//
|
|
8706
10247
|
}
|
|
8707
|
-
const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
|
|
8708
|
-
//
|
|
8709
|
-
// {
|
|
8710
|
-
// "code": "00000",
|
|
8711
|
-
// "msg": "success",
|
|
8712
|
-
// "requestTime": 1702975017017,
|
|
8713
|
-
// "data": {
|
|
8714
|
-
// "successList": [
|
|
8715
|
-
// {
|
|
8716
|
-
// "orderId": "1120923953904893955",
|
|
8717
|
-
// "clientOid": "1120923953904893956"
|
|
8718
|
-
// }
|
|
8719
|
-
// ],
|
|
8720
|
-
// "failureList": [],
|
|
8721
|
-
// "result": false
|
|
8722
|
-
// }
|
|
8723
|
-
// }
|
|
8724
|
-
//
|
|
8725
10248
|
const data = this.safeValue(response, 'data', {});
|
|
8726
|
-
const order = this.
|
|
10249
|
+
const order = this.safeList2(data, 'successList', 'list', []);
|
|
8727
10250
|
return this.parseOrder(order[0], market);
|
|
8728
10251
|
}
|
|
8729
10252
|
/**
|
|
@@ -8731,37 +10254,62 @@ export default class bitget extends Exchange {
|
|
|
8731
10254
|
* @name bitget#closeAllPositions
|
|
8732
10255
|
* @description closes all open positions for a market type
|
|
8733
10256
|
* @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
|
|
10257
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Close-All-Positions
|
|
8734
10258
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8735
10259
|
* @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
10260
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
8736
10261
|
* @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8737
10262
|
*/
|
|
8738
10263
|
async closeAllPositions(params = {}) {
|
|
8739
10264
|
await this.loadMarkets();
|
|
10265
|
+
const request = {};
|
|
8740
10266
|
let productType = undefined;
|
|
10267
|
+
let uta = undefined;
|
|
10268
|
+
let response = undefined;
|
|
8741
10269
|
[productType, params] = this.handleProductTypeAndParams(undefined, params);
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
10270
|
+
[uta, params] = this.handleOptionAndParams(params, 'closeAllPositions', 'uta', false);
|
|
10271
|
+
if (uta) {
|
|
10272
|
+
request['category'] = productType;
|
|
10273
|
+
response = await this.privateUtaPostV3TradeClosePositions(this.extend(request, params));
|
|
10274
|
+
//
|
|
10275
|
+
// {
|
|
10276
|
+
// "code": "00000",
|
|
10277
|
+
// "msg": "success",
|
|
10278
|
+
// "requestTime": 1751020218384,
|
|
10279
|
+
// "data": {
|
|
10280
|
+
// "list": [
|
|
10281
|
+
// {
|
|
10282
|
+
// "orderId": "1322440134099320832",
|
|
10283
|
+
// "clientOid": "1322440134099320833"
|
|
10284
|
+
// }
|
|
10285
|
+
// ]
|
|
10286
|
+
// }
|
|
10287
|
+
// }
|
|
10288
|
+
//
|
|
10289
|
+
}
|
|
10290
|
+
else {
|
|
10291
|
+
request['productType'] = productType;
|
|
10292
|
+
response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
|
|
10293
|
+
//
|
|
10294
|
+
// {
|
|
10295
|
+
// "code": "00000",
|
|
10296
|
+
// "msg": "success",
|
|
10297
|
+
// "requestTime": 1702975017017,
|
|
10298
|
+
// "data": {
|
|
10299
|
+
// "successList": [
|
|
10300
|
+
// {
|
|
10301
|
+
// "orderId": "1120923953904893955",
|
|
10302
|
+
// "clientOid": "1120923953904893956"
|
|
10303
|
+
// }
|
|
10304
|
+
// ],
|
|
10305
|
+
// "failureList": [],
|
|
10306
|
+
// "result": false
|
|
10307
|
+
// }
|
|
10308
|
+
// }
|
|
10309
|
+
//
|
|
10310
|
+
}
|
|
8763
10311
|
const data = this.safeValue(response, 'data', {});
|
|
8764
|
-
const orderInfo = this.
|
|
10312
|
+
const orderInfo = this.safeList2(data, 'successList', 'list', []);
|
|
8765
10313
|
return this.parsePositions(orderInfo, undefined, params);
|
|
8766
10314
|
}
|
|
8767
10315
|
/**
|
|
@@ -8829,25 +10377,27 @@ export default class bitget extends Exchange {
|
|
|
8829
10377
|
* @name bitget#fetchPositionsHistory
|
|
8830
10378
|
* @description fetches historical positions
|
|
8831
10379
|
* @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
|
|
10380
|
+
* @see https://www.bitget.com/api-doc/uta/trade/Get-Position-History
|
|
8832
10381
|
* @param {string[]} [symbols] unified contract symbols
|
|
8833
10382
|
* @param {int} [since] timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months
|
|
8834
10383
|
* @param {int} [limit] the maximum amount of records to fetch, default=20, max=100
|
|
8835
10384
|
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8836
10385
|
* @param {int} [params.until] timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
|
|
8837
|
-
*
|
|
8838
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
8839
10386
|
* @param {string} [params.productType] USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
|
|
10387
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
8840
10388
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8841
10389
|
*/
|
|
8842
10390
|
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8843
10391
|
await this.loadMarkets();
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
10392
|
+
let request = {};
|
|
10393
|
+
let market = undefined;
|
|
10394
|
+
let productType = undefined;
|
|
10395
|
+
let uta = undefined;
|
|
10396
|
+
let response = undefined;
|
|
8847
10397
|
if (symbols !== undefined) {
|
|
8848
10398
|
const symbolsLength = symbols.length;
|
|
8849
10399
|
if (symbolsLength > 0) {
|
|
8850
|
-
|
|
10400
|
+
market = this.market(symbols[0]);
|
|
8851
10401
|
request['symbol'] = market['id'];
|
|
8852
10402
|
}
|
|
8853
10403
|
}
|
|
@@ -8857,41 +10407,79 @@ export default class bitget extends Exchange {
|
|
|
8857
10407
|
if (limit !== undefined) {
|
|
8858
10408
|
request['limit'] = limit;
|
|
8859
10409
|
}
|
|
8860
|
-
|
|
8861
|
-
|
|
10410
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
10411
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
10412
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchPositionsHistory', 'uta', false);
|
|
10413
|
+
if (uta) {
|
|
10414
|
+
request['category'] = productType;
|
|
10415
|
+
response = await this.privateUtaGetV3PositionHistoryPosition(this.extend(request, params));
|
|
10416
|
+
//
|
|
10417
|
+
// {
|
|
10418
|
+
// "code": "00000",
|
|
10419
|
+
// "msg": "success",
|
|
10420
|
+
// "requestTime": 1751020950427,
|
|
10421
|
+
// "data": {
|
|
10422
|
+
// "list": [
|
|
10423
|
+
// {
|
|
10424
|
+
// "positionId": "1322441328637100049",
|
|
10425
|
+
// "category": "USDT-FUTURES",
|
|
10426
|
+
// "symbol": "BTCUSDT",
|
|
10427
|
+
// "marginCoin": "USDT",
|
|
10428
|
+
// "holdMode": "hedge_mode",
|
|
10429
|
+
// "posSide": "long",
|
|
10430
|
+
// "marginMode": "crossed",
|
|
10431
|
+
// "openPriceAvg": "107003.7",
|
|
10432
|
+
// "closePriceAvg": "107005.4",
|
|
10433
|
+
// "openTotalPos": "0.0001",
|
|
10434
|
+
// "closeTotalPos": "0.0001",
|
|
10435
|
+
// "cumRealisedPnl": "0.00017",
|
|
10436
|
+
// "netProfit": "-0.01267055",
|
|
10437
|
+
// "totalFunding": "0",
|
|
10438
|
+
// "openFeeTotal": "-0.00642022",
|
|
10439
|
+
// "closeFeeTotal": "-0.00642032",
|
|
10440
|
+
// "createdTime": "1751020503195",
|
|
10441
|
+
// "updatedTime": "1751020520458"
|
|
10442
|
+
// },
|
|
10443
|
+
// ],
|
|
10444
|
+
// "cursor": "1322440134158041089"
|
|
10445
|
+
// }
|
|
10446
|
+
// }
|
|
10447
|
+
//
|
|
10448
|
+
}
|
|
10449
|
+
else {
|
|
10450
|
+
response = await this.privateMixGetV2MixPositionHistoryPosition(this.extend(request, params));
|
|
10451
|
+
//
|
|
10452
|
+
// {
|
|
10453
|
+
// code: '00000',
|
|
10454
|
+
// msg: 'success',
|
|
10455
|
+
// requestTime: '1712794148791',
|
|
10456
|
+
// data: {
|
|
10457
|
+
// list: [
|
|
10458
|
+
// {
|
|
10459
|
+
// symbol: 'XRPUSDT',
|
|
10460
|
+
// marginCoin: 'USDT',
|
|
10461
|
+
// holdSide: 'long',
|
|
10462
|
+
// openAvgPrice: '0.64967',
|
|
10463
|
+
// closeAvgPrice: '0.58799',
|
|
10464
|
+
// marginMode: 'isolated',
|
|
10465
|
+
// openTotalPos: '10',
|
|
10466
|
+
// closeTotalPos: '10',
|
|
10467
|
+
// pnl: '-0.62976205',
|
|
10468
|
+
// netProfit: '-0.65356802',
|
|
10469
|
+
// totalFunding: '-0.01638',
|
|
10470
|
+
// openFee: '-0.00389802',
|
|
10471
|
+
// closeFee: '-0.00352794',
|
|
10472
|
+
// ctime: '1709590322199',
|
|
10473
|
+
// utime: '1709667583395'
|
|
10474
|
+
// },
|
|
10475
|
+
// ...
|
|
10476
|
+
// ]
|
|
10477
|
+
// }
|
|
10478
|
+
// }
|
|
10479
|
+
//
|
|
8862
10480
|
}
|
|
8863
|
-
const
|
|
8864
|
-
|
|
8865
|
-
// {
|
|
8866
|
-
// code: '00000',
|
|
8867
|
-
// msg: 'success',
|
|
8868
|
-
// requestTime: '1712794148791',
|
|
8869
|
-
// data: {
|
|
8870
|
-
// list: [
|
|
8871
|
-
// {
|
|
8872
|
-
// symbol: 'XRPUSDT',
|
|
8873
|
-
// marginCoin: 'USDT',
|
|
8874
|
-
// holdSide: 'long',
|
|
8875
|
-
// openAvgPrice: '0.64967',
|
|
8876
|
-
// closeAvgPrice: '0.58799',
|
|
8877
|
-
// marginMode: 'isolated',
|
|
8878
|
-
// openTotalPos: '10',
|
|
8879
|
-
// closeTotalPos: '10',
|
|
8880
|
-
// pnl: '-0.62976205',
|
|
8881
|
-
// netProfit: '-0.65356802',
|
|
8882
|
-
// totalFunding: '-0.01638',
|
|
8883
|
-
// openFee: '-0.00389802',
|
|
8884
|
-
// closeFee: '-0.00352794',
|
|
8885
|
-
// ctime: '1709590322199',
|
|
8886
|
-
// utime: '1709667583395'
|
|
8887
|
-
// },
|
|
8888
|
-
// ...
|
|
8889
|
-
// ]
|
|
8890
|
-
// }
|
|
8891
|
-
// }
|
|
8892
|
-
//
|
|
8893
|
-
const data = this.safeDict(response, 'data');
|
|
8894
|
-
const responseList = this.safeList(data, 'list');
|
|
10481
|
+
const data = this.safeDict(response, 'data', {});
|
|
10482
|
+
const responseList = this.safeList(data, 'list', []);
|
|
8895
10483
|
const positions = this.parsePositions(responseList, symbols, params);
|
|
8896
10484
|
return this.filterBySinceLimit(positions, since, limit);
|
|
8897
10485
|
}
|
|
@@ -9171,8 +10759,10 @@ export default class bitget extends Exchange {
|
|
|
9171
10759
|
* @name bitget#fetchFundingInterval
|
|
9172
10760
|
* @description fetch the current funding rate interval
|
|
9173
10761
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
|
|
10762
|
+
* @see https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate
|
|
9174
10763
|
* @param {string} symbol unified market symbol
|
|
9175
10764
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10765
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
9176
10766
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
9177
10767
|
*/
|
|
9178
10768
|
async fetchFundingInterval(symbol, params = {}) {
|
|
@@ -9182,23 +10772,48 @@ export default class bitget extends Exchange {
|
|
|
9182
10772
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
9183
10773
|
const request = {
|
|
9184
10774
|
'symbol': market['id'],
|
|
9185
|
-
'productType': productType,
|
|
9186
10775
|
};
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
10776
|
+
let response = undefined;
|
|
10777
|
+
let uta = undefined;
|
|
10778
|
+
[uta, params] = this.handleOptionAndParams(params, 'fetchFundingInterval', 'uta', false);
|
|
10779
|
+
if (uta) {
|
|
10780
|
+
response = await this.publicUtaGetV3MarketCurrentFundRate(this.extend(request, params));
|
|
10781
|
+
//
|
|
10782
|
+
// {
|
|
10783
|
+
// "code": "00000",
|
|
10784
|
+
// "msg": "success",
|
|
10785
|
+
// "requestTime": 1752880157959,
|
|
10786
|
+
// "data": [
|
|
10787
|
+
// {
|
|
10788
|
+
// "symbol": "BTCUSDT",
|
|
10789
|
+
// "fundingRate": "0.0001",
|
|
10790
|
+
// "fundingRateInterval": "8",
|
|
10791
|
+
// "nextUpdate": "1752883200000",
|
|
10792
|
+
// "minFundingRate": "-0.003",
|
|
10793
|
+
// "maxFundingRate": "0.003"
|
|
10794
|
+
// }
|
|
10795
|
+
// ]
|
|
10796
|
+
// }
|
|
10797
|
+
//
|
|
10798
|
+
}
|
|
10799
|
+
else {
|
|
10800
|
+
request['productType'] = productType;
|
|
10801
|
+
response = await this.publicMixGetV2MixMarketFundingTime(this.extend(request, params));
|
|
10802
|
+
//
|
|
10803
|
+
// {
|
|
10804
|
+
// "code": "00000",
|
|
10805
|
+
// "msg": "success",
|
|
10806
|
+
// "requestTime": 1727930153888,
|
|
10807
|
+
// "data": [
|
|
10808
|
+
// {
|
|
10809
|
+
// "symbol": "BTCUSDT",
|
|
10810
|
+
// "nextFundingTime": "1727942400000",
|
|
10811
|
+
// "ratePeriod": "8"
|
|
10812
|
+
// }
|
|
10813
|
+
// ]
|
|
10814
|
+
// }
|
|
10815
|
+
//
|
|
10816
|
+
}
|
|
9202
10817
|
const data = this.safeList(response, 'data', []);
|
|
9203
10818
|
const first = this.safeDict(data, 0, {});
|
|
9204
10819
|
return this.parseFundingRate(first, market);
|
|
@@ -9373,7 +10988,7 @@ export default class bitget extends Exchange {
|
|
|
9373
10988
|
}
|
|
9374
10989
|
}
|
|
9375
10990
|
const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
|
|
9376
|
-
if (sandboxMode && (path !== 'v2/public/time')) {
|
|
10991
|
+
if (sandboxMode && (path !== 'v2/public/time') && (path !== 'v3/market/current-fund-rate')) {
|
|
9377
10992
|
// https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
|
|
9378
10993
|
if (headers === undefined) {
|
|
9379
10994
|
headers = {};
|