ccxt 4.2.78 → 4.2.80
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 +5 -5
- package/dist/ccxt.browser.js +517 -79
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +35 -3
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bingx.js +39 -5
- package/dist/cjs/src/bitstamp.js +21 -26
- package/dist/cjs/src/bybit.js +101 -0
- package/dist/cjs/src/coinbaseinternational.js +2 -2
- package/dist/cjs/src/deribit.js +155 -0
- package/dist/cjs/src/gate.js +15 -4
- package/dist/cjs/src/hyperliquid.js +54 -10
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/binance.js +5 -5
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +1 -1
- package/dist/cjs/src/pro/bitopro.js +2 -1
- package/dist/cjs/src/pro/blockchaincom.js +1 -1
- package/dist/cjs/src/pro/bybit.js +16 -1
- package/dist/cjs/src/pro/cex.js +9 -5
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/gemini.js +3 -2
- package/dist/cjs/src/pro/hitbtc.js +1 -1
- package/dist/cjs/src/pro/htx.js +1 -1
- package/dist/cjs/src/pro/okcoin.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +1 -1
- package/dist/cjs/src/pro/phemex.js +7 -2
- package/dist/cjs/src/pro/woo.js +38 -0
- package/dist/cjs/src/upbit.js +2 -0
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/abstract/upbit.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +14 -5
- package/js/src/base/Exchange.js +35 -3
- package/js/src/base/types.d.ts +21 -0
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +1 -1
- package/js/src/bingx.js +39 -5
- package/js/src/bitstamp.js +21 -26
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +101 -0
- package/js/src/coinbaseinternational.js +2 -2
- package/js/src/deribit.d.ts +22 -1
- package/js/src/deribit.js +155 -0
- package/js/src/gate.js +15 -4
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +54 -10
- package/js/src/pro/alpaca.js +1 -1
- package/js/src/pro/binance.js +5 -5
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bitmex.js +1 -1
- package/js/src/pro/bitopro.js +2 -1
- package/js/src/pro/blockchaincom.js +1 -1
- package/js/src/pro/bybit.js +16 -1
- package/js/src/pro/cex.js +9 -5
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/gemini.d.ts +2 -2
- package/js/src/pro/gemini.js +3 -2
- package/js/src/pro/hitbtc.js +1 -1
- package/js/src/pro/htx.js +1 -1
- package/js/src/pro/okcoin.js +1 -1
- package/js/src/pro/onetrading.js +1 -1
- package/js/src/pro/phemex.js +7 -2
- package/js/src/pro/woo.js +38 -0
- package/js/src/upbit.js +2 -0
- package/package.json +1 -1
- package/skip-tests.json +7 -2
|
@@ -3,8 +3,8 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account } from './types.js';
|
|
7
|
-
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks, Leverage, Leverages,
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings } from './types.js';
|
|
7
|
+
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, BorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
10
10
|
/**
|
|
@@ -396,6 +396,8 @@ export default class Exchange {
|
|
|
396
396
|
fetchOpenOrder: any;
|
|
397
397
|
fetchOpenOrders: any;
|
|
398
398
|
fetchOpenOrdersWs: any;
|
|
399
|
+
fetchOption: any;
|
|
400
|
+
fetchOptionChain: any;
|
|
399
401
|
fetchOrder: any;
|
|
400
402
|
fetchOrderBook: boolean;
|
|
401
403
|
fetchOrderBooks: any;
|
|
@@ -621,6 +623,8 @@ export default class Exchange {
|
|
|
621
623
|
ethAbiEncode(types: any, args: any): Uint8Array;
|
|
622
624
|
ethEncodeStructuredData(domain: any, messageTypes: any, messageData: any): Uint8Array;
|
|
623
625
|
intToBase16(elem: any): string;
|
|
626
|
+
extendExchangeOptions(newOptions: any): void;
|
|
627
|
+
createSafeDictionary(): {};
|
|
624
628
|
safeBoolN(dictionaryOrList: any, keys: IndexType[], defaultValue?: boolean): boolean | undefined;
|
|
625
629
|
safeBool2(dictionary: any, key1: IndexType, key2: IndexType, defaultValue?: boolean): boolean | undefined;
|
|
626
630
|
safeBool(dictionary: any, key: IndexType, defaultValue?: boolean): boolean | undefined;
|
|
@@ -768,9 +772,9 @@ export default class Exchange {
|
|
|
768
772
|
convertTradingViewToOHLCV(ohlcvs: number[][], timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): any[];
|
|
769
773
|
convertOHLCVToTradingView(ohlcvs: number[][], timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): {};
|
|
770
774
|
fetchWebEndpoint(method: any, endpointMethod: any, returnAsJson: any, startRegex?: any, endRegex?: any): Promise<any>;
|
|
771
|
-
marketIds(symbols
|
|
772
|
-
marketSymbols(symbols
|
|
773
|
-
marketCodes(codes
|
|
775
|
+
marketIds(symbols?: Strings): any[];
|
|
776
|
+
marketSymbols(symbols?: Strings, type?: Str, allowEmpty?: boolean, sameTypeOnly?: boolean, sameSubTypeOnly?: boolean): any[];
|
|
777
|
+
marketCodes(codes?: Strings): any[];
|
|
774
778
|
parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
|
|
775
779
|
fetchL2OrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
|
|
776
780
|
filterBySymbol(objects: any, symbol?: Str): any;
|
|
@@ -864,6 +868,7 @@ export default class Exchange {
|
|
|
864
868
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
865
869
|
fetchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
866
870
|
fetchOrderBooks(symbols?: string[], limit?: Int, params?: {}): Promise<Dictionary<OrderBook>>;
|
|
871
|
+
watchBidsAsks(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
867
872
|
watchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
868
873
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
869
874
|
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
@@ -902,6 +907,8 @@ export default class Exchange {
|
|
|
902
907
|
fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
903
908
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
904
909
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
910
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
911
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
905
912
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
906
913
|
fetchDeposits(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
907
914
|
fetchWithdrawals(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
@@ -1000,6 +1007,8 @@ export default class Exchange {
|
|
|
1000
1007
|
parseLiquidation(liquidation: any, market?: Market): Liquidation;
|
|
1001
1008
|
parseLiquidations(liquidations: any, market?: any, since?: Int, limit?: Int): Liquidation[];
|
|
1002
1009
|
parseGreeks(greeks: any, market?: Market): Greeks;
|
|
1010
|
+
parseOption(chain: any, currency?: Currency, market?: Market): Option;
|
|
1011
|
+
parseOptionChain(response: object[], currencyKey?: Str, symbolKey?: Str): OptionChain;
|
|
1003
1012
|
parseMarginModes(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModes;
|
|
1004
1013
|
parseMarginMode(marginMode: any, market?: Market): MarginMode;
|
|
1005
1014
|
parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -453,6 +453,8 @@ export default class Exchange {
|
|
|
453
453
|
'fetchOpenOrder': undefined,
|
|
454
454
|
'fetchOpenOrders': undefined,
|
|
455
455
|
'fetchOpenOrdersWs': undefined,
|
|
456
|
+
'fetchOption': undefined,
|
|
457
|
+
'fetchOptionChain': undefined,
|
|
456
458
|
'fetchOrder': undefined,
|
|
457
459
|
'fetchOrderBook': true,
|
|
458
460
|
'fetchOrderBooks': undefined,
|
|
@@ -1424,6 +1426,12 @@ export default class Exchange {
|
|
|
1424
1426
|
intToBase16(elem) {
|
|
1425
1427
|
return elem.toString(16);
|
|
1426
1428
|
}
|
|
1429
|
+
extendExchangeOptions(newOptions) {
|
|
1430
|
+
this.options = this.extend(this.options, newOptions);
|
|
1431
|
+
}
|
|
1432
|
+
createSafeDictionary() {
|
|
1433
|
+
return {};
|
|
1434
|
+
}
|
|
1427
1435
|
/* eslint-enable */
|
|
1428
1436
|
// ------------------------------------------------------------------------
|
|
1429
1437
|
// ########################################################################
|
|
@@ -3124,7 +3132,7 @@ export default class Exchange {
|
|
|
3124
3132
|
throw new BadResponse(errorMessage);
|
|
3125
3133
|
}
|
|
3126
3134
|
}
|
|
3127
|
-
marketIds(symbols) {
|
|
3135
|
+
marketIds(symbols = undefined) {
|
|
3128
3136
|
if (symbols === undefined) {
|
|
3129
3137
|
return symbols;
|
|
3130
3138
|
}
|
|
@@ -3134,7 +3142,7 @@ export default class Exchange {
|
|
|
3134
3142
|
}
|
|
3135
3143
|
return result;
|
|
3136
3144
|
}
|
|
3137
|
-
marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3145
|
+
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3138
3146
|
if (symbols === undefined) {
|
|
3139
3147
|
if (!allowEmpty) {
|
|
3140
3148
|
throw new ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
@@ -3175,7 +3183,7 @@ export default class Exchange {
|
|
|
3175
3183
|
}
|
|
3176
3184
|
return result;
|
|
3177
3185
|
}
|
|
3178
|
-
marketCodes(codes) {
|
|
3186
|
+
marketCodes(codes = undefined) {
|
|
3179
3187
|
if (codes === undefined) {
|
|
3180
3188
|
return codes;
|
|
3181
3189
|
}
|
|
@@ -4115,6 +4123,9 @@ export default class Exchange {
|
|
|
4115
4123
|
async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
|
|
4116
4124
|
throw new NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
|
|
4117
4125
|
}
|
|
4126
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
4127
|
+
throw new NotSupported(this.id + ' watchBidsAsks() is not supported yet');
|
|
4128
|
+
}
|
|
4118
4129
|
async watchTickers(symbols = undefined, params = {}) {
|
|
4119
4130
|
throw new NotSupported(this.id + ' watchTickers() is not supported yet');
|
|
4120
4131
|
}
|
|
@@ -4467,6 +4478,12 @@ export default class Exchange {
|
|
|
4467
4478
|
async fetchGreeks(symbol, params = {}) {
|
|
4468
4479
|
throw new NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
4469
4480
|
}
|
|
4481
|
+
async fetchOptionChain(code, params = {}) {
|
|
4482
|
+
throw new NotSupported(this.id + ' fetchOptionChain() is not supported yet');
|
|
4483
|
+
}
|
|
4484
|
+
async fetchOption(symbol, params = {}) {
|
|
4485
|
+
throw new NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
4486
|
+
}
|
|
4470
4487
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4471
4488
|
/**
|
|
4472
4489
|
* @method
|
|
@@ -5645,6 +5662,21 @@ export default class Exchange {
|
|
|
5645
5662
|
parseGreeks(greeks, market = undefined) {
|
|
5646
5663
|
throw new NotSupported(this.id + ' parseGreeks () is not supported yet');
|
|
5647
5664
|
}
|
|
5665
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
5666
|
+
throw new NotSupported(this.id + ' parseOption () is not supported yet');
|
|
5667
|
+
}
|
|
5668
|
+
parseOptionChain(response, currencyKey = undefined, symbolKey = undefined) {
|
|
5669
|
+
const optionStructures = {};
|
|
5670
|
+
for (let i = 0; i < response.length; i++) {
|
|
5671
|
+
const info = response[i];
|
|
5672
|
+
const currencyId = this.safeString(info, currencyKey);
|
|
5673
|
+
const currency = this.safeCurrency(currencyId);
|
|
5674
|
+
const marketId = this.safeString(info, symbolKey);
|
|
5675
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'option');
|
|
5676
|
+
optionStructures[market['symbol']] = this.parseOption(info, currency, market);
|
|
5677
|
+
}
|
|
5678
|
+
return optionStructures;
|
|
5679
|
+
}
|
|
5648
5680
|
parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
5649
5681
|
const marginModeStructures = {};
|
|
5650
5682
|
for (let i = 0; i < response.length; i++) {
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -398,6 +398,25 @@ export interface Greeks {
|
|
|
398
398
|
underlyingPrice: number;
|
|
399
399
|
info: any;
|
|
400
400
|
}
|
|
401
|
+
export interface Option {
|
|
402
|
+
info: any;
|
|
403
|
+
currency: string;
|
|
404
|
+
symbol: string;
|
|
405
|
+
timestamp?: number;
|
|
406
|
+
datetime?: Str;
|
|
407
|
+
impliedVolatility: number;
|
|
408
|
+
openInterest: number;
|
|
409
|
+
bidPrice: number;
|
|
410
|
+
askPrice: number;
|
|
411
|
+
midPrice: number;
|
|
412
|
+
markPrice: number;
|
|
413
|
+
lastPrice: number;
|
|
414
|
+
underlyingPrice: number;
|
|
415
|
+
change: number;
|
|
416
|
+
percentage: number;
|
|
417
|
+
baseVolume: number;
|
|
418
|
+
quoteVolume: number;
|
|
419
|
+
}
|
|
401
420
|
export interface LastPrice {
|
|
402
421
|
symbol: string;
|
|
403
422
|
timestamp?: number;
|
|
@@ -419,6 +438,8 @@ export interface LastPrices extends Dictionary<LastPrice> {
|
|
|
419
438
|
}
|
|
420
439
|
export interface MarginModes extends Dictionary<MarginMode> {
|
|
421
440
|
}
|
|
441
|
+
export interface OptionChain extends Dictionary<Option> {
|
|
442
|
+
}
|
|
422
443
|
/** [ timestamp, open, high, low, close, volume ] */
|
|
423
444
|
export declare type OHLCV = [Num, Num, Num, Num, Num, Num];
|
|
424
445
|
/** [ timestamp, open, high, low, close, volume, count ] */
|
package/js/src/binance.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV,
|
|
|
6
6
|
*/
|
|
7
7
|
export default class binance extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
-
isInverse(type:
|
|
10
|
-
isLinear(type:
|
|
9
|
+
isInverse(type: string, subType?: Str): boolean;
|
|
10
|
+
isLinear(type: string, subType?: Str): boolean;
|
|
11
11
|
setSandboxMode(enable: boolean): void;
|
|
12
12
|
convertExpireDate(date: any): string;
|
|
13
13
|
createExpiredOptionMarket(symbol: string): MarketInterface;
|
package/js/src/binance.js
CHANGED
|
@@ -2405,7 +2405,7 @@ export default class binance extends Exchange {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
isInverse(type, subType = undefined) {
|
|
2407
2407
|
if (subType === undefined) {
|
|
2408
|
-
return type === 'delivery';
|
|
2408
|
+
return (type === 'delivery');
|
|
2409
2409
|
}
|
|
2410
2410
|
else {
|
|
2411
2411
|
return subType === 'inverse';
|
package/js/src/bingx.js
CHANGED
|
@@ -185,6 +185,7 @@ export default class bingx extends Exchange {
|
|
|
185
185
|
'post': {
|
|
186
186
|
'trade/cancelReplace': 1,
|
|
187
187
|
'positionSide/dual': 1,
|
|
188
|
+
'trade/closePosition': 1,
|
|
188
189
|
},
|
|
189
190
|
},
|
|
190
191
|
},
|
|
@@ -2166,6 +2167,8 @@ export default class bingx extends Exchange {
|
|
|
2166
2167
|
'SELL': 'sell',
|
|
2167
2168
|
'SHORT': 'sell',
|
|
2168
2169
|
'LONG': 'buy',
|
|
2170
|
+
'ask': 'sell',
|
|
2171
|
+
'bid': 'buy',
|
|
2169
2172
|
};
|
|
2170
2173
|
return this.safeString(sides, side, side);
|
|
2171
2174
|
}
|
|
@@ -3913,14 +3916,45 @@ export default class bingx extends Exchange {
|
|
|
3913
3916
|
* @param {string} symbol Unified CCXT market symbol
|
|
3914
3917
|
* @param {string} [side] not used by bingx
|
|
3915
3918
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
3919
|
+
* @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
|
|
3916
3920
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3917
3921
|
*/
|
|
3918
3922
|
await this.loadMarkets();
|
|
3919
|
-
const
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3923
|
+
const positionId = this.safeString(params, 'positionId');
|
|
3924
|
+
params = this.omit(params, 'positionId');
|
|
3925
|
+
let response = undefined;
|
|
3926
|
+
if (positionId !== undefined) {
|
|
3927
|
+
const request = {
|
|
3928
|
+
'positionId': positionId,
|
|
3929
|
+
};
|
|
3930
|
+
response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
|
|
3931
|
+
}
|
|
3932
|
+
else {
|
|
3933
|
+
const market = this.market(symbol);
|
|
3934
|
+
const request = {
|
|
3935
|
+
'symbol': market['id'],
|
|
3936
|
+
};
|
|
3937
|
+
response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
|
|
3938
|
+
}
|
|
3939
|
+
//
|
|
3940
|
+
// swapV1PrivatePostTradeClosePosition
|
|
3941
|
+
//
|
|
3942
|
+
// {
|
|
3943
|
+
// "code": 0,
|
|
3944
|
+
// "msg": "",
|
|
3945
|
+
// "timestamp": 1710992264190,
|
|
3946
|
+
// "data": {
|
|
3947
|
+
// "orderId": 1770656007907930112,
|
|
3948
|
+
// "positionId": "1751667128353910784",
|
|
3949
|
+
// "symbol": "LTC-USDT",
|
|
3950
|
+
// "side": "Ask",
|
|
3951
|
+
// "type": "MARKET",
|
|
3952
|
+
// "positionSide": "Long",
|
|
3953
|
+
// "origQty": "0.2"
|
|
3954
|
+
// }
|
|
3955
|
+
// }
|
|
3956
|
+
//
|
|
3957
|
+
// swapV2PrivatePostTradeCloseAllPositions
|
|
3924
3958
|
//
|
|
3925
3959
|
// {
|
|
3926
3960
|
// "code": 0,
|
package/js/src/bitstamp.js
CHANGED
|
@@ -1122,16 +1122,18 @@ export default class bitstamp extends Exchange {
|
|
|
1122
1122
|
'timestamp': undefined,
|
|
1123
1123
|
'datetime': undefined,
|
|
1124
1124
|
};
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1125
|
+
if (response === undefined) {
|
|
1126
|
+
response = [];
|
|
1127
|
+
}
|
|
1128
|
+
for (let i = 0; i < response.length; i++) {
|
|
1129
|
+
const currencyBalance = response[i];
|
|
1130
|
+
const currencyId = this.safeString(currencyBalance, 'currency');
|
|
1131
|
+
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
1130
1132
|
const account = this.account();
|
|
1131
|
-
account['free'] = this.safeString(
|
|
1132
|
-
account['used'] = this.safeString(
|
|
1133
|
-
account['total'] = this.safeString(
|
|
1134
|
-
result[
|
|
1133
|
+
account['free'] = this.safeString(currencyBalance, 'available');
|
|
1134
|
+
account['used'] = this.safeString(currencyBalance, 'reserved');
|
|
1135
|
+
account['total'] = this.safeString(currencyBalance, 'total');
|
|
1136
|
+
result[currencyCode] = account;
|
|
1135
1137
|
}
|
|
1136
1138
|
return this.safeBalance(result);
|
|
1137
1139
|
}
|
|
@@ -1145,24 +1147,17 @@ export default class bitstamp extends Exchange {
|
|
|
1145
1147
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1146
1148
|
*/
|
|
1147
1149
|
await this.loadMarkets();
|
|
1148
|
-
const response = await this.
|
|
1150
|
+
const response = await this.privatePostAccountBalances(params);
|
|
1149
1151
|
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
// "bat_balance": "0.00000000",
|
|
1160
|
-
// "bat_reserved": "0.00000000",
|
|
1161
|
-
// "bat_withdrawal_fee": "5.00000000",
|
|
1162
|
-
// "batbtc_fee": "0.000",
|
|
1163
|
-
// "bateur_fee": "0.000",
|
|
1164
|
-
// "batusd_fee": "0.000",
|
|
1165
|
-
// }
|
|
1152
|
+
// [
|
|
1153
|
+
// {
|
|
1154
|
+
// "currency": "usdt",
|
|
1155
|
+
// "total": "7.00000",
|
|
1156
|
+
// "available": "7.00000",
|
|
1157
|
+
// "reserved": "0.00000"
|
|
1158
|
+
// },
|
|
1159
|
+
// ...
|
|
1160
|
+
// ]
|
|
1166
1161
|
//
|
|
1167
1162
|
return this.parseBalance(response);
|
|
1168
1163
|
}
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bybit.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bybit
|
|
5
5
|
* @augments Exchange
|
|
@@ -256,6 +256,17 @@ export default class bybit extends Exchange {
|
|
|
256
256
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
257
257
|
parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
|
|
258
258
|
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
259
|
+
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
260
|
+
parseIncome(income: any, market?: Market): {
|
|
261
|
+
info: any;
|
|
262
|
+
symbol: string;
|
|
263
|
+
code: string;
|
|
264
|
+
timestamp: number;
|
|
265
|
+
datetime: string;
|
|
266
|
+
id: string;
|
|
267
|
+
amount: number;
|
|
268
|
+
rate: number;
|
|
269
|
+
};
|
|
259
270
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
260
271
|
url: string;
|
|
261
272
|
method: string;
|
package/js/src/bybit.js
CHANGED
|
@@ -73,6 +73,7 @@ export default class bybit extends Exchange {
|
|
|
73
73
|
'fetchDeposits': true,
|
|
74
74
|
'fetchDepositWithdrawFee': 'emulated',
|
|
75
75
|
'fetchDepositWithdrawFees': true,
|
|
76
|
+
'fetchFundingHistory': true,
|
|
76
77
|
'fetchFundingRate': true,
|
|
77
78
|
'fetchFundingRateHistory': true,
|
|
78
79
|
'fetchFundingRates': true,
|
|
@@ -8113,6 +8114,106 @@ export default class bybit extends Exchange {
|
|
|
8113
8114
|
}
|
|
8114
8115
|
return tiers;
|
|
8115
8116
|
}
|
|
8117
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8118
|
+
/**
|
|
8119
|
+
* @method
|
|
8120
|
+
* @name bybit#fetchFundingHistory
|
|
8121
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
8122
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
|
8123
|
+
* @param {string} [symbol] unified market symbol
|
|
8124
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
8125
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
8126
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8127
|
+
* @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)
|
|
8128
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
8129
|
+
*/
|
|
8130
|
+
await this.loadMarkets();
|
|
8131
|
+
let paginate = false;
|
|
8132
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
|
|
8133
|
+
if (paginate) {
|
|
8134
|
+
return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
|
|
8135
|
+
}
|
|
8136
|
+
let request = {
|
|
8137
|
+
'execType': 'Funding',
|
|
8138
|
+
};
|
|
8139
|
+
let market = undefined;
|
|
8140
|
+
if (symbol !== undefined) {
|
|
8141
|
+
market = this.market(symbol);
|
|
8142
|
+
request['symbol'] = market['id'];
|
|
8143
|
+
}
|
|
8144
|
+
let type = undefined;
|
|
8145
|
+
[type, params] = this.getBybitType('fetchFundingHistory', market, params);
|
|
8146
|
+
request['category'] = type;
|
|
8147
|
+
if (symbol !== undefined) {
|
|
8148
|
+
request['symbol'] = market['id'];
|
|
8149
|
+
}
|
|
8150
|
+
if (since !== undefined) {
|
|
8151
|
+
request['startTime'] = since;
|
|
8152
|
+
}
|
|
8153
|
+
if (limit !== undefined) {
|
|
8154
|
+
request['size'] = limit;
|
|
8155
|
+
}
|
|
8156
|
+
else {
|
|
8157
|
+
request['size'] = 100;
|
|
8158
|
+
}
|
|
8159
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
8160
|
+
const response = await this.privateGetV5ExecutionList(this.extend(request, params));
|
|
8161
|
+
const fundings = this.addPaginationCursorToResult(response);
|
|
8162
|
+
return this.parseIncomes(fundings, market, since, limit);
|
|
8163
|
+
}
|
|
8164
|
+
parseIncome(income, market = undefined) {
|
|
8165
|
+
//
|
|
8166
|
+
// {
|
|
8167
|
+
// "symbol": "XMRUSDT",
|
|
8168
|
+
// "orderType": "UNKNOWN",
|
|
8169
|
+
// "underlyingPrice": "",
|
|
8170
|
+
// "orderLinkId": "",
|
|
8171
|
+
// "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
|
|
8172
|
+
// "stopOrderType": "UNKNOWN",
|
|
8173
|
+
// "execTime": "1710950400000",
|
|
8174
|
+
// "feeCurrency": "",
|
|
8175
|
+
// "createType": "",
|
|
8176
|
+
// "feeRate": "-0.000761",
|
|
8177
|
+
// "tradeIv": "",
|
|
8178
|
+
// "blockTradeId": "",
|
|
8179
|
+
// "markPrice": "136.79",
|
|
8180
|
+
// "execPrice": "137.11",
|
|
8181
|
+
// "markIv": "",
|
|
8182
|
+
// "orderQty": "0",
|
|
8183
|
+
// "orderPrice": "0",
|
|
8184
|
+
// "execValue": "134.3678",
|
|
8185
|
+
// "closedSize": "0",
|
|
8186
|
+
// "execType": "Funding",
|
|
8187
|
+
// "seq": "28097658790",
|
|
8188
|
+
// "side": "Sell",
|
|
8189
|
+
// "indexPrice": "",
|
|
8190
|
+
// "leavesQty": "0",
|
|
8191
|
+
// "isMaker": false,
|
|
8192
|
+
// "execFee": "-0.10232512",
|
|
8193
|
+
// "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
|
|
8194
|
+
// "marketUnit": "",
|
|
8195
|
+
// "execQty": "0.98",
|
|
8196
|
+
// "nextPageCursor": "5774437%3A0%2C5771289%3A0"
|
|
8197
|
+
// }
|
|
8198
|
+
//
|
|
8199
|
+
const marketId = this.safeString(income, 'symbol');
|
|
8200
|
+
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
8201
|
+
let code = 'USDT';
|
|
8202
|
+
if (market['inverse']) {
|
|
8203
|
+
code = market['quote'];
|
|
8204
|
+
}
|
|
8205
|
+
const timestamp = this.safeInteger(income, 'execTime');
|
|
8206
|
+
return {
|
|
8207
|
+
'info': income,
|
|
8208
|
+
'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
|
|
8209
|
+
'code': code,
|
|
8210
|
+
'timestamp': timestamp,
|
|
8211
|
+
'datetime': this.iso8601(timestamp),
|
|
8212
|
+
'id': this.safeString(income, 'execId'),
|
|
8213
|
+
'amount': this.safeNumber(income, 'execQty'),
|
|
8214
|
+
'rate': this.safeNumber(income, 'feeRate'),
|
|
8215
|
+
};
|
|
8216
|
+
}
|
|
8116
8217
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8117
8218
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8118
8219
|
if (api === 'public') {
|
|
@@ -120,10 +120,10 @@ export default class coinbaseinternational extends Exchange {
|
|
|
120
120
|
},
|
|
121
121
|
'www': 'https://international.coinbase.com',
|
|
122
122
|
'doc': [
|
|
123
|
-
'https://docs.cloud.
|
|
123
|
+
'https://docs.cloud.coinbase.com/intx/docs',
|
|
124
124
|
],
|
|
125
125
|
'fees': [
|
|
126
|
-
'https://help.
|
|
126
|
+
'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
|
|
127
127
|
],
|
|
128
128
|
'referral': '',
|
|
129
129
|
},
|
package/js/src/deribit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/deribit.js';
|
|
2
|
-
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class deribit
|
|
5
5
|
* @augments Exchange
|
|
@@ -167,6 +167,27 @@ export default class deribit extends Exchange {
|
|
|
167
167
|
underlyingPrice: number;
|
|
168
168
|
info: any;
|
|
169
169
|
};
|
|
170
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
171
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
172
|
+
parseOption(chain: any, currency?: Currency, market?: Market): {
|
|
173
|
+
info: any;
|
|
174
|
+
currency: any;
|
|
175
|
+
symbol: string;
|
|
176
|
+
timestamp: number;
|
|
177
|
+
datetime: string;
|
|
178
|
+
impliedVolatility: any;
|
|
179
|
+
openInterest: number;
|
|
180
|
+
bidPrice: number;
|
|
181
|
+
askPrice: number;
|
|
182
|
+
midPrice: number;
|
|
183
|
+
markPrice: number;
|
|
184
|
+
lastPrice: number;
|
|
185
|
+
underlyingPrice: number;
|
|
186
|
+
change: any;
|
|
187
|
+
percentage: number;
|
|
188
|
+
baseVolume: number;
|
|
189
|
+
quoteVolume: number;
|
|
190
|
+
};
|
|
170
191
|
nonce(): number;
|
|
171
192
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
172
193
|
url: string;
|