Skip to content

Commit

Permalink
fix another ts vs node issue w/ multithreaded filler
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Jan 3, 2025
1 parent 55efd50 commit 7c36673
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/experimental-bots/filler-common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const serializeDLOBNode = (
): SerializedDLOBNode => {
if (node instanceof OrderNode) {
return {
type: node.constructor.name,
type: getOrderNodeType(node),
userAccountData: userAccountData,
order: serializeOrder(node.order),
userAccount: node.userAccount,
Expand All @@ -278,6 +278,22 @@ const serializeDLOBNode = (
}
};

const getOrderNodeType = (node: OrderNode): string => {
if (node instanceof TakingLimitOrderNode) {
return 'TakingLimitOrderNode';
} else if (node instanceof RestingLimitOrderNode) {
return 'RestingLimitOrderNode';
} else if (node instanceof FloatingLimitOrderNode) {
return 'FloatingLimitOrderNode';
} else if (node instanceof MarketOrderNode) {
return 'MarketOrderNode';
} else if (node instanceof SwiftOrderNode) {
return 'SwiftOrderNode';
} else {
throw new Error('Invalid node type');
}
};

export const deserializeNodeToFill = (
serializedNode: SerializedNodeToFill
): NodeToFillWithBuffer => {
Expand Down

0 comments on commit 7c36673

Please sign in to comment.