Skip to content

Commit

Permalink
[CLOB-815] - add new clob pair status (dydxprotocol#33)
Browse files Browse the repository at this point in the history
* add new clob pair status

* generate clob protos

* generate indexer protos

* update indexer with new clob pair status initializing

* add INITIALIZING status to indexer documentation
  • Loading branch information
jakob-dydx committed Aug 23, 2023
1 parent 1fd9f62 commit 90e6094
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 53 deletions.
1 change: 1 addition & 0 deletions indexer/packages/postgres/src/db/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const CLOB_STATUS_TO_MARKET_STATUS: Record<SpecifiedClobPairStatus, PerpetualMar
[ClobPair_Status.STATUS_CANCEL_ONLY]: PerpetualMarketStatus.CANCEL_ONLY,
[ClobPair_Status.STATUS_PAUSED]: PerpetualMarketStatus.PAUSED,
[ClobPair_Status.STATUS_POST_ONLY]: PerpetualMarketStatus.POST_ONLY,
[ClobPair_Status.STATUS_INITIALIZING]: PerpetualMarketStatus.INITIALIZING,
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ export enum PerpetualMarketStatus {
PAUSED = 'PAUSED',
CANCEL_ONLY = 'CANCEL_ONLY',
POST_ONLY = 'POST_ONLY',
INITIALIZING = 'INITIALIZING',
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ export enum ClobPair_Status {
/** STATUS_UNSPECIFIED - Default value. This value is invalid and unused. */
STATUS_UNSPECIFIED = 0,

/**
* STATUS_ACTIVE - STATUS_ACTIVE behavior is unfinalized.
* TODO(DEC-600): update this documentation.
*/
/** STATUS_ACTIVE - STATUS_ACTIVE represents an active clob pair. */
STATUS_ACTIVE = 1,

/**
Expand All @@ -29,6 +26,13 @@ export enum ClobPair_Status {
* TODO(DEC-600): update this documentation.
*/
STATUS_POST_ONLY = 4,

/**
* STATUS_INITIALIZING - STATUS_INITIALIZING represents a newly-added clob pair.
* Clob pairs in this state only accept orders which are
* both short-term and post-only.
*/
STATUS_INITIALIZING = 5,
UNRECOGNIZED = -1,
}
/** Status of the CLOB. */
Expand All @@ -37,10 +41,7 @@ export enum ClobPair_StatusSDKType {
/** STATUS_UNSPECIFIED - Default value. This value is invalid and unused. */
STATUS_UNSPECIFIED = 0,

/**
* STATUS_ACTIVE - STATUS_ACTIVE behavior is unfinalized.
* TODO(DEC-600): update this documentation.
*/
/** STATUS_ACTIVE - STATUS_ACTIVE represents an active clob pair. */
STATUS_ACTIVE = 1,

/**
Expand All @@ -60,6 +61,13 @@ export enum ClobPair_StatusSDKType {
* TODO(DEC-600): update this documentation.
*/
STATUS_POST_ONLY = 4,

/**
* STATUS_INITIALIZING - STATUS_INITIALIZING represents a newly-added clob pair.
* Clob pairs in this state only accept orders which are
* both short-term and post-only.
*/
STATUS_INITIALIZING = 5,
UNRECOGNIZED = -1,
}
export function clobPair_StatusFromJSON(object: any): ClobPair_Status {
Expand All @@ -84,6 +92,10 @@ export function clobPair_StatusFromJSON(object: any): ClobPair_Status {
case "STATUS_POST_ONLY":
return ClobPair_Status.STATUS_POST_ONLY;

case 5:
case "STATUS_INITIALIZING":
return ClobPair_Status.STATUS_INITIALIZING;

case -1:
case "UNRECOGNIZED":
default:
Expand All @@ -107,6 +119,9 @@ export function clobPair_StatusToJSON(object: ClobPair_Status): string {
case ClobPair_Status.STATUS_POST_ONLY:
return "STATUS_POST_ONLY";

case ClobPair_Status.STATUS_INITIALIZING:
return "STATUS_INITIALIZING";

case ClobPair_Status.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
Expand Down
1 change: 1 addition & 0 deletions indexer/services/comlink/public/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ or
|*anonymous*|PAUSED|
|*anonymous*|CANCEL_ONLY|
|*anonymous*|POST_ONLY|
|*anonymous*|INITIALIZING|

## PerpetualMarketResponseObject

Expand Down
3 changes: 2 additions & 1 deletion indexer/services/comlink/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@
"ACTIVE",
"PAUSED",
"CANCEL_ONLY",
"POST_ONLY"
"POST_ONLY",
"INITIALIZING"
],
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion indexer/services/comlink/public/websocket-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ interface TradingPerpetualMarketMessage {
clobPairId?: string;
ticker?: string;
marketId?: number;
status?: PerpetualMarketStatus; // 'ACTIVE', 'PAUSED', 'CANCEL_ONLY' or 'POST_ONLY'
status?: PerpetualMarketStatus; // 'ACTIVE', 'PAUSED', 'CANCEL_ONLY', 'POST_ONLY', or 'INITIALIZING'
baseAsset?: string;
quoteAsset?: string;
initialMarginFraction?: string;
Expand Down
7 changes: 5 additions & 2 deletions proto/dydxprotocol/clob/clob_pair.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ message ClobPair {
enum Status {
// Default value. This value is invalid and unused.
STATUS_UNSPECIFIED = 0;
// STATUS_ACTIVE behavior is unfinalized.
// TODO(DEC-600): update this documentation.
// STATUS_ACTIVE represents an active clob pair.
STATUS_ACTIVE = 1;
// STATUS_PAUSED behavior is unfinalized.
// TODO(DEC-600): update this documentation.
Expand All @@ -65,6 +64,10 @@ message ClobPair {
// STATUS_POST_ONLY behavior is unfinalized.
// TODO(DEC-600): update this documentation.
STATUS_POST_ONLY = 4;
// STATUS_INITIALIZING represents a newly-added clob pair.
// Clob pairs in this state only accept orders which are
// both short-term and post-only.
STATUS_INITIALIZING = 5;
}

Status status = 8;
Expand Down
89 changes: 48 additions & 41 deletions protocol/x/clob/types/clob_pair.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90e6094

Please sign in to comment.