Skip to content

Commit 414fdad

Browse files
committed
update market test selection to prefer live CLOB signals
1 parent c736cac commit 414fdad

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

packages/client/src/testing.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export async function findHighVolumeLowPriceMarket(): Promise<Market> {
114114

115115
function hasRequiredOrderFields(candidate: Market) {
116116
return (
117+
candidate.enableOrderBook === true &&
117118
candidate.acceptingOrders !== false &&
118119
candidate.orderMinSize !== null &&
119120
candidate.orderMinSize !== undefined &&
@@ -123,7 +124,12 @@ function hasRequiredOrderFields(candidate: Market) {
123124
}
124125

125126
function isEligibleTradeCandidate(candidate: Market) {
126-
return hasRequiredOrderFields(candidate) && hasTradableBestAsk(candidate);
127+
return (
128+
hasRequiredOrderFields(candidate) &&
129+
hasTradableBestAsk(candidate) &&
130+
hasTradableBestBid(candidate) &&
131+
hasClobLiquidity(candidate)
132+
);
127133
}
128134

129135
function hasTradableBestAsk(candidate: Market) {
@@ -134,6 +140,18 @@ function hasTradableBestAsk(candidate: Market) {
134140
);
135141
}
136142

143+
function hasTradableBestBid(candidate: Market) {
144+
return (
145+
candidate.bestBid !== null &&
146+
candidate.bestBid !== undefined &&
147+
candidate.bestBid > 0
148+
);
149+
}
150+
151+
function hasClobLiquidity(candidate: Market) {
152+
return (candidate.liquidityClob ?? candidate.liquidityNum ?? 0) > 0;
153+
}
154+
137155
export function expectNonEmptyPage<T>(
138156
page: Page<T>,
139157
): Omit<Page<T>, 'items'> & { items: NonEmptyArray<T> } {

0 commit comments

Comments
 (0)