Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ccxt/ccxt
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 27, 2025
2 parents afc52c2 + e7cbe61 commit feddde7
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 13 deletions.
15 changes: 13 additions & 2 deletions cs/ccxt/exchanges/deribit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3354,11 +3354,16 @@ public async override Task<object> fetchFundingRateHistory(object symbol = null,
var paginateparametersVariable = this.handleOptionAndParams(parameters, "fetchFundingRateHistory", "paginate");
paginate = ((IList<object>)paginateparametersVariable)[0];
parameters = ((IList<object>)paginateparametersVariable)[1];
object maxEntriesPerRequest = 744; // seems exchange returns max 744 items per request
object eachItemDuration = "1h";
if (isTrue(paginate))
{
// 1h needed to fix : https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory", symbol, since, limit, "1h", parameters, 720);
// fix for: https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory", symbol, since, limit, eachItemDuration, this.extend(parameters, new Dictionary<string, object>() {
{ "isDeribitPaginationCall", true },
}), maxEntriesPerRequest);
}
object duration = multiply(this.parseTimeframe(eachItemDuration), 1000);
object time = this.milliseconds();
object month = multiply(multiply(multiply(multiply(30, 24), 60), 60), 1000);
if (isTrue(isEqual(since, null)))
Expand All @@ -3381,6 +3386,12 @@ public async override Task<object> fetchFundingRateHistory(object symbol = null,
{
((IDictionary<string,object>)request)["end_timestamp"] = time;
}
if (isTrue(inOp(parameters, "isDeribitPaginationCall")))
{
parameters = this.omit(parameters, "isDeribitPaginationCall");
object maxUntil = this.sum(since, multiply(limit, duration));
((IDictionary<string,object>)request)["end_timestamp"] = mathMin(getValue(request, "end_timestamp"), maxUntil);
}
object response = await this.publicGetGetFundingRateHistory(this.extend(request, parameters));
//
// {
Expand Down
12 changes: 10 additions & 2 deletions dist/ccxt.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -151012,10 +151012,13 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
const market = this.market(symbol);
let paginate = false;
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
const maxEntriesPerRequest = 744; // seems exchange returns max 744 items per request
const eachItemDuration = '1h';
if (paginate) {
// 1h needed to fix : https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '1h', params, 720);
// fix for: https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, this.extend(params, { 'isDeribitPaginationCall': true }), maxEntriesPerRequest);
}
const duration = this.parseTimeframe(eachItemDuration) * 1000;
let time = this.milliseconds();
const month = 30 * 24 * 60 * 60 * 1000;
if (since === undefined) {
Expand All @@ -151036,6 +151039,11 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
else {
request['end_timestamp'] = time;
}
if ('isDeribitPaginationCall' in params) {
params = this.omit(params, 'isDeribitPaginationCall');
const maxUntil = this.sum(since, limit * duration);
request['end_timestamp'] = Math.min(request['end_timestamp'], maxUntil);
}
const response = await this.publicGetGetFundingRateHistory(this.extend(request, params));
//
// {
Expand Down
2 changes: 1 addition & 1 deletion dist/ccxt.browser.min.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions dist/cjs/src/deribit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3170,10 +3170,13 @@ class deribit extends deribit$1 {
const market = this.market(symbol);
let paginate = false;
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
const maxEntriesPerRequest = 744; // seems exchange returns max 744 items per request
const eachItemDuration = '1h';
if (paginate) {
// 1h needed to fix : https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '1h', params, 720);
// fix for: https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, this.extend(params, { 'isDeribitPaginationCall': true }), maxEntriesPerRequest);
}
const duration = this.parseTimeframe(eachItemDuration) * 1000;
let time = this.milliseconds();
const month = 30 * 24 * 60 * 60 * 1000;
if (since === undefined) {
Expand All @@ -3194,6 +3197,11 @@ class deribit extends deribit$1 {
else {
request['end_timestamp'] = time;
}
if ('isDeribitPaginationCall' in params) {
params = this.omit(params, 'isDeribitPaginationCall');
const maxUntil = this.sum(since, limit * duration);
request['end_timestamp'] = Math.min(request['end_timestamp'], maxUntil);
}
const response = await this.publicGetGetFundingRateHistory(this.extend(request, params));
//
// {
Expand Down
12 changes: 10 additions & 2 deletions js/src/deribit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3173,10 +3173,13 @@ export default class deribit extends Exchange {
const market = this.market(symbol);
let paginate = false;
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
const maxEntriesPerRequest = 744; // seems exchange returns max 744 items per request
const eachItemDuration = '1h';
if (paginate) {
// 1h needed to fix : https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '1h', params, 720);
// fix for: https://github.com/ccxt/ccxt/issues/25040
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, this.extend(params, { 'isDeribitPaginationCall': true }), maxEntriesPerRequest);
}
const duration = this.parseTimeframe(eachItemDuration) * 1000;
let time = this.milliseconds();
const month = 30 * 24 * 60 * 60 * 1000;
if (since === undefined) {
Expand All @@ -3197,6 +3200,11 @@ export default class deribit extends Exchange {
else {
request['end_timestamp'] = time;
}
if ('isDeribitPaginationCall' in params) {
params = this.omit(params, 'isDeribitPaginationCall');
const maxUntil = this.sum(since, limit * duration);
request['end_timestamp'] = Math.min(request['end_timestamp'], maxUntil);
}
const response = await this.publicGetGetFundingRateHistory(this.extend(request, params));
//
// {
Expand Down
3 changes: 1 addition & 2 deletions python/ccxt/async_support/deribit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3075,8 +3075,7 @@ async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None
eachItemDuration = '1h'
if paginate:
# fix for: https://github.com/ccxt/ccxt/issues/25040
params['isDeribitPaginationCall'] = True
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, params, maxEntriesPerRequest)
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, self.extend(params, {'isDeribitPaginationCall': True}), maxEntriesPerRequest)
duration = self.parse_timeframe(eachItemDuration) * 1000
time = self.milliseconds()
month = 30 * 24 * 60 * 60 * 1000
Expand Down
3 changes: 1 addition & 2 deletions python/ccxt/deribit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3075,8 +3075,7 @@ def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limi
eachItemDuration = '1h'
if paginate:
# fix for: https://github.com/ccxt/ccxt/issues/25040
params['isDeribitPaginationCall'] = True
return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, params, maxEntriesPerRequest)
return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, eachItemDuration, self.extend(params, {'isDeribitPaginationCall': True}), maxEntriesPerRequest)
duration = self.parse_timeframe(eachItemDuration) * 1000
time = self.milliseconds()
month = 30 * 24 * 60 * 60 * 1000
Expand Down

0 comments on commit feddde7

Please sign in to comment.