Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/api/info/_methods/_base/_schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export type FrontendOpenOrder = {
* - `"Stop Limit"`: Activates as a limit order when a stop price is reached.
* - `"Take Profit Market"`: Executes as a market order when a take profit price is reached.
* - `"Take Profit Limit"`: Executes as a limit order when a take profit price is reached.
* - `"Twap Slice"`: Executes a single slice of a TWAP order.
* - `"Vault Close"`: Closes a vault position.
* - `"Spot Dust Conversion"`: Converts residual spot balances.
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/order-types
*/
orderType:
Expand All @@ -164,7 +167,10 @@ export type FrontendOpenOrder = {
| "Stop Market"
| "Stop Limit"
| "Take Profit Market"
| "Take Profit Limit";
| "Take Profit Limit"
| "Twap Slice"
| "Vault Close"
| "Spot Dust Conversion";
/**
* Time-in-force:
* - `"Gtc"`: Remains active until filled or canceled.
Expand Down Expand Up @@ -361,7 +367,9 @@ export type UserFill = {
* - `"siblingFilledCanceled"`: Canceled due to sibling ordering being filled.
* - `"delistedCanceled"`: Canceled due to asset delisting.
* - `"liquidatedCanceled"`: Canceled due to liquidation.
* - `"outcomeSettledCanceled"`: Canceled due to outcome market settlement.
* - `"scheduledCancel"`: Canceled due to exceeding scheduled cancel deadline (dead man's switch).
* - `"internalCancel"`: Canceled due to an internal error.
* - `"tickRejected"`: Rejected due to invalid tick price.
* - `"minTradeNtlRejected"`: Rejected due to order notional below minimum.
* - `"perpMarginRejected"`: Rejected due to insufficient margin.
Expand All @@ -377,6 +385,7 @@ export type UserFill = {
* - `"insufficientSpotBalanceRejected"`: Rejected due to insufficient spot balance.
* - `"oracleRejected"`: Rejected due to price too far from oracle.
* - `"perpMaxPositionRejected"`: Rejected due to exceeding margin tier limit at current leverage.
* - `"tooManyOpenOrdersRejected"`: Rejected due to exceeding the open order limit.
*/
export type OrderProcessingStatus =
| "open"
Expand All @@ -392,7 +401,9 @@ export type OrderProcessingStatus =
| "siblingFilledCanceled"
| "delistedCanceled"
| "liquidatedCanceled"
| "outcomeSettledCanceled"
| "scheduledCancel"
| "internalCancel"
| "tickRejected"
| "minTradeNtlRejected"
| "perpMarginRejected"
Expand All @@ -407,4 +418,5 @@ export type OrderProcessingStatus =
| "openInterestIncreaseRejected"
| "insufficientSpotBalanceRejected"
| "oracleRejected"
| "perpMaxPositionRejected";
| "perpMaxPositionRejected"
| "tooManyOpenOrdersRejected";
3 changes: 3 additions & 0 deletions src/api/info/_methods/historicalOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export type HistoricalOrdersResponse = {
* - `"siblingFilledCanceled"`: Canceled due to sibling ordering being filled.
* - `"delistedCanceled"`: Canceled due to asset delisting.
* - `"liquidatedCanceled"`: Canceled due to liquidation.
* - `"outcomeSettledCanceled"`: Canceled due to outcome market settlement.
* - `"scheduledCancel"`: Canceled due to exceeding scheduled cancel deadline (dead man's switch).
* - `"internalCancel"`: Canceled due to an internal error.
* - `"tickRejected"`: Rejected due to invalid tick price.
* - `"minTradeNtlRejected"`: Rejected due to order notional below minimum.
* - `"perpMarginRejected"`: Rejected due to insufficient margin.
Expand All @@ -59,6 +61,7 @@ export type HistoricalOrdersResponse = {
* - `"insufficientSpotBalanceRejected"`: Rejected due to insufficient spot balance.
* - `"oracleRejected"`: Rejected due to price too far from oracle.
* - `"perpMaxPositionRejected"`: Rejected due to exceeding margin tier limit at current leverage.
* - `"tooManyOpenOrdersRejected"`: Rejected due to exceeding the open order limit.
*/
status: OrderProcessingStatus;
/** Timestamp when the status was last updated (in ms since epoch). */
Expand Down
3 changes: 3 additions & 0 deletions src/api/info/_methods/orderStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export type OrderStatusResponse = {
* - `"siblingFilledCanceled"`: Canceled due to sibling ordering being filled.
* - `"delistedCanceled"`: Canceled due to asset delisting.
* - `"liquidatedCanceled"`: Canceled due to liquidation.
* - `"outcomeSettledCanceled"`: Canceled due to outcome market settlement.
* - `"scheduledCancel"`: Canceled due to exceeding scheduled cancel deadline (dead man's switch).
* - `"internalCancel"`: Canceled due to an internal error.
* - `"tickRejected"`: Rejected due to invalid tick price.
* - `"minTradeNtlRejected"`: Rejected due to order notional below minimum.
* - `"perpMarginRejected"`: Rejected due to insufficient margin.
Expand All @@ -67,6 +69,7 @@ export type OrderStatusResponse = {
* - `"insufficientSpotBalanceRejected"`: Rejected due to insufficient spot balance.
* - `"oracleRejected"`: Rejected due to price too far from oracle.
* - `"perpMaxPositionRejected"`: Rejected due to exceeding margin tier limit at current leverage.
* - `"tooManyOpenOrdersRejected"`: Rejected due to exceeding the open order limit.
*/
status: OrderProcessingStatus;
/** Timestamp when the status was last updated (in ms since epoch). */
Expand Down
3 changes: 3 additions & 0 deletions src/api/subscription/_methods/orderUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export type OrderUpdatesEvent = {
* - `"siblingFilledCanceled"`: Canceled due to sibling ordering being filled.
* - `"delistedCanceled"`: Canceled due to asset delisting.
* - `"liquidatedCanceled"`: Canceled due to liquidation.
* - `"outcomeSettledCanceled"`: Canceled due to outcome market settlement.
* - `"scheduledCancel"`: Canceled due to exceeding scheduled cancel deadline (dead man's switch).
* - `"internalCancel"`: Canceled due to an internal error.
* - `"tickRejected"`: Rejected due to invalid tick price.
* - `"minTradeNtlRejected"`: Rejected due to order notional below minimum.
* - `"perpMarginRejected"`: Rejected due to insufficient margin.
Expand All @@ -59,6 +61,7 @@ export type OrderUpdatesEvent = {
* - `"insufficientSpotBalanceRejected"`: Rejected due to insufficient spot balance.
* - `"oracleRejected"`: Rejected due to price too far from oracle.
* - `"perpMaxPositionRejected"`: Rejected due to exceeding margin tier limit at current leverage.
* - `"tooManyOpenOrdersRejected"`: Rejected due to exceeding the open order limit.
*/
status: OrderProcessingStatus;
/** Timestamp when the status was last updated (in ms since epoch). */
Expand Down
3 changes: 3 additions & 0 deletions tests/api/info/frontendOpenOrders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ runTest({
"#/items/properties/orderType/enum/0",
"#/items/properties/orderType/enum/4",
"#/items/properties/orderType/enum/5",
"#/items/properties/orderType/enum/6",
"#/items/properties/orderType/enum/7",
"#/items/properties/orderType/enum/8",
"#/items/properties/tif/enum/1",
"#/items/properties/tif/enum/3",
"#/items/properties/tif/enum/4",
Expand Down
17 changes: 6 additions & 11 deletions tests/api/info/historicalOrders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,31 @@ runTest({
codeTestFn: async (_t, client) => {
const params: HistoricalOrdersParameters[] = [
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9" },
{ user: "0x8c967e73e7b15087c42a10d344cff4c96d877f1d" }, // "outcomeSettledCanceled"
{ user: "0x56dd49a9eb689386daf24f5bcf946bf29d552fd5" }, // "tooManyOpenOrdersRejected"
{ user: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" }, // "Spot Dust Conversion"
];

const data = await Promise.all(params.map((p) => client.historicalOrders(p)));

schemaCoverage(paramsSchema, params);
schemaCoverage(responseSchema, data, [
"#/items/properties/order/properties/orderType/enum/6",
"#/items/properties/order/properties/orderType/enum/7",
"#/items/properties/order/properties/tif/enum/5",
"#/items/properties/status/enum/5",
"#/items/properties/status/enum/6",
"#/items/properties/status/enum/7",
"#/items/properties/status/enum/8",
"#/items/properties/status/enum/10",
"#/items/properties/status/enum/11",
"#/items/properties/status/enum/12",
"#/items/properties/status/enum/13",
"#/items/properties/status/enum/14",
"#/items/properties/status/enum/15",
"#/items/properties/status/enum/16",
"#/items/properties/status/enum/17",
"#/items/properties/status/enum/18",
"#/items/properties/status/enum/19",
"#/items/properties/status/enum/20",
"#/items/properties/status/enum/21",
"#/items/properties/status/enum/22",
"#/items/properties/status/enum/23",
"#/items/properties/status/enum/24",
"#/items/properties/status/enum/25",
"#/items/properties/status/enum/26",
"#/items/properties/status/enum/27",
"#/items/properties/status/enum/28",
"#/items/properties/status/enum/30",
"#/items/properties/order/properties/children/*",
]);
},
Expand Down
6 changes: 6 additions & 0 deletions tests/api/info/orderStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ runTest({
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", oid: 14940693141 }, // order.order.orderType = Stop Limit
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", oid: 27379010444 }, // order.order.orderType = Take Profit Market
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", oid: 27379156434 }, // order.order.orderType = Take Profit Limit
{ user: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", oid: 57286378520 }, // order.order.orderType = Spot Dust Conversion

{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", oid: 15030144135 }, // order.order.tif = null
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", oid: 15029784876 }, // order.order.tif = Gtc
Expand All @@ -49,6 +50,8 @@ runTest({
schemaCoverage(paramsSchema, params);
schemaCoverage(responseSchema, data, [
"#/anyOf/0/properties/order/properties/order/properties/children/*",
"#/anyOf/0/properties/order/properties/order/properties/orderType/enum/6",
"#/anyOf/0/properties/order/properties/order/properties/orderType/enum/7",
"#/anyOf/0/properties/order/properties/order/properties/tif/enum/5",
"#/anyOf/0/properties/order/properties/status/enum/3",
"#/anyOf/0/properties/order/properties/status/enum/5",
Expand All @@ -74,6 +77,9 @@ runTest({
"#/anyOf/0/properties/order/properties/status/enum/26",
"#/anyOf/0/properties/order/properties/status/enum/27",
"#/anyOf/0/properties/order/properties/status/enum/28",
"#/anyOf/0/properties/order/properties/status/enum/29",
"#/anyOf/0/properties/order/properties/status/enum/30",
"#/anyOf/0/properties/order/properties/status/enum/31",
]);
},
});
3 changes: 3 additions & 0 deletions tests/api/info/webData2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ runTest({
"#/properties/openOrders/items/properties/orderType/enum/0",
"#/properties/openOrders/items/properties/orderType/enum/4",
"#/properties/openOrders/items/properties/orderType/enum/5",
"#/properties/openOrders/items/properties/orderType/enum/6",
"#/properties/openOrders/items/properties/orderType/enum/7",
"#/properties/openOrders/items/properties/orderType/enum/8",
"#/properties/openOrders/items/properties/tif/enum/1",
"#/properties/openOrders/items/properties/tif/enum/3",
"#/properties/openOrders/items/properties/tif/enum/4",
Expand Down
3 changes: 3 additions & 0 deletions tests/api/subscription/openOrders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ runTest({
"#/properties/orders/items/properties/orderType/enum/0",
"#/properties/orders/items/properties/orderType/enum/4",
"#/properties/orders/items/properties/orderType/enum/5",
"#/properties/orders/items/properties/orderType/enum/6",
"#/properties/orders/items/properties/orderType/enum/7",
"#/properties/orders/items/properties/orderType/enum/8",
"#/properties/orders/items/properties/tif/enum/1",
"#/properties/orders/items/properties/tif/enum/3",
"#/properties/orders/items/properties/tif/enum/4",
Expand Down
3 changes: 3 additions & 0 deletions tests/api/subscription/orderUpdates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ runTestWithExchange({
"#/items/properties/status/enum/26",
"#/items/properties/status/enum/27",
"#/items/properties/status/enum/28",
"#/items/properties/status/enum/29",
"#/items/properties/status/enum/30",
"#/items/properties/status/enum/31",
]);
},
});