{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arena-predictions-com/json-schema/arena-predictions-com-order-result-schema.json",
  "title": "OrderResult",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arena-predictions-com-openapi.json#/components/schemas/OrderResult",
  "type": "object",
  "required": [
    "status",
    "action",
    "type",
    "idempotencyKey",
    "replayed",
    "originalCreatedAt",
    "order",
    "trade",
    "fillVenue",
    "mode",
    "venueData"
  ],
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "executed",
        "resting",
        "canceled"
      ],
      "description": "canceled: an ioc or fok that did not fill. Nothing was spent."
    },
    "action": {
      "type": "string",
      "enum": [
        "buy",
        "sell"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "market",
        "limit"
      ]
    },
    "idempotencyKey": {
      "type": "string",
      "format": "uuid"
    },
    "replayed": {
      "type": "boolean",
      "description": "True when this idempotencyKey was used before: the stored order, nothing new placed."
    },
    "originalCreatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "On a replay: when the order was first placed."
    },
    "order": {
      "oneOf": [
        {
          "$ref": "#/$defs/OrderDetail"
        },
        {
          "type": "null"
        }
      ],
      "description": "The limit order. Null for a market order, which is a fill and not an order."
    },
    "trade": {
      "oneOf": [
        {
          "$ref": "#/$defs/Trade"
        },
        {
          "type": "null"
        }
      ],
      "description": "The position opened (buy) or closed (sell). Null while resting or canceled."
    },
    "fillVenue": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "kalshi",
        "novig",
        "polymarket",
        "prophetx",
        null
      ],
      "description": "Where the fill was priced. Paper only: nothing is sent there. The first leg when the ticket split."
    },
    "fills": {
      "type": "array",
      "description": "Present when route best split one ticket across venues. priceCents is omitted while venue data is off.",
      "items": {
        "type": "object",
        "required": [
          "venue",
          "contracts"
        ],
        "properties": {
          "venue": {
            "type": "string",
            "enum": [
              "kalshi",
              "novig",
              "polymarket",
              "prophetx"
            ]
          },
          "contracts": {
            "type": "number"
          },
          "priceCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 99
          }
        }
      }
    },
    "mode": {
      "type": "string",
      "const": "paper"
    },
    "venueData": {
      "type": "boolean"
    },
    "fillPriceCents": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Only while the venue-data switch is on."
    },
    "organization": {
      "type": "object",
      "description": "Present when X-Arena-Org selected an organization sandbox. Absent on the personal account.",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "slug": {
          "type": [
            "string",
            "null"
          ],
          "description": "The organization's slug. Null when the sandbox did not name one."
        }
      }
    }
  },
  "$defs": {
    "Order": {
      "type": "object",
      "required": [
        "orderId",
        "action",
        "instrumentId",
        "instrumentLabel",
        "instrumentSide",
        "orderSide",
        "contracts",
        "filledContracts",
        "remainingContracts",
        "limitCents",
        "holdDollars",
        "timeInForce",
        "expiresAt",
        "status",
        "createdAt"
      ],
      "properties": {
        "orderId": {
          "type": "string",
          "format": "uuid"
        },
        "action": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "buy",
            "sell",
            null
          ]
        },
        "instrumentId": {
          "type": [
            "string",
            "null"
          ]
        },
        "instrumentLabel": {
          "type": [
            "string",
            "null"
          ]
        },
        "instrumentSide": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "yes",
            "no",
            null
          ]
        },
        "orderSide": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "yes",
            "no",
            null
          ]
        },
        "contracts": {
          "type": "integer"
        },
        "filledContracts": {
          "type": "integer"
        },
        "remainingContracts": {
          "type": "integer"
        },
        "limitCents": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Your own limit."
        },
        "holdDollars": {
          "type": "number"
        },
        "timeInForce": {
          "type": [
            "string",
            "null"
          ]
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "statedProbPct": {
          "type": [
            "integer",
            "null"
          ]
        },
        "placedVia": {
          "type": [
            "string",
            "null"
          ]
        },
        "placedPrivate": {
          "type": "boolean"
        },
        "createdAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "marketTicker": {
          "type": [
            "string",
            "null"
          ],
          "description": "Only while the venue-data switch is on."
        }
      }
    },
    "OrderDetail": {
      "allOf": [
        {
          "$ref": "#/$defs/Order"
        },
        {
          "type": "object",
          "required": [
            "type",
            "cancelReason",
            "tradeId"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "limit"
            },
            "cancelReason": {
              "type": [
                "string",
                "null"
              ],
              "description": "user, expired, not_filled, market_closed, market_resolved, position_closed, and so on."
            },
            "tradeId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid",
              "description": "The position it opened or closed, once executed."
            },
            "fillPriceCents": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Only while the venue-data switch is on."
            }
          }
        }
      ]
    },
    "Position": {
      "type": "object",
      "required": [
        "tradeId",
        "instrumentId",
        "instrumentLabel",
        "instrumentSide",
        "boughtSide",
        "contracts",
        "costDollars",
        "statedProbPct",
        "placedVia",
        "placedPrivate",
        "parlayId",
        "fillVenue",
        "openedAt"
      ],
      "properties": {
        "tradeId": {
          "type": "string",
          "format": "uuid"
        },
        "instrumentId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The Arena instrument the market lists; null when not mapped."
        },
        "instrumentLabel": {
          "type": [
            "string",
            "null"
          ],
          "description": "The instrument's YES side in words."
        },
        "instrumentSide": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "yes",
            "no",
            null
          ],
          "description": "The side of the instrument held."
        },
        "boughtSide": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "yes",
            "no",
            null
          ],
          "description": "The side of the market bought."
        },
        "contracts": {
          "type": "integer"
        },
        "costDollars": {
          "type": "number",
          "description": "Paper dollars paid."
        },
        "statedProbPct": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The probability you stated when placing, if any."
        },
        "placedVia": {
          "type": [
            "string",
            "null"
          ]
        },
        "placedPrivate": {
          "type": "boolean"
        },
        "parlayId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "fillVenue": {
          "type": "string"
        },
        "openedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "marketTicker": {
          "type": [
            "string",
            "null"
          ],
          "description": "Only while the venue-data switch is on."
        },
        "entryCents": {
          "type": [
            "number",
            "null"
          ],
          "description": "Only while the venue-data switch is on."
        }
      }
    },
    "Trade": {
      "allOf": [
        {
          "$ref": "#/$defs/Position"
        },
        {
          "type": "object",
          "required": [
            "status",
            "closedAt",
            "closeReason",
            "pnlDollars",
            "resolvedOutcome"
          ],
          "properties": {
            "status": {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "open",
                "won",
                "lost",
                "settled_push",
                "cancelled",
                "sold",
                null
              ]
            },
            "closedAt": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "closeReason": {
              "type": [
                "string",
                "null"
              ]
            },
            "pnlDollars": {
              "type": [
                "number",
                "null"
              ]
            },
            "resolvedOutcome": {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "yes",
                "no",
                "push",
                "void",
                null
              ],
              "description": "The instrument's result."
            }
          }
        }
      ]
    }
  }
}