Skip to content

Commit 2774b48

Browse files
committed
fix: optional param, fix: invalid expiry time
1 parent 6c5510d commit 2774b48

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/rest-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ export class RestClient extends BaseRestClient {
24902490
getOpenInterestAndVolumeStrike(params: {
24912491
ccy: string;
24922492
expTime: string;
2493-
period: '8H' | '1D';
2493+
period?: '8H' | '1D';
24942494
}): Promise<any[]> {
24952495
return this.get(
24962496
'/api/v5/rubik/stat/option/open-interest-volume-strike',

test/public.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,23 @@ describe('Public Inverse REST API Endpoints', () => {
265265
});
266266

267267
it('getOpenInterestAndVolumeStrike()', async () => {
268+
// Strike stats only accept currently valid option expiries, so derive one
269+
const expiries = await api.getOpenInterestAndVolumeExpiry({
270+
ccy: 'BTC',
271+
period: '1D',
272+
});
273+
expect(expiries.length).toBeGreaterThan(0);
274+
275+
// Expiry rows are returned as [ts, expTime, ...]. Short-dated expiries can
276+
// be listed but still rejected by this endpoint during listing/expiry
277+
// windows, so use the farthest returned expiry for a more stable fixture.
278+
const expTime = expiries[expiries.length - 1][1];
279+
expect(expTime).toStrictEqual(expect.any(String));
280+
268281
expect(
269282
await api.getOpenInterestAndVolumeStrike({
270283
ccy: 'BTC',
271-
expTime: '20241223',
284+
expTime,
272285
period: '1D',
273286
}),
274287
).toMatchObject(successResponseList());

0 commit comments

Comments
 (0)