Private/Get-ClobOrder.ps1

function Get-ClobOrder {
  [CmdletBinding()]
  param (
    [Parameter()]
    [string]$Market,

    [Parameter()]
    [string]$OrderIds,

    [Parameter()]
    [ValidateSet('table', 'json')]
    [string]$Output = 'table'
  )

  process {
    $client = [ClobClient]::new()
    $config = [PolymarketConfig]::Load()

    if (!$config.ContainsKey('api_key')) {
      throw "API credentials not found. Please run 'polymarket clob auth' or set them in config."
    }

    $client.SetCredentials($config['api_key'], $config['api_secret'], $config['api_passphrase'])

    $params = @{}
    if ($Market) { $params['market'] = $Market }
    if ($OrderIds) { $params['order_ids'] = $OrderIds }

    $result = $client.GetOrders($params)
    [PolymarketOutput]::Format($result, $Output)
  }
}