File tree Expand file tree Collapse file tree
apps/e2e/src/nuanze-client
packages/nuanze-client/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,12 +204,14 @@ void describe(
204204 username : FOLLOWED_LEADERBOARD_USERNAME ,
205205 timeframe : '24h' ,
206206 includeUntraded : true ,
207+ includePrivate : true ,
207208 limit : 2 ,
208209 } ) ,
209210 tc . nuanze . getFollowedLeaderboard ( {
210211 username : FOLLOWED_LEADERBOARD_USERNAME ,
211212 timeframe : '24h' ,
212213 includeUntraded : false ,
214+ includePrivate : false ,
213215 limit : 2 ,
214216 } ) ,
215217 ] ) ;
@@ -309,6 +311,25 @@ void describe(
309311 }
310312 } ) ;
311313
314+ void test ( 'forwards followed leaderboard private visibility for server validation' , async ( ) => {
315+ try {
316+ await tc . nuanze . getFollowedLeaderboard ( {
317+ username : FOLLOWED_LEADERBOARD_USERNAME ,
318+ timeframe : '24h' ,
319+ includePrivate : 'invalid' as unknown as boolean ,
320+ } ) ;
321+ assert . fail ( 'expected BAD_REQUEST for an invalid includePrivate value' ) ;
322+ } catch ( error ) {
323+ assert . ok (
324+ error instanceof NuanzeServerFailureError ,
325+ 'should throw NuanzeServerFailureError' ,
326+ ) ;
327+ assert . equal ( error . errorCode , 'BAD_REQUEST' ) ;
328+ assert . equal ( error . httpStatus , 400 ) ;
329+ assertNonEmptyString ( error . requestId , 'error.requestId' ) ;
330+ }
331+ } ) ;
332+
312333 void test ( 'rejects an unknown followed leaderboard username' , async ( ) => {
313334 try {
314335 await tc . nuanze . getFollowedLeaderboard ( {
Original file line number Diff line number Diff line change @@ -152,6 +152,33 @@ void describe(
152152 }
153153 } ) ;
154154
155+ void test ( 'binds global open-position cursors to private visibility' , async ( ) => {
156+ const first = await tc . nuanze . getOpenPositions ( {
157+ limit : 2 ,
158+ includePrivate : false ,
159+ } ) ;
160+ const { nextCursor } = first ;
161+ assertNonEmptyString ( nextCursor , 'first.nextCursor' ) ;
162+ assert . ok ( nextCursor !== null ) ;
163+
164+ try {
165+ await tc . nuanze . getOpenPositions ( {
166+ limit : 2 ,
167+ includePrivate : true ,
168+ cursor : nextCursor ,
169+ } ) ;
170+ assert . fail ( 'expected CURSOR_FILTER_MISMATCH for changed filters' ) ;
171+ } catch ( error ) {
172+ assert . ok (
173+ error instanceof NuanzeServerFailureError ,
174+ 'should throw NuanzeServerFailureError' ,
175+ ) ;
176+ assert . equal ( error . errorCode , 'CURSOR_FILTER_MISMATCH' ) ;
177+ assert . equal ( error . httpStatus , 400 ) ;
178+ assertNonEmptyString ( error . requestId , 'error.requestId' ) ;
179+ }
180+ } ) ;
181+
155182 void test ( 'rejects an unknown ticker with MARKET_NOT_FOUND' , async ( ) => {
156183 try {
157184 await tc . nuanze . getMarketPositioning ( { ticker : 'NOTAREALTICKERXYZ' } ) ;
Original file line number Diff line number Diff line change @@ -253,7 +253,8 @@ export class NuanzeClient {
253253 /**
254254 * Gets a keyset-paginated leaderboard for every subaccount a username actively follows, sorted
255255 * by PnL descending with nulls last. Subaccounts with no PnL in the window are included by
256- * default with null PnL/rank, zero counts, and no products.
256+ * default with null PnL/rank, zero counts, and no products. Private subaccounts are excluded
257+ * unless `includePrivate=true`.
257258 *
258259 * @throws {NuanzeServerFailureError } With `BAD_REQUEST` when params are invalid, or
259260 * `USERNAME_NOT_FOUND` when the supplied username has no claimed identity.
@@ -509,7 +510,8 @@ export class NuanzeClient {
509510 * Lists current open perpetual position legs across every market by signed unrealized PnL.
510511 * Descending returns the largest gainers and ascending returns the largest losers. This is a
511512 * latest indexed snapshot with no timeframe. Legs below $10 absolute notional are excluded.
512- * Each row includes market identity and its source snapshot timestamp.
513+ * Private subaccounts are excluded unless `includePrivate=true`. Each row includes market
514+ * identity and its source snapshot timestamp.
513515 *
514516 * @throws {NuanzeServerFailureError } With `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, or
515517 * `BAD_REQUEST` when the query or cursor is invalid.
Original file line number Diff line number Diff line change @@ -216,6 +216,8 @@ export interface GetNuanzeFollowedLeaderboardParams {
216216 timeframe : NuanzeLeaderboardTimeframe ;
217217 /** Include followed subaccounts with no PnL in the requested window, default true. */
218218 includeUntraded ?: boolean ;
219+ /** Include followed subaccounts with Private Mode enabled, default false. */
220+ includePrivate ?: boolean ;
219221 /** Page size, 1-200, default 100. */
220222 limit ?: number ;
221223 /**
@@ -742,7 +744,9 @@ export interface GetNuanzeOpenPositionsParams {
742744 limit ?: number ;
743745 /** Signed unrealized-PnL direction, default `desc` (largest gainers first). */
744746 sortDirection ?: NuanzeOpenPositionSortDirection ;
745- /** Opaque exclusive cursor bound to the sort direction. */
747+ /** Include positions from subaccounts with Private Mode enabled, default false. */
748+ includePrivate ?: boolean ;
749+ /** Opaque exclusive cursor bound to the sort direction and private visibility. */
746750 cursor ?: string ;
747751}
748752
You can’t perform that action at this time.
0 commit comments