Skip to content

Commit 734c6e4

Browse files
[Automated changes] JS files
1 parent 17478ba commit 734c6e4

6 files changed

Lines changed: 278 additions & 5 deletions

File tree

dist/ccxt.browser.js

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378794,7 +378794,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
378794378794
'fetchDepositsWithdrawals': true,
378795378795
'fetchDepositWithdrawFee': 'emulated',
378796378796
'fetchDepositWithdrawFees': true,
378797-
'fetchFundingHistory': false,
378797+
'fetchFundingHistory': true,
378798378798
'fetchFundingRate': true,
378799378799
'fetchFundingRateHistory': false,
378800378800
'fetchFundingRates': true,
@@ -378929,6 +378929,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
378929378929
'collateral-account/balance',
378930378930
'collateral-account/balance-summary',
378931378931
'collateral-account/positions/history',
378932+
'collateral-account/funding-history',
378932378933
'collateral-account/leverage',
378933378934
'collateral-account/positions/open',
378934378935
'collateral-account/summary',
@@ -381363,6 +381364,88 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
381363381364
'interval': undefined,
381364381365
};
381365381366
}
381367+
/**
381368+
* @method
381369+
* @name whitebit#fetchFundingHistory
381370+
* @description fetch the history of funding payments paid and received on this account
381371+
* @see https://docs.whitebit.com/private/http-trade-v4/#funding-history
381372+
* @param {string} [symbol] unified market symbol
381373+
* @param {int} [since] the starting timestamp in milliseconds
381374+
* @param {int} [limit] the number of entries to return
381375+
* @param {object} [params] extra parameters specific to the exchange API endpoint
381376+
* @param {int} [params.until] the latest time in ms to fetch funding history for
381377+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
381378+
*/
381379+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
381380+
await this.loadMarkets();
381381+
if (symbol === undefined) {
381382+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchFundingHistory() requires a symbol argument');
381383+
}
381384+
const market = this.market(symbol);
381385+
let request = {
381386+
'market': market['id'],
381387+
};
381388+
if (since !== undefined) {
381389+
request['startDate'] = since;
381390+
}
381391+
if (limit !== undefined) {
381392+
request['limit'] = since;
381393+
}
381394+
[request, params] = this.handleUntilOption('endDate', request, params);
381395+
const response = await this.v4PrivatePostCollateralAccountFundingHistory(request);
381396+
//
381397+
// {
381398+
// "records": [
381399+
// {
381400+
// "market": "BTC_PERP",
381401+
// "fundingTime": "1708704000000",
381402+
// "fundingRate": "0.00017674",
381403+
// "fundingAmount": "-0.171053531892",
381404+
// "positionAmount": "0.019",
381405+
// "settlementPrice": "50938.2",
381406+
// "rateCalculatedTime": "1708675200000"
381407+
// },
381408+
// ],
381409+
// "limit": 100,
381410+
// "offset": 0
381411+
// }
381412+
//
381413+
const data = this.safeList(response, 'records', []);
381414+
return this.parseFundingHistories(data, market, since, limit);
381415+
}
381416+
parseFundingHistory(contract, market = undefined) {
381417+
//
381418+
// {
381419+
// "market": "BTC_PERP",
381420+
// "fundingTime": "1708704000000",
381421+
// "fundingRate": "0.00017674",
381422+
// "fundingAmount": "-0.171053531892",
381423+
// "positionAmount": "0.019",
381424+
// "settlementPrice": "50938.2",
381425+
// "rateCalculatedTime": "1708675200000"
381426+
// }
381427+
//
381428+
const marketId = this.safeString(contract, 'market');
381429+
const timestamp = this.safeInteger(contract, 'fundingTime');
381430+
return {
381431+
'info': contract,
381432+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
381433+
'code': undefined,
381434+
'timestamp': timestamp,
381435+
'datetime': this.iso8601(timestamp),
381436+
'id': undefined,
381437+
'amount': this.safeNumber(contract, 'fundingAmount'),
381438+
};
381439+
}
381440+
parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
381441+
const result = [];
381442+
for (let i = 0; i < contracts.length; i++) {
381443+
const contract = contracts[i];
381444+
result.push(this.parseFundingHistory(contract, market));
381445+
}
381446+
const sorted = this.sortBy(result, 'timestamp');
381447+
return this.filterBySinceLimit(sorted, since, limit);
381448+
}
381366381449
/**
381367381450
* @method
381368381451
* @name whitebit#fetchDepositsWithdrawals

dist/ccxt.browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/src/whitebit.js

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class whitebit extends whitebit$1 {
5555
'fetchDepositsWithdrawals': true,
5656
'fetchDepositWithdrawFee': 'emulated',
5757
'fetchDepositWithdrawFees': true,
58-
'fetchFundingHistory': false,
58+
'fetchFundingHistory': true,
5959
'fetchFundingRate': true,
6060
'fetchFundingRateHistory': false,
6161
'fetchFundingRates': true,
@@ -190,6 +190,7 @@ class whitebit extends whitebit$1 {
190190
'collateral-account/balance',
191191
'collateral-account/balance-summary',
192192
'collateral-account/positions/history',
193+
'collateral-account/funding-history',
193194
'collateral-account/leverage',
194195
'collateral-account/positions/open',
195196
'collateral-account/summary',
@@ -2624,6 +2625,88 @@ class whitebit extends whitebit$1 {
26242625
'interval': undefined,
26252626
};
26262627
}
2628+
/**
2629+
* @method
2630+
* @name whitebit#fetchFundingHistory
2631+
* @description fetch the history of funding payments paid and received on this account
2632+
* @see https://docs.whitebit.com/private/http-trade-v4/#funding-history
2633+
* @param {string} [symbol] unified market symbol
2634+
* @param {int} [since] the starting timestamp in milliseconds
2635+
* @param {int} [limit] the number of entries to return
2636+
* @param {object} [params] extra parameters specific to the exchange API endpoint
2637+
* @param {int} [params.until] the latest time in ms to fetch funding history for
2638+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
2639+
*/
2640+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2641+
await this.loadMarkets();
2642+
if (symbol === undefined) {
2643+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingHistory() requires a symbol argument');
2644+
}
2645+
const market = this.market(symbol);
2646+
let request = {
2647+
'market': market['id'],
2648+
};
2649+
if (since !== undefined) {
2650+
request['startDate'] = since;
2651+
}
2652+
if (limit !== undefined) {
2653+
request['limit'] = since;
2654+
}
2655+
[request, params] = this.handleUntilOption('endDate', request, params);
2656+
const response = await this.v4PrivatePostCollateralAccountFundingHistory(request);
2657+
//
2658+
// {
2659+
// "records": [
2660+
// {
2661+
// "market": "BTC_PERP",
2662+
// "fundingTime": "1708704000000",
2663+
// "fundingRate": "0.00017674",
2664+
// "fundingAmount": "-0.171053531892",
2665+
// "positionAmount": "0.019",
2666+
// "settlementPrice": "50938.2",
2667+
// "rateCalculatedTime": "1708675200000"
2668+
// },
2669+
// ],
2670+
// "limit": 100,
2671+
// "offset": 0
2672+
// }
2673+
//
2674+
const data = this.safeList(response, 'records', []);
2675+
return this.parseFundingHistories(data, market, since, limit);
2676+
}
2677+
parseFundingHistory(contract, market = undefined) {
2678+
//
2679+
// {
2680+
// "market": "BTC_PERP",
2681+
// "fundingTime": "1708704000000",
2682+
// "fundingRate": "0.00017674",
2683+
// "fundingAmount": "-0.171053531892",
2684+
// "positionAmount": "0.019",
2685+
// "settlementPrice": "50938.2",
2686+
// "rateCalculatedTime": "1708675200000"
2687+
// }
2688+
//
2689+
const marketId = this.safeString(contract, 'market');
2690+
const timestamp = this.safeInteger(contract, 'fundingTime');
2691+
return {
2692+
'info': contract,
2693+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
2694+
'code': undefined,
2695+
'timestamp': timestamp,
2696+
'datetime': this.iso8601(timestamp),
2697+
'id': undefined,
2698+
'amount': this.safeNumber(contract, 'fundingAmount'),
2699+
};
2700+
}
2701+
parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
2702+
const result = [];
2703+
for (let i = 0; i < contracts.length; i++) {
2704+
const contract = contracts[i];
2705+
result.push(this.parseFundingHistory(contract, market));
2706+
}
2707+
const sorted = this.sortBy(result, 'timestamp');
2708+
return this.filterBySinceLimit(sorted, since, limit);
2709+
}
26272710
/**
26282711
* @method
26292712
* @name whitebit#fetchDepositsWithdrawals

js/src/abstract/whitebit.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface Exchange {
3939
v4PrivatePostCollateralAccountBalance(params?: {}): Promise<implicitReturnType>;
4040
v4PrivatePostCollateralAccountBalanceSummary(params?: {}): Promise<implicitReturnType>;
4141
v4PrivatePostCollateralAccountPositionsHistory(params?: {}): Promise<implicitReturnType>;
42+
v4PrivatePostCollateralAccountFundingHistory(params?: {}): Promise<implicitReturnType>;
4243
v4PrivatePostCollateralAccountLeverage(params?: {}): Promise<implicitReturnType>;
4344
v4PrivatePostCollateralAccountPositionsOpen(params?: {}): Promise<implicitReturnType>;
4445
v4PrivatePostCollateralAccountSummary(params?: {}): Promise<implicitReturnType>;

js/src/whitebit.d.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Exchange from './abstract/whitebit.js';
2-
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int, FundingRate, FundingRates, DepositAddress, BorrowInterest } from './base/types.js';
2+
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int, FundingRate, FundingRates, DepositAddress, BorrowInterest, FundingHistory } from './base/types.js';
33
/**
44
* @class whitebit
55
* @augments Exchange
@@ -405,6 +405,29 @@ export default class whitebit extends Exchange {
405405
*/
406406
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
407407
parseFundingRate(contract: any, market?: Market): FundingRate;
408+
/**
409+
* @method
410+
* @name whitebit#fetchFundingHistory
411+
* @description fetch the history of funding payments paid and received on this account
412+
* @see https://docs.whitebit.com/private/http-trade-v4/#funding-history
413+
* @param {string} [symbol] unified market symbol
414+
* @param {int} [since] the starting timestamp in milliseconds
415+
* @param {int} [limit] the number of entries to return
416+
* @param {object} [params] extra parameters specific to the exchange API endpoint
417+
* @param {int} [params.until] the latest time in ms to fetch funding history for
418+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
419+
*/
420+
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
421+
parseFundingHistory(contract: any, market?: Market): {
422+
info: any;
423+
symbol: string;
424+
code: any;
425+
timestamp: number;
426+
datetime: string;
427+
id: any;
428+
amount: number;
429+
};
430+
parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
408431
/**
409432
* @method
410433
* @name whitebit#fetchDepositsWithdrawals

js/src/whitebit.js

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class whitebit extends Exchange {
5858
'fetchDepositsWithdrawals': true,
5959
'fetchDepositWithdrawFee': 'emulated',
6060
'fetchDepositWithdrawFees': true,
61-
'fetchFundingHistory': false,
61+
'fetchFundingHistory': true,
6262
'fetchFundingRate': true,
6363
'fetchFundingRateHistory': false,
6464
'fetchFundingRates': true,
@@ -193,6 +193,7 @@ export default class whitebit extends Exchange {
193193
'collateral-account/balance',
194194
'collateral-account/balance-summary',
195195
'collateral-account/positions/history',
196+
'collateral-account/funding-history',
196197
'collateral-account/leverage',
197198
'collateral-account/positions/open',
198199
'collateral-account/summary',
@@ -2627,6 +2628,88 @@ export default class whitebit extends Exchange {
26272628
'interval': undefined,
26282629
};
26292630
}
2631+
/**
2632+
* @method
2633+
* @name whitebit#fetchFundingHistory
2634+
* @description fetch the history of funding payments paid and received on this account
2635+
* @see https://docs.whitebit.com/private/http-trade-v4/#funding-history
2636+
* @param {string} [symbol] unified market symbol
2637+
* @param {int} [since] the starting timestamp in milliseconds
2638+
* @param {int} [limit] the number of entries to return
2639+
* @param {object} [params] extra parameters specific to the exchange API endpoint
2640+
* @param {int} [params.until] the latest time in ms to fetch funding history for
2641+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
2642+
*/
2643+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2644+
await this.loadMarkets();
2645+
if (symbol === undefined) {
2646+
throw new ArgumentsRequired(this.id + ' fetchFundingHistory() requires a symbol argument');
2647+
}
2648+
const market = this.market(symbol);
2649+
let request = {
2650+
'market': market['id'],
2651+
};
2652+
if (since !== undefined) {
2653+
request['startDate'] = since;
2654+
}
2655+
if (limit !== undefined) {
2656+
request['limit'] = since;
2657+
}
2658+
[request, params] = this.handleUntilOption('endDate', request, params);
2659+
const response = await this.v4PrivatePostCollateralAccountFundingHistory(request);
2660+
//
2661+
// {
2662+
// "records": [
2663+
// {
2664+
// "market": "BTC_PERP",
2665+
// "fundingTime": "1708704000000",
2666+
// "fundingRate": "0.00017674",
2667+
// "fundingAmount": "-0.171053531892",
2668+
// "positionAmount": "0.019",
2669+
// "settlementPrice": "50938.2",
2670+
// "rateCalculatedTime": "1708675200000"
2671+
// },
2672+
// ],
2673+
// "limit": 100,
2674+
// "offset": 0
2675+
// }
2676+
//
2677+
const data = this.safeList(response, 'records', []);
2678+
return this.parseFundingHistories(data, market, since, limit);
2679+
}
2680+
parseFundingHistory(contract, market = undefined) {
2681+
//
2682+
// {
2683+
// "market": "BTC_PERP",
2684+
// "fundingTime": "1708704000000",
2685+
// "fundingRate": "0.00017674",
2686+
// "fundingAmount": "-0.171053531892",
2687+
// "positionAmount": "0.019",
2688+
// "settlementPrice": "50938.2",
2689+
// "rateCalculatedTime": "1708675200000"
2690+
// }
2691+
//
2692+
const marketId = this.safeString(contract, 'market');
2693+
const timestamp = this.safeInteger(contract, 'fundingTime');
2694+
return {
2695+
'info': contract,
2696+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
2697+
'code': undefined,
2698+
'timestamp': timestamp,
2699+
'datetime': this.iso8601(timestamp),
2700+
'id': undefined,
2701+
'amount': this.safeNumber(contract, 'fundingAmount'),
2702+
};
2703+
}
2704+
parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
2705+
const result = [];
2706+
for (let i = 0; i < contracts.length; i++) {
2707+
const contract = contracts[i];
2708+
result.push(this.parseFundingHistory(contract, market));
2709+
}
2710+
const sorted = this.sortBy(result, 'timestamp');
2711+
return this.filterBySinceLimit(sorted, since, limit);
2712+
}
26302713
/**
26312714
* @method
26322715
* @name whitebit#fetchDepositsWithdrawals

0 commit comments

Comments
 (0)