ccxt 4.2.91 → 4.2.93
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 +3 -3
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +213 -205
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +33 -9
- package/dist/cjs/src/base/functions/encode.js +4 -4
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/coinex.js +0 -30
- package/dist/cjs/src/deribit.js +114 -101
- package/dist/cjs/src/digifinex.js +1 -22
- package/dist/cjs/src/kraken.js +56 -7
- package/dist/cjs/src/probit.js +3 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +8 -8
- package/js/src/base/Exchange.js +33 -9
- package/js/src/base/functions/encode.d.ts +1 -1
- package/js/src/base/functions/encode.js +4 -4
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/bybit.js +1 -0
- package/js/src/coinex.d.ts +0 -1
- package/js/src/coinex.js +0 -30
- package/js/src/deribit.js +114 -101
- package/js/src/digifinex.d.ts +0 -1
- package/js/src/digifinex.js +1 -49
- package/js/src/kraken.d.ts +2 -1
- package/js/src/kraken.js +56 -7
- package/js/src/probit.d.ts +1 -1
- package/js/src/probit.js +3 -4
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -3434,14 +3434,34 @@ export default class Exchange {
|
|
|
3434
3434
|
// marketIdKey should only be undefined when response is a dictionary
|
|
3435
3435
|
symbols = this.marketSymbols(symbols);
|
|
3436
3436
|
const tiers = {};
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3437
|
+
let symbolsLength = 0;
|
|
3438
|
+
if (symbols !== undefined) {
|
|
3439
|
+
symbolsLength = symbols.length;
|
|
3440
|
+
}
|
|
3441
|
+
const noSymbols = (symbols === undefined) || (symbolsLength === 0);
|
|
3442
|
+
if (Array.isArray(response)) {
|
|
3443
|
+
for (let i = 0; i < response.length; i++) {
|
|
3444
|
+
const item = response[i];
|
|
3445
|
+
const id = this.safeString(item, marketIdKey);
|
|
3446
|
+
const market = this.safeMarket(id, undefined, undefined, 'swap');
|
|
3447
|
+
const symbol = market['symbol'];
|
|
3448
|
+
const contract = this.safeBool(market, 'contract', false);
|
|
3449
|
+
if (contract && (noSymbols || this.inArray(symbol, symbols))) {
|
|
3450
|
+
tiers[symbol] = this.parseMarketLeverageTiers(item, market);
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
else {
|
|
3455
|
+
const keys = Object.keys(response);
|
|
3456
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3457
|
+
const marketId = keys[i];
|
|
3458
|
+
const item = response[marketId];
|
|
3459
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
3460
|
+
const symbol = market['symbol'];
|
|
3461
|
+
const contract = this.safeBool(market, 'contract', false);
|
|
3462
|
+
if (contract && (noSymbols || this.inArray(symbol, symbols))) {
|
|
3463
|
+
tiers[symbol] = this.parseMarketLeverageTiers(item, market);
|
|
3464
|
+
}
|
|
3445
3465
|
}
|
|
3446
3466
|
}
|
|
3447
3467
|
return tiers;
|
|
@@ -5794,7 +5814,7 @@ export default class Exchange {
|
|
|
5794
5814
|
return reconstructedDate;
|
|
5795
5815
|
}
|
|
5796
5816
|
convertMarketIdExpireDate(date) {
|
|
5797
|
-
// parse
|
|
5817
|
+
// parse 03JAN24 to 240103
|
|
5798
5818
|
const monthMappping = {
|
|
5799
5819
|
'JAN': '01',
|
|
5800
5820
|
'FEB': '02',
|
|
@@ -5809,6 +5829,10 @@ export default class Exchange {
|
|
|
5809
5829
|
'NOV': '11',
|
|
5810
5830
|
'DEC': '12',
|
|
5811
5831
|
};
|
|
5832
|
+
// if exchange omits first zero and provides i.e. '3JAN24' instead of '03JAN24'
|
|
5833
|
+
if (date.length === 6) {
|
|
5834
|
+
date = '0' + date;
|
|
5835
|
+
}
|
|
5812
5836
|
const year = date.slice(0, 2);
|
|
5813
5837
|
const monthName = date.slice(2, 5);
|
|
5814
5838
|
const month = this.safeString(monthMappping, monthName);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { concatBytes } from '../../static_dependencies/noble-curves/abstract/utils.js';
|
|
2
|
-
declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string:
|
|
2
|
+
declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string: string) => string, base64ToString: (string: string) => string, base64ToBinary: (str: string) => Uint8Array, binaryToBase64: (data: Uint8Array) => string, base16ToBinary: (str: string) => Uint8Array, binaryToBase16: (data: Uint8Array) => string, base58ToBinary: (str: string) => Uint8Array, binaryToBase58: (data: Uint8Array) => string, binaryConcat: typeof concatBytes, binaryConcatArray: (arr: any[]) => Uint8Array, urlencode: (object: object) => string, urlencodeNested: (object: object) => string, urlencodeWithArrayRepeat: (object: object) => string, rawencode: (object: object) => string, encode: (str: string) => Uint8Array, decode: (data: Uint8Array) => string, urlencodeBase64: (base64string: string) => string, numberToLE: (n: number, padding: number) => Uint8Array, numberToBE: (n: number, padding: number) => Uint8Array;
|
|
3
3
|
declare function packb(req: any): Uint8Array;
|
|
4
4
|
export { json, isJsonEncodedObject, binaryToString, stringToBinary, stringToBase64, base64ToBinary, base64ToString, binaryToBase64, base16ToBinary, binaryToBase16, binaryConcat, binaryConcatArray, urlencode, urlencodeWithArrayRepeat, rawencode, encode, decode, urlencodeBase64, numberToLE, numberToBE, base58ToBinary, binaryToBase58, urlencodeNested, packb };
|
|
@@ -11,13 +11,13 @@ import { numberToBytesBE, numberToBytesLE, concatBytes } from '../../static_depe
|
|
|
11
11
|
import { serialize } from '../../static_dependencies/messagepack/msgpack.js';
|
|
12
12
|
import qs from '../../static_dependencies/qs/index.cjs';
|
|
13
13
|
/* ------------------------------------------------------------------------ */
|
|
14
|
-
const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = object => ((typeof object === 'string') &&
|
|
14
|
+
const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = (object) => ((typeof object === 'string') &&
|
|
15
15
|
(object.length >= 2) &&
|
|
16
|
-
((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = string => base64.encode(utf8.decode(string)), base64ToString = string => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = object => qs.stringify(object), urlencodeNested = object => qs.stringify(object) // implemented only in python
|
|
17
|
-
, urlencodeWithArrayRepeat = object => qs.stringify(object, { arrayFormat: 'repeat' }), rawencode = object => qs.stringify(object, { encode: false }), encode = utf8.decode // lol
|
|
16
|
+
((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = (string) => base64.encode(utf8.decode(string)), base64ToString = (string) => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = (object) => qs.stringify(object), urlencodeNested = (object) => qs.stringify(object) // implemented only in python
|
|
17
|
+
, urlencodeWithArrayRepeat = (object) => qs.stringify(object, { arrayFormat: 'repeat' }), rawencode = (object) => qs.stringify(object, { encode: false }), encode = utf8.decode // lol
|
|
18
18
|
, decode = utf8.encode
|
|
19
19
|
// Url-safe-base64 without equals signs, with + replaced by - and slashes replaced by underscores
|
|
20
|
-
, urlencodeBase64 = base64string => base64string.replace(/[=]+$/, '')
|
|
20
|
+
, urlencodeBase64 = (base64string) => base64string.replace(/[=]+$/, '')
|
|
21
21
|
.replace(/\+/g, '-')
|
|
22
22
|
.replace(/\//g, '_'), numberToLE = (n, padding) => numberToBytesLE(BigInt(n), padding), numberToBE = (n, padding) => numberToBytesBE(BigInt(n), padding);
|
|
23
23
|
function packb(req) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CHash } from '../../static_dependencies/noble-hashes/utils.js';
|
|
2
|
-
declare function rsa(request: string, secret: string, hash: CHash): string
|
|
2
|
+
declare function rsa(request: string, secret: string, hash: CHash): string;
|
|
3
3
|
declare function jwt(request: {}, secret: Uint8Array, hash: CHash, isRSA?: boolean, opts?: {}): string;
|
|
4
4
|
export { rsa, jwt };
|
package/js/src/bybit.js
CHANGED
package/js/src/coinex.d.ts
CHANGED
|
@@ -71,7 +71,6 @@ export default class coinex extends Exchange {
|
|
|
71
71
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
72
72
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
73
73
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
74
|
-
parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
|
|
75
74
|
parseMarketLeverageTiers(item: any, market?: Market): any[];
|
|
76
75
|
modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
|
|
77
76
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
package/js/src/coinex.js
CHANGED
|
@@ -4128,36 +4128,6 @@ export default class coinex extends Exchange {
|
|
|
4128
4128
|
const data = this.safeValue(response, 'data', {});
|
|
4129
4129
|
return this.parseLeverageTiers(data, symbols, undefined);
|
|
4130
4130
|
}
|
|
4131
|
-
parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
|
|
4132
|
-
//
|
|
4133
|
-
// {
|
|
4134
|
-
// "BTCUSD": [
|
|
4135
|
-
// ["500001", "100", "0.005"],
|
|
4136
|
-
// ["1000001", "50", "0.01"],
|
|
4137
|
-
// ["2000001", "30", "0.015"],
|
|
4138
|
-
// ["5000001", "20", "0.02"],
|
|
4139
|
-
// ["10000001", "15", "0.025"],
|
|
4140
|
-
// ["20000001", "10", "0.03"]
|
|
4141
|
-
// ],
|
|
4142
|
-
// ...
|
|
4143
|
-
// }
|
|
4144
|
-
//
|
|
4145
|
-
const tiers = {};
|
|
4146
|
-
const marketIds = Object.keys(response);
|
|
4147
|
-
for (let i = 0; i < marketIds.length; i++) {
|
|
4148
|
-
const marketId = marketIds[i];
|
|
4149
|
-
const market = this.safeMarket(marketId, undefined, undefined, 'spot');
|
|
4150
|
-
const symbol = this.safeString(market, 'symbol');
|
|
4151
|
-
let symbolsLength = 0;
|
|
4152
|
-
if (symbols !== undefined) {
|
|
4153
|
-
symbolsLength = symbols.length;
|
|
4154
|
-
}
|
|
4155
|
-
if (symbol !== undefined && (symbolsLength === 0 || this.inArray(symbols, symbol))) {
|
|
4156
|
-
tiers[symbol] = this.parseMarketLeverageTiers(response[marketId], market);
|
|
4157
|
-
}
|
|
4158
|
-
}
|
|
4159
|
-
return tiers;
|
|
4160
|
-
}
|
|
4161
4131
|
parseMarketLeverageTiers(item, market = undefined) {
|
|
4162
4132
|
const tiers = [];
|
|
4163
4133
|
let minNotional = 0;
|
package/js/src/deribit.js
CHANGED
|
@@ -700,117 +700,130 @@ export default class deribit extends Exchange {
|
|
|
700
700
|
* @name deribit#fetchMarkets
|
|
701
701
|
* @description retrieves data on all markets for deribit
|
|
702
702
|
* @see https://docs.deribit.com/#public-get_currencies
|
|
703
|
+
* @see https://docs.deribit.com/#public-get_instruments
|
|
703
704
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
704
705
|
* @returns {object[]} an array of objects representing market data
|
|
705
706
|
*/
|
|
706
|
-
const
|
|
707
|
-
//
|
|
708
|
-
// {
|
|
709
|
-
// "jsonrpc": "2.0",
|
|
710
|
-
// "result": [
|
|
711
|
-
// {
|
|
712
|
-
// "withdrawal_priorities": [
|
|
713
|
-
// { value: 0.15, name: "very_low" },
|
|
714
|
-
// { value: 1.5, name: "very_high" },
|
|
715
|
-
// ],
|
|
716
|
-
// "withdrawal_fee": 0.0005,
|
|
717
|
-
// "min_withdrawal_fee": 0.0005,
|
|
718
|
-
// "min_confirmations": 1,
|
|
719
|
-
// "fee_precision": 4,
|
|
720
|
-
// "currency_long": "Bitcoin",
|
|
721
|
-
// "currency": "BTC",
|
|
722
|
-
// "coin_type": "BITCOIN"
|
|
723
|
-
// }
|
|
724
|
-
// ],
|
|
725
|
-
// "usIn": 1583761588590479,
|
|
726
|
-
// "usOut": 1583761588590544,
|
|
727
|
-
// "usDiff": 65,
|
|
728
|
-
// "testnet": false
|
|
729
|
-
// }
|
|
730
|
-
//
|
|
731
|
-
const parsedMarkets = {};
|
|
732
|
-
const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
|
|
707
|
+
const instrumentsResponses = [];
|
|
733
708
|
const result = [];
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
709
|
+
const parsedMarkets = {};
|
|
710
|
+
let fetchAllMarkets = undefined;
|
|
711
|
+
[fetchAllMarkets, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'fetchAllMarkets', true);
|
|
712
|
+
if (fetchAllMarkets) {
|
|
713
|
+
const instrumentsResponse = await this.publicGetGetInstruments(params);
|
|
714
|
+
instrumentsResponses.push(instrumentsResponse);
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
const currenciesResponse = await this.publicGetGetCurrencies(params);
|
|
740
718
|
//
|
|
741
719
|
// {
|
|
742
|
-
// "jsonrpc":"2.0",
|
|
743
|
-
// "result":[
|
|
720
|
+
// "jsonrpc": "2.0",
|
|
721
|
+
// "result": [
|
|
744
722
|
// {
|
|
745
|
-
// "
|
|
746
|
-
//
|
|
747
|
-
//
|
|
748
|
-
//
|
|
749
|
-
// "
|
|
750
|
-
// "
|
|
751
|
-
// "
|
|
752
|
-
// "
|
|
753
|
-
// "
|
|
754
|
-
// "
|
|
755
|
-
// "
|
|
756
|
-
//
|
|
757
|
-
// "expiration_timestamp":1656057600000,
|
|
758
|
-
// "creation_timestamp":1648199543000,
|
|
759
|
-
// "counter_currency":"USD",
|
|
760
|
-
// "contract_size":1.0,
|
|
761
|
-
// "block_trade_commission":0.0003,
|
|
762
|
-
// "base_currency":"BTC"
|
|
763
|
-
// },
|
|
764
|
-
// {
|
|
765
|
-
// "tick_size":0.5,
|
|
766
|
-
// "taker_commission":0.0005,
|
|
767
|
-
// "settlement_period":"month", // month, week
|
|
768
|
-
// "settlement_currency":"BTC",
|
|
769
|
-
// "quote_currency":"USD",
|
|
770
|
-
// "min_trade_amount":10.0,
|
|
771
|
-
// "max_liquidation_commission":0.0075,
|
|
772
|
-
// "max_leverage":50,
|
|
773
|
-
// "maker_commission":0.0,
|
|
774
|
-
// "kind":"future",
|
|
775
|
-
// "is_active":true,
|
|
776
|
-
// "instrument_name":"BTC-27MAY22",
|
|
777
|
-
// "future_type":"reversed",
|
|
778
|
-
// "expiration_timestamp":1653638400000,
|
|
779
|
-
// "creation_timestamp":1648195209000,
|
|
780
|
-
// "counter_currency":"USD",
|
|
781
|
-
// "contract_size":10.0,
|
|
782
|
-
// "block_trade_commission":0.0001,
|
|
783
|
-
// "base_currency":"BTC"
|
|
784
|
-
// },
|
|
785
|
-
// {
|
|
786
|
-
// "tick_size":0.5,
|
|
787
|
-
// "taker_commission":0.0005,
|
|
788
|
-
// "settlement_period":"perpetual",
|
|
789
|
-
// "settlement_currency":"BTC",
|
|
790
|
-
// "quote_currency":"USD",
|
|
791
|
-
// "min_trade_amount":10.0,
|
|
792
|
-
// "max_liquidation_commission":0.0075,
|
|
793
|
-
// "max_leverage":50,
|
|
794
|
-
// "maker_commission":0.0,
|
|
795
|
-
// "kind":"future",
|
|
796
|
-
// "is_active":true,
|
|
797
|
-
// "instrument_name":"BTC-PERPETUAL",
|
|
798
|
-
// "future_type":"reversed",
|
|
799
|
-
// "expiration_timestamp":32503708800000,
|
|
800
|
-
// "creation_timestamp":1534242287000,
|
|
801
|
-
// "counter_currency":"USD",
|
|
802
|
-
// "contract_size":10.0,
|
|
803
|
-
// "block_trade_commission":0.0001,
|
|
804
|
-
// "base_currency":"BTC"
|
|
805
|
-
// },
|
|
723
|
+
// "withdrawal_priorities": [
|
|
724
|
+
// { value: 0.15, name: "very_low" },
|
|
725
|
+
// { value: 1.5, name: "very_high" },
|
|
726
|
+
// ],
|
|
727
|
+
// "withdrawal_fee": 0.0005,
|
|
728
|
+
// "min_withdrawal_fee": 0.0005,
|
|
729
|
+
// "min_confirmations": 1,
|
|
730
|
+
// "fee_precision": 4,
|
|
731
|
+
// "currency_long": "Bitcoin",
|
|
732
|
+
// "currency": "BTC",
|
|
733
|
+
// "coin_type": "BITCOIN"
|
|
734
|
+
// }
|
|
806
735
|
// ],
|
|
807
|
-
// "usIn":
|
|
808
|
-
// "usOut":
|
|
809
|
-
// "usDiff":
|
|
810
|
-
// "testnet":false
|
|
736
|
+
// "usIn": 1583761588590479,
|
|
737
|
+
// "usOut": 1583761588590544,
|
|
738
|
+
// "usDiff": 65,
|
|
739
|
+
// "testnet": false
|
|
811
740
|
// }
|
|
812
741
|
//
|
|
813
|
-
const
|
|
742
|
+
const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
|
|
743
|
+
for (let i = 0; i < currenciesResult.length; i++) {
|
|
744
|
+
const currencyId = this.safeString(currenciesResult[i], 'currency');
|
|
745
|
+
const request = {
|
|
746
|
+
'currency': currencyId,
|
|
747
|
+
};
|
|
748
|
+
const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
|
|
749
|
+
//
|
|
750
|
+
// {
|
|
751
|
+
// "jsonrpc":"2.0",
|
|
752
|
+
// "result":[
|
|
753
|
+
// {
|
|
754
|
+
// "tick_size":0.0005,
|
|
755
|
+
// "taker_commission":0.0003,
|
|
756
|
+
// "strike":52000.0,
|
|
757
|
+
// "settlement_period":"month",
|
|
758
|
+
// "settlement_currency":"BTC",
|
|
759
|
+
// "quote_currency":"BTC",
|
|
760
|
+
// "option_type":"put", // put, call
|
|
761
|
+
// "min_trade_amount":0.1,
|
|
762
|
+
// "maker_commission":0.0003,
|
|
763
|
+
// "kind":"option",
|
|
764
|
+
// "is_active":true,
|
|
765
|
+
// "instrument_name":"BTC-24JUN22-52000-P",
|
|
766
|
+
// "expiration_timestamp":1656057600000,
|
|
767
|
+
// "creation_timestamp":1648199543000,
|
|
768
|
+
// "counter_currency":"USD",
|
|
769
|
+
// "contract_size":1.0,
|
|
770
|
+
// "block_trade_commission":0.0003,
|
|
771
|
+
// "base_currency":"BTC"
|
|
772
|
+
// },
|
|
773
|
+
// {
|
|
774
|
+
// "tick_size":0.5,
|
|
775
|
+
// "taker_commission":0.0005,
|
|
776
|
+
// "settlement_period":"month", // month, week
|
|
777
|
+
// "settlement_currency":"BTC",
|
|
778
|
+
// "quote_currency":"USD",
|
|
779
|
+
// "min_trade_amount":10.0,
|
|
780
|
+
// "max_liquidation_commission":0.0075,
|
|
781
|
+
// "max_leverage":50,
|
|
782
|
+
// "maker_commission":0.0,
|
|
783
|
+
// "kind":"future",
|
|
784
|
+
// "is_active":true,
|
|
785
|
+
// "instrument_name":"BTC-27MAY22",
|
|
786
|
+
// "future_type":"reversed",
|
|
787
|
+
// "expiration_timestamp":1653638400000,
|
|
788
|
+
// "creation_timestamp":1648195209000,
|
|
789
|
+
// "counter_currency":"USD",
|
|
790
|
+
// "contract_size":10.0,
|
|
791
|
+
// "block_trade_commission":0.0001,
|
|
792
|
+
// "base_currency":"BTC"
|
|
793
|
+
// },
|
|
794
|
+
// {
|
|
795
|
+
// "tick_size":0.5,
|
|
796
|
+
// "taker_commission":0.0005,
|
|
797
|
+
// "settlement_period":"perpetual",
|
|
798
|
+
// "settlement_currency":"BTC",
|
|
799
|
+
// "quote_currency":"USD",
|
|
800
|
+
// "min_trade_amount":10.0,
|
|
801
|
+
// "max_liquidation_commission":0.0075,
|
|
802
|
+
// "max_leverage":50,
|
|
803
|
+
// "maker_commission":0.0,
|
|
804
|
+
// "kind":"future",
|
|
805
|
+
// "is_active":true,
|
|
806
|
+
// "instrument_name":"BTC-PERPETUAL",
|
|
807
|
+
// "future_type":"reversed",
|
|
808
|
+
// "expiration_timestamp":32503708800000,
|
|
809
|
+
// "creation_timestamp":1534242287000,
|
|
810
|
+
// "counter_currency":"USD",
|
|
811
|
+
// "contract_size":10.0,
|
|
812
|
+
// "block_trade_commission":0.0001,
|
|
813
|
+
// "base_currency":"BTC"
|
|
814
|
+
// },
|
|
815
|
+
// ],
|
|
816
|
+
// "usIn":1648691472831791,
|
|
817
|
+
// "usOut":1648691472831896,
|
|
818
|
+
// "usDiff":105,
|
|
819
|
+
// "testnet":false
|
|
820
|
+
// }
|
|
821
|
+
//
|
|
822
|
+
instrumentsResponses.push(instrumentsResponse);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
for (let i = 0; i < instrumentsResponses.length; i++) {
|
|
826
|
+
const instrumentsResult = this.safeValue(instrumentsResponses[i], 'result', []);
|
|
814
827
|
for (let k = 0; k < instrumentsResult.length; k++) {
|
|
815
828
|
const market = instrumentsResult[k];
|
|
816
829
|
const kind = this.safeString(market, 'kind');
|
package/js/src/digifinex.d.ts
CHANGED
|
@@ -145,7 +145,6 @@ export default class digifinex extends Exchange {
|
|
|
145
145
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
146
146
|
fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
147
147
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
148
|
-
parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
|
|
149
148
|
fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
|
|
150
149
|
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
151
150
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
package/js/src/digifinex.js
CHANGED
|
@@ -3808,55 +3808,7 @@ export default class digifinex extends Exchange {
|
|
|
3808
3808
|
//
|
|
3809
3809
|
const data = this.safeValue(response, 'data', []);
|
|
3810
3810
|
symbols = this.marketSymbols(symbols);
|
|
3811
|
-
return this.parseLeverageTiers(data, symbols, '
|
|
3812
|
-
}
|
|
3813
|
-
parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
|
|
3814
|
-
//
|
|
3815
|
-
// [
|
|
3816
|
-
// {
|
|
3817
|
-
// "instrument_id": "BTCUSDTPERP",
|
|
3818
|
-
// "type": "REAL",
|
|
3819
|
-
// "contract_type": "PERPETUAL",
|
|
3820
|
-
// "base_currency": "BTC",
|
|
3821
|
-
// "quote_currency": "USDT",
|
|
3822
|
-
// "clear_currency": "USDT",
|
|
3823
|
-
// "contract_value": "0.001",
|
|
3824
|
-
// "contract_value_currency": "BTC",
|
|
3825
|
-
// "is_inverse": false,
|
|
3826
|
-
// "is_trading": true,
|
|
3827
|
-
// "status": "ONLINE",
|
|
3828
|
-
// "price_precision": 1,
|
|
3829
|
-
// "tick_size": "0.1",
|
|
3830
|
-
// "min_order_amount": 1,
|
|
3831
|
-
// "open_max_limits": [
|
|
3832
|
-
// {
|
|
3833
|
-
// "leverage": "50",
|
|
3834
|
-
// "max_limit": "1000000"
|
|
3835
|
-
// }
|
|
3836
|
-
// ]
|
|
3837
|
-
// },
|
|
3838
|
-
// ]
|
|
3839
|
-
//
|
|
3840
|
-
const tiers = {};
|
|
3841
|
-
const result = {};
|
|
3842
|
-
for (let i = 0; i < response.length; i++) {
|
|
3843
|
-
const entry = response[i];
|
|
3844
|
-
const marketId = this.safeString(entry, 'instrument_id');
|
|
3845
|
-
const market = this.safeMarket(marketId);
|
|
3846
|
-
const symbol = this.safeSymbol(marketId, market);
|
|
3847
|
-
let symbolsLength = 0;
|
|
3848
|
-
tiers[symbol] = this.parseMarketLeverageTiers(response[i], market);
|
|
3849
|
-
if (symbols !== undefined) {
|
|
3850
|
-
symbolsLength = symbols.length;
|
|
3851
|
-
if (this.inArray(symbol, symbols)) {
|
|
3852
|
-
result[symbol] = this.parseMarketLeverageTiers(response[i], market);
|
|
3853
|
-
}
|
|
3854
|
-
}
|
|
3855
|
-
if (symbol !== undefined && (symbolsLength === 0 || this.inArray(symbols, symbol))) {
|
|
3856
|
-
result[symbol] = this.parseMarketLeverageTiers(response[i], market);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
return result;
|
|
3811
|
+
return this.parseLeverageTiers(data, symbols, 'instrument_id');
|
|
3860
3812
|
}
|
|
3861
3813
|
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
3862
3814
|
/**
|
package/js/src/kraken.d.ts
CHANGED
|
@@ -104,7 +104,8 @@ export default class kraken extends Exchange {
|
|
|
104
104
|
info: any;
|
|
105
105
|
};
|
|
106
106
|
withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
|
|
107
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
107
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
108
|
+
parsePosition(position: any, market?: Market): import("./base/types.js").Position;
|
|
108
109
|
parseAccountType(account: any): string;
|
|
109
110
|
transferOut(code: string, amount: any, params?: {}): Promise<TransferEntry>;
|
|
110
111
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
package/js/src/kraken.js
CHANGED
|
@@ -2706,15 +2706,15 @@ export default class kraken extends Exchange {
|
|
|
2706
2706
|
* @name kraken#fetchPositions
|
|
2707
2707
|
* @description fetch all open positions
|
|
2708
2708
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
|
|
2709
|
-
* @param {string[]
|
|
2709
|
+
* @param {string[]} [symbols] not used by kraken fetchPositions ()
|
|
2710
2710
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2711
2711
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
2712
2712
|
*/
|
|
2713
2713
|
await this.loadMarkets();
|
|
2714
2714
|
const request = {
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2715
|
+
// 'txid': 'comma delimited list of transaction ids to restrict output to',
|
|
2716
|
+
'docalcs': 'true',
|
|
2717
|
+
'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
|
|
2718
2718
|
};
|
|
2719
2719
|
const response = await this.privatePostOpenPositions(this.extend(request, params));
|
|
2720
2720
|
//
|
|
@@ -2762,9 +2762,58 @@ export default class kraken extends Exchange {
|
|
|
2762
2762
|
// ]
|
|
2763
2763
|
// }
|
|
2764
2764
|
//
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2765
|
+
symbols = this.marketSymbols(symbols);
|
|
2766
|
+
const result = this.safeList(response, 'result');
|
|
2767
|
+
const results = this.parsePositions(result, symbols);
|
|
2768
|
+
return this.filterByArrayPositions(results, 'symbol', symbols, false);
|
|
2769
|
+
}
|
|
2770
|
+
parsePosition(position, market = undefined) {
|
|
2771
|
+
//
|
|
2772
|
+
// {
|
|
2773
|
+
// "pair": "ETHUSDT",
|
|
2774
|
+
// "positions": "1",
|
|
2775
|
+
// "type": "buy",
|
|
2776
|
+
// "leverage": "2.00000",
|
|
2777
|
+
// "cost": "28.49800",
|
|
2778
|
+
// "fee": "0.07979",
|
|
2779
|
+
// "vol": "0.02000000",
|
|
2780
|
+
// "vol_closed": "0.00000000",
|
|
2781
|
+
// "margin": "14.24900"
|
|
2782
|
+
// }
|
|
2783
|
+
//
|
|
2784
|
+
const marketId = this.safeString(position, 'pair');
|
|
2785
|
+
const rawSide = this.safeString(position, 'type');
|
|
2786
|
+
const side = (rawSide === 'buy') ? 'long' : 'short';
|
|
2787
|
+
return this.safePosition({
|
|
2788
|
+
'info': position,
|
|
2789
|
+
'id': undefined,
|
|
2790
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
2791
|
+
'notional': undefined,
|
|
2792
|
+
'marginMode': undefined,
|
|
2793
|
+
'liquidationPrice': undefined,
|
|
2794
|
+
'entryPrice': undefined,
|
|
2795
|
+
'unrealizedPnl': this.safeNumber(position, 'net'),
|
|
2796
|
+
'realizedPnl': undefined,
|
|
2797
|
+
'percentage': undefined,
|
|
2798
|
+
'contracts': this.safeNumber(position, 'vol'),
|
|
2799
|
+
'contractSize': undefined,
|
|
2800
|
+
'markPrice': undefined,
|
|
2801
|
+
'lastPrice': undefined,
|
|
2802
|
+
'side': side,
|
|
2803
|
+
'hedged': undefined,
|
|
2804
|
+
'timestamp': undefined,
|
|
2805
|
+
'datetime': undefined,
|
|
2806
|
+
'lastUpdateTimestamp': undefined,
|
|
2807
|
+
'maintenanceMargin': undefined,
|
|
2808
|
+
'maintenanceMarginPercentage': undefined,
|
|
2809
|
+
'collateral': undefined,
|
|
2810
|
+
'initialMargin': this.safeNumber(position, 'margin'),
|
|
2811
|
+
'initialMarginPercentage': undefined,
|
|
2812
|
+
'leverage': this.safeNumber(position, 'leverage'),
|
|
2813
|
+
'marginRatio': undefined,
|
|
2814
|
+
'stopLossPrice': undefined,
|
|
2815
|
+
'takeProfitPrice': undefined,
|
|
2816
|
+
});
|
|
2768
2817
|
}
|
|
2769
2818
|
parseAccountType(account) {
|
|
2770
2819
|
const accountByType = {
|
package/js/src/probit.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export default class probit extends Exchange {
|
|
|
48
48
|
withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
|
|
49
49
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
50
50
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
51
|
-
|
|
51
|
+
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
52
52
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
53
53
|
parseTransactionStatus(status: any): string;
|
|
54
54
|
fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
|
package/js/src/probit.js
CHANGED
|
@@ -1490,12 +1490,11 @@ export default class probit extends Exchange {
|
|
|
1490
1490
|
const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
|
|
1491
1491
|
return result;
|
|
1492
1492
|
}
|
|
1493
|
-
async
|
|
1493
|
+
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1494
1494
|
/**
|
|
1495
1495
|
* @method
|
|
1496
|
-
* @name probit#
|
|
1497
|
-
* @
|
|
1498
|
-
* @description use fetchDepositsWithdrawals instead
|
|
1496
|
+
* @name probit#fetchDepositsWithdrawals
|
|
1497
|
+
* @description fetch history of deposits and withdrawals
|
|
1499
1498
|
* @see https://docs-en.probit.com/reference/transferpayment
|
|
1500
1499
|
* @param {string} code unified currency code
|
|
1501
1500
|
* @param {int} [since] the earliest time in ms to fetch transactions for
|
package/package.json
CHANGED