feat(): add V2 REST client with initial endpoints
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
MarginType,
|
||||
WsAccountSnapshotUMCBL,
|
||||
WsBaseEvent,
|
||||
WSPositionSnapshotUMCBL,
|
||||
@@ -71,3 +72,13 @@ export function isWsFuturesPositionsSnapshotEvent(
|
||||
): event is WSPositionSnapshotUMCBL {
|
||||
return isWsPositionsSnapshotEvent(event) && event.arg.instType === 'umcbl';
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple guard for non-TypeScript users, throw a runtime error if value doesn't match type
|
||||
*/
|
||||
export function assertMarginType(marginType: string): marginType is MarginType {
|
||||
if (marginType !== 'isolated' && marginType !== 'crossed') {
|
||||
throw new Error(`MarginType should be one of: crossed | isolated`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user