Close an existing position using a reduce-only order. The router mirrors the behaviour of the open endpoint—scanning all supported venues for the best exit price unless you force a specific exchange.
Reduce-only semantics ensure the API never increases exposure while closing.
Provide credentials only for venues you wish to use; missing credentials remove that venue from routing consideration.
For partial closes, set size to the exact quantity you want to reduce.
Combine /api/trade/position/open and /api/trade/position/close in your workflow to ladder into and out of positions while keeping routing logic centralized.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Tide API Documentation","colors":{"primary":"#0EA5E9","light":"#38BDF8","dark":"#0284C7"},"favicon":"/tidebluefull.svg","logo":{"light":"https://mintcdn.com/arcane-0ded8dd0/TW8Wh8CNYhd3LgAt/tidebluefull.svg?fit=max\u0026auto=format\u0026n=TW8Wh8CNYhd3LgAt\u0026q=85\u0026s=75bd86a2ce8488db623250a6ccbe9af3","dark":"https://mintcdn.com/arcane-0ded8dd0/TW8Wh8CNYhd3LgAt/tidebluefull.svg?fit=max\u0026auto=format\u0026n=TW8Wh8CNYhd3LgAt\u0026q=85\u0026s=75bd86a2ce8488db623250a6ccbe9af3"},"api":{"openapi":"openapi.json","mdx":{"server":"https://api.tide.ag","auth":{"method":"key","name":"X-API-KEY"}}},"navbar":{"links":[{"label":"Dashboard","href":"https://app.tide.ag/"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.tide.ag/"}},"footer":{"socials":{"twitter":"https://x.com/tide_ag","telegram":"https://t.me/tidedotag"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"API Status","href":"https://api.tide.ag/health","icon":"chart-line"},{"anchor":"Community","href":"https://t.me/tidedotag","icon":"telegram"},{"anchor":"Support","href":"https://x.com/tide_ag","icon":"twitter"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"arcane-0ded8dd0","hasAudioNarration":false,"actualSubdomain":"arcane-0ded8dd0","customDomains":["docs.tide.ag"],"gitSource":{"type":"github","owner":"arcane-build","repo":"hyperdex-doc","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e8dc044dd579e9b5ccd5","collectionId":"4bee5a2a-953f-402b-a1a2-79fcc7d1cd5d","schemaVersion":"v2"},"entitlements":{},"buildId":"6a399b9e4917e8d409cb9bb9:failure","clientVersion":"0.0.3966","searchFilterCounts":[{"language":"default","tag":"Documentation","count":24},{"language":"default","tag":"Account","count":6},{"language":"default","tag":"Trading","count":6},{"language":"default","tag":"Market Data","count":4},{"language":"default","tag":"Guides","count":3},{"language":"default","tag":"Getting Started","count":3},{"language":"default","tag":"Positions","count":1},{"language":"default","tag":"System","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"trading/close-position","slug":"/trading/close-position","pageMetadata":{"title":"Close Position","openapi":"POST /api/trade/position/close","description":"Close an existing position using a reduce-only order","href":"/trading/close-position"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Close an existing position using a reduce-only order\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,hr:`hr`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Close an existing position using a reduce-only order. The router mirrors the behaviour of the open endpoint—scanning all supported venues for the best exit price unless you force a specific exchange.`}),`\n`,_jsx(Heading,{level:`2`,id:`features`,children:`Features`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Reduce-only safety`}),`: Guarantees the API only decreases exposure`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Smart venue selection`}),`: Routes exits to the venue with the best available price`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Partial or full closes`}),`: Specify any size up to the total position`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Consistent payloads`}),`: Response structure matches the open position endpoint for easy reconciliation`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`use-cases`,children:`Use Cases`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Automate take-profit or stop-loss workflows across multiple exchanges`}),`\n`,_jsx(_components.li,{children:`Build UI flows for one-click position unwinds`}),`\n`,_jsx(_components.li,{children:`Implement partial de-risking strategies using precise quantities`}),`\n`,_jsx(_components.li,{children:`Maintain audit trails with routing and execution metadata in a single response`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`request`,children:`Request`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Method`}),`: `,_jsx(_components.code,{children:`POST`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Endpoint`}),`: `,_jsx(_components.code,{children:`/api/trade/position/close`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Authentication`}),`: Required`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`request-fields`,children:`Request Fields`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`symbol`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`✅`}),_jsx(_components.td,{children:`Asset symbol being closed`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`direction`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`✅`}),_jsxs(_components.td,{children:[`Direction of the position you are closing (`,_jsx(_components.code,{children:`LONG`}),` or `,_jsx(_components.code,{children:`SHORT`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`size`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`✅`}),_jsx(_components.td,{children:`Quantity to close (must not exceed open position size)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`orderType`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`❌`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`MARKET`}),` by default; `,_jsx(_components.code,{children:`LIMIT`}),` supported when `,_jsx(_components.code,{children:`limitPrice`}),` is supplied`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`limitPrice`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`❌`}),_jsxs(_components.td,{children:[`Required when `,_jsx(_components.code,{children:`orderType`}),` is `,_jsx(_components.code,{children:`LIMIT`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`preferredExchange`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`❌`}),_jsx(_components.td,{children:`Force close on a specific venue`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`credentials`})}),_jsx(_components.td,{children:`object`}),_jsx(_components.td,{children:`✅`}),_jsx(_components.td,{children:`Exchange credentials required for execution`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`The response mirrors the `,_jsx(_components.strong,{children:`Open Position`}),` endpoint, returning execution, routing, and position data so you can reconcile final fills.`]}),`\n`,_jsx(Heading,{level:`2`,id:`usage-tips`,children:`Usage Tips`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Reduce-only semantics ensure the API never increases exposure while closing.`}),`\n`,_jsx(_components.li,{children:`Provide credentials only for venues you wish to use; missing credentials remove that venue from routing consideration.`}),`\n`,_jsxs(_components.li,{children:[`For partial closes, set `,_jsx(_components.code,{children:`size`}),` to the exact quantity you want to reduce.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Combine `,_jsx(_components.code,{children:`/api/trade/position/open`}),` and `,_jsx(_components.code,{children:`/api/trade/position/close`}),` in your workflow to ladder into and out of positions while keeping routing logic centralized.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`hyperliquid-close-single-position`,children:`Hyperliquid - Close Single Position`}),`\n`,_jsx(_components.p,{children:`Close a specific open position for a given symbol on Hyperliquid.`}),`\n`,_jsx(Heading,{level:`3`,id:`endpoint`,children:`Endpoint`}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`POST /api/hyperliquid/:walletId/positions/close/:symbol`})}),`\n`,_jsx(Heading,{level:`3`,id:`path-parameters`,children:`Path Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`walletId`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Wallet ID (UUID)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`symbol`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Asset symbol (e.g., “BTC”)`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`headers`,children:`Headers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Header`}),_jsx(_components.th,{children:`Value`}),_jsx(_components.th,{children:`Required`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-wallet-id`})}),_jsx(_components.td,{children:`Wallet ID (UUID)`}),_jsx(_components.td,{children:`Yes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`Content-Type`})}),_jsx(_components.td,{children:`application/json`}),_jsx(_components.td,{children:`Yes`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`request-body`,children:`Request Body`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"userId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ee337309-3e77-4278-b21a-4681468168ba\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"symbol\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BTC-PERP\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"side\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BUY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MARKET\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"quantity\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0.1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"price\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reduceOnly\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`request-parameters`,children:`Request Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`userId`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`User’s wallet ID`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`symbol`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Trading pair (e.g., “BTC-PERP”)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`side`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`”BUY” or “SELL” (opposite of position)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`type`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`”MARKET” or “LIMIT”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`quantity`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Quantity to close`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`price`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Price for the order`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`reduceOnly`})}),_jsx(_components.td,{children:`boolean`}),_jsx(_components.td,{children:`Yes`}),_jsxs(_components.td,{children:[`Must be `,_jsx(_components.code,{children:`true`}),` for closing positions`]})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`example-request`,children:`Example Request`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://api.tide.ag/api/hyperliquid/a1e82339-29f8-41a6-a468-ce8d268a3261/positions/close/BTC`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"x-wallet-id: a1e82339-29f8-41a6-a468-ce8d268a3261\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"userId\": \"ee337309-3e77-4278-b21a-4681468168ba\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"symbol\": \"BTC-PERP\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"side\": \"BUY\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"type\": \"MARKET\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"quantity\": \"0.1\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"price\": \"1\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"reduceOnly\": true`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`success-response`,children:`Success Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"closeId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"c2394ab3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"submitted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"timestamp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1698840000000`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`hyperliquid-close-all-positions`,children:`Hyperliquid - Close All Positions`}),`\n`,_jsx(_components.p,{children:`Close all open positions for the wallet on Hyperliquid.`}),`\n`,_jsx(Heading,{level:`3`,id:`endpoint-2`,children:`Endpoint`}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`POST /api/hyperliquid/:walletId/positions/close-all`})}),`\n`,_jsx(Heading,{level:`3`,id:`path-parameters-2`,children:`Path Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`walletId`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Wallet ID (UUID)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`headers-2`,children:`Headers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Header`}),_jsx(_components.th,{children:`Value`}),_jsx(_components.th,{children:`Required`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-wallet-id`})}),_jsx(_components.td,{children:`Wallet ID (UUID)`}),_jsx(_components.td,{children:`Yes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`Content-Type`})}),_jsx(_components.td,{children:`application/json`}),_jsx(_components.td,{children:`Yes`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`request-body-2`,children:`Request Body`}),`\n`,_jsx(_components.p,{children:`Same schema as close-single-symbol.`}),`\n`,_jsx(Heading,{level:`3`,id:`example-request-2`,children:`Example Request`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://api.tide.ag/api/hyperliquid/a1e82339-29f8-41a6-a468-ce8d268a3261/positions/close-all`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"x-wallet-id: a1e82339-29f8-41a6-a468-ce8d268a3261\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"userId\": \"a1e82339-29f8-41a6-a468-ce8d268a3261\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"symbol\": \"BTC-PERP\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"side\": \"BUY\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"type\": \"MARKET\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"quantity\": \"0.1\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"price\": \"1\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"reduceOnly\": true`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`success-response-2`,children:`Success Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"closedCount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"totalPositions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"results\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"symbol\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BTC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CLOSED\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"orderId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"255732635491\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Successfully closed 1/1 positions\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`aster-close-position`,children:`Aster - Close Position`}),`\n`,_jsx(_components.p,{children:`Close positions on Aster exchange with a single API call.`}),`\n`,_jsx(Heading,{level:`3`,id:`endpoint-3`,children:`Endpoint`}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`POST /api/aster/perp/:walletId/close-position`})}),`\n`,_jsx(Heading,{level:`3`,id:`path-parameters-3`,children:`Path Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`walletId`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Wallet ID (UUID)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`request-body-3`,children:`Request Body`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"symbol\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BTCUSDT\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Optional - Close specific side:`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"symbol\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BTCUSDT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"positionSide\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"LONG\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`request-parameters-2`,children:`Request Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`symbol`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Trading pair (e.g., “BTCUSDT”)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`positionSide`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`”LONG” or “SHORT” (for hedge mode). Omit to close all positions for the symbol`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`example-request-3`,children:`Example Request`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://api.tide.ag/api/aster/perp/ee337309-3e77-4278-b21a-4681468168ba/close-position`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"symbol\": \"BTCUSDT\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`success-response-3`,children:`Success Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`26`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`26`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"orderId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`9884649221`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"symbol\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BTCUSDT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"NEW\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"clientOrderId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"6D52PQwRlg0PcdHz5ttkgN\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"price\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"avgPrice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0.0000\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"origQty\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0.001\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"executedQty\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"cumQty\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"cumQuote\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"timeInForce\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"GTC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MARKET\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reduceOnly\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"closePosition\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"side\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SELL\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"positionSide\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"BOTH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"stopPrice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"workingType\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CONTRACT_PRICE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"priceProtect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"origType\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MARKET\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"updateTime\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1764640797006`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`avantis-close-position-client-side-execution`,children:`Avantis - Close Position (Client-Side Execution)`}),`\n`,_jsxs(_components.p,{children:[`Avantis positions are closed `,_jsx(_components.strong,{children:`client-side`}),` via on-chain transactions on the Base network. Like opening, closing is not routed through the Tide backend.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Avantis close execution uses client-side wallet signing via the `,_jsx(_components.code,{children:`useAvantisTrade`}),` React hook. Supports both full and partial closes.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`close-by-pair-and-trade-index`,children:`Close by Pair and Trade Index`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`useAvantisTrade`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`closePosition`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` pairIndex:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// From PAIR_INDEX_MAP (e.g., 0 = ETH)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tradeIndex:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// On-chain trade index`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` closeAmountUsdc:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"50.00\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Partial close amount (optional)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Returns: txHash`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`close-by-symbol-and-direction`,children:`Close by Symbol and Direction`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Convenience method — finds and closes the matching open trade`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`useAvantisTrade`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`closeBySymbol`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ETH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"LONG\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Returns: txHash`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`request-parameters-3`,children:`Request Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pairIndex`})}),_jsx(_components.td,{children:`number`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Pair index from PAIR_INDEX_MAP`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`tradeIndex`})}),_jsx(_components.td,{children:`number`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`On-chain trade index`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`closeAmountUsdc`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Partial close amount in USDC. Omit for full close`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`close-by-symbol-parameters`,children:`Close by Symbol Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`symbol`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Asset symbol (e.g., “ETH”)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`direction`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`\"LONG\"`}),` or `,_jsx(_components.code,{children:`\"SHORT\"`})]})]})]})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`The close operation uses `,_jsx(_components.code,{children:`initialPosToken`}),` (not `,_jsx(_components.code,{children:`positionSizeUSDC`}),`) for the collateral amount, read from `,_jsx(_components.code,{children:`TradingStorage.openTrades()`}),` on-chain.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Close Position","openapi":"POST /api/trade/position/close","description":"Close an existing position using a reduce-only order","href":"/trading/close-position"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Features","slug":"features","depth":2,"children":[]},{"title":"Use Cases","slug":"use-cases","depth":2,"children":[]},{"title":"Request","slug":"request","depth":2,"children":[]},{"title":"Request Fields","slug":"request-fields","depth":2,"children":[]},{"title":"Usage Tips","slug":"usage-tips","depth":2,"children":[]},{"title":"Hyperliquid - Close Single Position","slug":"hyperliquid-close-single-position","depth":2,"children":[{"title":"Endpoint","slug":"endpoint","depth":3,"children":[]},{"title":"Path Parameters","slug":"path-parameters","depth":3,"children":[]},{"title":"Headers","slug":"headers","depth":3,"children":[]},{"title":"Request Body","slug":"request-body","depth":3,"children":[]},{"title":"Request Parameters","slug":"request-parameters","depth":3,"children":[]},{"title":"Example Request","slug":"example-request","depth":3,"children":[]},{"title":"Success Response","slug":"success-response","depth":3,"children":[]}]},{"title":"Hyperliquid - Close All Positions","slug":"hyperliquid-close-all-positions","depth":2,"children":[{"title":"Endpoint","slug":"endpoint-2","depth":3,"children":[]},{"title":"Path Parameters","slug":"path-parameters-2","depth":3,"children":[]},{"title":"Headers","slug":"headers-2","depth":3,"children":[]},{"title":"Request Body","slug":"request-body-2","depth":3,"children":[]},{"title":"Example Request","slug":"example-request-2","depth":3,"children":[]},{"title":"Success Response","slug":"success-response-2","depth":3,"children":[]}]},{"title":"Aster - Close Position","slug":"aster-close-position","depth":2,"children":[{"title":"Endpoint","slug":"endpoint-3","depth":3,"children":[]},{"title":"Path Parameters","slug":"path-parameters-3","depth":3,"children":[]},{"title":"Request Body","slug":"request-body-3","depth":3,"children":[]},{"title":"Request Parameters","slug":"request-parameters-2","depth":3,"children":[]},{"title":"Example Request","slug":"example-request-3","depth":3,"children":[]},{"title":"Success Response","slug":"success-response-3","depth":3,"children":[]}]},{"title":"Avantis - Close Position (Client-Side Execution)","slug":"avantis-close-position-client-side-execution","depth":2,"children":[{"title":"Close by Pair and Trade Index","slug":"close-by-pair-and-trade-index","depth":3,"children":[]},{"title":"Close by Symbol and Direction","slug":"close-by-symbol-and-direction","depth":3,"children":[]},{"title":"Request Parameters","slug":"request-parameters-3","depth":3,"children":[]},{"title":"Close by Symbol Parameters","slug":"close-by-symbol-parameters","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Close Position","description":"Close an existing position using a reduce-only order","tags":["Trading"],"requestBody":"0794166f-c93f-492b-bee7-a04859902dc4","responses":{"200":"adc6b4ca-008a-40a4-883c-42f6ac44230f"},"method":"post","type":"path","servers":["7ffd4899-ce4a-4b56-8c94-cbc914622ed8"],"security":["f97ac229-9316-4a46-a82e-8e341069fcd4"],"path":"/api/trade/position/close","baseUrlOptions":["https://api.tide.ag"],"title":"Close Position","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["symbol","direction","size","credentials"],"properties":{"symbol":{"type":"string","description":"Asset symbol being closed","isRequired":true,"uniqueKey":"symbol","typeLabel":"string"},"direction":{"type":"string","enum":["LONG","SHORT"],"isRequired":true,"uniqueKey":"direction","typeLabel":"enum\u003cstring>"},"size":{"type":"string","description":"Quantity to close","isRequired":true,"uniqueKey":"size","typeLabel":"string"},"credentials":{"type":"object","properties":{"lighter":{"type":"object","properties":{"apiKeyPrivateKey":{"type":"string","uniqueKey":"credentials.lighter.apiKeyPrivateKey","typeLabel":"string"},"accountIndex":{"type":"integer","uniqueKey":"credentials.lighter.accountIndex","typeLabel":"integer"}},"uniqueKey":"credentials.lighter","typeLabel":"object"},"aster":{"type":"object","properties":{"apiKey":{"type":"string","uniqueKey":"credentials.aster.apiKey","typeLabel":"string"},"apiSecret":{"type":"string","uniqueKey":"credentials.aster.apiSecret","typeLabel":"string"},"walletAddress":{"type":"string","uniqueKey":"credentials.aster.walletAddress","typeLabel":"string"}},"uniqueKey":"credentials.aster","typeLabel":"object"},"hyperliquid":{"type":"object","properties":{"privateKey":{"type":"string","uniqueKey":"credentials.hyperliquid.privateKey","typeLabel":"string"}},"uniqueKey":"credentials.hyperliquid","typeLabel":"object"},"pacifica":{"type":"object","properties":{"apiKey":{"type":"string","uniqueKey":"credentials.pacifica.apiKey","typeLabel":"string"},"apiSecret":{"type":"string","uniqueKey":"credentials.pacifica.apiSecret","typeLabel":"string"},"walletAddress":{"type":"string","uniqueKey":"credentials.pacifica.walletAddress","typeLabel":"string"}},"uniqueKey":"credentials.pacifica","typeLabel":"object"}},"isRequired":true,"uniqueKey":"credentials","typeLabel":"object"},"orderType":{"type":"string","enum":["LIMIT","MARKET","STOP_MARKET","STOP_LIMIT"],"uniqueKey":"orderType","typeLabel":"enum\u003cstring>"},"limitPrice":{"type":"string","description":"Required when orderType is LIMIT","uniqueKey":"limitPrice","typeLabel":"string"},"preferredExchange":{"type":"string","enum":["hyperliquid","aster","lighter","pacifica"],"uniqueKey":"preferredExchange","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"symbol":"\u003cstring>","size":"\u003cstring>","credentials":{"lighter":{"apiKeyPrivateKey":"\u003cstring>","accountIndex":123},"aster":{"apiKey":"\u003cstring>","apiSecret":"\u003cstring>","walletAddress":"\u003cstring>"},"hyperliquid":{"privateKey":"\u003cstring>"},"pacifica":{"apiKey":"\u003cstring>","apiSecret":"\u003cstring>","walletAddress":"\u003cstring>"}},"limitPrice":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"adc6b4ca-008a-40a4-883c-42f6ac44230f":{"description":"Position closed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","uniqueKey":"success","typeLabel":"boolean"},"data":{"type":"object","properties":{"executedOn":{"type":"string","enum":["hyperliquid","aster","lighter","pacifica"],"uniqueKey":"data.executedOn","typeLabel":"enum\u003cstring>"},"order":{"type":"object","properties":{"orderId":{"type":"string","description":"Unique order identifier","uniqueKey":"data.order.orderId","typeLabel":"string"},"symbol":{"type":"string","description":"Trading pair symbol","uniqueKey":"data.order.symbol","typeLabel":"string"},"side":{"type":"string","enum":["BUY","SELL"],"uniqueKey":"data.order.side","typeLabel":"enum\u003cstring>"},"type":{"type":"string","enum":["LIMIT","MARKET","STOP_MARKET","STOP_LIMIT"],"uniqueKey":"data.order.type","typeLabel":"enum\u003cstring>"},"status":{"type":"string","enum":["OPEN","FILLED","PARTIALLY_FILLED","CANCELED","REJECTED","UNKNOWN"],"uniqueKey":"data.order.status","typeLabel":"enum\u003cstring>"},"price":{"type":"string","description":"Order price","uniqueKey":"data.order.price","typeLabel":"string"},"quantity":{"type":"string","description":"Order quantity","uniqueKey":"data.order.quantity","typeLabel":"string"},"filledQuantity":{"type":"string","description":"Filled quantity","uniqueKey":"data.order.filledQuantity","typeLabel":"string"},"averagePrice":{"type":"string","description":"Average fill price","uniqueKey":"data.order.averagePrice","typeLabel":"string"},"timestamp":{"type":"integer","description":"Order timestamp in milliseconds","uniqueKey":"data.order.timestamp","typeLabel":"integer"},"exchange":{"type":"string","enum":["hyperliquid","aster","lighter","pacifica"],"uniqueKey":"data.order.exchange","typeLabel":"enum\u003cstring>"},"clientOrderId":{"type":"string","description":"Client-provided order ID","uniqueKey":"data.order.clientOrderId","typeLabel":"string"},"reduceOnly":{"type":"boolean","description":"Whether this is a reduce-only order","uniqueKey":"data.order.reduceOnly","typeLabel":"boolean"},"triggerPrice":{"type":"string","description":"Trigger price for stop orders","uniqueKey":"data.order.triggerPrice","typeLabel":"string"}},"uniqueKey":"data.order","typeLabel":"object"},"routing":{"type":"object","uniqueKey":"data.routing","typeLabel":"object"},"execution":{"type":"object","uniqueKey":"data.execution","typeLabel":"object"}},"uniqueKey":"data","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":true,"data":{"executedOn":"hyperliquid","order":{"orderId":"\u003cstring>","symbol":"\u003cstring>","side":"BUY","type":"LIMIT","status":"OPEN","price":"\u003cstring>","quantity":"\u003cstring>","filledQuantity":"\u003cstring>","averagePrice":"\u003cstring>","timestamp":123,"exchange":"hyperliquid","clientOrderId":"\u003cstring>","reduceOnly":true,"triggerPrice":"\u003cstring>"},"routing":{},"execution":{}}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"f97ac229-9316-4a46-a82e-8e341069fcd4":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication. Also requires X-API-SECRET, X-API-TIMESTAMP, and X-API-SIGNATURE headers for private endpoints.","scopes":[]}}},"servers":{"7ffd4899-ce4a-4b56-8c94-cbc914622ed8":{"url":"https://api.tide.ag","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication. Also requires X-API-SECRET, X-API-TIMESTAMP, and X-API-SIGNATURE headers for private endpoints.","scopes":[]},"schema":{"title":"X-API-KEY","type":"string","description":"API key for authentication. Also requires X-API-SECRET, X-API-TIMESTAMP, and X-API-SIGNATURE headers for private endpoints.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"X-API-KEY"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"openapi.json"},"subdomain":"arcane-0ded8dd0","siteName":"Tide API Documentation","title":"Close Position - Tide API Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-06T17:46:28.212Z","originalFileLocation":"trading/close-position.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Close an existing position using a reduce-only order\">\u003cmeta data-mint-head name=\"application-name\" content=\"Tide API Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Close Position - Tide API Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Close an existing position using a reduce-only order\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Tide API Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.tide.ag/trading/close-position\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://arcane-0ded8dd0.mintlify.app/_mintlify/api/og/v2?division=Trading\u0026amp;title=Close+Position\u0026amp;description=Close+an+existing+position+using+a+reduce-only+order\u0026amp;theme=31a04741b4af92565e5a1ec8\u0026amp;signature=24ef55983f0303cf66d31f41989e5c3a0604b0e88f0cf313472aa7d3a535e273\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Close Position - Tide API Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Close an existing position using a reduce-only order\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://arcane-0ded8dd0.mintlify.app/_mintlify/api/og/v2?division=Trading\u0026amp;title=Close+Position\u0026amp;description=Close+an+existing+position+using+a+reduce-only+order\u0026amp;theme=31a04741b4af92565e5a1ec8\u0026amp;signature=24ef55983f0303cf66d31f41989e5c3a0604b0e88f0cf313472aa7d3a535e273\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/arcane-0ded8dd0/ZWboUMerARSBM0eF/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Tide API Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0EA5E9\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.tide.ag/trading/close-position\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/trading/close-position.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.tide.ag/#organization\",\"name\":\"Tide API Documentation\",\"url\":\"https://docs.tide.ag\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/arcane-0ded8dd0/TW8Wh8CNYhd3LgAt/tidebluefull.svg?fit=max\u0026auto=format\u0026n=TW8Wh8CNYhd3LgAt\u0026q=85\u0026s=75bd86a2ce8488db623250a6ccbe9af3\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.tide.ag#website\",\"name\":\"Tide API Documentation\",\"url\":\"https://docs.tide.ag\",\"publisher\":{\"@id\":\"https://docs.tide.ag/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.tide.ag/trading/close-position#webpage\",\"url\":\"https://docs.tide.ag/trading/close-position\",\"name\":\"Close Position\",\"description\":\"Close an existing position using a reduce-only order\",\"dateModified\":\"2026-04-06T17:46:28.212Z\",\"isPartOf\":{\"@id\":\"https://docs.tide.ag#website\"},\"breadcrumb\":{\"@id\":\"https://docs.tide.ag/trading/close-position#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.tide.ag/trading/close-position#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Trading\",\"item\":\"https://docs.tide.ag/trading/open-position\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Close Position\",\"item\":\"https://docs.tide.ag/trading/close-position\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.tide.ag/trading/close-position#apireference\",\"headline\":\"Close Position\",\"name\":\"Close Position\",\"description\":\"Close an existing position using a reduce-only order\",\"url\":\"https://docs.tide.ag/trading/close-position\",\"mainEntityOfPage\":{\"@id\":\"https://docs.tide.ag/trading/close-position#webpage\"},\"dateModified\":\"2026-04-06T17:46:28.212Z\",\"publisher\":{\"@id\":\"https://docs.tide.ag/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.tide.ag#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Tide API Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Tide API Documentation","nav":{"global":{"anchors":[{"anchor":"API Status","href":"https://api.tide.ag/health","icon":"chart-line"},{"anchor":"Community","href":"https://t.me/tidedotag","icon":"telegram"},{"anchor":"Support","href":"https://x.com/tide_ag","icon":"twitter"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Getting Started","pages":[{"title":"API Reference","href":"/introduction"},{"title":"Quick Start","href":"/quickstart"},{"title":"User Flow Documentation","href":"/user-flow"}]},{"group":"Market Data","pages":[{"title":"Get Token Pairs","api":"GET /api/token-pairs","href":"/market-data/token-pairs"},{"title":"Get Aggregated Order Book","openapi":"GET /orderbook","href":"/market-data/orderbook"},{"title":"Get Ticker Data","openapi":"GET /api/trading/ticker/{symbol}","href":"/market-data/ticker"},{"title":"Get Recent Trades","openapi":"GET /trades","href":"/market-data/trades"}]},{"group":"Trading","pages":[{"title":"Place Order","openapi":"POST /api/trading/{exchange}/orders","description":null,"href":"/trading/open-position"},{"title":"Close Position","openapi":"POST /api/trade/position/close","href":"/trading/close-position"},{"title":"Set Leverage (Aster)","openapi":"POST /api/aster/perp/{walletId}/leverage","description":null,"href":"/trading/set-leverage"},{"title":"Execute Smart Order","openapi":"POST /api/trade/execute","href":"/trading/execute-smart-order"},{"title":"Get Order Status","openapi":"GET /api/trading/{exchange}/orders/{orderId}/status","href":"/trading/get-order-status"},{"title":"Get Routing Recommendation","openapi":"GET /api/trade/routing/{symbol}","href":"/trading/routing-recommendation"}]},{"group":"Positions","pages":[{"title":"Get Open Positions","openapi":"GET /api/trading/positions/all/{walletAddress}","href":"/positions/get-positions"}]},{"group":"Account","pages":[{"title":"Create Server Wallet","openapi":"POST /api/wallets","href":"/account/create-wallet"},{"title":"Register API Key","openapi":"POST /api/trading/{exchange}/apikey","href":"/account/register-api-key"},{"title":"Import Lighter Credentials","openapi":"POST /api/trading/lighter/import","href":"/account/import-lighter-credentials"},{"title":"Deposit Funds","openapi":"POST /api/trading/{exchange}/deposit","href":"/account/deposit"},{"title":"Withdraw Funds","openapi":"POST /api/trading/{exchange}/withdraw","href":"/account/withdraw"},{"title":"Get Account Balances","openapi":"GET /api/trading/{exchange}/balances","href":"/account/get-balances"}]},{"group":"System","pages":[{"title":"Get System Status","openapi":"GET /health","href":"/system/get-status"}]},{"group":"Guides","pages":[{"title":"WebSocket API","href":"/websocket"},{"title":"Schema Reference","href":"/schema"},{"title":"Error Handling","href":"/errors"}]}]}]},"title":"Close Position - Tide API Documentation","buildId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","deploymentId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-DKJwRUt2.js","utils-CWD_VS3u.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-oFjciODD.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-C76WsxC3.js","snippetPresets-DvPMxpX_.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-CuNQfndH.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BVFpVUoF.js","shallow-t59Jg5Kr.js","getApiPlaygroundDisplay-C_JZ4amX.js","CodeSnippet-CLRDnx_h.js","CodeSnippets-C2myU4kc.js","Page-7TwLLapg.js","getPastedJson-B-JaVXw7.js","icon-BA-iDhH3.js","MethodPill-D4qZABFp.js","DuplicateIcon-THIDKO1O.js","createIcon-CYYJwgFd.js","DynamicMarkdown-UGQuxDKp.js","SectionHeading-jYELb23h.js","axios-vUo_bRtp.js","Markdown-DKsLa3wy.js","clsx-CefdjKz2.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BaREnp3o.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-sgx_0XzF.js"]}