Private/Remove-ClobOrder.ps1
|
function Remove-ClobOrder { [CmdletBinding(SupportsShouldProcess)] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [string]$OrderId, [Parameter()] [ValidateSet('table', 'json')] [string]$Output = 'table' ) process { if ($PSCmdlet.ShouldProcess("Order $OrderId", "Cancel order on CLOB")) { $client = [ClobClient]::new() $config = [PolymarketConfig]::Load() if (!$config.ContainsKey('api_key')) { throw "API credentials not found." } $client.SetCredentials($config['api_key'], $config['api_secret'], $config['api_passphrase']) $result = $client.CancelOrder($OrderId) [PolymarketOutput]::Format($result, $Output) } } } |