Skip to content

Commit b16e384

Browse files
authored
Update market-status (#620)
* Update market-status * Comments * Update status code * Add status string
1 parent 7f7b13e commit b16e384

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

src/adapter/market-status.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import { TransportGenerics } from '../transports'
2-
import { InputParametersDefinition } from '../validation/input-params'
32
import { AdapterEndpoint } from './endpoint'
43

5-
/**
6-
* Type for the base input parameter config that any [[MarketStatusEndpoint]] must extend
7-
*/
8-
export type MarketStatusEndpointInputParametersDefinition = InputParametersDefinition & {
9-
market: {
10-
aliases: readonly []
11-
type: 'string'
12-
description: 'The name of the market'
13-
required: boolean
14-
}
15-
}
16-
174
/**
185
* Base input parameter config that any [[MarketStatusEndpoint]] must extend
196
*/
@@ -24,26 +11,44 @@ export const marketStatusEndpointInputParametersDefinition = {
2411
description: 'The name of the market',
2512
required: true,
2613
},
27-
} as const satisfies MarketStatusEndpointInputParametersDefinition
14+
type: {
15+
type: 'string',
16+
description: 'Type of the market status',
17+
options: ['regular', '24/5'],
18+
default: 'regular',
19+
},
20+
} as const
2821

2922
export enum MarketStatus {
3023
UNKNOWN = 0,
3124
CLOSED = 1,
3225
OPEN = 2,
3326
}
3427

28+
export enum TwentyfourFiveMarketStatus {
29+
UNKNOWN = 0,
30+
PRE_MARKET = 1,
31+
REGULAR = 2,
32+
POST_MARKET = 3,
33+
OVERNIGHT = 4,
34+
WEEKEND = 5,
35+
}
36+
37+
type AggregatedMarketStatus = MarketStatus | TwentyfourFiveMarketStatus
38+
3539
export type MarketStatusResultResponse = {
36-
Result: MarketStatus
40+
Result: AggregatedMarketStatus
3741
Data: {
38-
result: MarketStatus
42+
result: AggregatedMarketStatus
43+
statusString: string
3944
}
4045
}
4146

4247
/**
4348
* Helper type structure that contains the different types passed to the generic parameters of a PriceEndpoint
4449
*/
4550
export type MarketStatusEndpointGenerics = TransportGenerics & {
46-
Parameters: MarketStatusEndpointInputParametersDefinition
51+
Parameters: typeof marketStatusEndpointInputParametersDefinition
4752
Response: MarketStatusResultResponse
4853
}
4954

0 commit comments

Comments
 (0)