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
2 changes: 1 addition & 1 deletion core/src/exchanges/gemini-titan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class GeminiTitanExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
4 changes: 2 additions & 2 deletions core/src/exchanges/gemini-titan/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function mapOrderStatus(geminiStatus: string): Order['status'] {
case 'open': return 'open';
case 'accepted': return 'open';
case 'filled': return 'filled';
case 'cancelled': return 'cancelled';
case 'canceled': return 'cancelled';
case 'cancelled': return 'canceled';
case 'canceled': return 'canceled';
case 'rejected': return 'rejected';
default: return 'open';
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/hyperliquid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class HyperliquidExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/kalshi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export class KalshiExchange extends PredictionMarketExchange {
side: order.side === 'yes' ? 'buy' : 'sell',
type: 'limit',
amount: order.count,
status: 'cancelled',
status: 'canceled',
filled: order.count - (order.remaining_count || 0),
remaining: 0,
timestamp: new Date(order.created_time).getTime(),
Expand Down
4 changes: 2 additions & 2 deletions core/src/exchanges/kalshi/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ export class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEvent, Kal

// -- Helpers ---------------------------------------------------------------

private mapOrderStatus(status: string | undefined): 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' {
private mapOrderStatus(status: string | undefined): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' {
switch ((status ?? '').toLowerCase()) {
case 'resting': return 'open';
case 'canceled':
case 'cancelled': return 'cancelled';
case 'cancelled': return 'canceled';
case 'executed':
case 'filled': return 'filled';
default: return 'open';
Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/limitless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export class LimitlessExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
6 changes: 3 additions & 3 deletions core/src/exchanges/metaculus/cancelOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface CancelOrderContext {
*
* @param orderId The Metaculus question ID to withdraw the forecast from.
* @param ctx HTTP client and auth context.
* @returns A synthetic Order with status "cancelled".
* @returns A synthetic Order with status "canceled".
*
* @throws {AuthenticationError} If no API token is configured.
* @throws {ValidationError} If the orderId is not a valid numeric question ID.
Expand Down Expand Up @@ -75,15 +75,15 @@ export async function cancelOrder(
headers: { "Content-Type": "application/json", ...headers },
});

// 4. Return synthetic cancelled order
// 4. Return synthetic canceled order
return {
id: `mc-withdraw-${questionId}-${Date.now()}`,
marketId: orderId,
outcomeId: orderId,
side: "buy",
type: "market",
amount: 1,
status: "cancelled",
status: "canceled",
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/metaculus/createOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export function redistributeProbabilities(
*/
function buildSyntheticOrder(
params: CreateOrderParams,
status: "filled" | "cancelled",
status: "filled" | "canceled",
): Order {
return {
id: `mc-${params.marketId}-${Date.now()}`,
Expand Down
4 changes: 2 additions & 2 deletions core/src/exchanges/mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export class MockExchange extends PredictionMarketExchange {
this._freeCash += rest;
this._lockedByBuy.delete(orderId);
}
const u: Order = { ...current, status: 'cancelled', remaining: 0, timestamp: Date.now() };
const u: Order = { ...current, status: 'canceled', remaining: 0, timestamp: Date.now() };
this._orders.set(orderId, u);
return { ...u };
}
Expand All @@ -656,7 +656,7 @@ export class MockExchange extends PredictionMarketExchange {

override async fetchClosedOrders(): Promise<Order[]> {
return Array.from(this._orders.values())
.filter(o => o.status === 'filled' || o.status === 'cancelled' || o.status === 'rejected')
.filter(o => o.status === 'filled' || o.status === 'canceled' || o.status === 'rejected')
.map(o => ({ ...o }));
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/opinion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export class OpinionExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
6 changes: 3 additions & 3 deletions core/src/exchanges/opinion/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ export function mapIntervalToOpinion(interval: CandleInterval): string {
}

// Map Opinion order status code to pmxt status string
export function mapOrderStatus(status: number): 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' {
export function mapOrderStatus(status: number): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' {
switch (status) {
case OPINION_ORDER_STATUS.PENDING: return 'pending';
case OPINION_ORDER_STATUS.FILLED: return 'filled';
case OPINION_ORDER_STATUS.CANCELED: return 'cancelled';
case OPINION_ORDER_STATUS.EXPIRED: return 'cancelled'; // expired -> cancelled
case OPINION_ORDER_STATUS.CANCELED: return 'canceled';
case OPINION_ORDER_STATUS.EXPIRED: return 'canceled'; // expired -> canceled
case OPINION_ORDER_STATUS.FAILED: return 'rejected'; // failed -> rejected
default: return 'pending';
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/polymarket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class PolymarketExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down
8 changes: 4 additions & 4 deletions core/src/exchanges/polymarket_us/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ function mapOrderType(type: OrderType): 'market' | 'limit' {
return type === 'ORDER_TYPE_MARKET' ? 'market' : 'limit';
}

// PMXT Order.status values: 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected'
// Note: PMXT has no 'expired' status; expired orders are mapped to 'cancelled'.
function mapOrderStatus(state: OrderState): 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' {
// PMXT Order.status values: 'pending' | 'open' | 'filled' | 'canceled' | 'rejected'
// Note: PMXT has no 'expired' status; expired orders are mapped to 'canceled'.
function mapOrderStatus(state: OrderState): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' {
switch (state) {
case 'ORDER_STATE_FILLED':
return 'filled';
case 'ORDER_STATE_CANCELED':
case 'ORDER_STATE_EXPIRED':
return 'cancelled';
return 'canceled';
case 'ORDER_STATE_REJECTED':
return 'rejected';
case 'ORDER_STATE_NEW':
Expand Down
6 changes: 3 additions & 3 deletions core/src/exchanges/probable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class ProbableExchange extends PredictionMarketExchange {
side: 'buy',
type: 'limit',
amount: 0,
status: 'cancelled',
status: 'canceled',
filled: 0,
remaining: 0,
timestamp: Date.now(),
Expand Down Expand Up @@ -490,12 +490,12 @@ function parseCompoundId(compoundId: string): [string, string | undefined] {
return [compoundId.substring(0, colonIndex), compoundId.substring(colonIndex + 1)];
}

function mapOrderStatus(status: string): 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' {
function mapOrderStatus(status: string): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' {
if (!status) return 'open';
const lower = status.toLowerCase();
if (lower === 'new' || lower === 'open' || lower === 'partially_filled') return 'open';
if (lower === 'filled' || lower === 'trade') return 'filled';
if (lower === 'canceled' || lower === 'cancelled' || lower === 'expired') return 'cancelled';
if (lower === 'canceled' || lower === 'cancelled' || lower === 'expired') return 'canceled';
if (lower === 'rejected') return 'rejected';
return 'open';
}
4 changes: 2 additions & 2 deletions core/src/exchanges/smarkets/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class SmarketsNormalizer implements IExchangeNormalizer<SmarketsRawEventW
const availableQty = raw.available_quantity || 0;
const quantity = raw.quantity || (totalExecuted + availableQty);

let status: 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' = 'open';
let status: 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' = 'open';
if (totalExecuted > 0 && availableQty === 0) {
status = 'filled';
} else if (totalExecuted > 0) {
Expand Down Expand Up @@ -287,7 +287,7 @@ export class SmarketsNormalizer implements IExchangeNormalizer<SmarketsRawEventW

// -- Private helpers ------------------------------------------------------

private mapOrderStatus(state: string): 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected' {
private mapOrderStatus(state: string): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected' {
switch (state) {
case 'created':
return 'pending';
Expand Down
2 changes: 1 addition & 1 deletion core/src/server/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,7 @@ components:
- pending
- open
- filled
- cancelled
- canceled
- rejected
description: Lifecycle status of the order.
filled:
Expand Down
2 changes: 1 addition & 1 deletion core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export interface Order {
price?: number; // For limit orders
amount: number; // Size in contracts/shares
/** Lifecycle status of the order. */
status: 'pending' | 'open' | 'filled' | 'cancelled' | 'rejected';
status: 'pending' | 'open' | 'filled' | 'canceled' | 'rejected';
filled: number; // Amount filled (USDC cost for buys, shares for sells)
/** Amount filled in shares/contracts (if different from USDC-denominated `filled`). */
filledShares?: number;
Expand Down
8 changes: 4 additions & 4 deletions core/test/pipeline/order-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe('Partial fill', () => {
// ---------------------------------------------------------------------------

describe('Cancel', () => {
it('cancelling an open resting order sets status to cancelled', async () => {
it('cancelling an open resting order sets status to canceled', async () => {
const ex = makeExchange({ limitOrderMode: 'resting' });
const order = await ex.createOrder({
marketId: MARKET_ID,
Expand All @@ -386,8 +386,8 @@ describe('Cancel', () => {
amount: 10,
});

const cancelled = await ex.cancelOrder(order.id);
expect(cancelled.status).toBe('cancelled');
const canceled = await ex.cancelOrder(order.id);
expect(canceled.status).toBe('canceled');
});

it('cancelling returns locked funds to available', async () => {
Expand Down Expand Up @@ -903,7 +903,7 @@ describe('Order query methods', () => {
expect(open.some(o => o.id === orderB.id)).toBe(true);
});

it('fetchClosedOrders returns filled and cancelled orders', async () => {
it('fetchClosedOrders returns filled and canceled orders', async () => {
const ex = makeExchange({ limitOrderMode: 'resting', balance: 1000 });

const orderA = await ex.createOrder({
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10307,7 +10307,7 @@
"pending",
"open",
"filled",
"cancelled",
"canceled",
"rejected"
],
"description": "Lifecycle status of the order."
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/pmxt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class PaginatedEventsResult:

@dataclass
class Order:
"""An order (open, filled, or cancelled)."""
"""An order (open, filled, or canceled)."""

id: str
"""Order ID"""
Expand All @@ -385,7 +385,7 @@ class Order:
"""Order amount (contracts)"""

status: str
"""Order status (pending, open, filled, cancelled, rejected)"""
"""Order status (pending, open, filled, canceled, rejected)"""

filled: float
"""Amount filled"""
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/tests/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ def test_distinct_field_values(self):
"side": "buy",
"type": "limit",
"amount": 111.0,
"status": "cancelled",
"status": "canceled",
"filled": 22.0,
"remaining": 89.0,
"timestamp": 3333333333333,
Expand All @@ -910,7 +910,7 @@ def test_distinct_field_values(self):
assert order.side == "buy"
assert order.type == "limit"
assert order.amount == 111.0
assert order.status == "cancelled"
assert order.status == "canceled"
assert order.filled == 22.0
assert order.remaining == 89.0
assert order.timestamp == 3333333333333
Expand Down
2 changes: 1 addition & 1 deletion sdks/typescript/pmxt/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export interface Trade {
}

/**
* An order (open, filled, or cancelled).
* An order (open, filled, or canceled).
*/
export interface Order {
/** Order ID */
Expand Down
Loading