-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New market status adapter endpoint (#263)
* New market status endpoint * Run prettier
- Loading branch information
1 parent
970e2af
commit d1bd1d5
Showing
5 changed files
with
567 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 22.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './basic' | ||
export * from './price' | ||
export * from './endpoint' | ||
export * from './types' | ||
export * from './lwba' | ||
export * from './market-status' | ||
export * from './price' | ||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { TransportGenerics } from '../transports' | ||
import { InputParametersDefinition } from '../validation/input-params' | ||
import { AdapterEndpoint } from './endpoint' | ||
|
||
/** | ||
* Type for the base input parameter config that any [[MarketStatusEndpoint]] must extend | ||
*/ | ||
export type MarketStatusEndpointInputParametersDefinition = InputParametersDefinition & { | ||
market: { | ||
aliases: readonly [] | ||
type: 'string' | ||
description: 'The name of the market' | ||
required: boolean | ||
} | ||
} | ||
|
||
/** | ||
* Base input parameter config that any [[MarketStatusEndpoint]] must extend | ||
*/ | ||
export const marketStatusEndpointInputParametersDefinition = { | ||
market: { | ||
aliases: [], | ||
type: 'string', | ||
description: 'The name of the market', | ||
required: true, | ||
}, | ||
} as const satisfies MarketStatusEndpointInputParametersDefinition | ||
|
||
export enum MarketStatus { | ||
UNKNOWN = 0, | ||
CLOSED = 1, | ||
OPEN = 2, | ||
} | ||
|
||
export type MarketStatusResultResponse = { | ||
Result: MarketStatus | ||
Data: { | ||
result: MarketStatus | ||
} | ||
} | ||
|
||
/** | ||
* Helper type structure that contains the different types passed to the generic parameters of a PriceEndpoint | ||
*/ | ||
export type MarketStatusEndpointGenerics = TransportGenerics & { | ||
Parameters: MarketStatusEndpointInputParametersDefinition | ||
Response: MarketStatusResultResponse | ||
} | ||
|
||
/** | ||
* A MarketStatusEndpoint is a specific type of AdapterEndpoint. Meant to comply with standard practices for | ||
* Data Feeds, its InputParameters must extend the basic ones (base). | ||
*/ | ||
export class MarketStatusEndpoint< | ||
T extends MarketStatusEndpointGenerics, | ||
> extends AdapterEndpoint<T> {} |
Oops, something went wrong.