{"openapi":"3.1.0","info":{"title":"myTraderDash API","version":"v1","description":"Your myTraderDash workspace over HTTPS: an API key (Settings → API keys) works in its own workspace, sent as a bearer token with the workspace's id in X-Workspace-Id."},"paths":{"/v1/health":{"get":{"operationId":"getHealth","summary":"Whether the API is up: the database, Redis, notifications and the background jobs, then the dash's own checks","description":"Whether the API is up: the database, Redis, notifications and the background jobs, then the dash's own checks. No sign-in. 500 when the database is unreachable.","tags":["health"],"x-not-for-mcp":"the stack's health check","responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"db":{"type":"string","const":"ok"},"redis":{"type":"string","enum":["ok","error","not_configured"]},"notifications":{"type":"object","properties":{"redis":{"type":"string","enum":["ok","error","not_configured"]},"email":{"type":"string","enum":["configured","not_configured"]}},"required":["redis","email"],"additionalProperties":false},"jobs":{"description":"Missing without Redis, or when the queues can't be read","type":"object","properties":{"total":{"type":"number"},"healthy":{"type":"number"},"hasFailures":{"type":"boolean"},"failing":{"type":"array","items":{"type":"string"},"description":"The failing jobs' names"}},"required":["total","healthy","hasFailures","failing"],"additionalProperties":false},"marketData":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","down"]},"disabled":{"description":"The price providers switched off on purpose (not counted)","type":"array","items":{"type":"string"}}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"error"}},"required":["status"],"additionalProperties":false}],"description":"The price providers: degraded when one is missing its key without being off"},"calendarSync":{"anyOf":[{"type":"object","properties":{"configured":{"type":"boolean"}},"required":["configured"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"error"}},"required":["status"],"additionalProperties":false}],"description":"Google calendar sync: its client and the token key are set"},"auth":{"anyOf":[{"type":"object","properties":{"configured":{"type":"boolean"},"provider":{"description":"The first enabled sign-in provider's key","type":"string"}},"required":["configured"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"error"}},"required":["status"],"additionalProperties":false}],"description":"The sign-in provider"}},"required":["status","db","redis","notifications","marketData","calendarSync","auth"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[]}},"/v1/auth/me":{"get":{"operationId":"getAuthMe","summary":"Who is calling: the user, their workspace, and for a key or token what it is and its scopes","description":"Who is calling: the user, their workspace, and for a key or token what it is and its scopes. A key or a connected app's token answers with `auth` (no email or name); a signed-in person answers with `terms` and may have `canInvite`.","tags":["auth"],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"user":{"type":"object","properties":{"sub":{"type":"string","description":"Who signed in: the provider's subject, or apikey:<id> for a key or token"},"provider":{"type":"string","description":"The sign-in provider; \"api-key\" for a key or a connected app's token"},"email":{"type":"string"},"name":{"type":"string"},"picture":{"type":"string"},"ownerKey":{"type":"string","description":"\"email:<address>\" for a person; empty for a key or token"},"workspaceId":{"type":"string"}},"required":["sub","provider","ownerKey","workspaceId"],"additionalProperties":false},"canInvite":{"type":"boolean","description":"Always false: a key or token never invites"},"auth":{"type":"object","properties":{"kind":{"type":"string","enum":["key","token"],"description":"A key the person made, or a connected app's OAuth token"},"scopes":{"type":"array","items":{"type":"string"},"description":"What it may do: read (GET), write (the rest)"}},"required":["kind","scopes"],"additionalProperties":false}},"required":["user","canInvite","auth"],"additionalProperties":false},{"type":"object","properties":{"user":{"type":"object","properties":{"sub":{"type":"string","description":"Who signed in: the provider's subject, or apikey:<id> for a key or token"},"provider":{"type":"string","description":"The sign-in provider; \"api-key\" for a key or a connected app's token"},"email":{"type":"string"},"name":{"type":"string"},"picture":{"type":"string"},"ownerKey":{"type":"string","description":"\"email:<address>\" for a person; empty for a key or token"},"workspaceId":{"type":"string"}},"required":["sub","provider","ownerKey","workspaceId"],"additionalProperties":false},"canInvite":{"type":"boolean","description":"Whether this person may invite someone (POST /v1/invites)"},"terms":{"type":"object","properties":{"required":{"type":"boolean","description":"The app must show the Terms screen before anything else"},"documents":{"type":"array","items":{"type":"object","properties":{"document":{"type":"string"},"title":{"type":"string"},"version":{"type":"string"},"effectiveDate":{"type":"string","description":"YYYY-MM-DD"},"accepted":{"anyOf":[{"type":"object","properties":{"version":{"type":"string"},"acceptedAt":{"type":"string"},"method":{"type":"string","enum":["clicked","continued_use"]}},"required":["version","acceptedAt","method"],"additionalProperties":false},{"type":"null"}],"description":"The workspace's latest acceptance of this document, any version"},"required":{"type":"boolean"}},"required":["document","title","version","effectiveDate","accepted","required"],"additionalProperties":false}}},"required":["required","documents"],"additionalProperties":false}},"required":["user","canInvite","terms"],"additionalProperties":false}]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/openapi.json":{"get":{"operationId":"getOpenapiJson","summary":"This API's OpenAPI 3.1 description: the routes meant for use with an API key or through MCP","description":"This API's OpenAPI 3.1 description: the routes meant for use with an API key or through MCP. No sign-in.","tags":["openapi.json"],"x-not-for-mcp":"the API's spec, for a developer with a key","responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"openapi":{"type":"string"},"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"}},"required":["title","version","description"],"additionalProperties":false},"paths":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"components":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["openapi","info","paths","components"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[]}},"/v1/openapi.txt":{"get":{"operationId":"getOpenapiTxt","summary":"The same routes as plain text, one line each (method, path, what the key needs, what it does), by area: short enough to read, or to give to an AI whole","description":"The same routes as plain text, one line each (method, path, what the key needs, what it does), by area: short enough to read, or to give to an AI whole. No sign-in.","tags":["openapi.txt"],"x-not-for-mcp":"the API's spec as text, for a developer with a key","responses":{"200":{"description":"The file","content":{"text/plain":{}}},"default":{"$ref":"#/components/responses/Error"}},"security":[]}},"/v1/trades":{"get":{"operationId":"getTrades","summary":"The trades (fills, dividends, expiries, journals) as the broker reported them, newest first, paged","description":"The trades (fills, dividends, expiries, journals) as the broker reported them, newest first, paged. Filters by ticker, account, tag, trade type, side and date; the workspace's account and date scope applies.","tags":["trades"],"parameters":[{"name":"page","in":"query","required":false,"schema":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"pageSize","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeTypes","in":"query","required":false,"schema":{"type":"string"}},{"name":"sides","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"hasIssues","in":"query","required":false,"schema":{"type":"string"}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string"}},{"name":"sortDirection","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"page":{"type":"number"},"pageSize":{"type":"number"},"totalItems":{"type":"number"},"maxPageSize":{"type":"number","description":"The largest pageSize the route takes"},"hasOptions":{"type":"boolean","description":"The workspace has option trades"},"issueCount":{"type":"number","description":"How many trades hasIssues=true lists under the same filters (all of them when it is on)"}},"required":["items","page","pageSize","totalItems","maxPageSize","hasOptions","issueCount"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postTrades","summary":"Adds one trade by hand to an account","description":"Adds one trade by hand to an account. The trades are regrouped into positions before the answer. With `syncRejectId` (a row a broker sync left out, of the same account: GET /v1/data-quality → syncRejects), that row is dismissed once the trade is saved.","tags":["trades"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticker":{"type":"string","minLength":1,"maxLength":20},"exchange":{"type":"string"},"market":{"type":"string","enum":["CA","US"]},"type":{"type":"string","enum":["buy","sell","dividend"]},"quantity":{"type":"number","minimum":0},"price":{"type":"number","minimum":0},"total":{"type":"number","minimum":0},"fees":{"type":"number","minimum":0},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"accountId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"expiration":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"optionRoot":{"type":"string","pattern":"^[A-Z]{1,6}$"},"syncRejectId":{"type":"string","minLength":1,"maxLength":64}},"required":["ticker","type","quantity","date","accountId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trades/option-close":{"post":{"operationId":"postTradesOptionClose","summary":"Records how an open option position ended (expired, assigned or exercised): the rows a broker would write (the option closed at 0, and on assignment or exercise the shares bought or sold at the strike)","description":"Records how an open option position ended (expired, assigned or exercised): the rows a broker would write (the option closed at 0, and on assignment or exercise the shares bought or sold at the strike). The position must be open in the account. Regrouped before the answer.","tags":["trades"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"ticker":{"type":"string","minLength":1,"maxLength":20},"securityId":{"type":"string","minLength":1},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"expiration":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"optionRoot":{"type":"string","pattern":"^[A-Z]{1,6}$"},"outcome":{"type":"string","enum":["expired","assigned","exercised"]},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fees":{"type":"number","minimum":0}},"required":["accountId","ticker","optionType","strike","expiration","outcome","quantity","date"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false},"description":"The trades written"}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trades/unallocated":{"get":{"operationId":"getTradesUnallocated","summary":"The trades in no trade group, each with why (its category), paged, with a summary of the whole unallocated set (counts per category and each filter's values)","description":"The trades in no trade group, each with why (its category), paged, with a summary of the whole unallocated set (counts per category and each filter's values). A data-quality view.","tags":["trades"],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["date","ticker","tradeType","quantity","price"]}},{"name":"sortDir","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"categories","in":"query","required":false,"schema":{"type":"string"}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeTypes","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeOrigins","in":"query","required":false,"schema":{"type":"string"}},{"name":"sources","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"exchanges","in":"query","required":false,"schema":{"type":"string"}},{"name":"currencies","in":"query","required":false,"schema":{"type":"string"}},{"name":"toCurrencies","in":"query","required":false,"schema":{"type":"string"}},{"name":"optionTypes","in":"query","required":false,"schema":{"type":"string"}},{"name":"syntheticReasons","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"signatures","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"qtyMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"qtyMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"priceMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"priceMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"},"category":{"type":"string","enum":["reconciled","partial_unmatched","journal_source","transfer_remnant","unmatched_option","orphan_dividend","orphan_buy","orphan_sell","other"]}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled","category"],"additionalProperties":false}},"page":{"type":"number"},"pageSize":{"type":"number"},"totalItems":{"type":"number"},"summary":{"type":"object","properties":{"total":{"type":"number"},"byCategory":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Count per category, the ones with trades only"},"tickers":{"type":"array","items":{"type":"string"}},"tradeTypes":{"type":"array","items":{"type":"string"}},"tradeOrigins":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"type":"string"}},"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"brokers":{"type":"array","items":{"type":"string"}},"exchanges":{"type":"array","items":{"type":"string"}},"currencies":{"type":"array","items":{"type":"string"}},"toCurrencies":{"type":"array","items":{"type":"string"}},"optionTypes":{"type":"array","items":{"type":"string"}},"syntheticReasons":{"type":"array","items":{"type":"string"}},"signatures":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}},"required":["total","byCategory","tickers","tradeTypes","tradeOrigins","sources","accounts","brokers","exchanges","currencies","toCurrencies","optionTypes","syntheticReasons","signatures","tags"],"additionalProperties":false}},"required":["items","page","pageSize","totalItems","summary"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/trades/{id}":{"get":{"operationId":"getTradesId","summary":"One trade by its id","description":"One trade by its id.","tags":["trades"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"patch":{"operationId":"patchTradesId","summary":"Changes a trade's fields or tags","description":"Changes a trade's fields or tags. A change other than tags regroups the trades before the answer.","tags":["trades"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string"},"quantity":{"type":"number"},"price":{"type":"number","minimum":0},"fees":{"type":"number","minimum":0},"type":{"type":"string"},"accountId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"optionRoot":{"type":"string","pattern":"^[A-Z]{1,6}$"},"addTags":{"type":"array","items":{"type":"string"}},"removeTags":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteTradesId","summary":"Deletes one trade","description":"Deletes one trade. The trades are regrouped into positions before the answer.","tags":["trades"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trades/bulk-delete":{"post":{"operationId":"postTradesBulkDelete","summary":"Deletes these trades ({ tradeIds })","description":"Deletes these trades ({ tradeIds }). An id not in this workspace is reported in `errors`, not deleted. Regrouped before the answer.","tags":["trades"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tradeIds":{"minItems":1,"type":"array","items":{"type":"string"}}},"required":["tradeIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"number","description":"Trades deleted"},"failed":{"type":"number","description":"Ids not deleted (not in this workspace)"},"errors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["id","message"],"additionalProperties":false}}},"required":["deleted","failed","errors"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trades/bulk-tag":{"post":{"operationId":"postTradesBulkTag","summary":"Adds and removes tags on these trades ({ tradeIds, addTags?, removeTags? }, at least one of the two)","description":"Adds and removes tags on these trades ({ tradeIds, addTags?, removeTags? }, at least one of the two). Tags only: no regrouping.","tags":["trades"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tradeIds":{"minItems":1,"type":"array","items":{"type":"string"}},"addTags":{"type":"array","items":{"type":"string"}},"removeTags":{"type":"array","items":{"type":"string"}}},"required":["tradeIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"number"}},"required":["updated"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups":{"get":{"operationId":"getTradeGroups","summary":"Trades grouped into positions, open and closed, paged and sorted as the app's Grouped view, with the totals of the whole filtered set","description":"Trades grouped into positions, open and closed, paged and sorted as the app's Grouped view, with the totals of the whole filtered set. Each group carries its trades.","tags":["trade-groups"],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","win","loss"]}},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"}},{"name":"positions","in":"query","required":false,"schema":{"type":"string"}},{"name":"results","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"sides","in":"query","required":false,"schema":{"type":"string"}},{"name":"actions","in":"query","required":false,"schema":{"type":"string"}},{"name":"hasIssues","in":"query","required":false,"schema":{"type":"string"}},{"name":"activityOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"callCoverage","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeDividendOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"groupId","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"openDateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"openDateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"closeDateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"closeDateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"entryMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"entryMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["status","dateOpen","dateClose","symbol","optionType","strike","expiration","account","broker","currency","entry","exit","quantity","openTotal","closeTotal","fees","returnDollar","returnPercent","side"]}},{"name":"sortDirection","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"number"},"pageSize":{"type":"number"},"totalItems":{"type":"number"},"totals":{"type":"object","properties":{"totalReturnDollar":{"type":"number","description":"Of every row, as the rows show it: after fees"},"totalFees":{"type":"number","description":"Inside the returns already: for information"},"avgReturnPercent":{"type":"number","description":"Weighed by cost; unknown cost bases left out"},"totalOpen":{"type":"number","description":"openTotal of the rows that have one, added up"},"totalClose":{"type":"number","description":"closeTotal of the rows that have one, added up"}},"required":["totalReturnDollar","totalFees","avgReturnPercent","totalOpen","totalClose"],"additionalProperties":false},"issueCount":{"type":"number","description":"How many groups hasIssues=true lists under the same filters (all of them when it is on)"}},"required":["items","page","pageSize","totalItems","totals","issueCount"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postTradeGroups","summary":"Groups these trades by hand into one position ({ buyTradeIds, sellTradeIds, dividendTradeIds?, ticker, tags?, broker?, sourceGroupIds? }), taking them out of the groups they were in","description":"Groups these trades by hand into one position ({ buyTradeIds, sellTradeIds, dividendTradeIds?, ticker, tags?, broker?, sourceGroupIds? }), taking them out of the groups they were in. A trade already wholly in a group of the user's own is taken from it only when sourceGroupIds names that group for it (trade id → group id: the group the row was picked in); a group left with nothing is removed. A manual group keeps its trades when the trades are regrouped.","tags":["trade-groups"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}},"broker":{"type":"string"},"sourceGroupIds":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","minLength":1}}},"required":["buyTradeIds","sellTradeIds","ticker"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/ids":{"get":{"operationId":"getTradeGroupsIds","summary":"The ids of every trade group matching the Grouped view's filters (as GET /v1/trade-groups takes them), unpaged: for selecting the whole filtered set","description":"The ids of every trade group matching the Grouped view's filters (as GET /v1/trade-groups takes them), unpaged: for selecting the whole filtered set.","tags":["trade-groups"],"x-not-for-mcp":"the app's own convenience: every id of a filter, for select all","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","win","loss"]}},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"}},{"name":"positions","in":"query","required":false,"schema":{"type":"string"}},{"name":"results","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"sides","in":"query","required":false,"schema":{"type":"string"}},{"name":"actions","in":"query","required":false,"schema":{"type":"string"}},{"name":"hasIssues","in":"query","required":false,"schema":{"type":"string"}},{"name":"activityOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"callCoverage","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeDividendOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"groupId","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"openDateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"openDateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"closeDateStart","in":"query","required":false,"schema":{"type":"string"}},{"name":"closeDateEnd","in":"query","required":false,"schema":{"type":"string"}},{"name":"entryMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"entryMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["status","dateOpen","dateClose","symbol","optionType","strike","expiration","account","broker","currency","entry","exit","quantity","openTotal","closeTotal","fees","returnDollar","returnPercent","side"]}},{"name":"sortDirection","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}}},"required":["ids"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/trade-groups/{id}":{"get":{"operationId":"getTradeGroupsId","summary":"One trade group by its id: its trade ids, allocations, dates, prices and result","description":"One trade group by its id: its trade ids, allocations, dates, prices and result.","tags":["trade-groups"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"patch":{"operationId":"patchTradeGroupsId","summary":"Adds or removes a trade group's tags, or sets its broker","description":"Adds or removes a trade group's tags, or sets its broker.","tags":["trade-groups"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"addTags":{"type":"array","items":{"type":"string"}},"removeTags":{"type":"array","items":{"type":"string"}},"broker":{"type":"string"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteTradeGroupsId","summary":"Deletes a trade group; its trades go back to automatic grouping on the next regroup","description":"Deletes a trade group; its trades go back to automatic grouping on the next regroup.","tags":["trade-groups"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/merge":{"post":{"operationId":"postTradeGroupsMerge","summary":"Merges two or more trade groups into one manual group ({ groupIds }, 2 to 1000), with every trade of the merged groups","description":"Merges two or more trade groups into one manual group ({ groupIds }, 2 to 1000), with every trade of the merged groups.","tags":["trade-groups"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"groupIds":{"minItems":2,"maxItems":1000,"type":"array","items":{"type":"string","minLength":1}}},"required":["groupIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/{id}/unmerge":{"post":{"operationId":"postTradeGroupsIdUnmerge","summary":"Undoes a manual group: its trades go back to automatic grouping (regrouped before the answer)","description":"Undoes a manual group: its trades go back to automatic grouping (regrouped before the answer).","tags":["trade-groups"],"x-not-for-mcp":"one group's unmerge: the bulk route does it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"unmerged":{"type":"number","description":"Groups undone"}},"required":["unmerged"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/{id}/unmerge-trade":{"post":{"operationId":"postTradeGroupsIdUnmergeTrade","summary":"Takes one trade out of a group ({ tradeId }) back to automatic grouping","description":"Takes one trade out of a group ({ tradeId }) back to automatic grouping. The group is deleted when it has no trade left.","tags":["trade-groups"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tradeId":{"type":"string","minLength":1}},"required":["tradeId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"unmerged":{"type":"number"},"groupDeleted":{"type":"boolean"}},"required":["unmerged","groupDeleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/{id}/confirmations/{code}":{"put":{"operationId":"putTradeGroupsIdConfirmationsCode","summary":"Confirms what a position's row asks (its confirmable list), by code: short_sale (the sale was a short sale) or uncovered (the sold call was uncovered)","description":"Confirms what a position's row asks (its confirmable list), by code: short_sale (the sale was a short sale) or uncovered (the sold call was uncovered). Stored on the position's opening sales, so it survives a re-import; the trades are regrouped before the answer. On a short the app assumed and on an uncovered call the flag and its tag go and no result changes. On a stock sale with no buy before it (unknown cost), short_sale turns the position into an open short: the shares no buy covers stay open until one does. 409 NOTHING_TO_CONFIRM when the position doesn't ask for it.","tags":["trade-groups"],"x-not-for-mcp":"the person's own answer about their position (a short sale, an uncovered call), given in the app","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"code","in":"path","required":true,"schema":{"type":"string","enum":["short_sale","uncovered"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","enum":["short_sale","uncovered"]},"tradeIds":{"type":"array","items":{"type":"string"},"description":"The trades whose confirmation changed"}},"required":["code","tradeIds"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteTradeGroupsIdConfirmationsCode","summary":"Takes a confirmation back: the position's flag returns, and an open short made by short_sale is the sale with no buy again (regrouped before the answer)","description":"Takes a confirmation back: the position's flag returns, and an open short made by short_sale is the sale with no buy again (regrouped before the answer). 409 NOT_CONFIRMED when none of its opening sales carries the code.","tags":["trade-groups"],"x-not-for-mcp":"the person's own answer about their position (a short sale, an uncovered call), given in the app","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"code","in":"path","required":true,"schema":{"type":"string","enum":["short_sale","uncovered"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","enum":["short_sale","uncovered"]},"tradeIds":{"type":"array","items":{"type":"string"},"description":"The trades whose confirmation changed"}},"required":["code","tradeIds"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/bulk-tag":{"post":{"operationId":"postTradeGroupsBulkTag","summary":"Adds and removes tags on these trade groups ({ groupIds, addTags?, removeTags? })","description":"Adds and removes tags on these trade groups ({ groupIds, addTags?, removeTags? }). Tags only: no regrouping.","tags":["trade-groups"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"groupIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"addTags":{"type":"array","items":{"type":"string"}},"removeTags":{"type":"array","items":{"type":"string"}}},"required":["groupIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"number"}},"required":["updated"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/bulk-unmerge":{"post":{"operationId":"postTradeGroupsBulkUnmerge","summary":"Undoes these manual groups ({ groupIds }, up to 1000): their trades go back to automatic grouping","description":"Undoes these manual groups ({ groupIds }, up to 1000): their trades go back to automatic grouping.","tags":["trade-groups"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"groupIds":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"string","minLength":1}}},"required":["groupIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"unmerged":{"type":"number"}},"required":["unmerged"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/trade-groups/move-trade":{"post":{"operationId":"postTradeGroupsMoveTrade","summary":"Moves one trade into another group ({ tradeId, sourceGroupId?, targetGroupId }): both become manual","description":"Moves one trade into another group ({ tradeId, sourceGroupId?, targetGroupId }): both become manual. The source group is deleted when it has no trade left.","tags":["trade-groups"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tradeId":{"type":"string","minLength":1},"sourceGroupId":{"type":"string","minLength":1},"targetGroupId":{"type":"string","minLength":1}},"required":["tradeId","targetGroupId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"targetGroup":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"groupType":{"type":"string","enum":["auto","manual","strategy"]},"recalculateOnTradeChange":{"type":"boolean"},"buyTradeIds":{"type":"array","items":{"type":"string"}},"sellTradeIds":{"type":"array","items":{"type":"string"}},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"journalTradeIds":{"type":"array","items":{"type":"string"}},"ticker":{"type":"string"},"securityId":{"type":"string"},"exchange":{"type":"string"},"canonicalTicker":{"type":"string"},"status":{"type":"string","enum":["open","win","loss","unknown"]},"result":{"anyOf":[{"type":"string","enum":["win","loss","unknown"]},{"type":"null"}],"description":"Closed → win or loss; an unknown cost basis → unknown; open → null"},"resultLabel":{"type":"string","description":"WIN, LOSS, OPEN, OPEN (UNKNOWN), CLOSED (UNKNOWN)"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"type":"string","description":"YYYY-MM-DD"},"entryPriceUSD":{"type":"number"},"entryPriceCAD":{"type":"number"},"exitPriceUSD":{"type":"number"},"exitPriceCAD":{"type":"number"},"size":{"type":"number"},"returnAmountUSD":{"description":"What the position made, after its fees (feesUSD): a closed position's result; a sold option still open, its premium less the sale's fee","type":"number"},"returnAmountCAD":{"type":"number"},"returnPercentUSD":{"description":"The return as a percentage of what the position cost, its opening fees included","type":"number"},"returnPercentCAD":{"type":"number"},"side":{"type":"string","enum":["long","short"]},"accountId":{"type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account of the group's trades"},"accountName":{"type":"string"},"broker":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"}},"suppressedTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"description":"The contract's root where the underlying has several (an index: SPX / SPXW)","type":"string"},"openOptionLegs":{"description":"A strategy group's open option contracts: a wheel's or a covered call's written call, a spread's contracts. Absent when it has none, and on any other group (its contract is its own optionType, strike and expiration)","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The leg's id"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"optionRoot":{"type":"string"},"side":{"type":"string","enum":["long","short"],"description":"long = bought, short = written"},"quantity":{"type":"number","description":"Contracts of it the strategy holds"}},"required":["id","optionType","strike","expiration","side","quantity"],"additionalProperties":false}},"buyMatchedQuantities":{"description":"Shares of each buy trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"sellAllocatedQuantities":{"description":"Shares of each sell trade in this group","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsUSD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"dividendAllocatedAmountsCAD":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"currentPrice":{"description":"The last cached price (open groups)","type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"type":"string"},"adjustedCostBasisUSD":{"type":"number"},"adjustedCostBasisCAD":{"type":"number"},"realizedPnlUSD":{"type":"number"},"realizedPnlCAD":{"type":"number"},"unrealizedPnLUSD":{"description":"The list only: an open position at its cached price, after its fees so far","type":"number"},"unrealizedPnLCAD":{"type":"number"},"unrealizedPnLPercentUSD":{"type":"number"},"unrealizedPnLPercentCAD":{"type":"number"},"feesUSD":{"description":"The group's fees (each trade's fee at the group's share of the trade, plus its holding fees: a short's borrow fees, a long's fees about the security). Already taken off the return: for information. The list's rows add up to totals.totalFees","type":"number"},"feesCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"openTotalUSD":{"description":"The list only: the money that opened the position, fees included, signed. A bought position: negative, what was paid (a wheel or covered call still open: at its adjusted cost). A sold one (shares sold short, a sold option): positive, what was received. Absent for an unknown cost basis","type":"number"},"openTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"closeTotalUSD":{"description":"The list only: the money that closes the position, signed. Open: what closing it at its cached price would bring (a bought position) or cost (a sold one: negative), a strategy holding shares less the buyback of its open sold options; absent without a price. Closed: what came back less what was paid to get out, so openTotal + closeTotal = the return","type":"number"},"closeTotalCAD":{"description":"The same in CAD, in a multi-currency workspace","type":"number"},"holdingFees":{"description":"The list only: the position's part of each fee charged on its security while it was held: a short's borrow fees, a long's fees about the security (an ADR fee)","type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["borrow_fee","fee"],"description":"borrow_fee: a short's borrowed shares; fee: a fee about the security"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What it cost this position (a rebate is negative)"}},"required":["kind","date","description","currency","amount"],"additionalProperties":false}},"withheldTax":{"description":"The list only: the position's part of the tax withheld on each of its dividends (a broker's own row, linked to the dividend). Its dividend amounts and its return are after it already","type":"array","items":{"type":"object","properties":{"dividendTradeId":{"type":"string"},"date":{"type":"string","description":"YYYY-MM-DD"},"description":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","description":"What was withheld from this position (> 0)"}},"required":["dividendTradeId","date","description","currency","amount"],"additionalProperties":false}},"hasUnknownCostBasis":{"type":"boolean"},"confirmable":{"description":"What the position asks to be confirmed (Show Issues): short_sale = the app assumed a short sale, or (the list only) a stock sale has no buy before it and may have been one; uncovered = a sold call nothing covered. PUT /v1/trade-groups/:id/confirmations/:code answers it","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"confirmed":{"description":"The list only: what was confirmed on the position's opening sales","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"buyTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"sellTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"dividends":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}},"journalTrades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string","description":"The security's id (the same security across tickers and exchanges)"},"type":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"description":"Where the trade came from beyond its type: assignment, exercise, transfer-in, …","type":["string","null"]},"syntheticReason":{"description":"Why myTraderDash made this trade itself (a transfer's other side, …); null for the broker's own","type":["string","null"]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per share or contract; a dividend's total amount"},"fees":{"type":"number"},"date":{"type":"string","description":"YYYY-MM-DD"},"executedAt":{"description":"The execution time (ISO), when the broker gave one","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"userTags":{"type":"array","items":{"type":"string"},"description":"Tags the person added"},"suppressedTags":{"type":"array","items":{"type":"string"},"description":"Automatic tags the person removed"},"userConfirmed":{"description":"What the person confirmed about the trade: short_sale (this sale was a short sale), uncovered (this sold call was uncovered)","type":"array","items":{"type":"string","enum":["short_sale","uncovered"]}},"accountId":{"type":"string"},"account":{"description":"The account's name","type":"string"},"broker":{"type":"string"},"source":{"description":"How it came in: manual, import, api, a broker sync","type":"string"},"createdAt":{"type":"string"},"globalFigi":{"type":"string"},"isin":{"type":"string"},"exchange":{"type":"string"},"currency":{"description":"ISO 4217","type":"string"},"fromCurrency":{"description":"A currency journal's source currency","type":"string"},"priceUSD":{"type":"number"},"priceCAD":{"type":"number"},"feesUSD":{"type":"number"},"feesCAD":{"type":"number"},"fxRate":{"type":"number"},"transferPairId":{"description":"Shared by the two sides of a transfer or journal","type":"string"},"transferKind":{"type":"string"},"isReconciled":{"type":"boolean"},"exDividendDate":{"type":"string"},"dividendEventId":{"type":"string"},"signature":{"type":"string"},"optionType":{"description":"An option trade's type; absent on a stock trade","type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string","description":"YYYY-MM-DD"},"ungroupedQty":{"type":"number"},"splitFactor":{"description":"Post-split shares per share of this trade","type":"number"}},"required":["id","ticker","securityId","type","quantity","price","fees","date","tags","userTags","suppressedTags","createdAt","isReconciled"],"additionalProperties":false}}},"required":["id","workspaceId","groupType","recalculateOnTradeChange","buyTradeIds","sellTradeIds","dividendTradeIds","journalTradeIds","ticker","securityId","status","result","resultLabel","openDate","accountId","accountIds","tags","userTags","suppressedTags","createdAt","updatedAt"],"additionalProperties":false},"sourceDeleted":{"type":"boolean"}},"required":["targetGroup","sourceDeleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/accounts/order":{"put":{"operationId":"putAccountsOrder","summary":"Sets the order every account list follows ({ accountIds }: every account's id, first to last)","description":"Sets the order every account list follows ({ accountIds }: every account's id, first to last).","tags":["accounts"],"x-not-for-mcp":"the app's own convenience: the order its lists show the accounts in","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountIds":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["accountIds"],"additionalProperties":false}}}},"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/accounts/sync-skips":{"get":{"operationId":"getAccountsSyncSkips","summary":"The brokerage accounts the syncs leave out because they were deleted in the workspace while their login stays connected, newest first","description":"The brokerage accounts the syncs leave out because they were deleted in the workspace while their login stays connected, newest first.","tags":["accounts"],"x-not-for-mcp":"the app's own convenience: the accounts left out of a broker sync","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"skipped":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","description":"The sync provider: snaptrade"},"externalAccountId":{"type":"string","description":"The provider's own id of the account"},"name":{"type":"string","description":"The account's name when it was deleted"},"createdAt":{"type":"string"}},"required":["id","provider","externalAccountId","name","createdAt"],"additionalProperties":false}}},"required":["skipped"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/accounts/sync-skips/{id}":{"delete":{"operationId":"deleteAccountsSyncSkipsId","summary":"Syncs a left-out brokerage account again: the next sync creates it","description":"Syncs a left-out brokerage account again: the next sync creates it. 404 SYNC_SKIP_NOT_FOUND for an id the workspace doesn't have.","tags":["accounts"],"x-not-for-mcp":"the app's own convenience: the accounts left out of a broker sync","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/accounts":{"get":{"operationId":"getAccounts","summary":"The workspace's brokerage accounts","description":"The workspace's brokerage accounts. Each with its broker, type, currencies, open or closed, how it is fed, and its trade, dividend and journal counts.","tags":["accounts"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"broker":{"type":"string","description":"The broker's slug"},"type":{"description":"The account type (e.g. tfsa, rrsp, margin, GET /v1/config accountTypes); null when it isn't known: a synced account whose broker didn't say. The tax report refuses it (ACCOUNT_TYPE_NOT_SET) until it is set or overridden","type":["string","null"]},"currencies":{"type":"array","items":{"type":"string"},"description":"ISO codes the account holds: USD, CAD or both"},"sourceType":{"type":"string","enum":["manual","brokersync"],"description":"Fed by hand / files, or by a broker sync"},"syncProvider":{"type":"string"},"brokerConnectionId":{"type":"string"},"externalAccountId":{"type":"string"},"lastSyncAt":{"type":"string"},"syncError":{"type":"string"},"tradeCount":{"type":"number"},"dividendCount":{"type":"number"},"journalCount":{"type":"number"},"watchOpenPositions":{"type":"boolean","description":"Its open positions are watched (alerts, reminders, digest)"},"isClosed":{"type":"boolean"},"openedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"closedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"cashBalances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"cash":{"type":"number","description":"As the broker reports it; negative on margin"},"buyingPower":{"description":"Where the broker gives it","type":["number","null"]},"asOf":{"type":"string","description":"The broker's own time for the figure, ISO"}},"required":["currency","cash","buyingPower","asOf"],"additionalProperties":false},"description":"The cash its broker reports, per currency: only for an account that syncs with a brokerage, the broker's number as sent (cached, up to a day old), never computed from trades. Empty for any other account and where the broker sent none."},"firstTradeDate":{"description":"YYYY-MM-DD of its first trade; absent without trades","type":"string"},"lastTradeDate":{"description":"YYYY-MM-DD of its last trade; absent without trades","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","broker","type","currencies","sourceType","tradeCount","dividendCount","journalCount","watchOpenPositions","isClosed","cashBalances","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postAccounts","summary":"Adds an account ({ name, broker, type, currencies?, isClosed?, openedOn?, closedOn? })","description":"Adds an account ({ name, broker, type, currencies?, isClosed?, openedOn?, closedOn? }). broker: a broker's slug or alias (GET /v1/brokers); type: one of the account types (GET /v1/config).","tags":["accounts"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"broker":{"type":"string"},"type":{"type":"string"},"currencies":{"type":"array","items":{"type":"string","minLength":1}},"isClosed":{"type":"boolean"},"openedOn":{"type":["string","null"]},"closedOn":{"type":["string","null"]}},"required":["name","broker","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"broker":{"type":"string","description":"The broker's slug"},"type":{"description":"The account type (e.g. tfsa, rrsp, margin, GET /v1/config accountTypes); null when it isn't known: a synced account whose broker didn't say. The tax report refuses it (ACCOUNT_TYPE_NOT_SET) until it is set or overridden","type":["string","null"]},"currencies":{"type":"array","items":{"type":"string"},"description":"ISO codes the account holds: USD, CAD or both"},"sourceType":{"type":"string","enum":["manual","brokersync"],"description":"Fed by hand / files, or by a broker sync"},"syncProvider":{"type":"string"},"brokerConnectionId":{"type":"string"},"externalAccountId":{"type":"string"},"lastSyncAt":{"type":"string"},"syncError":{"type":"string"},"tradeCount":{"type":"number"},"dividendCount":{"type":"number"},"journalCount":{"type":"number"},"watchOpenPositions":{"type":"boolean","description":"Its open positions are watched (alerts, reminders, digest)"},"isClosed":{"type":"boolean"},"openedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"closedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"cashBalances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"cash":{"type":"number","description":"As the broker reports it; negative on margin"},"buyingPower":{"description":"Where the broker gives it","type":["number","null"]},"asOf":{"type":"string","description":"The broker's own time for the figure, ISO"}},"required":["currency","cash","buyingPower","asOf"],"additionalProperties":false},"description":"The cash its broker reports, per currency: only for an account that syncs with a brokerage, the broker's number as sent (cached, up to a day old), never computed from trades. Empty for any other account and where the broker sent none."},"firstTradeDate":{"description":"YYYY-MM-DD of its first trade; absent without trades","type":"string"},"lastTradeDate":{"description":"YYYY-MM-DD of its last trade; absent without trades","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","broker","type","currencies","sourceType","tradeCount","dividendCount","journalCount","watchOpenPositions","isClosed","cashBalances","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/accounts/{id}":{"get":{"operationId":"getAccountsId","summary":"One account, by its id","description":"One account, by its id. 404 ACCOUNT_NOT_FOUND when the workspace has none with that id.","tags":["accounts"],"x-not-for-mcp":"one account: the list holds it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"broker":{"type":"string","description":"The broker's slug"},"type":{"description":"The account type (e.g. tfsa, rrsp, margin, GET /v1/config accountTypes); null when it isn't known: a synced account whose broker didn't say. The tax report refuses it (ACCOUNT_TYPE_NOT_SET) until it is set or overridden","type":["string","null"]},"currencies":{"type":"array","items":{"type":"string"},"description":"ISO codes the account holds: USD, CAD or both"},"sourceType":{"type":"string","enum":["manual","brokersync"],"description":"Fed by hand / files, or by a broker sync"},"syncProvider":{"type":"string"},"brokerConnectionId":{"type":"string"},"externalAccountId":{"type":"string"},"lastSyncAt":{"type":"string"},"syncError":{"type":"string"},"tradeCount":{"type":"number"},"dividendCount":{"type":"number"},"journalCount":{"type":"number"},"watchOpenPositions":{"type":"boolean","description":"Its open positions are watched (alerts, reminders, digest)"},"isClosed":{"type":"boolean"},"openedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"closedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"cashBalances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"cash":{"type":"number","description":"As the broker reports it; negative on margin"},"buyingPower":{"description":"Where the broker gives it","type":["number","null"]},"asOf":{"type":"string","description":"The broker's own time for the figure, ISO"}},"required":["currency","cash","buyingPower","asOf"],"additionalProperties":false},"description":"The cash its broker reports, per currency: only for an account that syncs with a brokerage, the broker's number as sent (cached, up to a day old), never computed from trades. Empty for any other account and where the broker sent none."},"firstTradeDate":{"description":"YYYY-MM-DD of its first trade; absent without trades","type":"string"},"lastTradeDate":{"description":"YYYY-MM-DD of its last trade; absent without trades","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","broker","type","currencies","sourceType","tradeCount","dividendCount","journalCount","watchOpenPositions","isClosed","cashBalances","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"patch":{"operationId":"patchAccountsId","summary":"Changes an account: its name, broker, type, currencies, open or closed and the dates, whether its open positions are watched","description":"Changes an account: its name, broker, type, currencies, open or closed and the dates, whether its open positions are watched. Only the fields sent change; null clears a date.","tags":["accounts"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"broker":{"type":"string"},"type":{"type":"string"},"currencies":{"type":"array","items":{"type":"string","minLength":1}},"watchOpenPositions":{"type":"boolean"},"isClosed":{"type":"boolean"},"openedOn":{"type":["string","null"]},"closedOn":{"type":["string","null"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"broker":{"type":"string","description":"The broker's slug"},"type":{"description":"The account type (e.g. tfsa, rrsp, margin, GET /v1/config accountTypes); null when it isn't known: a synced account whose broker didn't say. The tax report refuses it (ACCOUNT_TYPE_NOT_SET) until it is set or overridden","type":["string","null"]},"currencies":{"type":"array","items":{"type":"string"},"description":"ISO codes the account holds: USD, CAD or both"},"sourceType":{"type":"string","enum":["manual","brokersync"],"description":"Fed by hand / files, or by a broker sync"},"syncProvider":{"type":"string"},"brokerConnectionId":{"type":"string"},"externalAccountId":{"type":"string"},"lastSyncAt":{"type":"string"},"syncError":{"type":"string"},"tradeCount":{"type":"number"},"dividendCount":{"type":"number"},"journalCount":{"type":"number"},"watchOpenPositions":{"type":"boolean","description":"Its open positions are watched (alerts, reminders, digest)"},"isClosed":{"type":"boolean"},"openedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"closedOn":{"description":"YYYY, YYYY-MM or YYYY-MM-DD","type":"string"},"cashBalances":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"cash":{"type":"number","description":"As the broker reports it; negative on margin"},"buyingPower":{"description":"Where the broker gives it","type":["number","null"]},"asOf":{"type":"string","description":"The broker's own time for the figure, ISO"}},"required":["currency","cash","buyingPower","asOf"],"additionalProperties":false},"description":"The cash its broker reports, per currency: only for an account that syncs with a brokerage, the broker's number as sent (cached, up to a day old), never computed from trades. Empty for any other account and where the broker sent none."},"firstTradeDate":{"description":"YYYY-MM-DD of its first trade; absent without trades","type":"string"},"lastTradeDate":{"description":"YYYY-MM-DD of its last trade; absent without trades","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","broker","type","currencies","sourceType","tradeCount","dividendCount","journalCount","watchOpenPositions","isClosed","cashBalances","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteAccountsId","summary":"Deletes an account and everything in it (trades, cash records, journal entries linked to it)","description":"Deletes an account and everything in it (trades, cash records, journal entries linked to it). An account a broker sync feeds stays deleted: the last account of its brokerage login disconnects that login, any other is left out of the sync from then on (GET /v1/accounts/sync-skips) until it is linked again. 409 ACCOUNT_SYNC_ID_MISSING for a synced account that hasn't been synced once yet.","tags":["accounts"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/accounts/{id}/trades":{"delete":{"operationId":"deleteAccountsIdTrades","summary":"Deletes the account's trades and cash records and keeps the account, to start its imports over","description":"Deletes the account's trades and cash records and keeps the account, to start its imports over.","tags":["accounts"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"number","description":"How many trades were deleted"}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/entries":{"get":{"operationId":"getJournalEntries","summary":"Every journal entry of the workspace","description":"Every journal entry of the workspace. Each with its text, its day, tags, and the position, account, story or template it belongs to.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"title":{"type":"string"},"content":{"description":"The entry's text, a TipTap (ProseMirror) document","$ref":"#/$defs/__schema0"},"tradeGroupId":{"description":"The position it is about","type":"string"},"tradeGroup":{"description":"The linked position, in brief","type":"object","properties":{"ticker":{"type":"string"},"status":{"type":"string"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"description":"YYYY-MM-DD","type":"string"}},"required":["ticker","status","openDate"],"additionalProperties":false},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string"},"storyId":{"type":"string"},"date":{"description":"The day it is about (YYYY-MM-DD)","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","title","content","tags","createdAt","updatedAt"],"additionalProperties":false},"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postJournalEntries","summary":"Writes a journal entry","description":"Writes a journal entry. Linked to a position (tradeGroupId), an account or a story, or standalone on a day.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}},"tradeGroupId":{"type":"string","minLength":1},"accountId":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string","minLength":1},"storyId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["title","content"],"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"title":{"type":"string"},"content":{"description":"The entry's text, a TipTap (ProseMirror) document","$ref":"#/$defs/__schema0"},"tradeGroupId":{"description":"The position it is about","type":"string"},"tradeGroup":{"description":"The linked position, in brief","type":"object","properties":{"ticker":{"type":"string"},"status":{"type":"string"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"description":"YYYY-MM-DD","type":"string"}},"required":["ticker","status","openDate"],"additionalProperties":false},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string"},"storyId":{"type":"string"},"date":{"description":"The day it is about (YYYY-MM-DD)","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","title","content","tags","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/entries/{id}":{"get":{"operationId":"getJournalEntriesId","summary":"One journal entry, by its id","description":"One journal entry, by its id. 404 when the workspace has none with that id.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"title":{"type":"string"},"content":{"description":"The entry's text, a TipTap (ProseMirror) document","$ref":"#/$defs/__schema0"},"tradeGroupId":{"description":"The position it is about","type":"string"},"tradeGroup":{"description":"The linked position, in brief","type":"object","properties":{"ticker":{"type":"string"},"status":{"type":"string"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"description":"YYYY-MM-DD","type":"string"}},"required":["ticker","status","openDate"],"additionalProperties":false},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string"},"storyId":{"type":"string"},"date":{"description":"The day it is about (YYYY-MM-DD)","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","title","content","tags","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putJournalEntriesId","summary":"Changes a journal entry","description":"Changes a journal entry. Only the fields sent change; null unlinks a position, account, story or template, or clears the day.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}},"tradeGroupId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"storyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}},"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"title":{"type":"string"},"content":{"description":"The entry's text, a TipTap (ProseMirror) document","$ref":"#/$defs/__schema0"},"tradeGroupId":{"description":"The position it is about","type":"string"},"tradeGroup":{"description":"The linked position, in brief","type":"object","properties":{"ticker":{"type":"string"},"status":{"type":"string"},"openDate":{"type":"string","description":"YYYY-MM-DD"},"closeDate":{"description":"YYYY-MM-DD","type":"string"}},"required":["ticker","status","openDate"],"additionalProperties":false},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string"},"storyId":{"type":"string"},"date":{"description":"The day it is about (YYYY-MM-DD)","type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","title","content","tags","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteJournalEntriesId","summary":"Deletes a journal entry","description":"Deletes a journal entry.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/templates":{"get":{"operationId":"getJournalTemplates","summary":"The journal's templates: the text a new entry starts from, and the tags that pick each one","description":"The journal's templates: the text a new entry starts from, and the tags that pick each one.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"content":{"description":"The template's text, a TipTap (ProseMirror) document a new entry starts from","$ref":"#/$defs/__schema0"},"isDefault":{"type":"boolean","description":"The one a new entry starts from when none is picked"},"tagAssociations":{"type":"array","items":{"type":"string"},"description":"Tags that pick this template for a position carrying one of them"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","content","isDefault","tagAssociations","createdAt","updatedAt"],"additionalProperties":false},"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postJournalTemplates","summary":"Adds a journal template ({ name, content, isDefault?, tagAssociations? })","description":"Adds a journal template ({ name, content, isDefault?, tagAssociations? }). Making it the default unsets the previous one.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}},"isDefault":{"type":"boolean"},"tagAssociations":{"type":"array","items":{"type":"string"}}},"required":["name","content"],"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"content":{"description":"The template's text, a TipTap (ProseMirror) document a new entry starts from","$ref":"#/$defs/__schema0"},"isDefault":{"type":"boolean","description":"The one a new entry starts from when none is picked"},"tagAssociations":{"type":"array","items":{"type":"string"},"description":"Tags that pick this template for a position carrying one of them"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","content","isDefault","tagAssociations","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/templates/{id}":{"get":{"operationId":"getJournalTemplatesId","summary":"One journal template, by its id","description":"One journal template, by its id. 404 when the workspace has none with that id.","tags":["journal"],"x-not-for-mcp":"one template: the list holds it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"content":{"description":"The template's text, a TipTap (ProseMirror) document a new entry starts from","$ref":"#/$defs/__schema0"},"isDefault":{"type":"boolean","description":"The one a new entry starts from when none is picked"},"tagAssociations":{"type":"array","items":{"type":"string"},"description":"Tags that pick this template for a position carrying one of them"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","content","isDefault","tagAssociations","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putJournalTemplatesId","summary":"Changes a journal template","description":"Changes a journal template. Only the fields sent change.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}},"isDefault":{"type":"boolean"},"tagAssociations":{"type":"array","items":{"type":"string"}}},"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"content":{"description":"The template's text, a TipTap (ProseMirror) document a new entry starts from","$ref":"#/$defs/__schema0"},"isDefault":{"type":"boolean","description":"The one a new entry starts from when none is picked"},"tagAssociations":{"type":"array","items":{"type":"string"},"description":"Tags that pick this template for a position carrying one of them"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","content","isDefault","tagAssociations","createdAt","updatedAt"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteJournalTemplatesId","summary":"Deletes a journal template","description":"Deletes a journal template. Entries written from it keep their text.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/stories":{"get":{"operationId":"getJournalStories","summary":"The journal's stories: named threads that group entries (a theme, a strategy, an account), newest first","description":"The journal's stories: named threads that group entries (a theme, a strategy, an account), newest first.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","tags","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postJournalStories","summary":"Starts a story ({ name, description?, accountId?, tags? }): a named thread entries can join","description":"Starts a story ({ name, description?, accountId?, tags? }): a named thread entries can join.","tags":["journal"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"accountId":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","tags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/journal/stories/{id}":{"get":{"operationId":"getJournalStoriesId","summary":"One story, by its id","description":"One story, by its id. 404 when the workspace has none with that id.","tags":["journal"],"x-not-for-mcp":"one story: the list holds it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","tags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putJournalStoriesId","summary":"Changes a story","description":"Changes a story. Only the fields sent change; null clears the description or unlinks the account.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"accountId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"accountId":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","tags","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteJournalStoriesId","summary":"Deletes a story","description":"Deletes a story. Its entries stay, no longer in a story.","tags":["journal"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/open-positions":{"get":{"operationId":"getWatchlistOpenPositions","summary":"What the watched accounts hold (stocks and option contracts), as the generated Open and per-account watchlists: each row with its quote and its position per tab, the per-ticker alert settings, the accounts and the totals per tab, in the page currency (currency=USD|CAD, else the workspace's)","description":"What the watched accounts hold (stocks and option contracts), as the generated Open and per-account watchlists: each row with its quote and its position per tab, the per-ticker alert settings, the accounts and the totals per tab, in the page currency (currency=USD|CAD, else the workspace's).","tags":["watchlist"],"parameters":[{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Open-position alerts switched on in Settings"},"defaultThreshold":{"type":"number","description":"The open-position Swing % default"},"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"watchOpenPositions":{"type":"boolean"}},"required":["id","name","type","watchOpenPositions"],"additionalProperties":false}},"positions":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"name":{"type":"string"},"muted":{"type":"boolean"},"thresholdOverride":{"description":"null = the workspace default","type":["number","null"]},"threshold":{"type":"number"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["securityId","ticker","name","muted","thresholdOverride","threshold","accountIds"],"additionalProperties":false}},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The row's key: the securityId (stock) or the contract"},"securityId":{"type":"string"},"ticker":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"accountIds":{"type":"array","items":{"type":"string"},"description":"The watched accounts holding it"},"positions":{"description":"Per tab (\"all\" or an account id); absent on a row held only through options on it","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"quantity":{"type":"number","description":"Shares or contracts; a short position is negative"},"avgCost":{"description":"Entry price per share; null = unknown cost basis","type":["number","null"]},"cost":{"type":["number","null"]},"marketValue":{"description":"Signed like the position; null = no price","type":["number","null"]},"unrealizedPnL":{"type":["number","null"]},"unrealizedPnLPercent":{"type":["number","null"]},"dayChange":{"description":"What today did to the position; null = withheld","type":["number","null"]}},"required":["quantity","avgCost","cost","marketValue","unrealizedPnL","unrealizedPnLPercent","dayChange"],"additionalProperties":false}},"heldVia":{"description":"The ticker isn't held, options on it are: listed to follow its price","type":"string","const":"options"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"}},"required":["id","securityId","ticker","accountIds"],"additionalProperties":false}},"totals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"cost":{"type":"number"},"marketValue":{"type":"number"},"unrealizedPnL":{"type":"number"},"unrealizedPnLPercent":{"type":["number","null"]},"dayChange":{"type":"number"},"dayChangePercent":{"type":["number","null"]},"unpriced":{"type":"number","description":"Positions without a price (left out of every figure)"},"unknownCost":{"type":"number","description":"Priced positions with an unknown cost basis"}},"required":["cost","marketValue","unrealizedPnL","unrealizedPnLPercent","dayChange","dayChangePercent","unpriced","unknownCost"],"additionalProperties":false},"description":"Per tab (\"all\" or an account id)"},"currency":{"type":"string","enum":["USD","CAD"]},"pricesRefreshing":{"type":"number","description":"Stale quotes being refreshed: ask again shortly"}},"required":["enabled","defaultThreshold","accounts","positions","rows","totals","currency","pricesRefreshing"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/watchlist/lists":{"get":{"operationId":"getWatchlistLists","summary":"The workspace's watchlists (named lists), each with its item count","description":"The workspace's watchlists (named lists), each with its item count.","tags":["watchlist"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"sortOrder":{"type":"number"},"itemCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","sortOrder","itemCount","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postWatchlistLists","summary":"Makes a watchlist ({ name, description?, color?, sortOrder? })","description":"Makes a watchlist ({ name, description?, color?, sortOrder? }). 409 when the name is taken.","tags":["watchlist"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"color":{"type":"string","maxLength":50},"sortOrder":{"type":"integer","minimum":0,"maximum":10000}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"sortOrder":{"type":"number"},"itemCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","sortOrder","itemCount","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/lists/{id}":{"get":{"operationId":"getWatchlistListsId","summary":"One watchlist with its item count","description":"One watchlist with its item count. 404 when it isn't the workspace's.","tags":["watchlist"],"x-not-for-mcp":"the app's own convenience: one watchlist, where the lists hold it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"sortOrder":{"type":"number"},"itemCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","sortOrder","itemCount","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putWatchlistListsId","summary":"Renames or reorders a watchlist (any of name, description, color, sortOrder)","description":"Renames or reorders a watchlist (any of name, description, color, sortOrder).","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"color":{"type":"string","maxLength":50},"sortOrder":{"type":"integer","minimum":0,"maximum":10000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"sortOrder":{"type":"number"},"itemCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","workspaceId","name","sortOrder","itemCount","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteWatchlistListsId","summary":"Deletes a watchlist and every item on it","description":"Deletes a watchlist and every item on it.","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist":{"get":{"operationId":"getWatchlist","summary":"The watched tickers and option contracts, newest first, each with its alerts and its latest quote","description":"The watched tickers and option contracts, newest first, each with its alerts and its latest quote. watchlistId narrows to one list.","tags":["watchlist"],"parameters":[{"name":"watchlistId","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postWatchlist","summary":"Watches a ticker or an option contract","description":"Watches a ticker or an option contract. The ticker is resolved to its security (exchange / market narrow it); alerts already met fire at once and are named in alertsTriggered. 409 when it is already watched.","tags":["watchlist"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticker":{"type":"string","minLength":1},"exchange":{"type":"string","maxLength":10},"market":{"type":"string","enum":["CA","US"]},"watchlistId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"strikeDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"priceAlertHigh":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"priceAlertLow":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"yieldAlert":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"swingThreshold":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"notificationChannels":{"maxItems":2,"type":"array","items":{"type":"string","enum":["email","androidPush"]}},"linkedTemplateIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"automationAction":{"anyOf":[{"type":"string","enum":["email_results","create_watchlist","both"]},{"type":"null"}]},"automationConfig":{"anyOf":[{"type":"object","properties":{"maxResults":{"type":"integer","exclusiveMinimum":0,"maximum":1000}},"additionalProperties":false},{"type":"null"}]},"notes":{"type":"string","maxLength":2000}},"required":["ticker"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"},"alertsTriggered":{"description":"The alerts the item's new levels met at once","type":"object","properties":{"priceHigh":{"type":"boolean"},"priceLow":{"type":"boolean"},"yield":{"type":"boolean"}},"additionalProperties":false}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/bulk-delete":{"delete":{"operationId":"deleteWatchlistBulkDelete","summary":"Stops watching up to 500 items at once ({ ids })","description":"Stops watching up to 500 items at once ({ ids }).","tags":["watchlist"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"string"}}},"required":["ids"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"number"}},"required":["deleted"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/{id}":{"get":{"operationId":"getWatchlistId","summary":"One watched item with its alerts (no quote)","description":"One watched item with its alerts (no quote). 404 when it isn't the workspace's.","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putWatchlistId","summary":"Changes a watched item: its list, alert levels (null clears one; a changed level is armed again), reminders, channels, automation, notes","description":"Changes a watched item: its list, alert levels (null clears one; a changed level is armed again), reminders, channels, automation, notes. Levels already met fire at once (alertsTriggered).","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticker":{"description":"Ignored: an item's security never changes","type":"string"},"market":{"description":"Ignored","type":"string","enum":["CA","US"]},"watchlistId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"strikeDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"priceAlertHigh":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"priceAlertLow":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"yieldAlert":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"swingThreshold":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"notificationChannels":{"maxItems":2,"type":"array","items":{"type":"string","enum":["email","androidPush"]}},"linkedTemplateIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"automationAction":{"anyOf":[{"type":"string","enum":["email_results","create_watchlist","both"]},{"type":"null"}]},"automationConfig":{"anyOf":[{"type":"object","properties":{"maxResults":{"type":"integer","exclusiveMinimum":0,"maximum":1000}},"additionalProperties":false},{"type":"null"}]},"notes":{"type":"string","maxLength":2000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"},"alertsTriggered":{"description":"The alerts the item's new levels met at once","type":"object","properties":{"priceHigh":{"type":"boolean"},"priceLow":{"type":"boolean"},"yield":{"type":"boolean"}},"additionalProperties":false}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteWatchlistId","summary":"Stops watching an item","description":"Stops watching an item.","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/security/{securityId}":{"get":{"operationId":"getWatchlistSecuritySecurityId","summary":"The watched item of a security (no quote)","description":"The watched item of a security (no quote). 404 when it isn't watched.","tags":["watchlist"],"x-not-for-mcp":"the app's own convenience: a security's watchlist rows","parameters":[{"name":"securityId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/watchlist/check-security/{securityId}":{"get":{"operationId":"getWatchlistCheckSecuritySecurityId","summary":"Whether a security is on any watchlist","description":"Whether a security is on any watchlist.","tags":["watchlist"],"x-not-for-mcp":"the app's own convenience: whether a security is watched","parameters":[{"name":"securityId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"exists":{"type":"boolean"}},"required":["exists"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/watchlist/{id}/reset-alert":{"post":{"operationId":"postWatchlistIdResetAlert","summary":"Arms a triggered alert again without changing its level ({ alertType: priceHigh | priceLow | yield })","description":"Arms a triggered alert again without changing its level ({ alertType: priceHigh | priceLow | yield }).","tags":["watchlist"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"alertType":{"type":"string","enum":["priceHigh","priceLow","yield"]}},"required":["alertType"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"watchlistId":{"description":"The list it is on","type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"sector":{"type":"string"},"optionType":{"description":"An option item: its contract","type":"string","enum":["call","put"]},"strike":{"type":"number"},"strikeDate":{"description":"YYYY-MM-DD","type":"string"},"priceAlertHigh":{"type":"number"},"priceAlertLow":{"type":"number"},"yieldAlert":{"type":"number"},"swingThreshold":{"description":"Swing %: a daily move this large alerts","type":"number"},"exDividendReminder":{"type":"boolean"},"earningsReminder":{"type":"boolean"},"priceAlertHighTriggered":{"type":"boolean"},"priceAlertHighTriggeredAt":{"type":"string"},"priceAlertLowTriggered":{"type":"boolean"},"priceAlertLowTriggeredAt":{"type":"string"},"yieldAlertTriggered":{"type":"boolean"},"yieldAlertTriggeredAt":{"type":"string"},"notificationChannels":{"type":"array","items":{"type":"string"},"description":"Where its alerts go; empty = none"},"linkedTemplateIds":{"type":"array","items":{"type":"string"},"description":"Screener templates its alerts run"},"automationAction":{"type":"string","enum":["email_results","create_watchlist","both"]},"automationConfig":{"type":"object","properties":{"maxResults":{"type":"number"}},"additionalProperties":false},"notes":{"type":"string"},"addedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companyName":{"type":"string"},"exchange":{"description":"The listing's exchange (Yahoo code)","type":["string","null"]},"currency":{"description":"The listing's trading currency: every price is in it","type":"string"},"currentPrice":{"description":"The mark","type":"number"},"priceChange":{"type":"number"},"priceChangePercent":{"type":"number"},"dayHigh":{"type":"number"},"dayLow":{"type":"number"},"priceSource":{"type":"string"},"lastPriceUpdate":{"description":"ISO instant","type":"string"},"volume":{"type":"number"},"avgVolume3M":{"type":"number"},"marketCap":{"type":"number"},"peRatio":{"type":"number"},"dividendYield":{"description":"Percent","type":"number"},"analystRating":{"type":"string"},"trend":{"description":"The last ~30 daily closes, oldest first","type":"array","items":{"type":"number"}},"trendDates":{"description":"The date (YYYY-MM-DD) of each close in `trend`","type":"array","items":{"type":"string"}},"openPrice":{"type":"number"},"previousClose":{"type":"number"},"last":{"description":"The last trade (can be hours old on a thin contract)","type":"number"},"bid":{"type":"number"},"ask":{"type":"number"},"openInterest":{"type":"number"},"impliedVolatility":{"type":"number"},"delta":{"type":"number"},"gamma":{"type":"number"},"theta":{"type":"number"},"vega":{"type":"number"},"intrinsicValue":{"description":"Per share","type":"number"},"extrinsicValue":{"description":"Per share","type":"number"},"extrinsicPercent":{"description":"Extrinsic as a percent of the mark","type":"number"},"valueSplitIssue":{"type":"string","enum":["non-standard-contract","currency-mismatch","no-underlying-price","no-mark","quotes-apart","mark-below-intrinsic"],"description":"Why intrinsic / extrinsic is withheld"}},"required":["id","workspaceId","securityId","ticker","exDividendReminder","earningsReminder","priceAlertHighTriggered","priceAlertLowTriggered","yieldAlertTriggered","notificationChannels","linkedTemplateIds","addedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/bulk":{"post":{"operationId":"postWatchlistBulk","summary":"Adds up to 100 known securities (or option contracts) to a watchlist at once; ones already on it are skipped","description":"Adds up to 100 known securities (or option contracts) to a watchlist at once; ones already on it are skipped.","tags":["watchlist"],"x-not-for-mcp":"the app's own convenience: several tickers added at once","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"watchlistId":{"type":"string","minLength":1},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string","minLength":1},"securityId":{"type":"string","minLength":1},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"strikeDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"notes":{"type":"string","maxLength":2000}},"required":["ticker","securityId"],"additionalProperties":false}}},"required":["watchlistId","items"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"number"},"skipped":{"type":"number"}},"required":["created","skipped"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/watchlist/simulate":{"post":{"operationId":"postWatchlistSimulate","summary":"Tests the alerts: checks every watched item of a ticker at a made-up price ({ ticker, price }), sending what would fire without marking it fired, and the open-position Swing % rule the same way","description":"Tests the alerts: checks every watched item of a ticker at a made-up price ({ ticker, price }), sending what would fire without marking it fired, and the open-position Swing % rule the same way.","tags":["watchlist"],"x-not-for-mcp":"it sends real notifications","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticker":{"type":"string","minLength":1},"price":{"type":"number","exclusiveMinimum":0}},"required":["ticker","price"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"itemsChecked":{"type":"number"},"alertsFired":{"type":"number"},"emailsSent":{"type":"number"},"systemAlertFired":{"anyOf":[{"type":"string","const":"swing"},{"type":"null"}]},"systemAlertReason":{"type":"string","enum":["fired","not-qualified","ticker-not-in-any-universe","no-previous-close","workspace-not-found"]},"systemAbsChange":{"type":["number","null"]},"systemDirection":{"anyOf":[{"type":"string","enum":["up","down"]},{"type":"null"}]}},"required":["itemsChecked","alertsFired","emailsSent","systemAlertFired","systemAlertReason","systemAbsChange","systemDirection"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/workspace/usage":{"get":{"operationId":"getWorkspaceUsage","summary":"The workspace's stored bytes and its limit","description":"The workspace's stored bytes and its limit.","tags":["workspace"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"usedBytes":{"type":"number"},"limitBytes":{"description":"Null: no limit","type":["number","null"]}},"required":["usedBytes","limitBytes"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/trade-performance":{"get":{"operationId":"getAnalyticsTradePerformance","summary":"The realized performance of the trade groups the Trade Log's filters select (dates, tickers, statuses, results, tags, accounts, sides, ranges…): P&L, dividends, wins and losses, averages, fees","description":"The realized performance of the trade groups the Trade Log's filters select (dates, tickers, statuses, results, tags, accounts, sides, ranges…): P&L, dividends, wins and losses, averages, fees. Every result is after fees (commissions and the fees charged while a position was held); the fees are also given by themselves, for information. With it, `open`: what those groups hold now (value and unrealized P&L at market). In the display currency.","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"openDateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"openDateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"closeDateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"closeDateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"}},{"name":"positions","in":"query","required":false,"schema":{"type":"string"}},{"name":"results","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"callCoverage","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"sides","in":"query","required":false,"schema":{"type":"string"}},{"name":"actions","in":"query","required":false,"schema":{"type":"string"}},{"name":"entryMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"entryMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"groupId","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeDividendOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"capital":{"type":"number","description":"Trading P&L realized in the period, after fees"},"dividends":{"type":"number","description":"Dividends paid in the period"},"total":{"type":"number","description":"capital + dividends"},"groupCount":{"type":"number"},"closedCount":{"type":"number","description":"Groups closed in the period (wins + losses)"},"openCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgReturn":{"type":"number"},"avgTime":{"type":"number","description":"Mean days open of the period's closed groups"},"commissions":{"type":"number"},"avgFees":{"type":"number"},"open":{"type":"object","properties":{"value":{"type":"number","description":"Stocks + options, signed (a short position is negative): what closing them now would bring"},"stocksValue":{"type":"number"},"optionsValue":{"type":"number"},"cost":{"type":"number","description":"Of the priced positions with a known cost"},"unrealizedPnL":{"type":"number","description":"At market, less the sold options' premiums already counted as realized"},"unrealizedPnLPercent":{"type":"number","description":"Of `cost`"},"unpricedStocks":{"type":"number","description":"Positions without a price: left out of every figure"},"unpricedOptions":{"type":"number"},"unknownCost":{"type":"number","description":"Priced positions with no cost basis (valued, not in unrealized)"},"pricesRefreshing":{"type":"number","description":"Stale quotes being refreshed: ask again shortly"}},"required":["value","stocksValue","optionsValue","cost","unrealizedPnL","unrealizedPnLPercent","unpricedStocks","unpricedOptions","unknownCost","pricesRefreshing"],"additionalProperties":false,"description":"What the matched groups hold now, at market, by the dashboard's own rule (portfolio-summary's `holdings`): a strategy counts the part it claims of each position. With no filter it equals portfolio-summary's holdings. Today's prices, whatever the dates"}},"required":["capital","dividends","total","groupCount","closedCount","openCount","winCount","lossCount","winPercent","avgWin","avgLoss","avgReturn","avgTime","commissions","avgFees","open"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/performance-report":{"get":{"operationId":"getAnalyticsPerformanceReport","summary":"As trade-performance, plus the same figures per year and per month (Performance Reports)","description":"As trade-performance, plus the same figures per year and per month (Performance Reports).","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"openDateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"openDateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"closeDateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"closeDateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"statuses","in":"query","required":false,"schema":{"type":"string"}},{"name":"positions","in":"query","required":false,"schema":{"type":"string"}},{"name":"results","in":"query","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeTags","in":"query","required":false,"schema":{"type":"string"}},{"name":"callCoverage","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"brokers","in":"query","required":false,"schema":{"type":"string"}},{"name":"sides","in":"query","required":false,"schema":{"type":"string"}},{"name":"actions","in":"query","required":false,"schema":{"type":"string"}},{"name":"entryMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"entryMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"exitMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"quantityMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"feesMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnDollarMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMin","in":"query","required":false,"schema":{"type":"number"}},{"name":"returnPercentMax","in":"query","required":false,"schema":{"type":"number"}},{"name":"groupId","in":"query","required":false,"schema":{"type":"string"}},{"name":"tradeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"excludeDividendOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"capital":{"type":"number","description":"Trading P&L realized in the period, after fees"},"dividends":{"type":"number","description":"Dividends paid in the period"},"total":{"type":"number","description":"capital + dividends"},"groupCount":{"type":"number"},"closedCount":{"type":"number","description":"Groups closed in the period (wins + losses)"},"openCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgReturn":{"type":"number"},"avgTime":{"type":"number","description":"Mean days open of the period's closed groups"},"commissions":{"type":"number"},"avgFees":{"type":"number"}},"required":["capital","dividends","total","groupCount","closedCount","openCount","winCount","lossCount","winPercent","avgWin","avgLoss","avgReturn","avgTime","commissions","avgFees"],"additionalProperties":false},"years":{"type":"array","items":{"type":"object","properties":{"year":{"type":"number"},"capital":{"type":"number","description":"Trading P&L realized in the period, after fees"},"dividends":{"type":"number","description":"Dividends paid in the period"},"total":{"type":"number","description":"capital + dividends"},"groupCount":{"type":"number"},"closedCount":{"type":"number","description":"Groups closed in the period (wins + losses)"},"openCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgReturn":{"type":"number"},"avgTime":{"type":"number","description":"Mean days open of the period's closed groups"},"commissions":{"type":"number"},"avgFees":{"type":"number"},"months":{"type":"array","items":{"type":"object","properties":{"month":{"type":"number","description":"1–12"},"capital":{"type":"number","description":"Trading P&L realized in the period, after fees"},"dividends":{"type":"number","description":"Dividends paid in the period"},"total":{"type":"number","description":"capital + dividends"},"groupCount":{"type":"number"},"closedCount":{"type":"number","description":"Groups closed in the period (wins + losses)"},"openCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgReturn":{"type":"number"},"avgTime":{"type":"number","description":"Mean days open of the period's closed groups"},"commissions":{"type":"number"},"avgFees":{"type":"number"}},"required":["month","capital","dividends","total","groupCount","closedCount","openCount","winCount","lossCount","winPercent","avgWin","avgLoss","avgReturn","avgTime","commissions","avgFees"],"additionalProperties":false},"description":"Always 12"}},"required":["year","capital","dividends","total","groupCount","closedCount","openCount","winCount","lossCount","winPercent","avgWin","avgLoss","avgReturn","avgTime","commissions","avgFees","months"],"additionalProperties":false},"description":"Newest first; only years with activity"}},"required":["summary","years"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/portfolio-summary":{"get":{"operationId":"getAnalyticsPortfolioSummary","summary":"The dashboard's cards: holdings value now, the period's realized P&L, all-time total P&L, the win rate, the best and worst performers, and the dividends per month","description":"The dashboard's cards: holdings value now, the period's realized P&L, all-time total P&L, the win rate, the best and worst performers, and the dividends per month. In the display currency.","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"holdings":{"type":"object","properties":{"value":{"type":"number","description":"Stocks + options, signed: what selling everything now would bring"},"stocksValue":{"type":"number"},"optionsValue":{"type":"number"},"cost":{"type":"number","description":"Of the priced positions with a known cost"},"unrealizedPnL":{"type":"number"},"unrealizedPnLPercent":{"type":"number"},"unpricedStocks":{"type":"number"},"unpricedOptions":{"type":"number"},"unknownCost":{"type":"number","description":"Priced positions with no cost basis (valued, not in unrealized)"},"pricesRefreshing":{"type":"number"}},"required":["value","stocksValue","optionsValue","cost","unrealizedPnL","unrealizedPnLPercent","unpricedStocks","unpricedOptions","unknownCost","pricesRefreshing"],"additionalProperties":false,"description":"Today: the open positions at market, never filtered by date"},"realized":{"type":"object","properties":{"total":{"type":"number"},"capital":{"type":"number"},"dividends":{"type":"number"}},"required":["total","capital","dividends"],"additionalProperties":false,"description":"The period's realized P&L (the Trade Log's figure for the same dates)"},"totalPnL":{"type":"object","properties":{"total":{"type":"number"},"realized":{"type":"number"},"unrealized":{"type":"number"},"invested":{"type":"number"},"percent":{"type":"number"}},"required":["total","realized","unrealized","invested","percent"],"additionalProperties":false,"description":"All time: realized + unrealized, % of the capital ever put in"},"winRate":{"type":"object","properties":{"percent":{"type":"number"},"closedCount":{"type":"number"}},"required":["percent","closedCount"],"additionalProperties":false},"topPerformers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"totalReturnPercent":{"type":"number"},"totalReturn":{"type":"number"}},"required":["ticker","totalReturnPercent","totalReturn"],"additionalProperties":false},"description":"Up to ten with a positive return, best first"},"worstPerformers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"totalReturnPercent":{"type":"number"},"totalReturn":{"type":"number"}},"required":["ticker","totalReturnPercent","totalReturn"],"additionalProperties":false},"description":"Up to ten with a negative return, worst first"},"monthlyDividends":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string","description":"YYYY-MM"},"amount":{"type":"number"}},"required":["month","amount"],"additionalProperties":false},"description":"Every month of the period, oldest first"}},"required":["holdings","realized","totalPnL","winRate","topPerformers","worstPerformers","monthlyDividends"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/today":{"get":{"operationId":"getAnalyticsToday","summary":"One trading session of the accounts: the holdings value, the day's P&L (the session's fills included), the pre- / post-market move, what was realized, a row per security held or closed that session (with its option contracts and a 30-close trend), and the market indices","description":"One trading session of the accounts: the holdings value, the day's P&L (the session's fills included), the pre- / post-market move, what was realized, a row per security held or closed that session (with its option contracts and a 30-close trend), and the market indices. The latest session by default, or a past US trading day with `date` (from stored closes, no extended hours). `includeWatched` adds the watched tickers not held. Money is in the display currency; a position without a price or cost is counted in `unpriced` / `unknownCost` and its day in `withheld` instead of a wrong number. `pricesRefreshing` > 0: some quotes are being refreshed, ask again shortly.","tags":["analytics"],"parameters":[{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"includeWatched","in":"query","required":false,"schema":{"type":"string"}},{"name":"date","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","enum":["USD","CAD"]},"sessionDate":{"type":"string"},"latestSessionDate":{"type":"string"},"marketState":{"type":"string","enum":["pre","open","after","closed"]},"dataAsOf":{"type":["string","null"]},"lastTradeDate":{"type":["string","null"]},"headline":{"type":"object","properties":{"value":{"type":"number"},"stocksValue":{"type":"number"},"optionsValue":{"type":"number"},"unrealizedPnL":{"type":"number"},"unrealizedPnLPercent":{"type":"number"},"unpriced":{"type":"number"},"unknownCost":{"type":"number"},"today":{"type":"number","description":"What the session did to the account, after the fees of its trades"},"todayPercent":{"type":["number","null"]},"todayFees":{"type":"number","description":"The fees of the session's trades, already taken off `today`"},"withheld":{"type":"object","propertyNames":{"type":"string","enum":["no_price","no_previous_close","split","inconsistent"]},"additionalProperties":{"type":"number"}},"extended":{"anyOf":[{"type":"object","properties":{"session":{"type":"string","enum":["pre","post"]},"change":{"type":"number"},"percent":{"type":["number","null"]}},"required":["session","change","percent"],"additionalProperties":false},{"type":"null"}]},"realized":{"type":"object","properties":{"capital":{"type":"number"},"dividends":{"type":"number"},"total":{"type":"number"}},"required":["capital","dividends","total"],"additionalProperties":false},"cash":{"anyOf":[{"type":"object","properties":{"total":{"type":"number","description":"Every convertible balance's cash, in the display currency at today's rate"},"buyingPower":{"description":"Display currency; null when no account reports buying power","type":["number","null"]},"asOf":{"type":"string","description":"The oldest balance's time: the figures are no fresher"},"accounts":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string","description":"The broker's currency: the line is in it"},"cash":{"type":"number"},"buyingPower":{"type":["number","null"]}},"required":["accountId","name","currency","cash","buyingPower"],"additionalProperties":false},"description":"One line per account and currency, in the accounts' order, never converted"},"unconverted":{"type":"array","items":{"type":"string"},"description":"Currencies on an account's line that the totals leave out (no rate kept)"}},"required":["total","buyingPower","asOf","accounts","unconverted"],"additionalProperties":false},{"type":"null"}],"description":"The cash the brokers report for the accounts in scope; null on a past session or when no account in scope has a balance"}},"required":["value","stocksValue","optionsValue","unrealizedPnL","unrealizedPnLPercent","unpriced","unknownCost","today","todayPercent","todayFees","withheld","extended","realized","cash"],"additionalProperties":false},"rows":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"price":{"type":["number","null"]},"change":{"type":["number","null"]},"changePercent":{"type":["number","null"]},"sector":{"description":"The company's sector; null = not known","type":["string","null"]},"held":{"type":"boolean"},"hasStock":{"type":"boolean"},"hasOptions":{"type":"boolean"},"accountIds":{"type":"array","items":{"type":"string"}},"value":{"description":"Its open positions that have a price; null = none of them has one","type":["number","null"]},"unpriced":{"type":"number","description":"Its open positions without a price, left out of the value"},"today":{"type":"number"},"todayPercent":{"type":["number","null"]},"withheld":{"type":"number"},"extendedChange":{"type":["number","null"]},"shares":{"type":"number"},"avgCost":{"type":["number","null"]},"optionPositions":{"type":"number"},"contracts":{"type":"array","items":{"type":"object","properties":{"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"optionRoot":{"type":"string"},"contracts":{"type":"number"},"mark":{"type":["number","null"]},"value":{"type":["number","null"]},"avgPrice":{"type":["number","null"]},"cost":{"type":["number","null"]},"unrealizedPnL":{"type":["number","null"]},"unrealizedPercent":{"type":["number","null"]},"today":{"type":"number"},"todayPercent":{"type":["number","null"]},"withheld":{"type":"number"}},"required":["optionType","strike","expiration","contracts","mark","value","avgPrice","cost","unrealizedPnL","unrealizedPercent","today","todayPercent","withheld"],"additionalProperties":false}},"cost":{"type":"number"},"unrealizedPnL":{"type":"number"},"unrealizedPercent":{"type":["number","null"]},"trend":{"type":"array","items":{"type":"number"}},"trendDates":{"type":"array","items":{"type":"string"},"description":"The date (YYYY-MM-DD) of each close in `trend`"}},"required":["securityId","ticker","exchange","name","price","change","changePercent","sector","held","hasStock","hasOptions","accountIds","value","unpriced","today","todayPercent","withheld","extendedChange","shares","avgCost","optionPositions","contracts","cost","unrealizedPnL","unrealizedPercent","trend","trendDates"],"additionalProperties":false}},"watched":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"price":{"type":["number","null"]},"change":{"type":["number","null"]},"changePercent":{"type":["number","null"]}},"required":["securityId","ticker","exchange","name","price","change","changePercent"],"additionalProperties":false}},"indices":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"price":{"type":["number","null"]},"change":{"type":["number","null"]},"changePercent":{"type":["number","null"]}},"required":["securityId","ticker","exchange","name","price","change","changePercent"],"additionalProperties":false},"description":"The market funds (SPY, QQQ, DIA, IWM), in the display currency"},"marketLine":{"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string","description":"Yahoo's symbol: ^GSPC, ^TNX, GC=F, BTC-USD, CAD=X"},"label":{"type":"string"},"kind":{"type":"string","enum":["index","yield","volatility","future","fx","crypto"]},"decimals":{"type":"number"},"price":{"description":"In its own units (points, a yield in %, a price, a rate), never converted; null = none stored","type":["number","null"]},"change":{"type":["number","null"]},"changePercent":{"type":["number","null"]},"asOf":{"type":["string","null"]},"trend":{"type":"array","items":{"type":"number"},"description":"Its daily closes over the month up to the session, oldest first (stored, never fetched)"},"trendDates":{"type":"array","items":{"type":"string"},"description":"The dates of trend, YYYY-MM-DD"}},"required":["symbol","label","kind","decimals","price","change","changePercent","asOf","trend","trendDates"],"additionalProperties":false},"description":"The market line's indicators in its order (US indices, the TSX, the 10-year yield, VIX, gold, oil, Bitcoin, USD/CAD): display only, never securities. A past session: that day's close against the one before"},"pricesRefreshing":{"type":"number"}},"required":["currency","sessionDate","latestSessionDate","marketState","dataAsOf","lastTradeDate","headline","rows","watched","indices","marketLine","pricesRefreshing"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/today/history":{"get":{"operationId":"getAnalyticsTodayHistory","summary":"The day's P&L of each of the last `sessions` (default 30) US sessions before the latest one, from stored closes, oldest first","description":"The day's P&L of each of the last `sessions` (default 30) US sessions before the latest one, from stored closes, oldest first.","tags":["analytics"],"parameters":[{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"sessions","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":90}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","enum":["USD","CAD"]},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"today":{"type":"number","description":"The session's P&L"},"todayPercent":{"type":["number","null"]},"withheld":{"type":"number","description":"Positions left out that day"}},"required":["date","today","todayPercent","withheld"],"additionalProperties":false},"description":"Oldest first"}},"required":["currency","days"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/upcoming":{"get":{"operationId":"getAnalyticsUpcoming","summary":"What's coming up over the next `days` (up to 100): earnings, ex-dividend and payment dates (announced or expected; for a held stock the amount for the shares held now), option expirations (held and watched, in or out of the money against the last price), US and Canadian economic events, and market holidays, sorted by date","description":"What's coming up over the next `days` (up to 100): earnings, ex-dividend and payment dates (announced or expected; for a held stock the amount for the shares held now), option expirations (held and watched, in or out of the money against the last price), US and Canadian economic events, and market holidays, sorted by date. Each ticker's item says why it's there (held, watched, tracked); `dividendsWithheld` lists the dividend payers whose next dates aren't projected, and why.","tags":["analytics"],"parameters":[{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","enum":["USD","CAD"]},"from":{"type":"string"},"to":{"type":"string"},"items":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"date":{"type":"string"},"expected":{"type":"boolean"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"reasons":{"type":"array","items":{"type":"string","enum":["held","watched","tracked"]}},"kind":{"type":"string","const":"earnings"},"hour":{"type":["string","null"]}},"required":["date","expected","securityId","ticker","exchange","name","reasons","kind","hour"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string"},"expected":{"type":"boolean"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"reasons":{"type":"array","items":{"type":"string","enum":["held","watched","tracked"]}},"kind":{"type":"string","enum":["ex_dividend","dividend_payment"]},"perShare":{"type":["number","null"]},"currency":{"type":["string","null"]},"amount":{"type":["number","null"]},"amountExpected":{"type":"boolean"}},"required":["date","expected","securityId","ticker","exchange","name","reasons","kind","perShare","currency","amount","amountExpected"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string"},"expected":{"type":"boolean"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"reasons":{"type":"array","items":{"type":"string","enum":["held","watched","tracked"]}},"kind":{"type":"string","const":"option_expiration"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"optionRoot":{"type":"string"},"contracts":{"type":["number","null"]},"moneyness":{"anyOf":[{"type":"string","enum":["itm","otm","atm"]},{"type":"null"}]}},"required":["date","expected","securityId","ticker","exchange","name","reasons","kind","optionType","strike","contracts","moneyness"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string"},"expected":{"type":"boolean"},"kind":{"type":"string","const":"economic"},"country":{"type":"string"},"title":{"type":"string"},"category":{"type":["string","null"]},"importance":{"type":["string","null"]}},"required":["date","expected","kind","country","title","category","importance"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string"},"expected":{"type":"boolean"},"kind":{"type":"string","const":"holiday"},"country":{"type":"string"},"title":{"type":"string"}},"required":["date","expected","kind","country","title"],"additionalProperties":false}]}},"dividendsWithheld":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"reason":{"type":"string","enum":["stale","outsized_last","no_schedule"]}},"required":["securityId","ticker","reason"],"additionalProperties":false}}},"required":["currency","from","to","items","dividendsWithheld"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/portfolio-chart":{"get":{"operationId":"getAnalyticsPortfolioChart","summary":"The market value and cost of the shares held over time: month-end points (weekly for a range under ~400 days), then today at live prices","description":"The market value and cost of the shares held over time: month-end points (weekly for a range under ~400 days), then today at live prices.","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"points":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"},"cost":{"type":"number"}},"required":["date","value","cost"],"additionalProperties":false}},"unpricedSecurities":{"type":"number","description":"Securities held at some point that had no close for it (left out of that point)"}},"required":["points","unpricedSecurities"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/pnl-history":{"get":{"operationId":"getAnalyticsPnlHistory","summary":"P&L over time: realized P&L (all time, all instruments) and total P&L (realized + the unrealized P&L of what was held that day, at that day's stored closes; options at their own daily bars) by date: a point per weekday up to ~3 months, weekly up to ~400 days, month-ends beyond, then today live (equal to the Summary's Total and Realized P&L)","description":"P&L over time: realized P&L (all time, all instruments) and total P&L (realized + the unrealized P&L of what was held that day, at that day's stored closes; options at their own daily bars) by date: a point per weekday up to ~3 months, weekly up to ~400 days, month-ends beyond, then today live (equal to the Summary's Total and Realized P&L). A range picks the dates shown; the values stay cumulative from the first trade. In the display currency; stored prices only.","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"points":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"realized":{"type":"number","description":"Realized P&L booked up to this date, all time (stocks, options, dividends)"},"total":{"type":"number","description":"Realized + the unrealized P&L of what was held that day"}},"required":["date","realized","total"],"additionalProperties":false}},"optionsAtCost":{"type":"number","description":"Option positions without a price on some point while held: no unrealized P&L there (their result counts when they close)"},"unpricedSecurities":{"type":"number","description":"Securities held on some point without a close for it: no unrealized P&L there"}},"required":["points","optionsAtCost","unpricedSecurities"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/positions":{"get":{"operationId":"getAnalyticsPositions","summary":"The shares held now per security (stock positions only, no prices), sorted by ticker","description":"The shares held now per security (stock positions only, no prices), sorted by ticker. Narrow with `accounts` and `securityIds`.","tags":["analytics"],"parameters":[{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"positions":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"shares":{"type":"number"}},"required":["securityId","ticker","shares"],"additionalProperties":false}}},"required":["positions"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/income-stats":{"get":{"operationId":"getAnalyticsIncomeStats","summary":"The dividends received, summed: the total and count, by year, by month, by security, by native currency and by ticker × year","description":"The dividends received, summed: the total and count, by year, by month, by security, by native currency and by ticker × year. In the display currency except `byCurrency` (each payment in its own currency). Narrow with a date range, `accounts`, `securityIds`, `years`, or `holdingsOnly` (the securities held now).","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"incomeTypes","in":"query","required":false,"schema":{"type":"string"}},{"name":"holdingsOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"years","in":"query","required":false,"schema":{"type":"string","pattern":"^\\s*\\d{4}\\s*(,\\s*\\d{4}\\s*)*$"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","enum":["USD","CAD"],"description":"The display currency every amount is in, but byCurrency's"},"totalIncome":{"type":"number"},"totalCount":{"type":"number"},"uniqueSecurities":{"type":"number"},"byType":{"type":"object","properties":{"dividend":{"type":"number"},"interest":{"type":"number"},"other":{"type":"number"}},"required":["dividend","interest","other"],"additionalProperties":false},"byYear":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"byMonth":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"bySecurity":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"currency":{"type":"string"},"totalIncome":{"type":"number"},"paymentCount":{"type":"number"},"avgPayment":{"type":"number"}},"required":["securityId","ticker","exchange","currency","totalIncome","paymentCount","avgPayment"],"additionalProperties":false}},"byCurrency":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"byTickerAndYear":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}},"dateRange":{"type":"object","properties":{"start":{"type":["string","null"]},"end":{"type":["string","null"]}},"required":["start","end"],"additionalProperties":false}},"required":["currency","totalIncome","totalCount","uniqueSecurities","byType","byYear","byMonth","bySecurity","byCurrency","byTickerAndYear","dateRange"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/calendar-summary":{"get":{"operationId":"getAnalyticsCalendarSummary","summary":"The Events page's counts (trades, dividends, journal entries) and month-by-month realized P&L and dividends over the dates","description":"The Events page's counts (trades, dividends, journal entries) and month-by-month realized P&L and dividends over the dates.","tags":["analytics"],"parameters":[{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"showTrades","in":"query","required":false,"schema":{"type":"string"}},{"name":"showDividends","in":"query","required":false,"schema":{"type":"string"}},{"name":"showJournalEntries","in":"query","required":false,"schema":{"type":"string"}},{"name":"holdingsOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"eventCounts":{"type":"object","properties":{"dividends":{"type":"number"},"trades":{"type":"number"},"journalEntries":{"type":"number"},"total":{"type":"number"}},"required":["dividends","trades","journalEntries","total"],"additionalProperties":false},"monthlyPnL":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"tradePnl":{"type":"number","description":"Realized P&L of the groups closed that month"},"tradeCount":{"type":"number","description":"Buy / sell trades dated in it"},"dividendAmount":{"type":"number"},"dividendCount":{"type":"number"}},"required":["tradePnl","tradeCount","dividendAmount","dividendCount"],"additionalProperties":false},"description":"By YYYY-MM"},"dailyPnL":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Realized trading P&L by YYYY-MM-DD (the groups closed that day, as the months' tradePnl); only the days that realized something"},"dateRange":{"type":"object","properties":{"start":{"type":["string","null"]},"end":{"type":["string","null"]}},"required":["start","end"],"additionalProperties":false}},"required":["eventCounts","monthlyPnL","dailyPnL","dateRange"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/dividend-projections":{"get":{"operationId":"getAnalyticsDividendProjections","summary":"The dividends to expect from the stocks held: each security's last dividend, frequency, next payment and annual projection, a portfolio summary and year-over-year growth","description":"The dividends to expect from the stocks held: each security's last dividend, frequency, next payment and annual projection, a portfolio summary and year-over-year growth. In the display currency.","tags":["analytics"],"parameters":[{"name":"tickers","in":"query","required":false,"schema":{"type":"string"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"holdingsOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"projections":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"currency":{"type":"string","description":"The dividend's native currency"},"shares":{"type":"number"},"costBasis":{"type":"number","description":"Average cost per share"},"totalCost":{"type":"number","description":"What the holding cost: shares × costBasis, display currency"},"yieldOnCost":{"type":"number","description":"Yield on cost %: annualProjection over totalCost; 0 with no cost or no estimate"},"lastDividendAmount":{"type":"number","description":"Display currency"},"lastDividendPerShare":{"type":"number","description":"Native currency"},"lastDividendDate":{"type":["string","null"]},"frequency":{"type":"string","description":"quarterly, monthly, … or unknown"},"projectedPayment":{"type":"number","description":"The next payment, display currency"},"annualProjection":{"type":"number"},"nextPaymentDate":{"type":["string","null"]},"projectionWithheld":{"anyOf":[{"type":"string","enum":["stale","outsized_last"]},{"type":"null"}],"description":"Why there is no estimate although the security pays"},"dividendYield":{"type":"number"},"yoyGrowth":{"type":"number"}},"required":["securityId","ticker","exchange","currency","shares","costBasis","totalCost","yieldOnCost","lastDividendAmount","lastDividendPerShare","lastDividendDate","frequency","projectedPayment","annualProjection","nextPaymentDate","projectionWithheld","dividendYield","yoyGrowth"],"additionalProperties":false}},"expectedByMonth":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string","description":"YYYY-MM"},"amount":{"type":"number"}},"required":["month","amount"],"additionalProperties":false},"description":"What the holdings are expected to pay in each of the next twelve months, the current one first (display currency): each holding's payments from its next one on, one interval apart"},"summary":{"type":"object","properties":{"totalAnnualProjection":{"type":"number"},"totalCostBasis":{"type":"number"},"portfolioYield":{"type":"number"},"portfolioYieldOnCost":{"type":"number","description":"Yield on cost %: totalAnnualProjection over totalCostBasis; 0 with no cost"},"estimatedMonthly":{"type":"number"},"estimatedDaily":{"type":"number"}},"required":["totalAnnualProjection","totalCostBasis","portfolioYield","portfolioYieldOnCost","estimatedMonthly","estimatedDaily"],"additionalProperties":false},"growth":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"ticker":{"type":"string"},"currentYearTotal":{"type":"number"},"previousYearTotal":{"type":"number"},"yoyGrowthPercent":{"type":"number"},"yearlyTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Year → total"}},"required":["ticker","currentYearTotal","previousYearTotal","yoyGrowthPercent","yearlyTotals"],"additionalProperties":false},"description":"By ticker"},"asOf":{"type":"string","description":"ISO instant"}},"required":["projections","expectedByMonth","summary","growth","asOf"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report":{"post":{"operationId":"postAnalyticsTaxReport","summary":"Estimates a year's (or a quarter's) tax on the accounts' realized gains and dividends: the lots, the dividends, the brackets, wash sales, transfers, foreign tax, and the flags to act on","description":"Estimates a year's (or a quarter's) tax on the accounts' realized gains and dividends: the lots, the dividends, the brackets, wash sales, transfers, foreign tax, and the flags to act on. The report reads the accounts of accountIds and no other, the wash-sale check included; each is taxed or sheltered by its type in that country (GET /v1/config accountTypes[].shelteredIn) unless taxableAccountIds / shelteredAccountIds say otherwise: a sheltered account is not taxed, and a loss replaced by shares bought in it is denied for good. An account whose type is null (not known yet) is refused unless an override places it. 400 STATUS_ACCOUNT_NOT_IN_REPORT, STATUS_CONFLICT, ACCOUNT_TYPE_NOT_SET (details.accountIds), NO_TAXABLE_ACCOUNT. JSON, or multipart with the JSON as `input` and broker tax documents as `files` (documentAccountIds[i] is the accounts of files[i]) to compare each with the report. Kept for a while under its `reportId`; with `keep` false it is answered and not kept: no `reportId`, nothing stored.","tags":["analytics"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"year":{"type":"number"},"quarter":{"default":"FULL_YEAR","type":"string","enum":["FULL_YEAR","Q1","Q2","Q3","Q4"]},"baseIncome":{"type":"number"},"country":{"type":"string","enum":["US","CA"]},"accountIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"taxableAccountIds":{"description":"Accounts of accountIds to tax though their type is sheltered in this country","type":"array","items":{"type":"string","minLength":1}},"shelteredAccountIds":{"description":"Accounts of accountIds to treat as sheltered though their type is taxable: not taxed, and a loss replaced there is denied for good","type":"array","items":{"type":"string","minLength":1}},"canadaCapitalGainsInclusionRate":{"type":"number"},"accountingMethod":{"type":"string","enum":["FIFO","ACB"]},"elections":{"type":"object","properties":{"canadianSecurities":{"description":"Canada: you elected under s. 39(4), so a short sale of a Canadian security is a capital gain or loss, not income","type":"boolean"},"identifiedStraddles":{"description":"US: you identify each straddle in your records the day you open it (IRC 1092(a)(2)): no loss is deferred at the year's end; a loss on one side goes into the cost of the positions that offset it","type":"boolean"},"traderMarkToMarket":{"description":"US: you are a trader in securities who elected mark-to-market (IRC 475(f)): every security is taxed at the year's end as if sold, as ordinary income; no wash sale; index options stay section 1256 contracts","type":"boolean"},"mixedStraddles":{"description":"US: what you say of index options held against a fund that tracks the index (a mixed straddle, IRC 1092(b)(2)), per index family (sp500, nasdaq100, russell2000, dow, sp100). offsetting: they offset each other and you made no election; identified: you identified each straddle the day you established it; account: you elected a mixed straddle account for the year (Form 6781); section1256d: you elected section 1256 out for them. A family not named is taxed apart and flagged","maxItems":5,"type":"array","items":{"type":"object","properties":{"family":{"type":"string","enum":["sp500","nasdaq100","russell2000","dow","sp100"]},"treatment":{"type":"string","enum":["offsetting","identified","account","section1256d"]}},"required":["family","treatment"],"additionalProperties":false}}},"additionalProperties":false},"documentAccountIds":{"type":"array","items":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}}},"keep":{"description":"false: the report is answered and not kept (no reportId, nothing to get or export later). Default true","type":"boolean"}},"required":["year","baseIncome","country","accountIds"]}},"multipart/form-data":{"schema":{"type":"object","properties":{"input":{"type":"string","description":"The JSON body, as text"},"files":{"description":"Broker tax documents: PDF, CSV or XLSX","type":"array","items":{"type":"string","format":"binary","contentEncoding":"binary"}}},"required":["input"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"object","properties":{"year":{"type":"number"},"quarter":{"type":"string","enum":["FULL_YEAR","Q1","Q2","Q3","Q4"]},"baseIncome":{"type":"number"},"country":{"type":"string","enum":["US","CA"]},"accountingMethod":{"type":"string","enum":["FIFO","ACB"]},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account the report read, and no other"},"taxableAccountIds":{"type":"array","items":{"type":"string"},"description":"Of those, the taxed ones"},"shelteredAccountIds":{"type":"array","items":{"type":"string"},"description":"Of those, the sheltered ones: not taxed, read as wash-sale replacements"},"canadaCapitalGainsInclusionRate":{"type":"number"},"elections":{"type":"object","properties":{"canadianSecurities":{"type":"boolean"},"identifiedStraddles":{"type":"boolean"},"traderMarkToMarket":{"type":"boolean"}},"additionalProperties":false}},"required":["year","quarter","baseIncome","country","accountingMethod","accountIds","taxableAccountIds","shelteredAccountIds","canadaCapitalGainsInclusionRate"],"additionalProperties":false},"aggregatedData":{"type":"object","properties":{"totalDividendsUSD":{"type":"number"},"totalDividendsCAD":{"type":"number"},"shortTermCapitalGainsUSD":{"type":"number"},"shortTermCapitalGainsCAD":{"type":"number"},"longTermCapitalGainsUSD":{"type":"number"},"longTermCapitalGainsCAD":{"type":"number"},"totalCapitalLossesUSD":{"type":"number"},"totalCapitalLossesCAD":{"type":"number"},"longTermCapitalLossesUSD":{"description":"US: the long-term part of totalCapitalLosses; the rest is short-term","type":"number"},"longTermCapitalLossesCAD":{"type":"number"},"incomeAccountNetUSD":{"type":"number"},"incomeAccountNetCAD":{"description":"Canada: the net result on income account (short sales of shares); can be negative","type":"number"},"washSaleDisallowedTotalUSD":{"type":"number"},"washSaleDisallowedTotalCAD":{"type":"number"},"straddleDeferredTotalUSD":{"description":"US: losses of the period deferred to the next year by the straddle rules","type":"number"},"straddleDeferredTotalCAD":{"type":"number"},"netShortTermGainsUSD":{"type":"number"},"netShortTermGainsCAD":{"type":"number"},"netLongTermGainsUSD":{"type":"number"},"netLongTermGainsCAD":{"type":"number"},"capitalLossCarryforwardUSD":{"type":"number"},"capitalLossCarryforwardCAD":{"type":"number"},"eligibleDividendsCAD":{"type":"number"},"nonEligibleDividendsCAD":{"type":"number"},"qualifiedDividendsUSD":{"type":"number"}},"required":["totalDividendsUSD","totalDividendsCAD","shortTermCapitalGainsUSD","shortTermCapitalGainsCAD","longTermCapitalGainsUSD","longTermCapitalGainsCAD","totalCapitalLossesUSD","totalCapitalLossesCAD","washSaleDisallowedTotalUSD","washSaleDisallowedTotalCAD","netShortTermGainsUSD","netShortTermGainsCAD","netLongTermGainsUSD","netLongTermGainsCAD","capitalLossCarryforwardUSD","capitalLossCarryforwardCAD","eligibleDividendsCAD","qualifiedDividendsUSD"],"additionalProperties":false},"taxBreakdown":{"type":"object","properties":{"taxOnBaseIncome":{"type":"number"},"taxOnDividends":{"type":"number"},"eligibleDividendGrossUp":{"type":"number"},"nonEligibleDividendGrossUp":{"type":"number"},"dividendTaxCredit":{"type":"number"},"taxOnQualifiedDividends":{"type":"number"},"taxOnShortTermGains":{"type":"number"},"taxOnLongTermGains":{"type":"number"},"taxOnIncomeAccount":{"description":"CA: the tax the income-account result adds; negative for a net loss","type":"number"},"taxableIncome":{"type":"number"},"foreignTaxCredit":{"type":"number"},"totalEstimatedTax":{"type":"number"},"effectiveRate":{"type":"number"}},"required":["taxOnBaseIncome","taxOnDividends","taxOnShortTermGains","taxOnLongTermGains","totalEstimatedTax","effectiveRate"],"additionalProperties":false},"bracketsUsed":{"type":"array","items":{"type":"object","properties":{"bracket":{"type":"string"},"rate":{"type":"number"}},"required":["bracket","rate"],"additionalProperties":false}},"explanations":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"},"description":"What the estimate leaves out"},"foreignTax":{"description":"The withholding brokers reported and the credit from it (null: none in the period)","anyOf":[{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":"string"},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"linked":{"type":"boolean"},"grossDividends":{"type":"number"},"withheld":{"type":"number"},"above15":{"type":"number"}},"required":["accountId","ticker","dividendTradeIds","linked","grossDividends","withheld","above15"],"additionalProperties":false}},"unmatched":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":["string","null"]},"withheld":{"type":"number"}},"required":["accountId","ticker","withheld"],"additionalProperties":false}},"foreignIncome":{"type":"number"},"withheld":{"type":"number"},"creditable":{"type":"number"},"withholdingAbove15":{"type":"number"},"limit":{"type":"number"},"credit":{"type":"number"}},"required":["groups","unmatched","foreignIncome","withheld","creditable","withholdingAbove15","limit","credit"],"additionalProperties":false},{"type":"null"}]},"taxLots":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"openDate":{"type":"string"},"closeDate":{"type":"string"},"holdingPeriodDays":{"type":"number"},"term":{"description":"US: the term a rule sets, whatever the days held; absent, the days decide","type":"string","enum":["short","long"]},"termReason":{"description":"Which rule set the term: an option sold, a short sale covered by a purchase, a straddle loss against a long-term position, a qualified call's loss with the shares long-term","type":"string","enum":["written_option","short_sale","straddle_loss","qualified_call_loss","short_against_long_term"]},"realizedDate":{"description":"US: the day the result counts on when not the close (a short covered at a loss: its settlement day)","type":"string"},"quantity":{"type":"number"},"adjustedQuantity":{"type":"number"},"costBasisUSD":{"type":"number"},"costBasisCAD":{"type":"number"},"proceedsUSD":{"type":"number"},"proceedsCAD":{"type":"number"},"realizedGainUSD":{"type":"number"},"realizedGainCAD":{"type":"number"},"tag":{"type":"string","enum":["DIVIDEND","STCG","LTCG","CG","CAPITAL_LOSS","INCOME","SEC_1256"]},"straddleHolding":{"description":"US: a straddle reset this lot's holding period, or a qualified call sold in the money paused it","type":"object","properties":{"rule":{"type":"string","enum":["reset","paused"]},"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"},"pausedDays":{"type":"number"},"pausedBy":{"type":"string"},"assumedCoverage":{"type":"boolean"}},"required":["rule","daysBefore"],"additionalProperties":false},"shortSaleHolding":{"description":"US: a short sale of the same shares restarted this lot's holding period (IRC 1233(b))","type":"object","properties":{"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"}},"required":["daysBefore","since","by"],"additionalProperties":false},"straddleDeferredUSD":{"description":"US: the part of this loss deferred to the next year by the straddle rules","type":"number"},"straddleDeferredCAD":{"type":"number"},"straddleToBasisUSD":{"description":"US, identified straddles: this loss is not taken; it went into the offsetting positions' cost","type":"number"},"straddleToBasisCAD":{"type":"number"},"straddleBasisAdjUSD":{"description":"US, identified straddles: a loss on an offsetting position added to this lot's cost","type":"number"},"straddleBasisAdjCAD":{"type":"number"},"straddleDeferralUnknown":{"description":"The whole loss is held back: no year-end price for what offset it","type":"boolean"},"straddleCarriedFrom":{"description":"A loss of an earlier year, deferred then, taken in this one","type":"object","properties":{"closeDate":{"type":"string"},"year":{"type":"number"}},"required":["closeDate","year"],"additionalProperties":false},"section1256":{"description":"US: an option on a broad-based index: 60% long-term, 40% short-term, marked at the year's end","type":"boolean"},"yearStartMark":{"description":"US §1256: the value on the year before's last trading day, where this year's result starts","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"yearEndMark":{"description":"US §1256: still open at the year's end, taxed as if sold at this value","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"incomeAccount":{"description":"On income account (tag INCOME): taxed whole, in no capital bucket (Canada: a short sale; US: a trader's 475(f) election)","type":"boolean"},"markToMarket475":{"description":"US: marked to market under the trader's election (IRC 475(f)): ordinary, taxed at the year's end when open","type":"boolean"},"assumedShort":{"description":"A short sale the engine assumed: the broker didn't mark it, you didn't confirm it","type":"boolean"},"shortSaleAccount":{"description":"Canada: which account a short sale of shares is on, and why","type":"string","enum":["income","election_39_4","hedge"]},"isWashSale":{"type":"boolean"},"washSaleDisallowedUSD":{"type":"number"},"washSaleDisallowedCAD":{"type":"number"},"washSaleCostBasisAdjUSD":{"type":"number"},"washSaleCostBasisAdjCAD":{"type":"number"},"washSaleHoldingDays":{"description":"US: days of the shares sold at a loss, inside holdingPeriodDays","type":"number"},"washSaleCarriedFrom":{"description":"The earlier losses inside washSaleCostBasisAdj: each loss's sale day and its part","type":"array","items":{"type":"object","properties":{"lossDate":{"type":"string"},"ticker":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["lossDate","ticker","usd","cad"],"additionalProperties":false}},"washSaleCoveredQty":{"description":"ACB: shares of this loss the pool found replaced","type":"number"},"washSaleSheltered":{"description":"ACB: the part replaced in sheltered accounts of the report, per purchase","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"quantity":{"type":"number"},"date":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","quantity","date","usd","cad"],"additionalProperties":false}},"washSaleReplacement":{"type":"string"},"washSalePermanentlyDenied":{"type":"boolean"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"isBoundary":{"description":"A prior-year lot kept only for the wash-sale carry-forward","type":"boolean"},"notes":{"type":"array","items":{"type":"string"}},"fxRate":{"type":"number"},"allocationTradeId":{"type":"string"}},"required":["groupId","accountId","ticker","securityId","side","openDate","closeDate","holdingPeriodDays","quantity","costBasisUSD","costBasisCAD","proceedsUSD","proceedsCAD","realizedGainUSD","realizedGainCAD","tag"],"additionalProperties":false}},"dividendLots":{"type":"array","items":{"type":"object","properties":{"tradeId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"date":{"type":"string"},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"dividendType":{"description":"regular, roc or trust","type":"string"},"securityId":{"type":"string"},"qualified":{"type":["boolean","null"]},"qualifiedStatus":{"type":"string","enum":["override","broker","held","partly","not_held","pending","issuer_unsure","hedged","period_unsure","not_assessed"]},"qualifiedShare":{"type":"number"},"qualifiedPendingUntil":{"type":"string"},"qualifiedDoubt":{"type":"string","enum":["industry","no_treaty","otc_receipt","reit","option","preferred_period"]},"dividendClass":{"type":"string","enum":["eligible","ca_fund","unknown_issuer","foreign","non_eligible","ordinary"]},"treatmentSetByUser":{"type":"boolean"}},"required":["tradeId","accountId","ticker","date","amountUSD","amountCAD"],"additionalProperties":false}},"transferAudit":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"securityId":{"type":"string"},"quantity":{"type":"number"},"transferOutDate":{"type":"string"},"transferInDate":{"type":"string"},"sourceAccountId":{"type":"string"},"destAccountId":{"type":"string"},"transferPairId":{"type":"string"},"appAcbUSD":{"type":"number"},"appAcbCAD":{"type":"number"},"hasUnknownCostBasis":{"type":"boolean"},"optionType":{"type":["string","null"]}},"required":["ticker","securityId","quantity","transferPairId","hasUnknownCostBasis"],"additionalProperties":false}},"unresolvableGroups":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"ticker":{"type":"string"},"accountId":{"type":"string"},"side":{"type":"string"},"openDate":{"type":"string"},"closeDate":{"type":"string"},"quantity":{"type":"number"},"bookValueUSD":{"type":"number"},"bookValueCAD":{"type":"number"},"reason":{"type":"string"},"actionRequired":{"type":"string"}},"required":["groupId","ticker","accountId","openDate","reason","actionRequired"],"additionalProperties":false}},"flags":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["cross_year_assignment","unknown_cost_basis","cross_year_wash_sale","replacement_registered_account","superficial_call_then_shares","short_sale_wash_sale","short_sale_assumed_not_checked","short_sale_loss_reshorted","constructive_sale","synthetic_disposition","straddle_loss_pending","straddle_close_missing","section_1256_mark_missing","mark_to_market_missing","mixed_straddle_possible","section_1256_by_definition","wash_sale_put_itm","wash_sale_written_option","premium_unmatched","ungrouped_trades","ca_fund_distribution","dividend_issuer_unknown","withholding_unmatched","dividend_paid_on_short","dividend_looks_net","broker_cost_basis","qualified_dividend_pending","qualified_dividend_unconfirmed"]},"ticker":{"type":"string"},"details":{"type":"string"},"actionRequired":{"type":"string"},"taxYear":{"type":"number"}},"required":["type","ticker","details","actionRequired"],"additionalProperties":false}},"commissions":{"type":"object","properties":{"totalUSD":{"type":"number"},"totalCAD":{"type":"number"},"rows":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":"string"},"trades":{"type":"number"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","ticker","trades","usd","cad"],"additionalProperties":false}}},"required":["totalUSD","totalCAD","rows"],"additionalProperties":false},"assignedContracts":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"securityId":{"type":"string"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"premiumUSD":{"type":"number"},"premiumCAD":{"type":"number"},"assignmentDate":{"type":"string"},"stockTicker":{"type":"string"},"sharesAssigned":{"type":"number"}},"required":["ticker","securityId","optionType","strike","expiration","premiumUSD","premiumCAD","assignmentDate","stockTicker","sharesAssigned"],"additionalProperties":false}},"securityFamilyMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"securityId → the canonical securityId of its same-company family"},"comparisonResults":{"description":"With broker files: each file compared with the report","type":"array","items":{"type":"object","properties":{"fileName":{"type":"string"},"broker":{"type":"string"},"documentType":{"type":"string"},"entries":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","description":"\"MSTR\" or \"MSTR|put|300|2025-12-19\""},"brokerGL":{"type":"number"},"appGL":{"type":"number"},"delta":{"type":"number"},"category":{"type":"string"},"explanation":{"type":"string"}},"required":["asset","brokerGL","appGL","delta","category","explanation"],"additionalProperties":false}},"totalBrokerGL":{"type":"number"},"totalAppGL":{"type":"number"},"totalDelta":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"warnings":{"type":"array","items":{"type":"string"}}},"required":["fileName","broker","documentType","entries","totalBrokerGL","totalAppGL","totalDelta","currency","warnings"],"additionalProperties":false}},"reportId":{"description":"Kept for a while: GET /v1/analytics/tax-report/:reportId, the export. Absent when asked with keep false","type":"string"}},"required":["inputs","aggregatedData","taxBreakdown","bracketsUsed","explanations","notes","taxLots","dividendLots","transferAudit","unresolvableGroups","flags","commissions","assignedContracts","securityFamilyMap"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/dividend-tax-settings":{"get":{"operationId":"getAnalyticsDividendTaxSettings","summary":"Every security the workspace received a dividend from, with the user's settings for how its dividends are taxed: per country (CA: eligible, non_eligible, ordinary; US: qualified, not_qualified) and per tax year or for every year","description":"Every security the workspace received a dividend from, with the user's settings for how its dividends are taxed: per country (CA: eligible, non_eligible, ordinary; US: qualified, not_qualified) and per tax year or for every year. No setting = the report decides: `automatic` says how, per country, as far as the security alone tells (Canada: the class; US: whether its dividends can qualify, which the report then decides per dividend from the holding period).","tags":["analytics"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"securities":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"name":{"type":["string","null"]},"exchange":{"type":["string","null"]},"dividends":{"type":"number","description":"Dividends the workspace holds for it"},"lastDividendDate":{"type":["string","null"]},"settings":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string","enum":["US","CA"]},"year":{"description":"null = every year","type":["number","null"]},"treatment":{"type":"string","enum":["eligible","non_eligible","ordinary","qualified","not_qualified"]},"qualifiedPercent":{"description":"US qualified: null = all of it","type":["number","null"]}},"required":["country","year","treatment","qualifiedPercent"],"additionalProperties":false}},"automatic":{"type":"object","properties":{"CA":{"type":"object","properties":{"class":{"type":"string","enum":["eligible","ca_fund","unknown_issuer","foreign"]},"label":{"type":"string","description":"How it is taxed, in two or three words"},"detail":{"type":"string","description":"Why, and what can be set"}},"required":["class","label","detail"],"additionalProperties":false},"US":{"type":"object","properties":{"reading":{"type":"string","enum":["can_qualify","in_doubt","not_assessed"],"description":"can_qualify: decided per dividend by the holding period and hedges; in_doubt: the issuer can't be confirmed, ordinary income; not_assessed: not company stock or no ISIN, ordinary income"},"reason":{"type":"string","enum":["industry","no_treaty","otc_receipt","reit","no_isin","not_stock"]},"label":{"type":"string"},"detail":{"type":"string"},"brokerLabels":{"type":"object","properties":{"qualified":{"type":"number"},"notQualified":{"type":"number"},"unlabelled":{"type":"number"}},"required":["qualified","notQualified","unlabelled"],"additionalProperties":false,"description":"The broker's own label on the dividends held: a labelled one follows it"},"brokerNote":{"type":["string","null"]}},"required":["reading","label","detail","brokerLabels","brokerNote"],"additionalProperties":false}},"required":["CA","US"],"additionalProperties":false,"description":"What the report does with no setting, as far as the security alone tells"}},"required":["securityId","ticker","name","exchange","dividends","lastDividendDate","settings","automatic"],"additionalProperties":false}}},"required":["securities"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putAnalyticsDividendTaxSettings","summary":"Sets how one security's dividends are taxed in one country's tax report ({ securityId, country, year?, treatment, qualifiedPercent? }): for every year, or for one tax year, which wins for that year","description":"Sets how one security's dividends are taxed in one country's tax report ({ securityId, country, year?, treatment, qualifiedPercent? }): for every year, or for one tax year, which wins for that year. qualifiedPercent (US qualified only) is the share of each dividend that is qualified, as a fund's 1099-DIV gives it. treatment null removes that setting. It wins over the report's own reading and a broker's label. 400 TREATMENT_NOT_OF_COUNTRY, PERCENT_NEEDS_QUALIFIED, 404 SECURITY_NOT_FOUND. Returns the list.","tags":["analytics"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"securityId":{"type":"string","minLength":1},"country":{"type":"string","enum":["US","CA"]},"year":{"description":"The tax year it is for; null or absent = every year","anyOf":[{"type":"integer","minimum":1990,"maximum":2200},{"type":"null"}]},"treatment":{"anyOf":[{"type":"string","enum":["eligible","non_eligible","ordinary","qualified","not_qualified"]},{"type":"null"}],"description":"null removes the setting"},"qualifiedPercent":{"description":"US qualified only: the share of each dividend that is qualified","anyOf":[{"type":"number","exclusiveMinimum":0,"maximum":100},{"type":"null"}]}},"required":["securityId","country","treatment"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"securities":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"name":{"type":["string","null"]},"exchange":{"type":["string","null"]},"dividends":{"type":"number","description":"Dividends the workspace holds for it"},"lastDividendDate":{"type":["string","null"]},"settings":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string","enum":["US","CA"]},"year":{"description":"null = every year","type":["number","null"]},"treatment":{"type":"string","enum":["eligible","non_eligible","ordinary","qualified","not_qualified"]},"qualifiedPercent":{"description":"US qualified: null = all of it","type":["number","null"]}},"required":["country","year","treatment","qualifiedPercent"],"additionalProperties":false}},"automatic":{"type":"object","properties":{"CA":{"type":"object","properties":{"class":{"type":"string","enum":["eligible","ca_fund","unknown_issuer","foreign"]},"label":{"type":"string","description":"How it is taxed, in two or three words"},"detail":{"type":"string","description":"Why, and what can be set"}},"required":["class","label","detail"],"additionalProperties":false},"US":{"type":"object","properties":{"reading":{"type":"string","enum":["can_qualify","in_doubt","not_assessed"],"description":"can_qualify: decided per dividend by the holding period and hedges; in_doubt: the issuer can't be confirmed, ordinary income; not_assessed: not company stock or no ISIN, ordinary income"},"reason":{"type":"string","enum":["industry","no_treaty","otc_receipt","reit","no_isin","not_stock"]},"label":{"type":"string"},"detail":{"type":"string"},"brokerLabels":{"type":"object","properties":{"qualified":{"type":"number"},"notQualified":{"type":"number"},"unlabelled":{"type":"number"}},"required":["qualified","notQualified","unlabelled"],"additionalProperties":false,"description":"The broker's own label on the dividends held: a labelled one follows it"},"brokerNote":{"type":["string","null"]}},"required":["reading","label","detail","brokerLabels","brokerNote"],"additionalProperties":false}},"required":["CA","US"],"additionalProperties":false,"description":"What the report does with no setting, as far as the security alone tells"}},"required":["securityId","ticker","name","exchange","dividends","lastDividendDate","settings","automatic"],"additionalProperties":false}}},"required":["securities"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/analytics/year-end-values":{"get":{"operationId":"getAnalyticsYearEndValues","summary":"The user's own values of option contracts on a day (their 1099-B, their broker's year-end statement), one year's with `year` or all","description":"The user's own values of option contracts on a day (their 1099-B, their broker's year-end statement), one year's with `year` or all. The tax report uses one where no market close is stored for the year's last trading day (an index option's year-end mark, a straddle's open gain) and says \"your value\".","tags":["analytics"],"parameters":[{"name":"year","in":"query","required":false,"schema":{"type":"integer","minimum":1990,"maximum":2200}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"optionRoot":{"type":"string","description":"The contract's root when the underlying has several; else empty"},"date":{"type":"string","description":"The day the value is for"},"value":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"currency":{"type":"string"}},"required":["securityId","ticker","optionType","strike","expiration","optionRoot","date","value","currency"],"additionalProperties":false}}},"required":["values"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"put":{"operationId":"putAnalyticsYearEndValues","summary":"Sets what one option contract was worth on one day ({ securityId of the underlying, optionType, strike, expiration, optionRoot?, date, value, currency? }; value per share of the underlying, as quoted)","description":"Sets what one option contract was worth on one day ({ securityId of the underlying, optionType, strike, expiration, optionRoot?, date, value, currency? }; value per share of the underlying, as quoted). value null removes it. 400 VALUE_AFTER_EXPIRATION, 404 SECURITY_NOT_FOUND. Returns the list.","tags":["analytics"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"securityId":{"type":"string","minLength":1},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number","exclusiveMinimum":0},"expiration":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"optionRoot":{"type":"string","maxLength":12},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"value":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["securityId","optionType","strike","expiration","date","value"],"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"optionRoot":{"type":"string","description":"The contract's root when the underlying has several; else empty"},"date":{"type":"string","description":"The day the value is for"},"value":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"currency":{"type":"string"}},"required":["securityId","ticker","optionType","strike","expiration","optionRoot","date","value","currency"],"additionalProperties":false}}},"required":["values"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/analytics/tax-report/{reportId}":{"get":{"operationId":"getAnalyticsTaxReportReportId","summary":"A tax report made earlier, by its reportId","description":"A tax report made earlier, by its reportId. 410 REPORT_EXPIRED once it is gone: make it again.","tags":["analytics"],"x-not-for-mcp":"the tool's report is not kept (it asks with keep false, so it only reads): there is none to get, and its answer is the whole report","parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"object","properties":{"year":{"type":"number"},"quarter":{"type":"string","enum":["FULL_YEAR","Q1","Q2","Q3","Q4"]},"baseIncome":{"type":"number"},"country":{"type":"string","enum":["US","CA"]},"accountingMethod":{"type":"string","enum":["FIFO","ACB"]},"accountIds":{"type":"array","items":{"type":"string"},"description":"Every account the report read, and no other"},"taxableAccountIds":{"type":"array","items":{"type":"string"},"description":"Of those, the taxed ones"},"shelteredAccountIds":{"type":"array","items":{"type":"string"},"description":"Of those, the sheltered ones: not taxed, read as wash-sale replacements"},"canadaCapitalGainsInclusionRate":{"type":"number"},"elections":{"type":"object","properties":{"canadianSecurities":{"type":"boolean"},"identifiedStraddles":{"type":"boolean"},"traderMarkToMarket":{"type":"boolean"}},"additionalProperties":false}},"required":["year","quarter","baseIncome","country","accountingMethod","accountIds","taxableAccountIds","shelteredAccountIds","canadaCapitalGainsInclusionRate"],"additionalProperties":false},"aggregatedData":{"type":"object","properties":{"totalDividendsUSD":{"type":"number"},"totalDividendsCAD":{"type":"number"},"shortTermCapitalGainsUSD":{"type":"number"},"shortTermCapitalGainsCAD":{"type":"number"},"longTermCapitalGainsUSD":{"type":"number"},"longTermCapitalGainsCAD":{"type":"number"},"totalCapitalLossesUSD":{"type":"number"},"totalCapitalLossesCAD":{"type":"number"},"longTermCapitalLossesUSD":{"description":"US: the long-term part of totalCapitalLosses; the rest is short-term","type":"number"},"longTermCapitalLossesCAD":{"type":"number"},"incomeAccountNetUSD":{"type":"number"},"incomeAccountNetCAD":{"description":"Canada: the net result on income account (short sales of shares); can be negative","type":"number"},"washSaleDisallowedTotalUSD":{"type":"number"},"washSaleDisallowedTotalCAD":{"type":"number"},"straddleDeferredTotalUSD":{"description":"US: losses of the period deferred to the next year by the straddle rules","type":"number"},"straddleDeferredTotalCAD":{"type":"number"},"netShortTermGainsUSD":{"type":"number"},"netShortTermGainsCAD":{"type":"number"},"netLongTermGainsUSD":{"type":"number"},"netLongTermGainsCAD":{"type":"number"},"capitalLossCarryforwardUSD":{"type":"number"},"capitalLossCarryforwardCAD":{"type":"number"},"eligibleDividendsCAD":{"type":"number"},"nonEligibleDividendsCAD":{"type":"number"},"qualifiedDividendsUSD":{"type":"number"}},"required":["totalDividendsUSD","totalDividendsCAD","shortTermCapitalGainsUSD","shortTermCapitalGainsCAD","longTermCapitalGainsUSD","longTermCapitalGainsCAD","totalCapitalLossesUSD","totalCapitalLossesCAD","washSaleDisallowedTotalUSD","washSaleDisallowedTotalCAD","netShortTermGainsUSD","netShortTermGainsCAD","netLongTermGainsUSD","netLongTermGainsCAD","capitalLossCarryforwardUSD","capitalLossCarryforwardCAD","eligibleDividendsCAD","qualifiedDividendsUSD"],"additionalProperties":false},"taxBreakdown":{"type":"object","properties":{"taxOnBaseIncome":{"type":"number"},"taxOnDividends":{"type":"number"},"eligibleDividendGrossUp":{"type":"number"},"nonEligibleDividendGrossUp":{"type":"number"},"dividendTaxCredit":{"type":"number"},"taxOnQualifiedDividends":{"type":"number"},"taxOnShortTermGains":{"type":"number"},"taxOnLongTermGains":{"type":"number"},"taxOnIncomeAccount":{"description":"CA: the tax the income-account result adds; negative for a net loss","type":"number"},"taxableIncome":{"type":"number"},"foreignTaxCredit":{"type":"number"},"totalEstimatedTax":{"type":"number"},"effectiveRate":{"type":"number"}},"required":["taxOnBaseIncome","taxOnDividends","taxOnShortTermGains","taxOnLongTermGains","totalEstimatedTax","effectiveRate"],"additionalProperties":false},"bracketsUsed":{"type":"array","items":{"type":"object","properties":{"bracket":{"type":"string"},"rate":{"type":"number"}},"required":["bracket","rate"],"additionalProperties":false}},"explanations":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"},"description":"What the estimate leaves out"},"foreignTax":{"description":"The withholding brokers reported and the credit from it (null: none in the period)","anyOf":[{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":"string"},"dividendTradeIds":{"type":"array","items":{"type":"string"}},"linked":{"type":"boolean"},"grossDividends":{"type":"number"},"withheld":{"type":"number"},"above15":{"type":"number"}},"required":["accountId","ticker","dividendTradeIds","linked","grossDividends","withheld","above15"],"additionalProperties":false}},"unmatched":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":["string","null"]},"withheld":{"type":"number"}},"required":["accountId","ticker","withheld"],"additionalProperties":false}},"foreignIncome":{"type":"number"},"withheld":{"type":"number"},"creditable":{"type":"number"},"withholdingAbove15":{"type":"number"},"limit":{"type":"number"},"credit":{"type":"number"}},"required":["groups","unmatched","foreignIncome","withheld","creditable","withholdingAbove15","limit","credit"],"additionalProperties":false},{"type":"null"}]},"taxLots":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"openDate":{"type":"string"},"closeDate":{"type":"string"},"holdingPeriodDays":{"type":"number"},"term":{"description":"US: the term a rule sets, whatever the days held; absent, the days decide","type":"string","enum":["short","long"]},"termReason":{"description":"Which rule set the term: an option sold, a short sale covered by a purchase, a straddle loss against a long-term position, a qualified call's loss with the shares long-term","type":"string","enum":["written_option","short_sale","straddle_loss","qualified_call_loss","short_against_long_term"]},"realizedDate":{"description":"US: the day the result counts on when not the close (a short covered at a loss: its settlement day)","type":"string"},"quantity":{"type":"number"},"adjustedQuantity":{"type":"number"},"costBasisUSD":{"type":"number"},"costBasisCAD":{"type":"number"},"proceedsUSD":{"type":"number"},"proceedsCAD":{"type":"number"},"realizedGainUSD":{"type":"number"},"realizedGainCAD":{"type":"number"},"tag":{"type":"string","enum":["DIVIDEND","STCG","LTCG","CG","CAPITAL_LOSS","INCOME","SEC_1256"]},"straddleHolding":{"description":"US: a straddle reset this lot's holding period, or a qualified call sold in the money paused it","type":"object","properties":{"rule":{"type":"string","enum":["reset","paused"]},"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"},"pausedDays":{"type":"number"},"pausedBy":{"type":"string"},"assumedCoverage":{"type":"boolean"}},"required":["rule","daysBefore"],"additionalProperties":false},"shortSaleHolding":{"description":"US: a short sale of the same shares restarted this lot's holding period (IRC 1233(b))","type":"object","properties":{"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"}},"required":["daysBefore","since","by"],"additionalProperties":false},"straddleDeferredUSD":{"description":"US: the part of this loss deferred to the next year by the straddle rules","type":"number"},"straddleDeferredCAD":{"type":"number"},"straddleToBasisUSD":{"description":"US, identified straddles: this loss is not taken; it went into the offsetting positions' cost","type":"number"},"straddleToBasisCAD":{"type":"number"},"straddleBasisAdjUSD":{"description":"US, identified straddles: a loss on an offsetting position added to this lot's cost","type":"number"},"straddleBasisAdjCAD":{"type":"number"},"straddleDeferralUnknown":{"description":"The whole loss is held back: no year-end price for what offset it","type":"boolean"},"straddleCarriedFrom":{"description":"A loss of an earlier year, deferred then, taken in this one","type":"object","properties":{"closeDate":{"type":"string"},"year":{"type":"number"}},"required":["closeDate","year"],"additionalProperties":false},"section1256":{"description":"US: an option on a broad-based index: 60% long-term, 40% short-term, marked at the year's end","type":"boolean"},"yearStartMark":{"description":"US §1256: the value on the year before's last trading day, where this year's result starts","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"yearEndMark":{"description":"US §1256: still open at the year's end, taxed as if sold at this value","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"incomeAccount":{"description":"On income account (tag INCOME): taxed whole, in no capital bucket (Canada: a short sale; US: a trader's 475(f) election)","type":"boolean"},"markToMarket475":{"description":"US: marked to market under the trader's election (IRC 475(f)): ordinary, taxed at the year's end when open","type":"boolean"},"assumedShort":{"description":"A short sale the engine assumed: the broker didn't mark it, you didn't confirm it","type":"boolean"},"shortSaleAccount":{"description":"Canada: which account a short sale of shares is on, and why","type":"string","enum":["income","election_39_4","hedge"]},"isWashSale":{"type":"boolean"},"washSaleDisallowedUSD":{"type":"number"},"washSaleDisallowedCAD":{"type":"number"},"washSaleCostBasisAdjUSD":{"type":"number"},"washSaleCostBasisAdjCAD":{"type":"number"},"washSaleHoldingDays":{"description":"US: days of the shares sold at a loss, inside holdingPeriodDays","type":"number"},"washSaleCarriedFrom":{"description":"The earlier losses inside washSaleCostBasisAdj: each loss's sale day and its part","type":"array","items":{"type":"object","properties":{"lossDate":{"type":"string"},"ticker":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["lossDate","ticker","usd","cad"],"additionalProperties":false}},"washSaleCoveredQty":{"description":"ACB: shares of this loss the pool found replaced","type":"number"},"washSaleSheltered":{"description":"ACB: the part replaced in sheltered accounts of the report, per purchase","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"quantity":{"type":"number"},"date":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","quantity","date","usd","cad"],"additionalProperties":false}},"washSaleReplacement":{"type":"string"},"washSalePermanentlyDenied":{"type":"boolean"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"isBoundary":{"description":"A prior-year lot kept only for the wash-sale carry-forward","type":"boolean"},"notes":{"type":"array","items":{"type":"string"}},"fxRate":{"type":"number"},"allocationTradeId":{"type":"string"}},"required":["groupId","accountId","ticker","securityId","side","openDate","closeDate","holdingPeriodDays","quantity","costBasisUSD","costBasisCAD","proceedsUSD","proceedsCAD","realizedGainUSD","realizedGainCAD","tag"],"additionalProperties":false}},"dividendLots":{"type":"array","items":{"type":"object","properties":{"tradeId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"date":{"type":"string"},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"dividendType":{"description":"regular, roc or trust","type":"string"},"securityId":{"type":"string"},"qualified":{"type":["boolean","null"]},"qualifiedStatus":{"type":"string","enum":["override","broker","held","partly","not_held","pending","issuer_unsure","hedged","period_unsure","not_assessed"]},"qualifiedShare":{"type":"number"},"qualifiedPendingUntil":{"type":"string"},"qualifiedDoubt":{"type":"string","enum":["industry","no_treaty","otc_receipt","reit","option","preferred_period"]},"dividendClass":{"type":"string","enum":["eligible","ca_fund","unknown_issuer","foreign","non_eligible","ordinary"]},"treatmentSetByUser":{"type":"boolean"}},"required":["tradeId","accountId","ticker","date","amountUSD","amountCAD"],"additionalProperties":false}},"transferAudit":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"securityId":{"type":"string"},"quantity":{"type":"number"},"transferOutDate":{"type":"string"},"transferInDate":{"type":"string"},"sourceAccountId":{"type":"string"},"destAccountId":{"type":"string"},"transferPairId":{"type":"string"},"appAcbUSD":{"type":"number"},"appAcbCAD":{"type":"number"},"hasUnknownCostBasis":{"type":"boolean"},"optionType":{"type":["string","null"]}},"required":["ticker","securityId","quantity","transferPairId","hasUnknownCostBasis"],"additionalProperties":false}},"unresolvableGroups":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"ticker":{"type":"string"},"accountId":{"type":"string"},"side":{"type":"string"},"openDate":{"type":"string"},"closeDate":{"type":"string"},"quantity":{"type":"number"},"bookValueUSD":{"type":"number"},"bookValueCAD":{"type":"number"},"reason":{"type":"string"},"actionRequired":{"type":"string"}},"required":["groupId","ticker","accountId","openDate","reason","actionRequired"],"additionalProperties":false}},"flags":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["cross_year_assignment","unknown_cost_basis","cross_year_wash_sale","replacement_registered_account","superficial_call_then_shares","short_sale_wash_sale","short_sale_assumed_not_checked","short_sale_loss_reshorted","constructive_sale","synthetic_disposition","straddle_loss_pending","straddle_close_missing","section_1256_mark_missing","mark_to_market_missing","mixed_straddle_possible","section_1256_by_definition","wash_sale_put_itm","wash_sale_written_option","premium_unmatched","ungrouped_trades","ca_fund_distribution","dividend_issuer_unknown","withholding_unmatched","dividend_paid_on_short","dividend_looks_net","broker_cost_basis","qualified_dividend_pending","qualified_dividend_unconfirmed"]},"ticker":{"type":"string"},"details":{"type":"string"},"actionRequired":{"type":"string"},"taxYear":{"type":"number"}},"required":["type","ticker","details","actionRequired"],"additionalProperties":false}},"commissions":{"type":"object","properties":{"totalUSD":{"type":"number"},"totalCAD":{"type":"number"},"rows":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ticker":{"type":"string"},"trades":{"type":"number"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","ticker","trades","usd","cad"],"additionalProperties":false}}},"required":["totalUSD","totalCAD","rows"],"additionalProperties":false},"assignedContracts":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"securityId":{"type":"string"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"premiumUSD":{"type":"number"},"premiumCAD":{"type":"number"},"assignmentDate":{"type":"string"},"stockTicker":{"type":"string"},"sharesAssigned":{"type":"number"}},"required":["ticker","securityId","optionType","strike","expiration","premiumUSD","premiumCAD","assignmentDate","stockTicker","sharesAssigned"],"additionalProperties":false}},"securityFamilyMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"securityId → the canonical securityId of its same-company family"},"comparisonResults":{"description":"With broker files: each file compared with the report","type":"array","items":{"type":"object","properties":{"fileName":{"type":"string"},"broker":{"type":"string"},"documentType":{"type":"string"},"entries":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","description":"\"MSTR\" or \"MSTR|put|300|2025-12-19\""},"brokerGL":{"type":"number"},"appGL":{"type":"number"},"delta":{"type":"number"},"category":{"type":"string"},"explanation":{"type":"string"}},"required":["asset","brokerGL","appGL","delta","category","explanation"],"additionalProperties":false}},"totalBrokerGL":{"type":"number"},"totalAppGL":{"type":"number"},"totalDelta":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"warnings":{"type":"array","items":{"type":"string"}}},"required":["fileName","broker","documentType","entries","totalBrokerGL","totalAppGL","totalDelta","currency","warnings"],"additionalProperties":false}},"reportId":{"description":"Kept for a while: GET /v1/analytics/tax-report/:reportId, the export. Absent when asked with keep false","type":"string"}},"required":["inputs","aggregatedData","taxBreakdown","bracketsUsed","explanations","notes","taxLots","dividendLots","transferAudit","unresolvableGroups","flags","commissions","assignedContracts","securityFamilyMap"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/compare":{"post":{"operationId":"postAnalyticsTaxReportCompare","summary":"Compares a broker's T5008 (PDF, multipart field `pdf`) with the app's report for its year and the accounts: per-ticker gains, the differences and their likely causes","description":"Compares a broker's T5008 (PDF, multipart field `pdf`) with the app's report for its year and the accounts: per-ticker gains, the differences and their likely causes.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's PDF"},"broker":{"description":"The broker's slug (default: detected)","type":"string"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"baseIncome":{"description":"Other income for the year (default 0)","type":"string"},"country":{"description":"Default CA","type":"string","enum":["US","CA"]},"accountIds":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"The accounts the document covers: a repeated field, a JSON array or a comma-separated list"}},"required":["pdf","accountIds"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["broker","taxYear","entries","skipped","warnings"],"additionalProperties":false},"comparison":{"type":"object","properties":{"totalBrokerGL_USD":{"type":"number"},"totalAppGL_USD":{"type":"number"},"totalDeltaUSD":{"type":"number"},"totalBrokerGL_CAD":{"type":"number"},"totalAppGL_CAD":{"type":"number"},"totalDeltaCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"broker":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"entries":{"type":"number"},"types":{"type":"array","items":{"type":"string"}}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","entries","types"],"additionalProperties":false},"app":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"lots":{"type":"number"}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","lots"],"additionalProperties":false},"deltaUSD":{"type":"number"},"deltaCAD":{"type":"number"},"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"explanation":{"type":"string"},"brokerEntries":{"type":"array","items":{"type":"object","properties":{"entryIndex":{"type":"number"},"pageNumber":{"type":"number"},"ticker":{"type":"string"},"tickerConfidence":{"type":"number"},"date":{"type":"string"},"quantity":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"costBasis":{"type":"number"},"proceeds":{"type":"number"},"faceAmount":{"type":"number"},"securityType":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"cusip":{"type":"string"},"brokerDescription":{"type":"string"},"notes":{"type":"string"},"resolvedTicker":{"type":"string","description":"The ticker the entry was matched as (its CUSIP or its own)"}},"required":["entryIndex","pageNumber","ticker","tickerConfidence","date","quantity","currency","costBasis","proceeds","faceAmount","securityType","brokerDescription","resolvedTicker"],"additionalProperties":false}},"appLots":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"openDate":{"type":"string"},"closeDate":{"type":"string"},"holdingPeriodDays":{"type":"number"},"term":{"description":"US: the term a rule sets, whatever the days held; absent, the days decide","type":"string","enum":["short","long"]},"termReason":{"description":"Which rule set the term: an option sold, a short sale covered by a purchase, a straddle loss against a long-term position, a qualified call's loss with the shares long-term","type":"string","enum":["written_option","short_sale","straddle_loss","qualified_call_loss","short_against_long_term"]},"realizedDate":{"description":"US: the day the result counts on when not the close (a short covered at a loss: its settlement day)","type":"string"},"quantity":{"type":"number"},"adjustedQuantity":{"type":"number"},"costBasisUSD":{"type":"number"},"costBasisCAD":{"type":"number"},"proceedsUSD":{"type":"number"},"proceedsCAD":{"type":"number"},"realizedGainUSD":{"type":"number"},"realizedGainCAD":{"type":"number"},"tag":{"type":"string","enum":["DIVIDEND","STCG","LTCG","CG","CAPITAL_LOSS","INCOME","SEC_1256"]},"straddleHolding":{"description":"US: a straddle reset this lot's holding period, or a qualified call sold in the money paused it","type":"object","properties":{"rule":{"type":"string","enum":["reset","paused"]},"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"},"pausedDays":{"type":"number"},"pausedBy":{"type":"string"},"assumedCoverage":{"type":"boolean"}},"required":["rule","daysBefore"],"additionalProperties":false},"shortSaleHolding":{"description":"US: a short sale of the same shares restarted this lot's holding period (IRC 1233(b))","type":"object","properties":{"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"}},"required":["daysBefore","since","by"],"additionalProperties":false},"straddleDeferredUSD":{"description":"US: the part of this loss deferred to the next year by the straddle rules","type":"number"},"straddleDeferredCAD":{"type":"number"},"straddleToBasisUSD":{"description":"US, identified straddles: this loss is not taken; it went into the offsetting positions' cost","type":"number"},"straddleToBasisCAD":{"type":"number"},"straddleBasisAdjUSD":{"description":"US, identified straddles: a loss on an offsetting position added to this lot's cost","type":"number"},"straddleBasisAdjCAD":{"type":"number"},"straddleDeferralUnknown":{"description":"The whole loss is held back: no year-end price for what offset it","type":"boolean"},"straddleCarriedFrom":{"description":"A loss of an earlier year, deferred then, taken in this one","type":"object","properties":{"closeDate":{"type":"string"},"year":{"type":"number"}},"required":["closeDate","year"],"additionalProperties":false},"section1256":{"description":"US: an option on a broad-based index: 60% long-term, 40% short-term, marked at the year's end","type":"boolean"},"yearStartMark":{"description":"US §1256: the value on the year before's last trading day, where this year's result starts","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"yearEndMark":{"description":"US §1256: still open at the year's end, taxed as if sold at this value","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"incomeAccount":{"description":"On income account (tag INCOME): taxed whole, in no capital bucket (Canada: a short sale; US: a trader's 475(f) election)","type":"boolean"},"markToMarket475":{"description":"US: marked to market under the trader's election (IRC 475(f)): ordinary, taxed at the year's end when open","type":"boolean"},"assumedShort":{"description":"A short sale the engine assumed: the broker didn't mark it, you didn't confirm it","type":"boolean"},"shortSaleAccount":{"description":"Canada: which account a short sale of shares is on, and why","type":"string","enum":["income","election_39_4","hedge"]},"isWashSale":{"type":"boolean"},"washSaleDisallowedUSD":{"type":"number"},"washSaleDisallowedCAD":{"type":"number"},"washSaleCostBasisAdjUSD":{"type":"number"},"washSaleCostBasisAdjCAD":{"type":"number"},"washSaleHoldingDays":{"description":"US: days of the shares sold at a loss, inside holdingPeriodDays","type":"number"},"washSaleCarriedFrom":{"description":"The earlier losses inside washSaleCostBasisAdj: each loss's sale day and its part","type":"array","items":{"type":"object","properties":{"lossDate":{"type":"string"},"ticker":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["lossDate","ticker","usd","cad"],"additionalProperties":false}},"washSaleCoveredQty":{"description":"ACB: shares of this loss the pool found replaced","type":"number"},"washSaleSheltered":{"description":"ACB: the part replaced in sheltered accounts of the report, per purchase","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"quantity":{"type":"number"},"date":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","quantity","date","usd","cad"],"additionalProperties":false}},"washSaleReplacement":{"type":"string"},"washSalePermanentlyDenied":{"type":"boolean"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"isBoundary":{"description":"A prior-year lot kept only for the wash-sale carry-forward","type":"boolean"},"notes":{"type":"array","items":{"type":"string"}},"fxRate":{"type":"number"},"allocationTradeId":{"type":"string"}},"required":["groupId","accountId","ticker","securityId","side","openDate","closeDate","holdingPeriodDays","quantity","costBasisUSD","costBasisCAD","proceedsUSD","proceedsCAD","realizedGainUSD","realizedGainCAD","tag"],"additionalProperties":false}}},"required":["ticker","broker","app","deltaUSD","deltaCAD","category","explanation","brokerEntries","appLots"],"additionalProperties":false}},"deltaBreakdown":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"string"}}},"required":["category","amountUSD","amountCAD","tickers"],"additionalProperties":false}},"brokerEntriesCount":{"type":"number"},"appLotsCount":{"type":"number"},"matchedTickers":{"type":"number"},"divergedTickers":{"type":"number"},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]},"taxYear":{"type":"number"},"country":{"type":"string"},"compareTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","compareTimeMs"],"additionalProperties":false}},"required":["totalBrokerGL_USD","totalAppGL_USD","totalDeltaUSD","totalBrokerGL_CAD","totalAppGL_CAD","totalDeltaCAD","tickers","deltaBreakdown","brokerEntriesCount","appLotsCount","matchedTickers","divergedTickers","warnings","meta"],"additionalProperties":false}},"required":["parse","comparison"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/compare-gl":{"post":{"operationId":"postAnalyticsTaxReportCompareGl","summary":"Compares a broker's gains & losses report (PDF, field `pdf`) for one account with the app's report: per-ticker gains in CAD and the differences","description":"Compares a broker's gains & losses report (PDF, field `pdf`) for one account with the app's report: per-ticker gains in CAD and the differences.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's PDF"},"broker":{"description":"The broker's slug (default: detected)","type":"string"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"baseIncome":{"description":"Other income for the year (default 0)","type":"string"},"country":{"description":"Default CA","type":"string","enum":["US","CA"]},"accountId":{"type":"string","description":"The account the document is for"}},"required":["pdf","accountId"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"resolutionStats":{"type":"object","properties":{"total":{"type":"number"},"regexOption":{"type":"number"},"cached":{"type":"number"},"unresolved":{"type":"number"}},"required":["total","regexOption","cached","unresolved"],"additionalProperties":false}},"required":["broker","taxYear","entries","skipped","warnings","periodStart","periodEnd","unresolvedDescriptions","resolutionStats"],"additionalProperties":false},"comparison":{"type":"object","properties":{"totalBrokerGL_CAD":{"type":"number"},"totalAppGL_CAD":{"type":"number"},"totalDeltaCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"brokerGLCAD":{"type":"number"},"brokerEntries":{"type":"number"},"appGLCAD":{"type":"number"},"appLots":{"type":"number"},"deltaCAD":{"type":"number"},"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"explanation":{"type":"string"}},"required":["ticker","brokerGLCAD","brokerEntries","appGLCAD","appLots","deltaCAD","category","explanation"],"additionalProperties":false}},"deltaBreakdown":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"string"}}},"required":["category","amountUSD","amountCAD","tickers"],"additionalProperties":false}},"brokerEntriesCount":{"type":"number"},"appLotsCount":{"type":"number"},"matchedTickers":{"type":"number"},"divergedTickers":{"type":"number"},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","const":"gains_losses_pdf"},"taxYear":{"type":"number"},"country":{"type":"string"},"compareTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","compareTimeMs"],"additionalProperties":false}},"required":["totalBrokerGL_CAD","totalAppGL_CAD","totalDeltaCAD","tickers","deltaBreakdown","brokerEntriesCount","appLotsCount","matchedTickers","divergedTickers","unresolvedDescriptions","warnings","meta"],"additionalProperties":false}},"required":["parse","comparison"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/reconcile-trading-summary":{"post":{"operationId":"postAnalyticsTaxReportReconcileTradingSummary","summary":"Matches a broker's trading summary (PDF, field `pdf`) for one account with the app's trades, transaction by transaction: exact, price mismatch, or on one side only","description":"Matches a broker's trading summary (PDF, field `pdf`) for one account with the app's trades, transaction by transaction: exact, price mismatch, or on one side only.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's PDF"},"broker":{"description":"The broker's slug (default: detected)","type":"string"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"accountId":{"type":"string","description":"The account the document is for"}},"required":["pdf","accountId"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"resolutionStats":{"type":"object","properties":{"total":{"type":"number"},"regexOption":{"type":"number"},"cached":{"type":"number"},"unresolved":{"type":"number"}},"required":["total","regexOption","cached","unresolved"],"additionalProperties":false}},"required":["broker","taxYear","entries","skipped","warnings","periodStart","periodEnd","unresolvedDescriptions","resolutionStats"],"additionalProperties":false},"reconciliation":{"type":"object","properties":{"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"brokerTransactions":{"type":"number"},"appTrades":{"type":"number"},"exact":{"type":"number"},"priceMismatch":{"type":"number"},"brokerOnly":{"type":"number"},"appOnly":{"type":"number"},"matches":{"type":"array","items":{"type":"object","properties":{"brokerEntry":{"type":"object","properties":{"entryIndex":{"type":"number"},"pageNumber":{"type":"number"},"ticker":{"type":"string"},"securityId":{"type":"string"},"tickerConfidence":{"type":"number"},"date":{"type":"string"},"direction":{"type":"string","enum":["buy","sell"]},"quantity":{"type":"number"},"price":{"type":"number"},"amount":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"brokerDescription":{"type":"string"},"resolutionMethod":{"type":"string"}},"required":["entryIndex","pageNumber","ticker","tickerConfidence","date","direction","quantity","price","amount","currency","brokerDescription"],"additionalProperties":false},"appTrade":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string"},"ticker":{"type":"string"},"quantity":{"type":"number"},"price":{"type":"number"},"tradeType":{"type":"string"},"currency":{"type":"string"}},"required":["id","date","ticker","quantity","price","tradeType","currency"],"additionalProperties":false},"matchType":{"type":"string","enum":["exact","price_mismatch","broker_only","app_only"]},"priceDelta":{"type":"number"},"amountDelta":{"type":"number"},"explanation":{"type":"string"}},"required":["matchType","explanation"],"additionalProperties":false}}},"required":["ticker","brokerTransactions","appTrades","exact","priceMismatch","brokerOnly","appOnly","matches"],"additionalProperties":false}},"totalBrokerTransactions":{"type":"number"},"totalAppTrades":{"type":"number"},"totalExact":{"type":"number"},"totalPriceMismatch":{"type":"number"},"totalMissingInApp":{"type":"number"},"totalMissingInBroker":{"type":"number"},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","const":"trading_summary"},"taxYear":{"type":"number"},"country":{"type":"string"},"reconcileTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","reconcileTimeMs"],"additionalProperties":false}},"required":["tickers","totalBrokerTransactions","totalAppTrades","totalExact","totalPriceMismatch","totalMissingInApp","totalMissingInBroker","unresolvedDescriptions","warnings","meta"],"additionalProperties":false}},"required":["parse","reconciliation"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/compare-gl-csv":{"post":{"operationId":"postAnalyticsTaxReportCompareGlCsv","summary":"Compares a broker's gains & losses worksheet (CSV, field `csv`; TastyTrade's) with the app's report for its year and the accounts","description":"Compares a broker's gains & losses worksheet (CSV, field `csv`; TastyTrade's) with the app's report for its year and the accounts.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"csv":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's CSV worksheet"},"broker":{"type":"string","description":"The broker's slug (required: a CSV doesn't say)"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"baseIncome":{"description":"Other income for the year (default 0)","type":"string"},"country":{"description":"Default US","type":"string","enum":["US","CA"]},"accountIds":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"The accounts the document covers: a repeated field, a JSON array or a comma-separated list"}},"required":["csv","broker","accountIds"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]}},"required":["broker","taxYear","entries","skipped","warnings","documentType"],"additionalProperties":false},"comparison":{"type":"object","properties":{"totalBrokerGL_USD":{"type":"number"},"totalAppGL_USD":{"type":"number"},"totalDeltaUSD":{"type":"number"},"totalBrokerGL_CAD":{"type":"number"},"totalAppGL_CAD":{"type":"number"},"totalDeltaCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"broker":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"entries":{"type":"number"},"types":{"type":"array","items":{"type":"string"}}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","entries","types"],"additionalProperties":false},"app":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"lots":{"type":"number"}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","lots"],"additionalProperties":false},"deltaUSD":{"type":"number"},"deltaCAD":{"type":"number"},"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"explanation":{"type":"string"},"brokerEntries":{"type":"array","items":{"type":"object","properties":{"entryIndex":{"type":"number"},"pageNumber":{"type":"number"},"ticker":{"type":"string"},"tickerConfidence":{"type":"number"},"date":{"type":"string"},"quantity":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"costBasis":{"type":"number"},"proceeds":{"type":"number"},"faceAmount":{"type":"number"},"securityType":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"cusip":{"type":"string"},"brokerDescription":{"type":"string"},"notes":{"type":"string"},"resolvedTicker":{"type":"string","description":"The ticker the entry was matched as (its CUSIP or its own)"}},"required":["entryIndex","pageNumber","ticker","tickerConfidence","date","quantity","currency","costBasis","proceeds","faceAmount","securityType","brokerDescription","resolvedTicker"],"additionalProperties":false}},"appLots":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"openDate":{"type":"string"},"closeDate":{"type":"string"},"holdingPeriodDays":{"type":"number"},"term":{"description":"US: the term a rule sets, whatever the days held; absent, the days decide","type":"string","enum":["short","long"]},"termReason":{"description":"Which rule set the term: an option sold, a short sale covered by a purchase, a straddle loss against a long-term position, a qualified call's loss with the shares long-term","type":"string","enum":["written_option","short_sale","straddle_loss","qualified_call_loss","short_against_long_term"]},"realizedDate":{"description":"US: the day the result counts on when not the close (a short covered at a loss: its settlement day)","type":"string"},"quantity":{"type":"number"},"adjustedQuantity":{"type":"number"},"costBasisUSD":{"type":"number"},"costBasisCAD":{"type":"number"},"proceedsUSD":{"type":"number"},"proceedsCAD":{"type":"number"},"realizedGainUSD":{"type":"number"},"realizedGainCAD":{"type":"number"},"tag":{"type":"string","enum":["DIVIDEND","STCG","LTCG","CG","CAPITAL_LOSS","INCOME","SEC_1256"]},"straddleHolding":{"description":"US: a straddle reset this lot's holding period, or a qualified call sold in the money paused it","type":"object","properties":{"rule":{"type":"string","enum":["reset","paused"]},"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"},"pausedDays":{"type":"number"},"pausedBy":{"type":"string"},"assumedCoverage":{"type":"boolean"}},"required":["rule","daysBefore"],"additionalProperties":false},"shortSaleHolding":{"description":"US: a short sale of the same shares restarted this lot's holding period (IRC 1233(b))","type":"object","properties":{"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"}},"required":["daysBefore","since","by"],"additionalProperties":false},"straddleDeferredUSD":{"description":"US: the part of this loss deferred to the next year by the straddle rules","type":"number"},"straddleDeferredCAD":{"type":"number"},"straddleToBasisUSD":{"description":"US, identified straddles: this loss is not taken; it went into the offsetting positions' cost","type":"number"},"straddleToBasisCAD":{"type":"number"},"straddleBasisAdjUSD":{"description":"US, identified straddles: a loss on an offsetting position added to this lot's cost","type":"number"},"straddleBasisAdjCAD":{"type":"number"},"straddleDeferralUnknown":{"description":"The whole loss is held back: no year-end price for what offset it","type":"boolean"},"straddleCarriedFrom":{"description":"A loss of an earlier year, deferred then, taken in this one","type":"object","properties":{"closeDate":{"type":"string"},"year":{"type":"number"}},"required":["closeDate","year"],"additionalProperties":false},"section1256":{"description":"US: an option on a broad-based index: 60% long-term, 40% short-term, marked at the year's end","type":"boolean"},"yearStartMark":{"description":"US §1256: the value on the year before's last trading day, where this year's result starts","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"yearEndMark":{"description":"US §1256: still open at the year's end, taxed as if sold at this value","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"incomeAccount":{"description":"On income account (tag INCOME): taxed whole, in no capital bucket (Canada: a short sale; US: a trader's 475(f) election)","type":"boolean"},"markToMarket475":{"description":"US: marked to market under the trader's election (IRC 475(f)): ordinary, taxed at the year's end when open","type":"boolean"},"assumedShort":{"description":"A short sale the engine assumed: the broker didn't mark it, you didn't confirm it","type":"boolean"},"shortSaleAccount":{"description":"Canada: which account a short sale of shares is on, and why","type":"string","enum":["income","election_39_4","hedge"]},"isWashSale":{"type":"boolean"},"washSaleDisallowedUSD":{"type":"number"},"washSaleDisallowedCAD":{"type":"number"},"washSaleCostBasisAdjUSD":{"type":"number"},"washSaleCostBasisAdjCAD":{"type":"number"},"washSaleHoldingDays":{"description":"US: days of the shares sold at a loss, inside holdingPeriodDays","type":"number"},"washSaleCarriedFrom":{"description":"The earlier losses inside washSaleCostBasisAdj: each loss's sale day and its part","type":"array","items":{"type":"object","properties":{"lossDate":{"type":"string"},"ticker":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["lossDate","ticker","usd","cad"],"additionalProperties":false}},"washSaleCoveredQty":{"description":"ACB: shares of this loss the pool found replaced","type":"number"},"washSaleSheltered":{"description":"ACB: the part replaced in sheltered accounts of the report, per purchase","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"quantity":{"type":"number"},"date":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","quantity","date","usd","cad"],"additionalProperties":false}},"washSaleReplacement":{"type":"string"},"washSalePermanentlyDenied":{"type":"boolean"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"isBoundary":{"description":"A prior-year lot kept only for the wash-sale carry-forward","type":"boolean"},"notes":{"type":"array","items":{"type":"string"}},"fxRate":{"type":"number"},"allocationTradeId":{"type":"string"}},"required":["groupId","accountId","ticker","securityId","side","openDate","closeDate","holdingPeriodDays","quantity","costBasisUSD","costBasisCAD","proceedsUSD","proceedsCAD","realizedGainUSD","realizedGainCAD","tag"],"additionalProperties":false}}},"required":["ticker","broker","app","deltaUSD","deltaCAD","category","explanation","brokerEntries","appLots"],"additionalProperties":false}},"deltaBreakdown":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"string"}}},"required":["category","amountUSD","amountCAD","tickers"],"additionalProperties":false}},"brokerEntriesCount":{"type":"number"},"appLotsCount":{"type":"number"},"matchedTickers":{"type":"number"},"divergedTickers":{"type":"number"},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]},"taxYear":{"type":"number"},"country":{"type":"string"},"compareTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","compareTimeMs"],"additionalProperties":false}},"required":["totalBrokerGL_USD","totalAppGL_USD","totalDeltaUSD","totalBrokerGL_CAD","totalAppGL_CAD","totalDeltaCAD","tickers","deltaBreakdown","brokerEntriesCount","appLotsCount","matchedTickers","divergedTickers","warnings","meta"],"additionalProperties":false}},"required":["parse","comparison"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/compare-1099b":{"post":{"operationId":"postAnalyticsTaxReportCompare1099b","summary":"Compares the 1099-B of a broker's composite 1099 (PDF, field `pdf`) with the app's report for its year and the accounts","description":"Compares the 1099-B of a broker's composite 1099 (PDF, field `pdf`) with the app's report for its year and the accounts.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's PDF"},"broker":{"description":"The broker's slug (default: detected)","type":"string"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"baseIncome":{"description":"Other income for the year (default 0)","type":"string"},"country":{"description":"Default US","type":"string","enum":["US","CA"]},"accountIds":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"The accounts the document covers: a repeated field, a JSON array or a comma-separated list"}},"required":["pdf","accountIds"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]},"pdfTotals":{"type":"object","properties":{"totalCost":{"type":"number"},"totalProceeds":{"type":"number"}},"additionalProperties":false}},"required":["broker","taxYear","entries","skipped","warnings","documentType"],"additionalProperties":false},"comparison":{"type":"object","properties":{"totalBrokerGL_USD":{"type":"number"},"totalAppGL_USD":{"type":"number"},"totalDeltaUSD":{"type":"number"},"totalBrokerGL_CAD":{"type":"number"},"totalAppGL_CAD":{"type":"number"},"totalDeltaCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"broker":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"entries":{"type":"number"},"types":{"type":"array","items":{"type":"string"}}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","entries","types"],"additionalProperties":false},"app":{"type":"object","properties":{"glUSD":{"type":"number"},"glCAD":{"type":"number"},"costUSD":{"type":"number"},"proceedsUSD":{"type":"number"},"costCAD":{"type":"number"},"proceedsCAD":{"type":"number"},"lots":{"type":"number"}},"required":["glUSD","glCAD","costUSD","proceedsUSD","costCAD","proceedsCAD","lots"],"additionalProperties":false},"deltaUSD":{"type":"number"},"deltaCAD":{"type":"number"},"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"explanation":{"type":"string"},"brokerEntries":{"type":"array","items":{"type":"object","properties":{"entryIndex":{"type":"number"},"pageNumber":{"type":"number"},"ticker":{"type":"string"},"tickerConfidence":{"type":"number"},"date":{"type":"string"},"quantity":{"type":"number"},"currency":{"type":"string","enum":["USD","CAD"]},"costBasis":{"type":"number"},"proceeds":{"type":"number"},"faceAmount":{"type":"number"},"securityType":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"cusip":{"type":"string"},"brokerDescription":{"type":"string"},"notes":{"type":"string"},"resolvedTicker":{"type":"string","description":"The ticker the entry was matched as (its CUSIP or its own)"}},"required":["entryIndex","pageNumber","ticker","tickerConfidence","date","quantity","currency","costBasis","proceeds","faceAmount","securityType","brokerDescription","resolvedTicker"],"additionalProperties":false}},"appLots":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"accountId":{"type":"string"},"ticker":{"type":"string"},"securityId":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"openDate":{"type":"string"},"closeDate":{"type":"string"},"holdingPeriodDays":{"type":"number"},"term":{"description":"US: the term a rule sets, whatever the days held; absent, the days decide","type":"string","enum":["short","long"]},"termReason":{"description":"Which rule set the term: an option sold, a short sale covered by a purchase, a straddle loss against a long-term position, a qualified call's loss with the shares long-term","type":"string","enum":["written_option","short_sale","straddle_loss","qualified_call_loss","short_against_long_term"]},"realizedDate":{"description":"US: the day the result counts on when not the close (a short covered at a loss: its settlement day)","type":"string"},"quantity":{"type":"number"},"adjustedQuantity":{"type":"number"},"costBasisUSD":{"type":"number"},"costBasisCAD":{"type":"number"},"proceedsUSD":{"type":"number"},"proceedsCAD":{"type":"number"},"realizedGainUSD":{"type":"number"},"realizedGainCAD":{"type":"number"},"tag":{"type":"string","enum":["DIVIDEND","STCG","LTCG","CG","CAPITAL_LOSS","INCOME","SEC_1256"]},"straddleHolding":{"description":"US: a straddle reset this lot's holding period, or a qualified call sold in the money paused it","type":"object","properties":{"rule":{"type":"string","enum":["reset","paused"]},"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"},"pausedDays":{"type":"number"},"pausedBy":{"type":"string"},"assumedCoverage":{"type":"boolean"}},"required":["rule","daysBefore"],"additionalProperties":false},"shortSaleHolding":{"description":"US: a short sale of the same shares restarted this lot's holding period (IRC 1233(b))","type":"object","properties":{"daysBefore":{"type":"number"},"since":{"type":"string"},"by":{"type":"string"}},"required":["daysBefore","since","by"],"additionalProperties":false},"straddleDeferredUSD":{"description":"US: the part of this loss deferred to the next year by the straddle rules","type":"number"},"straddleDeferredCAD":{"type":"number"},"straddleToBasisUSD":{"description":"US, identified straddles: this loss is not taken; it went into the offsetting positions' cost","type":"number"},"straddleToBasisCAD":{"type":"number"},"straddleBasisAdjUSD":{"description":"US, identified straddles: a loss on an offsetting position added to this lot's cost","type":"number"},"straddleBasisAdjCAD":{"type":"number"},"straddleDeferralUnknown":{"description":"The whole loss is held back: no year-end price for what offset it","type":"boolean"},"straddleCarriedFrom":{"description":"A loss of an earlier year, deferred then, taken in this one","type":"object","properties":{"closeDate":{"type":"string"},"year":{"type":"number"}},"required":["closeDate","year"],"additionalProperties":false},"section1256":{"description":"US: an option on a broad-based index: 60% long-term, 40% short-term, marked at the year's end","type":"boolean"},"yearStartMark":{"description":"US §1256: the value on the year before's last trading day, where this year's result starts","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"yearEndMark":{"description":"US §1256: still open at the year's end, taxed as if sold at this value","type":"object","properties":{"day":{"type":"string"},"close":{"type":"number","description":"Per share of the underlying, as an option's price is quoted"},"source":{"type":"string","enum":["market","yours"],"description":"The stored close, or the user's own value"}},"required":["day","close","source"],"additionalProperties":false},"incomeAccount":{"description":"On income account (tag INCOME): taxed whole, in no capital bucket (Canada: a short sale; US: a trader's 475(f) election)","type":"boolean"},"markToMarket475":{"description":"US: marked to market under the trader's election (IRC 475(f)): ordinary, taxed at the year's end when open","type":"boolean"},"assumedShort":{"description":"A short sale the engine assumed: the broker didn't mark it, you didn't confirm it","type":"boolean"},"shortSaleAccount":{"description":"Canada: which account a short sale of shares is on, and why","type":"string","enum":["income","election_39_4","hedge"]},"isWashSale":{"type":"boolean"},"washSaleDisallowedUSD":{"type":"number"},"washSaleDisallowedCAD":{"type":"number"},"washSaleCostBasisAdjUSD":{"type":"number"},"washSaleCostBasisAdjCAD":{"type":"number"},"washSaleHoldingDays":{"description":"US: days of the shares sold at a loss, inside holdingPeriodDays","type":"number"},"washSaleCarriedFrom":{"description":"The earlier losses inside washSaleCostBasisAdj: each loss's sale day and its part","type":"array","items":{"type":"object","properties":{"lossDate":{"type":"string"},"ticker":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["lossDate","ticker","usd","cad"],"additionalProperties":false}},"washSaleCoveredQty":{"description":"ACB: shares of this loss the pool found replaced","type":"number"},"washSaleSheltered":{"description":"ACB: the part replaced in sheltered accounts of the report, per purchase","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"quantity":{"type":"number"},"date":{"type":"string"},"usd":{"type":"number"},"cad":{"type":"number"}},"required":["accountId","quantity","date","usd","cad"],"additionalProperties":false}},"washSaleReplacement":{"type":"string"},"washSalePermanentlyDenied":{"type":"boolean"},"optionType":{"type":"string"},"strike":{"type":"number"},"expiration":{"type":"string"},"isBoundary":{"description":"A prior-year lot kept only for the wash-sale carry-forward","type":"boolean"},"notes":{"type":"array","items":{"type":"string"}},"fxRate":{"type":"number"},"allocationTradeId":{"type":"string"}},"required":["groupId","accountId","ticker","securityId","side","openDate","closeDate","holdingPeriodDays","quantity","costBasisUSD","costBasisCAD","proceedsUSD","proceedsCAD","realizedGainUSD","realizedGainCAD","tag"],"additionalProperties":false}}},"required":["ticker","broker","app","deltaUSD","deltaCAD","category","explanation","brokerEntries","appLots"],"additionalProperties":false}},"deltaBreakdown":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["match","fx_rounding","commission","unknown_acb","assignment_treatment","disposition_only","broker_only","app_only","broker_assignment_mismatch","unresolvable","transfer_fx_restamp","transfer_market_value","transfer_zero_cost","transfer_unexplained","broker_duplicate_close","unexplained"]},"amountUSD":{"type":"number"},"amountCAD":{"type":"number"},"tickers":{"type":"array","items":{"type":"string"}}},"required":["category","amountUSD","amountCAD","tickers"],"additionalProperties":false}},"brokerEntriesCount":{"type":"number"},"appLotsCount":{"type":"number"},"matchedTickers":{"type":"number"},"divergedTickers":{"type":"number"},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]},"taxYear":{"type":"number"},"country":{"type":"string"},"compareTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","compareTimeMs"],"additionalProperties":false}},"required":["totalBrokerGL_USD","totalAppGL_USD","totalDeltaUSD","totalBrokerGL_CAD","totalAppGL_CAD","totalDeltaCAD","tickers","deltaBreakdown","brokerEntriesCount","appLotsCount","matchedTickers","divergedTickers","warnings","meta"],"additionalProperties":false}},"required":["parse","comparison"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-report/compare-1099div":{"post":{"operationId":"postAnalyticsTaxReportCompare1099div","summary":"Compares a broker's 1099-DIV (PDF, field `pdf`) for one account with the app's dividends: ordinary and return of capital, per ticker","description":"Compares a broker's 1099-DIV (PDF, field `pdf`) for one account with the app's dividends: ordinary and return of capital, per ticker.","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","format":"binary","contentEncoding":"binary","description":"The broker's PDF"},"broker":{"description":"The broker's slug (default: detected)","type":"string"},"year":{"description":"The tax year, 4 digits (default: the document's)","type":"string"},"baseIncome":{"description":"Other income for the year (default 0)","type":"string"},"country":{"description":"Default US","type":"string","enum":["US","CA"]},"accountId":{"type":"string","description":"The account the document is for"}},"required":["pdf","accountId"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"parse":{"type":"object","properties":{"broker":{"type":"string"},"detectedBroker":{"type":"string"},"taxYear":{"type":"number"},"entries":{"type":"number","description":"Entries read from the document"},"skipped":{"type":"number","description":"Lines the parser couldn't read"},"warnings":{"type":"array","items":{"type":"string"}},"documentType":{"type":"string","const":"1099div"},"currency":{"type":"string","enum":["USD","CAD"]},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"pdfTotals":{"type":"object","properties":{"box1a":{"type":"number"},"box1b":{"type":"number"},"box3":{"type":"number"}},"additionalProperties":false},"resolutionStats":{"type":"object","properties":{"total":{"type":"number"},"cached":{"type":"number"},"unresolved":{"type":"number"}},"required":["total","cached","unresolved"],"additionalProperties":false}},"required":["broker","taxYear","entries","skipped","warnings","documentType","currency","unresolvedDescriptions","resolutionStats"],"additionalProperties":false},"comparison":{"type":"object","properties":{"totalBrokerOrdinary":{"type":"number"},"totalBrokerROC":{"type":"number"},"totalAppOrdinary":{"type":"number"},"totalAppROC":{"type":"number"},"deltaOrdinary":{"type":"number"},"deltaROC":{"type":"number"},"tickers":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"securityId":{"type":"string"},"brokerOrdinary":{"type":"number"},"brokerQualified":{"type":"number"},"brokerROC":{"type":"number"},"appOrdinary":{"type":"number"},"appROC":{"type":"number"},"deltaOrdinary":{"type":"number"},"deltaROC":{"type":"number"},"category":{"type":"string","enum":["match","broker_only","app_only","amount_mismatch","unresolvable"]},"explanation":{"type":"string"}},"required":["ticker","securityId","brokerOrdinary","brokerQualified","brokerROC","appOrdinary","appROC","deltaOrdinary","deltaROC","category","explanation"],"additionalProperties":false}},"matchedTickers":{"type":"number"},"divergedTickers":{"type":"number"},"unresolvedDescriptions":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"broker":{"type":"string"},"documentType":{"type":"string","const":"1099div"},"taxYear":{"type":"number"},"country":{"type":"string"},"compareTimeMs":{"type":"number"}},"required":["broker","documentType","taxYear","country","compareTimeMs"],"additionalProperties":false}},"required":["totalBrokerOrdinary","totalBrokerROC","totalAppOrdinary","totalAppROC","deltaOrdinary","deltaROC","tickers","matchedTickers","divergedTickers","unresolvedDescriptions","warnings","meta"],"additionalProperties":false}},"required":["parse","comparison"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tax-documents/detect":{"post":{"operationId":"postAnalyticsTaxDocumentsDetect","summary":"Says what a tax document is (multipart field `file`: PDF, CSV or XLSX): its broker, type and account number, or why it isn't supported (the team is told about an unsupported one)","description":"Says what a tax document is (multipart field `file`: PDF, CSV or XLSX): its broker, type and account number, or why it isn't supported (the team is told about an unsupported one).","tags":["analytics"],"x-not-for-mcp":"a broker's document (a PDF or CSV upload): a file a tool can't carry","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","contentEncoding":"binary"}},"required":["file"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"supported":{"type":"boolean","const":true},"broker":{"type":"string"},"documentType":{"type":"string","enum":["t5008","trading_summary","gains_losses_pdf","gains_losses_csv","1099b","1099div"]},"accountNumber":{"description":"As printed in the document","type":"string"}},"required":["supported","broker","documentType"],"additionalProperties":false},{"type":"object","properties":{"supported":{"type":"boolean","const":false},"hint":{"type":"string"}},"required":["supported","hint"],"additionalProperties":false}]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/securities/stats":{"get":{"operationId":"getAnalyticsSecuritiesStats","summary":"A listing's stats with its same-company siblings (1–20 securityIds), all together: shares, cost, value, realized and unrealized P&L, dividends, win rate and averages, labelled with the first one's ticker","description":"A listing's stats with its same-company siblings (1–20 securityIds), all together: shares, cost, value, realized and unrealized P&L, dividends, win rate and averages, labelled with the first one's ticker. Never matches by symbol.","tags":["analytics"],"parameters":[{"name":"securityIds","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"securityId":{"type":"string","description":"The first listing's; empty when nothing matched"},"ticker":{"type":"string"},"shares":{"type":"number"},"averageCost":{"type":"number"},"totalInvested":{"type":"number"},"totalDividends":{"type":"number"},"totalReturn":{"type":"number"},"totalReturnPercent":{"type":"number"},"currentValue":{"type":"number"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgHoldTime":{"type":"number","description":"Days"},"avgFeesPerGroup":{"type":"number"},"tradeCount":{"type":"number"},"groupCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"openCount":{"type":"number"},"firstTradeDate":{"type":["string","null"]},"lastTradeDate":{"type":["string","null"]},"unpricedPositions":{"type":"number","description":"Open positions without a price (left out of value)"},"yieldOnCost":{"description":"Annual dividend × shares ÷ cost; null = n/a","type":["number","null"]}},"required":["securityId","ticker","shares","averageCost","totalInvested","totalDividends","totalReturn","totalReturnPercent","currentValue","realizedPnL","unrealizedPnL","winPercent","avgWin","avgLoss","avgHoldTime","avgFeesPerGroup","tradeCount","groupCount","winCount","lossCount","openCount","firstTradeDate","lastTradeDate","unpricedPositions","yieldOnCost"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tickers/batch-stats":{"get":{"operationId":"getAnalyticsTickersBatchStats","summary":"Ticker stats for several tickers at once (?tickers=a,b), with the total value and capital invested across them","description":"Ticker stats for several tickers at once (?tickers=a,b), with the total value and capital invested across them. A ticker with no trade group is left out.","tags":["analytics"],"parameters":[{"name":"tickers","in":"query","required":true,"description":"Comma-separated tickers","schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"stats":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"securityId":{"type":"string","description":"The first listing's; empty when nothing matched"},"ticker":{"type":"string"},"shares":{"type":"number"},"averageCost":{"type":"number"},"totalInvested":{"type":"number"},"totalDividends":{"type":"number"},"totalReturn":{"type":"number"},"totalReturnPercent":{"type":"number"},"currentValue":{"type":"number"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"winPercent":{"type":"number"},"avgWin":{"type":"number"},"avgLoss":{"type":"number"},"avgHoldTime":{"type":"number","description":"Days"},"avgFeesPerGroup":{"type":"number"},"tradeCount":{"type":"number"},"groupCount":{"type":"number"},"winCount":{"type":"number"},"lossCount":{"type":"number"},"openCount":{"type":"number"},"firstTradeDate":{"type":["string","null"]},"lastTradeDate":{"type":["string","null"]},"unpricedPositions":{"type":"number","description":"Open positions without a price (left out of value)"},"yieldOnCost":{"description":"Annual dividend × shares ÷ cost; null = n/a","type":["number","null"]}},"required":["securityId","ticker","shares","averageCost","totalInvested","totalDividends","totalReturn","totalReturnPercent","currentValue","realizedPnL","unrealizedPnL","winPercent","avgWin","avgLoss","avgHoldTime","avgFeesPerGroup","tradeCount","groupCount","winCount","lossCount","openCount","firstTradeDate","lastTradeDate","unpricedPositions","yieldOnCost"],"additionalProperties":false},"description":"By ticker"},"totals":{"type":"object","properties":{"totalValue":{"type":"number"},"totalInvested":{"type":"number"}},"required":["totalValue","totalInvested"],"additionalProperties":false}},"required":["stats","totals"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/analytics/tickers/performance-history":{"get":{"operationId":"getAnalyticsTickersPerformanceHistory","summary":"Each ticker's cumulative realized P&L (capital + dividends) by month, for the Compare chart","description":"Each ticker's cumulative realized P&L (capital + dividends) by month, for the Compare chart. Months with no realized activity are left out.","tags":["analytics"],"parameters":[{"name":"tickers","in":"query","required":true,"description":"Comma-separated tickers","schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"securities":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string","description":"YYYY-MM"},"pnl":{"type":"number"}},"required":["month","pnl"],"additionalProperties":false}},"description":"By ticker"}},"required":["securities"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/strategies":{"get":{"operationId":"getStrategies","summary":"Every strategy the workspace's trade groups use, with its group counts, P&L and win rate in the display currency, highest total P&L first","description":"Every strategy the workspace's trade groups use, with its group counts, P&L and win rate in the display currency, highest total P&L first.","tags":["strategies"],"parameters":[{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"strategyKey":{"type":"string","description":"Upper case: the strategy, or a user's strategy tag"},"displayName":{"type":"string","description":"The strategy's name; a user's strategy tag: its key"},"displayDescription":{"type":"string"},"displayIconName":{"type":"string","description":"A Lucide icon name"},"groupCount":{"type":"number"},"openGroupCount":{"type":"number"},"closedGroupCount":{"type":"number"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"totalPnL":{"type":"number"},"totalDividends":{"type":"number"},"winRate":{"type":"number","description":"Percent of the closed groups that won"},"aggregatedMetadata":{"anyOf":[{"type":"object","properties":{"totalSavedVsBank":{"type":"number"},"totalBankWouldPay":{"type":"number"},"avgEffectiveRate":{"type":"number"},"avgFxRate":{"type":"number"},"avgSavingsPercent":{"type":"number"},"bankFeePercent":{"type":"number"},"conversionCount":{"type":"number"}},"required":["totalSavedVsBank","totalBankWouldPay","avgEffectiveRate","avgFxRate","avgSavingsPercent","bankFeePercent","conversionCount"],"additionalProperties":false},{"type":"null"}]}},"required":["strategyKey","displayName","displayDescription","displayIconName","groupCount","openGroupCount","closedGroupCount","realizedPnL","unrealizedPnL","totalPnL","totalDividends","winRate","aggregatedMetadata"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/strategies/{strategyKey}/detail":{"get":{"operationId":"getStrategiesStrategyKeyDetail","summary":"One strategy (any case of its key): its totals, a page of its securities (page, pageSize ≤ 100, default 25) and the P&L of each of its groups over time","description":"One strategy (any case of its key): its totals, a page of its securities (page, pageSize ≤ 100, default 25) and the P&L of each of its groups over time. An unknown key answers zeros.","tags":["strategies"],"parameters":[{"name":"strategyKey","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"strategyKey":{"type":"string","description":"Upper case: the strategy, or a user's strategy tag"},"displayName":{"type":"string","description":"The strategy's name; a user's strategy tag: its key"},"displayDescription":{"type":"string"},"displayIconName":{"type":"string","description":"A Lucide icon name"},"totalGroups":{"type":"number"},"openGroups":{"type":"number"},"closedGroups":{"type":"number"},"wins":{"type":"number"},"losses":{"type":"number"},"winRate":{"type":"number"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"totalPnL":{"type":"number"},"totalDividends":{"type":"number"},"bySecurity":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"totalGroups":{"type":"number"},"openGroups":{"type":"number"},"closedGroups":{"type":"number"},"wins":{"type":"number"},"losses":{"type":"number"},"winRate":{"type":"number"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"totalPnL":{"type":"number"},"totalDividends":{"type":"number"}},"required":["securityId","ticker","totalGroups","openGroups","closedGroups","wins","losses","winRate","realizedPnL","unrealizedPnL","totalPnL","totalDividends"],"additionalProperties":false}},"page":{"type":"number"},"pageSize":{"type":"number"},"totalItems":{"type":"number"}},"required":["items","page","pageSize","totalItems"],"additionalProperties":false},"pnlTimeSeries":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"realizedPnL":{"type":"number"},"unrealizedPnL":{"type":"number"},"ticker":{"type":"string"},"status":{"type":"string","description":"The group's status"}},"required":["date","realizedPnL","unrealizedPnL","ticker","status"],"additionalProperties":false}},"aggregatedMetadata":{"anyOf":[{"type":"object","properties":{"totalSavedVsBank":{"type":"number"},"totalBankWouldPay":{"type":"number"},"avgEffectiveRate":{"type":"number"},"avgFxRate":{"type":"number"},"avgSavingsPercent":{"type":"number"},"bankFeePercent":{"type":"number"},"conversionCount":{"type":"number"}},"required":["totalSavedVsBank","totalBankWouldPay","avgEffectiveRate","avgFxRate","avgSavingsPercent","bankFeePercent","conversionCount"],"additionalProperties":false},{"type":"null"}]}},"required":["strategyKey","displayName","displayDescription","displayIconName","totalGroups","openGroups","closedGroups","wins","losses","winRate","realizedPnL","unrealizedPnL","totalPnL","totalDividends","bySecurity","pnlTimeSeries","aggregatedMetadata"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/events":{"get":{"operationId":"getEvents","summary":"The calendar: trades, dividends, journal entries, market holidays, dividends to come, earnings, ex-dividend dates and economic events, newest first, filtered by type, dates, securities and accounts (limit ≤ 10000, default 1000; offset)","description":"The calendar: trades, dividends, journal entries, market holidays, dividends to come, earnings, ex-dividend dates and economic events, newest first, filtered by type, dates, securities and accounts (limit ≤ 10000, default 1000; offset).","tags":["events"],"parameters":[{"name":"types","in":"query","required":false,"schema":{"type":"string"}},{"name":"countries","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateStart","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"dateEnd","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:?\\d{2})?)?$"}},{"name":"securityIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"accounts","in":"query","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","enum":["USD","CAD"]}},{"name":"holdingsOnly","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":10000}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"trade"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"amount":{"type":"number","description":"Price × quantity in the trade's own currency"},"metadata":{"type":"object","properties":{"tradeType":{"type":"string"},"quantity":{"type":["number","null"]},"price":{"type":["number","null"]},"fees":{"type":["number","null"]}},"required":["tradeType","quantity","price","fees"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","amount","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"dividend"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"amount":{"type":"number","description":"The payment in its own currency"},"metadata":{"type":"object","properties":{"quantity":{"type":["number","null"]},"perShare":{"type":"number"}},"required":["quantity","perShare"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","amount","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"journal"},"description":{"description":"The entry's text, on one line, its first 200 characters","type":"string"},"metadata":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"}}},"required":["tags"],"additionalProperties":false}},"required":["id","date","title","type","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"expiration"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"metadata":{"type":"object","properties":{"securityId":{"type":"string"},"exchange":{"type":["string","null"]},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"optionRoot":{"description":"The contract's series where its index trades as several (SPX / SPXW)","type":"string"},"contracts":{"description":"Held now, signed (short negative); 0 = held into its expiration day, no longer open; null = watched","type":["number","null"]},"moneyness":{"anyOf":[{"type":"string","enum":["itm","otm","atm"]},{"type":"null"}],"description":"Against the underlying's last price; null = no price, or already expired"}},"required":["securityId","exchange","optionType","strike","contracts","moneyness"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"holiday"},"description":{"type":"string"},"metadata":{"type":"object","properties":{"country":{"type":"string","enum":["US","CA"]},"year":{"type":"number"}},"required":["country","year"],"additionalProperties":false}},"required":["id","date","title","type","description","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"projected-dividend"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"amount":{"type":"number","description":"In the display currency; 0 while the amount isn't announced"},"metadata":{"type":"object","properties":{"securityId":{"type":"string"},"exchange":{"type":["string","null"]},"shares":{"type":"number"},"perShare":{"type":["number","null"]},"isEstimated":{"type":"boolean","description":"The date or the amount is expected, not announced"},"dateExpected":{"type":"boolean"}},"required":["securityId","exchange","shares","perShare","isEstimated","dateExpected"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","amount","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"earnings"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"metadata":{"type":"object","properties":{"securityId":{"type":"string"},"exchange":{"type":["string","null"]},"hour":{"type":["string","null"]},"expected":{"type":"boolean"},"epsActual":{"type":["number","null"]},"epsEstimate":{"type":["number","null"]},"revenueActual":{"type":["number","null"]},"revenueEstimate":{"type":["number","null"]}},"required":["securityId","exchange","hour","expected","epsActual","epsEstimate","revenueActual","revenueEstimate"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"ex-dividend"},"ticker":{"type":"string","description":"The display ticker"},"description":{"type":"string"},"amount":{"description":"Per share; null while not announced","type":["number","null"]},"metadata":{"type":"object","properties":{"securityId":{"type":"string"},"exchange":{"type":["string","null"]},"expected":{"type":"boolean"}},"required":["securityId","exchange","expected"],"additionalProperties":false}},"required":["id","date","title","type","ticker","description","amount","metadata"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string","description":"ISO instant (midnight UTC for a day)"},"title":{"type":"string"},"type":{"type":"string","const":"economic-event"},"description":{"type":"string"},"metadata":{"type":"object","properties":{"country":{"type":"string"},"category":{"type":["string","null"]},"source":{"type":"string"},"actual":{"type":["number","null"]},"previous":{"type":["number","null"]},"estimate":{"type":["number","null"]},"period":{"type":["string","null"]},"importance":{"type":["string","null"]}},"required":["country","category","source","actual","previous","estimate","period","importance"],"additionalProperties":false}},"required":["id","date","title","type","description","metadata"],"additionalProperties":false}]}},"total":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["events","total","hasMore"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/events/tickers":{"get":{"operationId":"getEventsTickers","summary":"The tickers followed on the calendar without being held or watched, with their reminders","description":"The tickers followed on the calendar without being held or watched, with their reminders.","tags":["events"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"tickers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"earningsReminder":{"type":"boolean"},"exDividendReminder":{"type":"boolean"}},"required":["id","securityId","ticker","exchange","name","earningsReminder","exDividendReminder"],"additionalProperties":false}}},"required":["tickers"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"post":{"operationId":"postEventsTickers","summary":"Follows a security on the calendar ({ securityId, earningsReminder?, exDividendReminder? })","description":"Follows a security on the calendar ({ securityId, earningsReminder?, exDividendReminder? }).","tags":["events"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"securityId":{"type":"string","minLength":1},"earningsReminder":{"type":"boolean"},"exDividendReminder":{"type":"boolean"}},"required":["securityId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"earningsReminder":{"type":"boolean"},"exDividendReminder":{"type":"boolean"}},"required":["id","securityId","ticker","exchange","name","earningsReminder","exDividendReminder"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/events/tickers/{id}":{"patch":{"operationId":"patchEventsTickersId","summary":"Turns a followed ticker's earnings or ex-dividend reminder on or off","description":"Turns a followed ticker's earnings or ex-dividend reminder on or off.","tags":["events"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"earningsReminder":{"type":"boolean"},"exDividendReminder":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"securityId":{"type":"string"},"ticker":{"type":"string"},"exchange":{"type":["string","null"]},"name":{"type":"string"},"earningsReminder":{"type":"boolean"},"exDividendReminder":{"type":"boolean"}},"required":["id","securityId","ticker","exchange","name","earningsReminder","exDividendReminder"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]},"delete":{"operationId":"deleteEventsTickersId","summary":"Stops following a ticker on the calendar","description":"Stops following a ticker on the calendar.","tags":["events"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/brokers":{"get":{"operationId":"getBrokers","summary":"The brokers myTraderDash supports: name, logo, countries, website, and what it handles for each (file import, sync, options, corporate actions)","description":"The brokers myTraderDash supports: name, logo, countries, website, and what it handles for each (file import, sync, options, corporate actions).","tags":["brokers"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"brokers":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string","description":"Its id: an account's broker"},"fullName":{"type":"string"},"shortName":{"type":"string"},"logo":{"type":"string","description":"The logo's path in the app"},"countries":{"type":"array","items":{"type":"string"},"description":"Markets it serves (ISO country codes)"},"features":{"type":"object","properties":{"fileImport":{"type":"boolean","description":"Its transaction files can be imported"},"apiSync":{"type":"boolean","description":"It can be synced through a connection"},"optionsSupport":{"type":"boolean"},"exerciseDetection":{"type":"boolean"},"assignmentDetection":{"type":"boolean"},"dividendCancellation":{"type":"boolean"},"transferDetection":{"type":"boolean"},"splitHandling":{"type":"boolean"},"spinoffHandling":{"type":"boolean"},"mergerHandling":{"type":"boolean"}},"required":["fileImport","apiSync","optionsSupport","exerciseDetection","assignmentDetection","dividendCancellation","transferDetection","splitHandling","spinoffHandling","mergerHandling"],"additionalProperties":false,"description":"What myTraderDash handles for this broker"},"website":{"type":"string"},"betaStatus":{"type":"boolean","description":"Its support is in beta"}},"required":["slug","fullName","shortName","logo","countries","features","website","betaStatus"],"additionalProperties":false}}},"required":["brokers"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/workspace":{"get":{"operationId":"getWorkspace","summary":"The caller's workspace","description":"The caller's workspace.","tags":["workspace"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","description":"ISO instant"},"isInitialized":{"type":"boolean","description":"The workspace's first data has been processed"},"hasMultiCurrency":{"type":"boolean","description":"It holds trades in more than one currency"},"timeZone":{"description":"The person's time zone (an IANA name); null = not known yet, read as America/New_York","type":["string","null"]}},"required":["id","name","createdAt","isInitialized","hasMultiCurrency","timeZone"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/workspace/metadata":{"get":{"operationId":"getWorkspaceMetadata","summary":"Every filter value in the workspace: its tickers, brokers, accounts, tags and trade types (cached up to 5 minutes)","description":"Every filter value in the workspace: its tickers, brokers, accounts, tags and trade types (cached up to 5 minutes).","tags":["workspace"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"tickers":{"type":"array","items":{"type":"string"}},"brokers":{"type":"array","items":{"type":"string"}},"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"broker":{"type":["string","null"]}},"required":["id","name","broker"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"string"}},"tradeTypes":{"type":"array","items":{"type":"string"}}},"required":["tickers","brokers","accounts","tags","tradeTypes"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/workspace/processing":{"get":{"operationId":"getWorkspaceProcessing","summary":"The trade processing's state: since when it has been failing, when it last recovered, the tickers whose strategies weren't built, whether a broker sync didn't complete, whether a Recalculate is owed after grouping by hand, and the data version that changes whenever the workspace's figures do","description":"The trade processing's state: since when it has been failing, when it last recovered, the tickers whose strategies weren't built, whether a broker sync didn't complete, whether a Recalculate is owed after grouping by hand, and the data version that changes whenever the workspace's figures do.","tags":["workspace"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"failedSince":{"description":"ISO instant; null while processing works","type":["string","null"]},"recoveredAt":{"description":"ISO instant of the last recovery","type":["string","null"]},"strategiesNotBuilt":{"type":"array","items":{"type":"string"},"description":"Tickers whose strategies the last run couldn't build (their positions show plain)"},"brokerSyncFailed":{"type":"boolean","description":"An open synced account's last sync didn't complete (Accounts & Data says which)"},"recalculateOwed":{"type":"boolean","description":"Groups were changed by hand (merge, new group, move, unmerge) and no run has rebuilt the automatic groups around them since: the Trade Log asks for a Recalculate"},"dataVersion":{"type":"number","description":"Goes up each time the workspace's data changes"}},"required":["failedSince","recoveredAt","strategiesNotBuilt","brokerSyncFailed","recalculateOwed","dataVersion"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/exports/trades":{"get":{"operationId":"getExportsTrades","summary":"The trades and cash records (deposits, withdrawals, interest, fees, FX conversions, dividend withholding) as a file to download, which an import reads back: format csv (the default), json, xlsx, pdf or docx; filtered by accounts (accountIds) and dates (dateFrom, dateTo)","description":"The trades and cash records (deposits, withdrawals, interest, fees, FX conversions, dividend withholding) as a file to download, which an import reads back: format csv (the default), json, xlsx, pdf or docx; filtered by accounts (accountIds) and dates (dateFrom, dateTo). Several accounts as CSV answer a ZIP with one CSV per account.","tags":["exports"],"parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["csv","json","xlsx","pdf","docx"]}},{"name":"accountIds","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateFrom","in":"query","required":false,"schema":{"type":"string"}},{"name":"dateTo","in":"query","required":false,"schema":{"type":"string"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The file","content":{"text/csv":{},"application/json":{},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{},"application/pdf":{},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{},"application/zip":{}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/exports/tax-report/{reportId}":{"get":{"operationId":"getExportsTaxReportReportId","summary":"A tax report made by the Tax page (its reportId, kept for a while after it was made) as an Excel workbook","description":"A tax report made by the Tax page (its reportId, kept for a while after it was made) as an Excel workbook. 410 REPORT_EXPIRED once it's gone: make it again.","tags":["exports"],"x-not-for-mcp":"the tax report as a workbook: a file a tool's answer can't carry","parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The file","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/imports":{"post":{"operationId":"postImports","summary":"Starts importing a broker's file into an account (multipart: `file`, `accountId`, `previewToken` from POST /v1/imports/preview to import exactly what it showed)","description":"Starts importing a broker's file into an account (multipart: `file`, `accountId`, `previewToken` from POST /v1/imports/preview to import exactly what it showed). 202 with its task at once: GET /v1/imports/status/:taskId follows it.","tags":["imports"],"x-not-for-mcp":"a broker's file, which a tool can't carry: MCP imports a list of trades (import_trades)","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","contentEncoding":"binary","description":"CSV, XLSX, JSON or XML from a broker"},"accountId":{"description":"The account the trades go into (a broker file)","type":"string"},"previewToken":{"description":"From the preview: imports the rows it showed without reading the file again","type":"string"}},"required":["file"]}}}},"responses":{"202":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"type":"object","properties":{"id":{"type":"string","description":"The task's id: GET /v1/imports/status/:taskId"},"status":{"type":"string","enum":["waiting","processing"]}},"required":["id","status"],"additionalProperties":false}},"required":["task"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/imports/uploads/{uploadId}":{"patch":{"operationId":"patchImportsUploadsUploadId","summary":"Says which broker a file the preview couldn't read is from (`uploadId` from the preview's 400): `broker` is a broker's slug (GET /v1/brokers) or, for one that isn't listed, its name","description":"Says which broker a file the preview couldn't read is from (`uploadId` from the preview's 400): `broker` is a broker's slug (GET /v1/brokers) or, for one that isn't listed, its name. 404 UPLOAD_NOT_FOUND when the workspace has no such kept file.","tags":["imports"],"x-not-for-mcp":"a step of a file's import (the preview's): MCP imports no file","parameters":[{"name":"uploadId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"broker":{"type":"string","minLength":1,"maxLength":80}},"required":["broker"],"additionalProperties":false}}}},"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/imports/status/{taskId}":{"get":{"operationId":"getImportsStatusTaskId","summary":"How an import is going: waiting (for its turn), processing (with its stage), completed (with its result) or failed (with the error)","description":"How an import is going: waiting (for its turn), processing (with its stage), completed (with its result) or failed (with the error). 404 TASK_NOT_FOUND when it isn't this workspace's or has lapsed (an hour after it ended). For an import started by POST /v1/imports/api that answered 202, `result` is what that call would have answered (`http`, `body`).","tags":["imports"],"x-not-for-mcp":"a file import's status: MCP imports no file","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The task's id"},"status":{"type":"string","enum":["waiting","processing","completed","failed"]},"progress":{"description":"While it runs: the stage the import window shows","type":"object","properties":{"current":{"type":"number"},"total":{"type":"number"},"stage":{"type":"string"}},"required":["current","total","stage"],"additionalProperties":false},"result":{"description":"Once completed","anyOf":[{"type":"object","properties":{"inserted":{"type":"number"},"updated":{"type":"number","description":"Rows already here where a stored value changed"},"unchanged":{"description":"Rows already here with nothing new","type":"number"},"skipped":{"type":"number"},"errors":{"type":"array","items":{"type":"object","properties":{"line":{"type":"number"},"index":{"type":"number"},"field":{"type":"string"},"message":{"type":"string"},"data":{"anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["message"],"additionalProperties":false}},"pricesMissing":{"description":"Open positions still being priced in the background (GET /v1/imports/:importId/enrichment-status)","type":"number"},"pipelineFailed":{"type":"boolean"},"cashRecords":{"type":"number"},"cashRecordsError":{"type":"string"},"currencies":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"skippedRows":{"description":"The rows not imported, as read","type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"updatedRows":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The row as read"},"before":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The stored trade before"},"after":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The stored trade after"},"changedFields":{"type":"array","items":{"type":"string"}}},"required":["raw","before","after","changedFields"],"additionalProperties":false}},"identicalRows":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"quantity":{"type":"number"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"count":{"type":"number"}},"required":["date","ticker","tradeType","quantity","count"],"additionalProperties":false}},"duplicateDividends":{"description":"Dividends the file listed more than once: imported once","type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"quantity":{"type":"number"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"count":{"type":"number"}},"required":["date","ticker","tradeType","quantity","count"],"additionalProperties":false}}},"required":["inserted","updated","skipped","errors"],"additionalProperties":false},{"type":"object","properties":{"http":{"type":"number"},"body":{}},"required":["http","body"],"additionalProperties":false,"description":"A POST /v1/imports/api import: the status and body of its answer"}]},"error":{"description":"Once failed: IMPORT_FAILED with the error's text, or TASK_INTERRUPTED","type":"object","properties":{"status":{"type":"number","description":"The HTTP status the route answers it with"},"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["status","code","message"],"additionalProperties":false}},"required":["id","status"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/imports/{importId}/enrichment-status":{"get":{"operationId":"getImportsImportIdEnrichmentStatus","summary":"How far the background pricing of an import's open positions is (the import's job id), when its result had pricesMissing > 0","description":"How far the background pricing of an import's open positions is (the import's job id), when its result had pricesMissing > 0. 404 JOB_NOT_FOUND before it starts or once it's gone.","tags":["imports"],"x-not-for-mcp":"a file import's status: MCP imports no file","parameters":[{"name":"importId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["in_progress","completed","failed"]},"totalItems":{"type":"number"},"completedItems":{"type":"number"},"elapsedSeconds":{"type":"number"}},"required":["status","totalItems","completedItems","elapsedSeconds"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/imports/api":{"post":{"operationId":"postImportsApi","summary":"Imports trades into an account: a JSON list of trades, or a broker's file (multipart: `file`, `accountId`, `broker`)","description":"Imports trades into an account: a JSON list of trades, or a broker's file (multipart: `file`, `accountId`, `broker`). A row already there is updated or left as is, never doubled; the trades are regrouped before the answer. Imports run a few at a time: one that isn't done within about 90 seconds answers 202 with its `task`, and GET /v1/imports/status/:taskId has the answer as its `result` when it is. 500 TASK_INTERRUPTED when the import was given up before it ended.","tags":["imports"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"broker":{"type":"string"},"trades":{"minItems":1,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","minLength":1},"ticker":{"type":"string","minLength":1},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"quantity":{"type":"number","minimum":0},"price":{"type":"number","minimum":0},"fees":{"default":0,"type":"number"},"currency":{"default":"USD","type":"string"},"market":{"type":"string","enum":["CA","US"]},"exchange":{"type":"string","enum":["NYSE","NASDAQ","TSX","TSXV","AMEX","OTHER"]},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"tradeOrigin":{"type":"string","enum":["assignment","exercise","transfer-in","transfer-out","journal"]},"dividendType":{"type":"string","enum":["regular","roc","trust"]},"securityId":{"type":"string"},"settlementDate":{"type":"string"}},"required":["date","ticker","tradeType","quantity","price"],"additionalProperties":false}}},"required":["accountId","trades"],"additionalProperties":false}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","contentEncoding":"binary","description":"CSV, XLSX, JSON or XML from a broker"},"accountId":{"type":"string","description":"The account the trades go into"},"broker":{"description":"The file's broker, when its format alone doesn't say","type":"string"}},"required":["file","accountId"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"imported":{"type":"number"},"updated":{"type":"number","description":"Rows already here where a stored value changed"},"unchanged":{"type":"number","description":"Rows already here with nothing new"},"duplicates":{"type":"number"},"skipped":{"type":"number"},"cashRecords":{"type":"number","description":"Cash rows stored (deposits, interest, fees, withholding)"},"cashRecordsError":{"description":"Why the cash rows weren't stored","type":"string"},"pipelineFailed":{"type":"boolean","description":"The trades were saved but grouping them failed"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number","description":"The row's index in the payload or file"},"ticker":{"type":"string"},"reason":{"type":"string"}},"required":["row","ticker","reason"],"additionalProperties":false}},"warnings":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number","description":"The row's index in the payload or file"},"ticker":{"type":"string"},"reason":{"type":"string"}},"required":["row","ticker","reason"],"additionalProperties":false}}},"required":["imported","updated","unchanged","duplicates","skipped","cashRecords","pipelineFailed","errors","warnings"],"additionalProperties":false}}}},"202":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"type":"object","properties":{"id":{"type":"string","description":"The task's id: GET /v1/imports/status/:taskId"},"status":{"type":"string","enum":["waiting","processing"]}},"required":["id","status"],"additionalProperties":false},"message":{"type":"string"}},"required":["task","message"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/imports/preview":{"post":{"operationId":"postImportsPreview","summary":"Reads a broker's file without importing it (multipart: `file`, `accountId`): how many rows will be imported, skipped (and why) or need a look, the broker it recognized, and a `previewToken` that POST /v1/imports takes to import exactly these rows (15 minutes)","description":"Reads a broker's file without importing it (multipart: `file`, `accountId`): how many rows will be imported, skipped (and why) or need a look, the broker it recognized, and a `previewToken` that POST /v1/imports takes to import exactly these rows (15 minutes). 400 UNSUPPORTED_FORMAT for a file it doesn't recognize and 400 UNSUPPORTED_FILE_TYPE for a type it doesn't read: the file is kept 30 days so the format can be added, and the error's `details` carry its `uploadId` (absent when it wasn't kept) for PATCH /v1/imports/uploads/:uploadId, and `lookedLike` (a broker's name) when the file has that broker's column headings but none of its rows could be read.","tags":["imports"],"x-not-for-mcp":"a broker's file, which a tool can't carry: MCP imports a list of trades (import_trades)","parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","contentEncoding":"binary","description":"CSV, XLSX, JSON or XML from a broker"},"accountId":{"description":"The account it's for (its broker helps the reading)","type":"string"}},"required":["file"]}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"totalRows":{"type":"number"},"willImport":{"type":"number"},"willSkip":{"type":"number"},"cashRecords":{"type":"number","description":"Cash rows kept as cash records, not skipped"},"skippedReasons":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Skipped rows per reason"},"needsAttention":{"type":"number","description":"Rows the parser is less than 80 % sure of"},"currencies":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"},"description":"Rows per currency"},"skippedRows":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"type":"string","enum":["assignment","exercise","transfer-in","transfer-out","journal","tender"]},"syntheticReason":{"type":"string","const":"transfer"},"dividendType":{"type":"string","enum":["regular","roc","trust"]},"dividendQualified":{"type":"boolean"},"positionEffect":{"type":"string","enum":["open","close"]},"quantity":{"type":"number"},"price":{"type":"number"},"fees":{"type":"number"},"currency":{"type":"string"},"fromCurrency":{"type":"string"},"exchange":{"type":"string"},"market":{"type":"string","enum":["CA","US"]},"signature":{"type":"string"},"securityId":{"type":"string"},"identity":{"type":"object","properties":{"ticker":{"type":"string"},"tradeOrigin":{"type":"string","enum":["assignment","exercise","transfer-in","transfer-out","journal","tender"]}},"required":["ticker"],"additionalProperties":false},"descriptionHint":{"type":"string"},"brokerFxRate":{"type":"number"},"settlementDate":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"confidence":{"type":"number","description":"0–100: how sure the parser is of the row"},"warnings":{"type":"array","items":{"type":"string"}},"skipReason":{"type":"string"},"cash":{"description":"A cash row (deposit, interest, fee, withholding), kept as a cash record","type":"object","properties":{"kind":{"type":"string"},"amount":{"type":"number","description":"Signed: money into the account > 0"},"currency":{"type":"string"},"brokerType":{"type":"string"},"description":{"type":"string"},"ticker":{"type":"string"},"conversionKey":{"type":"string"},"externalId":{"type":"string"}},"required":["kind","amount","currency","brokerType","description"],"additionalProperties":false},"rawRow":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The file's own columns"},"_transferResolved":{"type":"boolean"}},"required":["date","ticker","tradeType","quantity","price","fees","currency","confidence","warnings","rawRow"],"additionalProperties":false}},"lowConfidenceRows":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"tradeOrigin":{"type":"string","enum":["assignment","exercise","transfer-in","transfer-out","journal","tender"]},"syntheticReason":{"type":"string","const":"transfer"},"dividendType":{"type":"string","enum":["regular","roc","trust"]},"dividendQualified":{"type":"boolean"},"positionEffect":{"type":"string","enum":["open","close"]},"quantity":{"type":"number"},"price":{"type":"number"},"fees":{"type":"number"},"currency":{"type":"string"},"fromCurrency":{"type":"string"},"exchange":{"type":"string"},"market":{"type":"string","enum":["CA","US"]},"signature":{"type":"string"},"securityId":{"type":"string"},"identity":{"type":"object","properties":{"ticker":{"type":"string"},"tradeOrigin":{"type":"string","enum":["assignment","exercise","transfer-in","transfer-out","journal","tender"]}},"required":["ticker"],"additionalProperties":false},"descriptionHint":{"type":"string"},"brokerFxRate":{"type":"number"},"settlementDate":{"type":"string"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"confidence":{"type":"number","description":"0–100: how sure the parser is of the row"},"warnings":{"type":"array","items":{"type":"string"}},"skipReason":{"type":"string"},"cash":{"description":"A cash row (deposit, interest, fee, withholding), kept as a cash record","type":"object","properties":{"kind":{"type":"string"},"amount":{"type":"number","description":"Signed: money into the account > 0"},"currency":{"type":"string"},"brokerType":{"type":"string"},"description":{"type":"string"},"ticker":{"type":"string"},"conversionKey":{"type":"string"},"externalId":{"type":"string"}},"required":["kind","amount","currency","brokerType","description"],"additionalProperties":false},"rawRow":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The file's own columns"},"_transferResolved":{"type":"boolean"}},"required":["date","ticker","tradeType","quantity","price","fees","currency","confidence","warnings","rawRow"],"additionalProperties":false}},"detectedBroker":{"description":"The broker recognized, by its name","type":"string"},"parserUsed":{"type":"string"},"identicalRows":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"quantity":{"type":"number"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"count":{"type":"number"}},"required":["date","ticker","tradeType","quantity","count"],"additionalProperties":false}},"duplicateDividends":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"ticker":{"type":"string"},"tradeType":{"type":"string","enum":["buy","sell","dividend","expiry","journal"]},"quantity":{"type":"number"},"optionType":{"type":"string","enum":["call","put"]},"strike":{"type":"number"},"expiration":{"type":"string"},"count":{"type":"number"}},"required":["date","ticker","tradeType","quantity","count"],"additionalProperties":false},"description":"Dividends the file lists more than once: one payment, imported once"},"previewToken":{"description":"For POST /v1/imports; null when it couldn't be kept","type":["string","null"]},"preWarmStats":{"anyOf":[{"type":"object","properties":{"total":{"type":"number"},"warmed":{"type":"number"},"alreadyKnown":{"type":"number"},"skipped":{"type":"number"},"failed":{"type":"number"},"timedOut":{"type":"number"},"budgetExhausted":{"type":"number"},"warnings":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string"},"issue":{"type":"string"}},"required":["ticker","issue"],"additionalProperties":false}}},"required":["total","warmed","alreadyKnown","skipped","failed","timedOut","budgetExhausted","warnings"],"additionalProperties":false},{"type":"null"}],"description":"The new tickers looked up before the preview; null when there were none"}},"required":["totalRows","willImport","willSkip","cashRecords","skippedReasons","needsAttention","currencies","skippedRows","lowConfidenceRows","parserUsed","identicalRows","duplicateDividends","previewToken","preWarmStats"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/stock-lists":{"get":{"operationId":"getStockLists","summary":"The workspace's own stock lists (the screener's), each with its count","description":"The workspace's own stock lists (the screener's), each with its count.","tags":["stock-lists"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sortOrder":{"type":"number"},"count":{"type":"number","description":"Stocks on it"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","sortOrder","count","createdAt","updatedAt"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/stock-lists/{id}/export":{"get":{"operationId":"getStockListsIdExport","summary":"A stock list as CSV (Symbol, Exchange, Name), as a download","description":"A stock list as CSV (Symbol, Exchange, Name), as a download.","tags":["stock-lists"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The file","content":{"text/csv":{}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/notifications/positions/{securityId}":{"put":{"operationId":"putNotificationsPositionsSecurityId","summary":"Mutes or unmutes the alerts of an open position, or sets its own price-swing threshold ({ muted?, swingThreshold? }, percent; null = the workspace's default)","description":"Mutes or unmutes the alerts of an open position, or sets its own price-swing threshold ({ muted?, swingThreshold? }, percent; null = the workspace's default). Answers the position as now set; 404 when nothing is held in it.","tags":["notifications"],"parameters":[{"name":"securityId","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"muted":{"type":"boolean"},"swingThreshold":{"anyOf":[{"type":"number","exclusiveMinimum":0,"maximum":100},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"securityId":{"type":"string"},"ticker":{"type":"string"},"name":{"type":"string"},"muted":{"type":"boolean"},"thresholdOverride":{"description":"Its own threshold; null = the default","type":["number","null"]},"threshold":{"type":"number","description":"The threshold in effect, percent"},"accountIds":{"type":"array","items":{"type":"string"},"description":"Watched accounts holding it"}},"required":["securityId","ticker","name","muted","thresholdOverride","threshold","accountIds"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/config":{"get":{"operationId":"getConfig","summary":"The reference lists every client uses: account types (and in which country's tax report each is sheltered), currencies, markets, trade types, statuses, results and sides, dividend frequencies, tax countries and quarters, accounting methods","description":"The reference lists every client uses: account types (and in which country's tax report each is sheltered), currencies, markets, trade types, statuses, results and sides, dividend frequencies, tax countries and quarters, accounting methods. The same for everyone; changes only with a release.","tags":["config"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"accountTypes":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"What an account's type is set to"},"label":{"type":"string"},"country":{"type":"string","enum":["US","CA","both"],"description":"Where the type is offered"},"shelteredIn":{"type":"array","items":{"type":"string","enum":["US","CA"]},"description":"The tax report countries in which the account is sheltered (not taxed) by default; empty = taxable everywhere"}},"required":["value","label","country","shelteredIn"],"additionalProperties":false}},"currencies":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"symbol":{"type":"string"}},"required":["value","label","symbol"],"additionalProperties":false}},"markets":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"tradeTypes":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"tradeStatuses":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"positionStates":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"tradeResults":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"tradeSides":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"unallocatedCategories":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"dividendFrequencies":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"taxCountries":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"taxQuarters":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"accountingMethods":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"],"additionalProperties":false}},"indexOptionSeries":{"type":"array","items":{"type":"object","properties":{"underlying":{"type":"string"},"roots":{"type":"array","items":{"type":"string"}}},"required":["underlying","roots"],"additionalProperties":false}}},"required":["accountTypes","currencies","markets","tradeTypes","tradeStatuses","positionStates","tradeResults","tradeSides","unallocatedCategories","dividendFrequencies","taxCountries","taxQuarters","accountingMethods","indexOptionSeries"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/archive/exports":{"post":{"operationId":"postArchiveExports","summary":"Starts an export of the whole workspace as one archive (a job); the passphrase given, else the stored one","description":"Starts an export of the whole workspace as one archive (a job); the passphrase given, else the stored one. Poll the run, then download it.","tags":["archive"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"passphrase":{"type":"string","maxLength":1024}},"additionalProperties":false}}}},"responses":{"202":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["export","import"]},"status":{"type":"string","enum":["waiting","queued","running","succeeded","failed"]},"fileName":{"type":["string","null"]},"bytes":{"type":["number","null"]},"createdAt":{"type":"string","description":"ISO instant"},"startedAt":{"type":["string","null"]},"finishedAt":{"type":["string","null"]},"error":{"description":"A refusal: `<CODE>: <message>`","type":["string","null"]},"archive":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"The archive's manifest summary (never the workspace's data); a Drive download's progress"},"expiresAt":{"description":"A finished export: when it is deleted","type":"string"}},"required":["id","kind","status","fileName","bytes","createdAt","startedAt","finishedAt","error","archive"],"additionalProperties":false}}},"required":["runs"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"get":{"operationId":"getArchiveExports","summary":"The workspace's last 10 exports","description":"The workspace's last 10 exports.","tags":["archive"],"parameters":[{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["export","import"]},"status":{"type":"string","enum":["waiting","queued","running","succeeded","failed"]},"fileName":{"type":["string","null"]},"bytes":{"type":["number","null"]},"createdAt":{"type":"string","description":"ISO instant"},"startedAt":{"type":["string","null"]},"finishedAt":{"type":["string","null"]},"error":{"description":"A refusal: `<CODE>: <message>`","type":["string","null"]},"archive":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"The archive's manifest summary (never the workspace's data); a Drive download's progress"},"expiresAt":{"description":"A finished export: when it is deleted","type":"string"}},"required":["id","kind","status","fileName","bytes","createdAt","startedAt","finishedAt","error","archive"],"additionalProperties":false}}},"required":["runs"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}},"/v1/archive/exports/{id}":{"get":{"operationId":"getArchiveExportsId","summary":"One export's run","description":"One export's run.","tags":["archive"],"x-not-for-mcp":"one export's run: the list holds it","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["export","import"]},"status":{"type":"string","enum":["waiting","queued","running","succeeded","failed"]},"fileName":{"type":["string","null"]},"bytes":{"type":["number","null"]},"createdAt":{"type":"string","description":"ISO instant"},"startedAt":{"type":["string","null"]},"finishedAt":{"type":["string","null"]},"error":{"description":"A refusal: `<CODE>: <message>`","type":["string","null"]},"archive":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"The archive's manifest summary (never the workspace's data); a Drive download's progress"},"expiresAt":{"description":"A finished export: when it is deleted","type":"string"}},"required":["id","kind","status","fileName","bytes","createdAt","startedAt","finishedAt","error","archive"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]},"delete":{"operationId":"deleteArchiveExportsId","summary":"Deletes a finished export","description":"Deletes a finished export. 409 NOT_READY while it is made.","tags":["archive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Done (no body)"},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["write"]}]}},"/v1/archive/exports/{id}/download":{"get":{"operationId":"getArchiveExportsIdDownload","summary":"The finished archive (a zip; Range works)","description":"The finished archive (a zip; Range works). 409 NOT_READY while it is made, 410 EXPIRED after a day.","tags":["archive"],"x-not-for-mcp":"a backup's file: downloaded by the person in the app, not something a tool's answer can carry","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"X-Workspace-Id","in":"header","required":true,"description":"The key's own workspace id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The file","content":{"application/zip":{}}},"400":{"$ref":"#/components/responses/ValidationFailed"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":["read"]}]}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key from Settings, as `Authorization: Bearer <key>`. Its scopes: `read` (GET, and the routes that only read), `write` (POST, PUT, PATCH, DELETE); each operation lists the one it needs."}},"schemas":{"ApiError":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}},"responses":{"ValidationFailed":{"description":"The input didn't pass (code VALIDATION_FAILED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"Error":{"description":"Refused or failed: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}