bharosa 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/CONTRACT-SHA256 +1 -0
- package/CONTRIBUTING.md +40 -0
- package/FIRST-PARTY-CONTRACT-SHA256 +1 -0
- package/LICENSE +21 -0
- package/MONTHLY-MARKET-CONTRACT-SHA256 +1 -0
- package/README.md +128 -2
- package/SECURITY.md +11 -0
- package/dist/browser.cjs +26 -0
- package/dist/browser.d.cts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/client-types.cjs +2 -0
- package/dist/client-types.d.cts +229 -0
- package/dist/client-types.d.ts +229 -0
- package/dist/contract.cjs +2 -0
- package/dist/contract.d.cts +3 -0
- package/dist/contract.d.ts +3 -0
- package/dist/errors.cjs +73 -0
- package/dist/errors.d.cts +48 -0
- package/dist/errors.d.ts +48 -0
- package/dist/index.cjs +390 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.mjs +1 -0
- package/dist/market-data.cjs +3799 -0
- package/dist/market-data.d.cts +2 -0
- package/dist/market-data.d.ts +2 -0
- package/dist/market-types.cjs +2 -0
- package/dist/market-types.d.cts +194 -0
- package/dist/market-types.d.ts +194 -0
- package/dist/models.cjs +2 -0
- package/dist/models.d.cts +511 -0
- package/dist/models.d.ts +511 -0
- package/dist/monthly-market-data.cjs +967 -0
- package/dist/monthly-market-data.d.cts +2 -0
- package/dist/monthly-market-data.d.ts +2 -0
- package/dist/monthly-types.cjs +2 -0
- package/dist/monthly-types.d.cts +32 -0
- package/dist/monthly-types.d.ts +32 -0
- package/dist/operation-types.cjs +2 -0
- package/dist/operation-types.d.cts +54 -0
- package/dist/operation-types.d.ts +54 -0
- package/dist/response-checks.cjs +163 -0
- package/dist/response-checks.d.cts +3 -0
- package/dist/response-checks.d.ts +3 -0
- package/dist/schema.cjs +6 -0
- package/dist/schema.d.cts +38 -0
- package/dist/schema.d.ts +38 -0
- package/dist/testing.cjs +132 -0
- package/dist/testing.d.cts +82 -0
- package/dist/testing.d.ts +82 -0
- package/dist/transport.cjs +425 -0
- package/dist/transport.d.cts +5 -0
- package/dist/transport.d.ts +5 -0
- package/dist/validate.cjs +167 -0
- package/dist/validate.d.cts +4 -0
- package/dist/validate.d.ts +4 -0
- package/docs/getting-started.md +88 -0
- package/docs/index.md +14 -0
- package/docs/monthly-market-data.md +39 -0
- package/docs/portfolios.md +106 -0
- package/docs/provenance.md +9 -0
- package/docs/releasing.md +23 -0
- package/docs/reliability.md +34 -0
- package/docs/testing.md +21 -0
- package/examples/README.md +27 -0
- package/examples/create-investor.ts +12 -0
- package/examples/offline-smoke.mjs +31 -0
- package/examples/portfolio-mixes.ts +99 -0
- package/examples/read-account.ts +12 -0
- package/package.json +69 -4
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { MonthlyMarketClient } from "./monthly-types.js";
|
|
2
|
+
import type { MarketDataClient, CurrentHoldingsInput, CurrentHoldingsResult } from "./market-types.js";
|
|
3
|
+
export type * from "./market-types.js";
|
|
4
|
+
import type { Holding, HoldingPosition, HistoryCapability, HistoryView, HistoryImport, HistoryImportResult, HoldingsList, AssetMix, SectorMix, IssuerMix, PositionInput, Account, Client, ClientsList, Investor, InvestorsList, InvestorCreate, InvestorUpdate, Portfolio, PortfoliosList, PortfolioCreate, PortfolioUpdate, SnapshotCreate, SnapshotView, FundsList, FundReferences } from "./models.js";
|
|
5
|
+
export type * from "./models.js";
|
|
6
|
+
export type Auth = {
|
|
7
|
+
readonly type: "account_key";
|
|
8
|
+
readonly apiKey: string;
|
|
9
|
+
readonly userAccessToken?: never;
|
|
10
|
+
} | {
|
|
11
|
+
readonly type: "delegated_application";
|
|
12
|
+
readonly apiKey: string;
|
|
13
|
+
readonly userAccessToken: string;
|
|
14
|
+
};
|
|
15
|
+
/** Trusted caller-owned transport. Authentication, session handling and origin policy belong to the host application. */
|
|
16
|
+
export interface BharosaTransport {
|
|
17
|
+
send(url: string, request: RequestInit): Promise<Response>;
|
|
18
|
+
}
|
|
19
|
+
interface BharosaBaseConfig {
|
|
20
|
+
readonly baseUrl: string;
|
|
21
|
+
readonly account: string;
|
|
22
|
+
readonly allowLocalhostHttp?: boolean;
|
|
23
|
+
readonly maxResponseBytes?: number;
|
|
24
|
+
}
|
|
25
|
+
export type BharosaConfig = BharosaBaseConfig & ({
|
|
26
|
+
readonly auth: Auth;
|
|
27
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
28
|
+
readonly transport?: never;
|
|
29
|
+
} | {
|
|
30
|
+
readonly transport: BharosaTransport;
|
|
31
|
+
readonly auth?: never;
|
|
32
|
+
readonly fetch?: never;
|
|
33
|
+
});
|
|
34
|
+
export interface RequestOptions {
|
|
35
|
+
idempotencyKey?: string;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
maxRetries?: 0 | 1 | 2;
|
|
39
|
+
}
|
|
40
|
+
export interface IdempotentOptions extends RequestOptions {
|
|
41
|
+
idempotencyKey: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ListOptions {
|
|
44
|
+
limit?: number;
|
|
45
|
+
startingAfter?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface FilteredListOptions extends ListOptions {
|
|
48
|
+
client?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface PortfolioListOptions extends ListOptions {
|
|
51
|
+
/** Compatibility alias; cannot be combined with plural filters. */
|
|
52
|
+
client?: string;
|
|
53
|
+
client_ids?: string[];
|
|
54
|
+
investor_ids?: string[];
|
|
55
|
+
}
|
|
56
|
+
export type MutationOutcome = "not_applicable" | "not_sent" | "rejected" | "unknown";
|
|
57
|
+
export interface MixOptions {
|
|
58
|
+
asOf?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PortfolioMethods {
|
|
61
|
+
assetMix(params?: MixOptions, options?: RequestOptions): Promise<AssetMix>;
|
|
62
|
+
sectorMix(params?: MixOptions, options?: RequestOptions): Promise<SectorMix>;
|
|
63
|
+
issuerMix(params?: MixOptions, options?: RequestOptions): Promise<IssuerMix>;
|
|
64
|
+
}
|
|
65
|
+
export interface InMemoryPortfolioInput {
|
|
66
|
+
valuationDate: string;
|
|
67
|
+
currency?: "INR";
|
|
68
|
+
positions: ReadonlyArray<Readonly<PositionInput>>;
|
|
69
|
+
}
|
|
70
|
+
export interface DatedPortfolioMethods {
|
|
71
|
+
assetMix(params?: MixOptions & {
|
|
72
|
+
valuationDate?: string;
|
|
73
|
+
}, options?: RequestOptions): Promise<AssetMix>;
|
|
74
|
+
sectorMix(params?: MixOptions & {
|
|
75
|
+
valuationDate?: string;
|
|
76
|
+
}, options?: RequestOptions): Promise<SectorMix>;
|
|
77
|
+
issuerMix(params?: MixOptions & {
|
|
78
|
+
valuationDate?: string;
|
|
79
|
+
}, options?: RequestOptions): Promise<IssuerMix>;
|
|
80
|
+
on(date: string): DatedPortfolioMethods;
|
|
81
|
+
}
|
|
82
|
+
export type HoldingObject = Holding & {
|
|
83
|
+
positionOn(date: string, options?: RequestOptions): Promise<HoldingPosition>;
|
|
84
|
+
};
|
|
85
|
+
export interface InMemoryPortfolio extends PortfolioMethods {
|
|
86
|
+
on(date: string): DatedPortfolioMethods;
|
|
87
|
+
readonly positions: ReadonlyArray<Readonly<PositionInput>>;
|
|
88
|
+
}
|
|
89
|
+
export interface CurrentPortfolioMethods {
|
|
90
|
+
assetMix(params?: Record<string, never>, options?: RequestOptions): Promise<AssetMix & CurrentMixEvidence>;
|
|
91
|
+
sectorMix(params?: Record<string, never>, options?: RequestOptions): Promise<SectorMix & CurrentMixEvidence>;
|
|
92
|
+
issuerMix(params?: Record<string, never>, options?: RequestOptions): Promise<IssuerMix & CurrentMixEvidence>;
|
|
93
|
+
}
|
|
94
|
+
export interface CurrentMixEvidence {
|
|
95
|
+
current_valuation: {
|
|
96
|
+
valuation_date: string;
|
|
97
|
+
holdings: Array<{
|
|
98
|
+
holding: string;
|
|
99
|
+
investment_account: string;
|
|
100
|
+
instrument: string;
|
|
101
|
+
scheme_id: string;
|
|
102
|
+
status: "available";
|
|
103
|
+
units: string;
|
|
104
|
+
as_of: string;
|
|
105
|
+
position_date: string;
|
|
106
|
+
value: {
|
|
107
|
+
amount: string;
|
|
108
|
+
currency: "INR";
|
|
109
|
+
};
|
|
110
|
+
nav: {
|
|
111
|
+
amount: string;
|
|
112
|
+
currency: "INR";
|
|
113
|
+
date: string;
|
|
114
|
+
};
|
|
115
|
+
freshness: {
|
|
116
|
+
status: "recent" | "stale";
|
|
117
|
+
age_days: number;
|
|
118
|
+
recent_within_days: 3;
|
|
119
|
+
time_zone: "Asia/Kolkata";
|
|
120
|
+
};
|
|
121
|
+
ownership_status: "user_supplied_not_verified";
|
|
122
|
+
valuation_basis: "units_times_latest_nav";
|
|
123
|
+
revision: number | null;
|
|
124
|
+
source: {
|
|
125
|
+
kind: "user" | "statement";
|
|
126
|
+
reference: string;
|
|
127
|
+
};
|
|
128
|
+
derivation: import("./market-types.js").CurrentHoldingsResult["holdings"][number]["derivation"] | null;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export type PortfolioObject = Portfolio & PortfolioMethods & {
|
|
133
|
+
current(): CurrentPortfolioMethods;
|
|
134
|
+
currentSnapshot(options?: RequestOptions): Promise<SnapshotPortfolioView>;
|
|
135
|
+
on(date: string): DatedPortfolioMethods;
|
|
136
|
+
readonly history: {
|
|
137
|
+
retrieve(options?: RequestOptions): Promise<HistoryView>;
|
|
138
|
+
import(body: HistoryImport, options: IdempotentOptions): Promise<HistoryImportResult>;
|
|
139
|
+
canReconstruct(date: string, options?: RequestOptions): Promise<HistoryCapability>;
|
|
140
|
+
};
|
|
141
|
+
readonly holdings: {
|
|
142
|
+
setCurrent(body: CurrentHoldingsInput, options: IdempotentOptions): Promise<CurrentHoldingsResult>;
|
|
143
|
+
retrieve(holding: string, options?: RequestOptions): Promise<HoldingObject>;
|
|
144
|
+
list(params?: {
|
|
145
|
+
date?: string;
|
|
146
|
+
}, options?: RequestOptions): Promise<Omit<HoldingsList, "data"> & {
|
|
147
|
+
data: HoldingObject[];
|
|
148
|
+
}>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
type Fields<T> = {
|
|
152
|
+
[K in keyof T as string extends K ? never : K]: T[K];
|
|
153
|
+
};
|
|
154
|
+
export type SnapshotPortfolioView = Omit<Fields<SnapshotView>, "portfolio"> & {
|
|
155
|
+
portfolio: PortfolioObject;
|
|
156
|
+
};
|
|
157
|
+
export type PortfolioObjectsList = Omit<Fields<PortfoliosList>, "data"> & {
|
|
158
|
+
data: PortfolioObject[];
|
|
159
|
+
};
|
|
160
|
+
export interface MutualFundObject extends PortfolioMethods {
|
|
161
|
+
readonly portfolio: PortfolioMethods;
|
|
162
|
+
readonly mutual_fund_id?: string;
|
|
163
|
+
readonly instrument?: string;
|
|
164
|
+
}
|
|
165
|
+
export type FundObjectsList = Omit<Fields<FundsList>, "data"> & {
|
|
166
|
+
data: Array<FundsList["data"][number] & {
|
|
167
|
+
instrument: FundsList["data"][number]["instrument"] & MutualFundObject;
|
|
168
|
+
}>;
|
|
169
|
+
};
|
|
170
|
+
export type FundObjectReferences = Omit<Fields<FundReferences>, "data"> & {
|
|
171
|
+
data: Array<FundReferences["data"][number] & {
|
|
172
|
+
instrument: FundReferences["data"][number]["instrument"] & MutualFundObject;
|
|
173
|
+
}>;
|
|
174
|
+
};
|
|
175
|
+
export interface ClientSurface {
|
|
176
|
+
readonly marketSnapshots: MonthlyMarketClient;
|
|
177
|
+
readonly mutualFundSchemes: {
|
|
178
|
+
readonly navs: {
|
|
179
|
+
readonly retrieve: MonthlyMarketClient["schemes"]["nav"];
|
|
180
|
+
};
|
|
181
|
+
readonly expenseRatios: {
|
|
182
|
+
readonly retrieve: MonthlyMarketClient["schemes"]["expenseRatio"];
|
|
183
|
+
};
|
|
184
|
+
readonly valuation: MonthlyMarketClient["schemes"]["valuation"];
|
|
185
|
+
};
|
|
186
|
+
readonly marketData: MarketDataClient;
|
|
187
|
+
readonly accounts: {
|
|
188
|
+
readonly retrieve: (options?: RequestOptions) => Promise<Account>;
|
|
189
|
+
};
|
|
190
|
+
readonly clients: {
|
|
191
|
+
readonly list: (params?: ListOptions, options?: RequestOptions) => Promise<ClientsList>;
|
|
192
|
+
readonly retrieve: (id: string, options?: RequestOptions) => Promise<Client>;
|
|
193
|
+
};
|
|
194
|
+
readonly investors: {
|
|
195
|
+
readonly list: (params?: FilteredListOptions, options?: RequestOptions) => Promise<InvestorsList>;
|
|
196
|
+
readonly retrieve: (id: string, options?: RequestOptions) => Promise<Investor>;
|
|
197
|
+
readonly create: (body: InvestorCreate, options: IdempotentOptions) => Promise<Investor>;
|
|
198
|
+
readonly update: (id: string, body: InvestorUpdate, options?: RequestOptions) => Promise<Investor>;
|
|
199
|
+
};
|
|
200
|
+
readonly portfolios: {
|
|
201
|
+
readonly update: (id: string, body: PortfolioUpdate, options: IdempotentOptions) => Promise<PortfolioObject>;
|
|
202
|
+
readonly build: (input: InMemoryPortfolioInput) => InMemoryPortfolio;
|
|
203
|
+
readonly fromPositions: (input: InMemoryPortfolioInput) => InMemoryPortfolio;
|
|
204
|
+
readonly list: (params?: PortfolioListOptions, options?: RequestOptions) => Promise<PortfolioObjectsList>;
|
|
205
|
+
readonly retrieve: (id: string, options?: RequestOptions) => Promise<PortfolioObject>;
|
|
206
|
+
readonly create: (body: PortfolioCreate, options: IdempotentOptions) => Promise<SnapshotPortfolioView>;
|
|
207
|
+
readonly snapshots: {
|
|
208
|
+
readonly retrieveCurrent: (id: string, options?: RequestOptions) => Promise<SnapshotPortfolioView>;
|
|
209
|
+
readonly create: (id: string, body: SnapshotCreate, options: IdempotentOptions) => Promise<SnapshotPortfolioView>;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
readonly mutualFunds: {
|
|
213
|
+
readonly portfolios: {
|
|
214
|
+
readonly retrieve: MonthlyMarketClient["funds"]["portfolio"];
|
|
215
|
+
readonly holdings: {
|
|
216
|
+
readonly list: MonthlyMarketClient["funds"]["holdings"];
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
readonly fromId: (mutualFundId: string) => MutualFundObject;
|
|
220
|
+
readonly fromInstrument: (instrument: string) => MutualFundObject;
|
|
221
|
+
readonly search: (params: {
|
|
222
|
+
query: string;
|
|
223
|
+
limit?: number;
|
|
224
|
+
}, options?: RequestOptions) => Promise<FundObjectsList>;
|
|
225
|
+
readonly references: (params: {
|
|
226
|
+
instruments: string[];
|
|
227
|
+
}, options?: RequestOptions) => Promise<FundObjectReferences>;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Generated from frozen OpenAPI; do not edit.
|
|
2
|
+
module.exports = {"schemas":{"DecimalInput":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},"Money":{"type":"object","properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]{0,21})(\\.[0-9]{1,18})?$"},"currency":{"const":"INR"}},"required":["amount","currency"],"additionalProperties":true},"FinancialDate":{"type":"object","properties":{"precision":{"const":"date"},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"time_zone":{"const":"Asia/Kolkata"}},"required":["precision","date","time_zone"],"additionalProperties":true},"Account":{"type":"object","properties":{"id":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"object":{"const":"account"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"primary_investor":{"anyOf":[{"type":"string","pattern":"^inv_[a-f0-9]{32}$"},{"type":"null"}]},"personal_client_id":{"anyOf":[{"type":"string","pattern":"^clt_[a-f0-9]{32}$"},{"type":"null"}],"description":"Authenticated human user personal household in this account; null for machine account keys or no link. This context grants no access."}},"required":["id","object","created","primary_investor"],"additionalProperties":true},"Client":{"type":"object","properties":{"id":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"},"object":{"const":"client"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"}},"required":["id","object","created","account","name"],"additionalProperties":true},"Investor":{"type":"object","properties":{"id":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"},"object":{"const":"investor"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"client":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"relationship_to_owner":{"type":"string","x-known-values":["self","spouse","child","parent","sibling","other"],"minLength":1}},"required":["id","object","created","account","client","name","relationship_to_owner"],"additionalProperties":true},"Portfolio":{"type":"object","properties":{"id":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"object":{"const":"portfolio"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"investor":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"reporting_currency":{"const":"INR"}},"required":["id","object","created","account","investor","name","reporting_currency"],"additionalProperties":true},"Instrument":{"type":"object","properties":{"id":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"object":{"const":"instrument"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"identifiers":{"type":"array","items":{"type":"object","properties":{"namespace":{"type":"string"},"value":{"type":"string"}},"required":["namespace","value"],"additionalProperties":true}},"domicile_country":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"const":"mutual_fund"},"mutual_fund":{"type":"object","properties":{"fund_name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"share_class":{"anyOf":[{"type":"string"},{"type":"null"}]},"class_currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"distribution_policy":{"type":"string","x-known-values":["accumulating","distributing","unknown"],"minLength":1}},"required":["fund_name","share_class","class_currency","distribution_policy"],"additionalProperties":true}},"required":["id","object","created","name","identifiers","domicile_country","type","mutual_fund"],"additionalProperties":true},"Source":{"type":"object","properties":{"kind":{"type":"string","x-known-values":["manual","provider","statement"],"minLength":1},"name":{"type":"string"}},"required":["kind","name"],"additionalProperties":true},"MarketData":{"type":"object","properties":{"mode":{"type":"string","x-known-values":["live","fixture","unavailable"],"minLength":1},"notice":{"type":"string"}},"required":["mode","notice"],"additionalProperties":true},"PositionInput":{"type":"object","properties":{"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"current_value":{"$ref":"#/components/schemas/DecimalInput"}},"required":["instrument","current_value"],"additionalProperties":false},"InvestorCreate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"relationship_to_owner":{"type":"string","enum":["self","spouse","child","parent","sibling","other"]},"client":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}},"required":["name","relationship_to_owner"],"additionalProperties":false},"InvestorUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"relationship_to_owner":{"type":"string","enum":["self","spouse","child","parent","sibling","other"]}},"required":[],"additionalProperties":false,"minProperties":1},"PortfolioUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"expected_name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"}},"required":["name","expected_name"],"additionalProperties":false},"PortfolioCreate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"investor":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"},"as_of":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"positions":{"type":"array","items":{"$ref":"#/components/schemas/CreationPositionInput"},"minItems":0,"maxItems":100}},"required":["name","investor","as_of","positions"],"additionalProperties":false},"SnapshotCreate":{"type":"object","properties":{"expected_snapshot":{"type":"string","pattern":"^psn_[a-f0-9]{32}$"},"as_of":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"positions":{"type":"array","items":{"$ref":"#/components/schemas/PositionInput"},"maxItems":100}},"required":["expected_snapshot","as_of","positions"],"additionalProperties":false},"InvestmentAccount":{"type":"object","properties":{"id":{"type":"string","pattern":"^iac_[a-f0-9]{32}$"},"object":{"const":"investment_account"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"name":{"type":"string","minLength":1,"maxLength":200,"pattern":"\\S"},"kind":{"const":"manual"},"institution_name":{"type":"null"},"reference_masked":{"type":"null"},"latest_snapshot":{"type":"string","pattern":"^psn_[a-f0-9]{32}$"}},"required":["id","object","created","account","portfolio","name","kind","institution_name","reference_masked","latest_snapshot"],"additionalProperties":true},"Snapshot":{"type":"object","properties":{"id":{"type":"string","pattern":"^psn_[a-f0-9]{32}$"},"object":{"const":"position_snapshot"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"investment_account":{"type":"string","pattern":"^iac_[a-f0-9]{32}$"},"as_of":{"$ref":"#/components/schemas/FinancialDate"},"source":{"$ref":"#/components/schemas/Source"},"position_count":{"type":"integer","minimum":0,"maximum":100}},"required":["id","object","created","account","investment_account","as_of","source","position_count"],"additionalProperties":true},"Position":{"type":"object","properties":{"id":{"type":"string","pattern":"^pos_[a-f0-9]{32}$"},"object":{"const":"position"},"created":{"type":"integer","minimum":0,"maximum":9007199254740991},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"snapshot":{"type":"string","pattern":"^psn_[a-f0-9]{32}$"},"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"listing":{"type":"null"},"quantity":{"anyOf":[{"$ref":"#/components/schemas/DecimalInput"},{"type":"null"}]},"cost_basis":{"type":"null"},"valuation":{"anyOf":[{"type":"object","properties":{"method":{"const":"reported"},"market_value":{"$ref":"#/components/schemas/Money"},"as_of":{"$ref":"#/components/schemas/FinancialDate"},"source":{"$ref":"#/components/schemas/Source"},"unit_price":{"type":"null"}},"required":["method","market_value","as_of","source","unit_price"],"additionalProperties":true},{"type":"null"}]}},"required":["id","object","created","account","snapshot","instrument","listing","quantity","cost_basis","valuation"],"additionalProperties":true},"SnapshotView":{"type":"object","properties":{"portfolio":{"$ref":"#/components/schemas/Portfolio"},"investment_account":{"$ref":"#/components/schemas/InvestmentAccount"},"snapshot":{"$ref":"#/components/schemas/Snapshot"},"positions":{"type":"array","items":{"$ref":"#/components/schemas/Position"},"maxItems":100},"instruments":{"type":"array","items":{"$ref":"#/components/schemas/Instrument"},"maxItems":100},"total_current_value":{"anyOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}],"description":"Null if any snapshot position has only supplied units; unavailable value is not zero."},"valuation_basis":{"enum":["manual_current_value","supplied_quantity"]},"market_data":{"$ref":"#/components/schemas/MarketData"}},"required":["portfolio","investment_account","snapshot","positions","instruments","total_current_value","valuation_basis","market_data"],"additionalProperties":true},"FundReference":{"type":"object","properties":{"instrument":{"$ref":"#/components/schemas/Instrument"},"market":{"const":"IN"},"currency":{"const":"INR"},"scheme_id":{"type":"string","minLength":1,"description":"Opaque catalogue identifier; production bridge accepts validated positive decimal scheme IDs, fixture IDs are not DB IDs."},"plan_label":{"type":"string"},"option_label":{"type":"string"},"amfi_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"isin":{"anyOf":[{"type":"string"},{"type":"null"}]},"identity_status":{"type":"string","x-known-values":["resolved","conflict"],"minLength":1},"latest_nav":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},"currency":{"const":"INR"},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["amount","currency","date"],"additionalProperties":true},{"type":"null"}]},"data_mode":{"type":"string","x-known-values":["live","fixture"],"minLength":1},"source":{"type":"string"},"freshness":{"type":"object","properties":{"status":{"type":"string","x-known-values":["recent","stale","missing","invalid","fixture"],"minLength":1},"checked_at":{"type":"string","format":"date-time"},"as_of":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"time_zone":{"const":"Asia/Kolkata"},"age_days":{"anyOf":[{"type":"integer"},{"type":"null"}]},"recent_within_days":{"const":3}},"required":["status","checked_at","as_of","time_zone","age_days","recent_within_days"],"additionalProperties":true}},"required":["instrument","market","currency","scheme_id","plan_label","option_label","amfi_code","isin","identity_status","latest_nav","data_mode","source","freshness"],"additionalProperties":true},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","x-known-values":["authentication_error","permission_error","idempotency_error","rate_limit_error","api_error","invalid_request_error"],"minLength":1},"code":{"type":"string","minLength":1},"message":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"type":"null"}]},"request_id":{"type":"string","minLength":1}},"required":["type","code","message","param","request_id"],"additionalProperties":true}},"required":["error"],"additionalProperties":true},"ClientsList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Client"}},"has_more":{"type":"boolean"},"url":{"type":"string"}},"required":["object","data","has_more","url"],"additionalProperties":true},"InvestorsList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Investor"}},"has_more":{"type":"boolean"},"url":{"type":"string"}},"required":["object","data","has_more","url"],"additionalProperties":true},"PortfoliosList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Portfolio"}},"has_more":{"type":"boolean"},"url":{"type":"string"}},"required":["object","data","has_more","url"],"additionalProperties":true},"FundsList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/FundReference"}},"has_more":{"type":"boolean"},"url":{"type":"string"},"market_data":{"$ref":"#/components/schemas/MarketData"}},"required":["object","data","has_more","url","market_data"],"additionalProperties":true},"FundReferences":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/FundReference"}},"has_more":{"const":false},"url":{"type":"string"},"market_data":{"$ref":"#/components/schemas/MarketData"},"missing":{"type":"array","items":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"}}},"required":["object","data","has_more","url","market_data","missing"],"additionalProperties":true},"PortfolioMixRequest":{"type":"object","properties":{"portfolio":{"anyOf":[{"type":"object","properties":{"type":{"const":"saved"},"id":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},"required":["type","id"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"in_memory"},"valuation_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"currency":{"const":"INR"},"positions":{"type":"array","items":{"$ref":"#/components/schemas/PositionInput"},"minItems":1,"maxItems":100}},"required":["type","valuation_date","currency","positions"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"mutual_fund"},"mutual_fund_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$","description":"Portfolio-owning MutualFund ID (positive int64), never AMC or investible scheme ID."}},"required":["type","mutual_fund_id"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"fund_instrument"},"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"}},"required":["type","instrument"],"additionalProperties":false}]},"as_of":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"position_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"valuation_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["portfolio"],"additionalProperties":false},"AssetMix":{"type":"object","properties":{"object":{"const":"portfolio_mix"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"anyOf":[{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},{"type":"null"}]},"mix_type":{"const":"asset"},"engine_version":{"type":"string","minLength":1},"as_of_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"valuation_date":{"anyOf":[{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},{"type":"null"}]},"input_total":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]{0,21})(\\.[0-9]{1,18})?$"},"currency":{"const":"INR"}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"calculation_precision":{"const":"float64"},"source_roots":{"type":"array","items":{"type":"object","properties":{"mutual_fund_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"portfolio_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"date":{"type":"string","format":"date","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$"}},"required":["mutual_fund_id","portfolio_id","date"],"additionalProperties":false},"minItems":1,"maxItems":100},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","x-known-values":["float64_precision","threshold_contribution_skipped","nested_holdings_unavailable","missing_issuer_identity","cycle_detected","classifications_not_historical"],"minLength":1},"message":{"type":"string"},"mutual_fund_id":{"anyOf":[{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},{"type":"null"}]},"path":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","mutual_fund_id","path"],"additionalProperties":false}},"mix":{"type":"object","properties":{"status":{"type":"string","x-known-values":["available","unavailable"],"minLength":1},"denominator":{"const":"total_supplied_value_or_root_value"},"unavailable_reason":{"anyOf":[{"type":"string","x-known-values":["no_eligible_contributions"],"minLength":1},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","x-known-values":["cash","debt","equity","gold","other","unknown"],"minLength":1},"percentage":{"type":"string","pattern":"^-?(1000000000000(\\.0{1,10})?|[0-9]{1,12}(\\.[0-9]{1,10})?)$"}},"required":["code","percentage"],"additionalProperties":false}}},"required":["status","denominator","unavailable_reason","items"],"additionalProperties":false},"position_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["object","account","portfolio","mix_type","engine_version","as_of_date","valuation_date","input_total","calculation_precision","source_roots","warnings","mix"],"additionalProperties":true},"SectorMix":{"type":"object","properties":{"object":{"const":"portfolio_mix"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"anyOf":[{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},{"type":"null"}]},"mix_type":{"const":"sector"},"engine_version":{"type":"string","minLength":1},"as_of_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"valuation_date":{"anyOf":[{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},{"type":"null"}]},"input_total":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]{0,21})(\\.[0-9]{1,18})?$"},"currency":{"const":"INR"}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"calculation_precision":{"const":"float64"},"source_roots":{"type":"array","items":{"type":"object","properties":{"mutual_fund_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"portfolio_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"date":{"type":"string","format":"date","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$"}},"required":["mutual_fund_id","portfolio_id","date"],"additionalProperties":false},"minItems":1,"maxItems":100},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","x-known-values":["float64_precision","threshold_contribution_skipped","nested_holdings_unavailable","missing_issuer_identity","cycle_detected","classifications_not_historical"],"minLength":1},"message":{"type":"string"},"mutual_fund_id":{"anyOf":[{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},{"type":"null"}]},"path":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","mutual_fund_id","path"],"additionalProperties":false}},"mix":{"type":"object","properties":{"status":{"type":"string","x-known-values":["available","unavailable"],"minLength":1},"denominator":{"const":"recursively_normalized_eligible_equity_sector_contributions"},"unavailable_reason":{"anyOf":[{"type":"string","x-known-values":["no_eligible_contributions"],"minLength":1},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","x-known-values":["not_set","agriculture","auto","cash_equivalents","chemicals","construction","consumer_discretionary","consumer_staples","defence","diversified","education","electronics","etf","energy_production","finance","furniture","government","healthcare","industrial_equipment","infrastructure","it_technology","logistics","media","outsourcing","packaging","paper_products","photographic_films","plastic_products","raw_materials","real_estate","restaurants","retail","shipping","telecom","textile","tobacco","trading","travel_lodging","utilities","other","not_applicable"],"minLength":1},"label":{"type":"string"},"percentage":{"type":"string","pattern":"^(100(\\.0{1,10})?|[0-9]{1,2}(\\.[0-9]{1,10})?)$"}},"required":["code","label","percentage"],"additionalProperties":false}}},"required":["status","denominator","unavailable_reason","items"],"additionalProperties":false},"position_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["object","account","portfolio","mix_type","engine_version","as_of_date","valuation_date","input_total","calculation_precision","source_roots","warnings","mix"],"additionalProperties":true},"IssuerMix":{"type":"object","properties":{"object":{"const":"portfolio_mix"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"anyOf":[{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},{"type":"null"}]},"mix_type":{"const":"issuer"},"engine_version":{"type":"string","minLength":1},"as_of_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"valuation_date":{"anyOf":[{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},{"type":"null"}]},"input_total":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^(0|[1-9][0-9]{0,21})(\\.[0-9]{1,18})?$"},"currency":{"const":"INR"}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"calculation_precision":{"const":"float64"},"source_roots":{"type":"array","items":{"type":"object","properties":{"mutual_fund_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"portfolio_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"date":{"type":"string","format":"date","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$"}},"required":["mutual_fund_id","portfolio_id","date"],"additionalProperties":false},"minItems":1,"maxItems":100},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","x-known-values":["float64_precision","threshold_contribution_skipped","nested_holdings_unavailable","missing_issuer_identity","cycle_detected","classifications_not_historical"],"minLength":1},"message":{"type":"string"},"mutual_fund_id":{"anyOf":[{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},{"type":"null"}]},"path":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","message","mutual_fund_id","path"],"additionalProperties":false}},"mix":{"type":"object","properties":{"status":{"type":"string","x-known-values":["available","unavailable"],"minLength":1},"denominator":{"const":"recursively_normalized_eligible_equity_issuer_contributions"},"unavailable_reason":{"anyOf":[{"type":"string","x-known-values":["no_eligible_contributions"],"minLength":1},{"type":"null"}]},"items":{"type":"array","items":{"type":"object","properties":{"issuer_type":{"type":"string","minLength":1},"issuer_id":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"percentage":{"type":"string","pattern":"^(100(\\.0{1,10})?|[0-9]{1,2}(\\.[0-9]{1,10})?)$"}},"required":["issuer_type","issuer_id","name","percentage"],"additionalProperties":false}}},"required":["status","denominator","unavailable_reason","items"],"additionalProperties":false},"position_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["object","account","portfolio","mix_type","engine_version","as_of_date","valuation_date","input_total","calculation_precision","source_roots","warnings","mix"],"additionalProperties":true},"HistorySource":{"type":"object","properties":{"kind":{"type":"string","enum":["user","statement"]},"reference":{"type":"string","minLength":1,"maxLength":255}},"required":["kind","reference"],"additionalProperties":false},"HistoryRange":{"type":"object","properties":{"from":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"through":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}},"required":["from","through"],"additionalProperties":false},"HistoryOpening":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"quantity":{"$ref":"#/components/schemas/UnitInput"}},"required":["date","quantity"],"additionalProperties":false},"HistoryTransaction":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":255},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"sequence":{"type":"integer","minimum":0,"maximum":9007199254740991},"kind":{"type":"string","enum":["buy","sell"]},"quantity":{"$ref":"#/components/schemas/UnitInput"}},"required":["external_id","date","sequence","kind","quantity"],"additionalProperties":false},"HistoryObservation":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"quantity":{"anyOf":[{"$ref":"#/components/schemas/UnitInput"},{"type":"null"}]},"current_value":{"$ref":"#/components/schemas/Money"}},"required":["date"],"additionalProperties":false},"HistoryHoldingInput":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":255},"investment_account":{"type":"string","pattern":"^iac_[a-f0-9]{32}$"},"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"opening":{"$ref":"#/components/schemas/HistoryOpening"},"complete_range":{"$ref":"#/components/schemas/HistoryRange"},"transactions":{"type":"array","items":{"$ref":"#/components/schemas/HistoryTransaction"},"maxItems":5000},"observed_position":{"$ref":"#/components/schemas/HistoryObservation"}},"required":["external_id","investment_account","instrument"],"additionalProperties":false},"HistoryImport":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/HistorySource"},"holdings":{"type":"array","items":{"$ref":"#/components/schemas/HistoryHoldingInput"},"minItems":1,"maxItems":100},"complete_range":{"$ref":"#/components/schemas/HistoryRange"}},"required":["source","holdings"],"additionalProperties":false},"Holding":{"type":"object","properties":{"id":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"},"object":{"const":"holding"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"investment_account":{"type":"string","pattern":"^iac_[a-f0-9]{32}$"},"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"position_backing":{"type":"string","x-known-values":["snapshot","ledger","mixed"],"minLength":1}},"required":["id","object","account","portfolio","investment_account","instrument","position_backing"],"additionalProperties":true},"HoldingPosition":{"type":"object","properties":{"object":{"const":"holding_position"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"holding":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"},"position_date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"quantity":{"anyOf":[{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},{"type":"null"}]},"valuation":{"anyOf":[{"type":"object","properties":{"market_value":{"$ref":"#/components/schemas/Money"},"as_of":{"$ref":"#/components/schemas/FinancialDate"}},"required":["market_value","as_of"],"additionalProperties":true},{"type":"null"}]},"position_backing":{"type":"string","x-known-values":["snapshot","ledger","mixed"],"minLength":1},"history_complete":{"type":"boolean"}},"required":["object","account","portfolio","holding","position_date","quantity","valuation","position_backing","history_complete"],"additionalProperties":true},"HistoryCapability":{"type":"object","properties":{"object":{"const":"history_capability"},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"basis":{"const":"declared"},"can_reconstruct":{"type":"boolean"},"history_complete":{"type":"boolean"},"position_backing":{"type":"string","x-known-values":["snapshot","ledger","mixed"],"minLength":1},"reasons":{"type":"array","items":{"type":"string"}}},"required":["object","date","basis","can_reconstruct","history_complete","position_backing","reasons"],"additionalProperties":true},"HoldingsList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Holding"}},"has_more":{"type":"boolean"},"url":{"type":"string"}},"required":["object","data","has_more","url"],"additionalProperties":true},"HistoryImportResult":{"type":"object","properties":{"object":{"const":"history_import"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"holdings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"}},"required":["id"],"additionalProperties":true}}},"required":["object","account","portfolio","holdings"],"additionalProperties":true},"HistoryView":{"type":"object","properties":{"object":{"const":"portfolio_history"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"source":{"anyOf":[{"$ref":"#/components/schemas/HistorySource"},{"type":"null"}]},"complete_range":{"anyOf":[{"$ref":"#/components/schemas/HistoryRange"},{"type":"null"}]},"holdings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"},"object":{"const":"holding"},"account":{"type":"string","pattern":"^acct_[a-f0-9]{32}$"},"portfolio":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"},"investment_account":{"type":"string","pattern":"^iac_[a-f0-9]{32}$"},"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"position_backing":{"type":"string","x-known-values":["snapshot","ledger","mixed"],"minLength":1},"external_id":{"type":"string"},"opening":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},"source":{"$ref":"#/components/schemas/HistorySource"}},"required":["date","quantity","source"],"additionalProperties":true},{"type":"null"}]},"complete_range":{"anyOf":[{"$ref":"#/components/schemas/HistoryRange"},{"type":"null"}]},"complete_range_source":{"anyOf":[{"$ref":"#/components/schemas/HistorySource"},{"type":"null"}]},"transactions":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":255},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"sequence":{"type":"integer","minimum":0,"maximum":9007199254740991},"kind":{"type":"string","x-known-values":["buy","sell"],"minLength":1},"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},"source":{"$ref":"#/components/schemas/HistorySource"}},"required":["external_id","date","sequence","kind","quantity","source"],"additionalProperties":true}},"observed_position":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."},"quantity":{"anyOf":[{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$"},{"type":"null"}]},"current_value":{"$ref":"#/components/schemas/Money"},"source":{"$ref":"#/components/schemas/HistorySource"}},"required":["date","quantity","source"],"additionalProperties":true},{"type":"null"}]}},"required":["id","object","account","portfolio","investment_account","instrument","position_backing","external_id","opening","complete_range","complete_range_source","transactions","observed_position"],"additionalProperties":true}}},"required":["object","account","portfolio","source","complete_range","holdings"],"additionalProperties":true},"CreationPositionInput":{"anyOf":[{"$ref":"#/components/schemas/PositionInput"},{"type":"object","properties":{"instrument":{"type":"string","pattern":"^ins_[A-Za-z0-9_-]{1,150}$"},"quantity":{"type":"string","pattern":"^(?=[0-9.]*[1-9])(0|[1-9][0-9]{0,19})(\\.[0-9]{1,4})?$"}},"required":["instrument","quantity"],"additionalProperties":false}],"description":"Exactly one reported current_value or positive supplied quantity per position. Quantity creation stores dated units atomically; no reported amount is inferred."},"UnitInput":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,4})?$","description":"Supplied units: maximum four fractional digits; no rounding on input."}},"operations":{"retrieve_account":{"path":"/v1/accounts/{account}","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}}],"status":200,"response":{"$ref":"#/components/schemas/Account"}},"list_clients":{"path":"/v1/accounts/{account}/clients","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"limit","in":"query","required":false,"description":"1–100; default 10.","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"starting_after","in":"query","required":false,"description":"Last resource ID from the previous page. Omit on the first page. Keep filters unchanged.","schema":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/ClientsList"}},"retrieve_client":{"path":"/v1/accounts/{account}/clients/{client}","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"client","in":"path","required":true,"description":"ID returned by the clients list or creation response.","schema":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/Client"}},"list_investors":{"path":"/v1/accounts/{account}/investors","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"limit","in":"query","required":false,"description":"1–100; default 10.","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"starting_after","in":"query","required":false,"description":"Last resource ID from the previous page. Omit on the first page. Keep filters unchanged.","schema":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"}},{"name":"client","in":"query","required":false,"description":"Limit to investors in this same-account Client, or their portfolios. Does not expand access.","schema":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/InvestorsList"}},"create_investor":{"path":"/v1/accounts/{account}/investors","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/InvestorCreate"},"status":201,"response":{"$ref":"#/components/schemas/Investor"}},"retrieve_investor":{"path":"/v1/accounts/{account}/investors/{investor}","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"investor","in":"path","required":true,"description":"ID returned by the investors list or creation response.","schema":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/Investor"}},"update_investor":{"path":"/v1/accounts/{account}/investors/{investor}","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"investor","in":"path","required":true,"description":"Investor being edited.","schema":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/InvestorUpdate"},"status":200,"response":{"$ref":"#/components/schemas/Investor"}},"list_portfolios":{"path":"/v1/accounts/{account}/portfolios","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"limit","in":"query","required":false,"description":"1–100; default 10.","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"starting_after","in":"query","required":false,"description":"Last resource ID from the previous page. Omit on the first page. Keep filters unchanged.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"client","in":"query","required":false,"description":"Limit to investors in this same-account Client, or their portfolios. Does not expand access.","schema":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}},{"name":"client_ids","in":"query","required":false,"style":"form","explode":true,"schema":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","pattern":"^clt_[a-f0-9]{32}$"}},"description":"OR within list. Mutually exclusive with other filter types and legacy client. Repeated query keys; duplicate IDs are deduplicated."},{"name":"investor_ids","in":"query","required":false,"style":"form","explode":true,"schema":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","pattern":"^inv_[a-f0-9]{32}$"}},"description":"OR within list. Mutually exclusive with other filter types and legacy client. Repeated query keys; duplicate IDs are deduplicated."}],"status":200,"response":{"$ref":"#/components/schemas/PortfoliosList"}},"create_portfolio":{"path":"/v1/accounts/{account}/portfolios","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/PortfolioCreate"},"status":201,"response":{"$ref":"#/components/schemas/SnapshotView"}},"retrieve_portfolio":{"path":"/v1/accounts/{account}/portfolios/{portfolio}","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"ID returned by the portfolios list or creation response.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/Portfolio"}},"update_portfolio":{"path":"/v1/accounts/{account}/portfolios/{portfolio}","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"ID returned by the portfolios list or creation response.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/PortfolioUpdate"},"status":200,"response":{"$ref":"#/components/schemas/Portfolio"}},"search_funds":{"path":"/v1/accounts/{account}/mutual_funds","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"query","in":"query","required":true,"description":"2–100 characters. Case-insensitive label and identifier search; percent and underscore are literal.","schema":{"type":"string","minLength":2,"maxLength":100}},{"name":"limit","in":"query","required":false,"description":"1–20; default 10. Search is a bounded result set, not cursor pagination.","schema":{"type":"integer","minimum":1,"maximum":20,"default":10}}],"status":200,"response":{"$ref":"#/components/schemas/FundsList"}},"fund_references":{"path":"/v1/accounts/{account}/mutual_funds/references","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"instruments","in":"query","required":true,"description":"1–100 distinct instrument IDs in one query parameter. Unknown, inactive or unsupported IDs appear in missing.","schema":{"type":"string","minLength":1,"description":"1–100 distinct IDs separated by commas, singleton query parameter."}}],"status":200,"response":{"$ref":"#/components/schemas/FundReferences"}},"current_snapshot":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/current_snapshot","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Same-account portfolio.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/SnapshotView"}},"replace_snapshot":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/snapshots","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account. me resolves the account bound to the account-owned key or delegated grant, never an arbitrary user account.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Portfolio being edited.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/SnapshotCreate"},"status":201,"response":{"$ref":"#/components/schemas/SnapshotView"}},"asset_mix":{"path":"/v1/accounts/{account}/portfolios/asset_mix","readOnly":true,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Account ID or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}}],"request":{"$ref":"#/components/schemas/PortfolioMixRequest"},"status":200,"response":{"$ref":"#/components/schemas/AssetMix"}},"sector_mix":{"path":"/v1/accounts/{account}/portfolios/sector_mix","readOnly":true,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Account ID or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}}],"request":{"$ref":"#/components/schemas/PortfolioMixRequest"},"status":200,"response":{"$ref":"#/components/schemas/SectorMix"}},"issuer_mix":{"path":"/v1/accounts/{account}/portfolios/issuer_mix","readOnly":true,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Account ID or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}}],"request":{"$ref":"#/components/schemas/PortfolioMixRequest"},"status":200,"response":{"$ref":"#/components/schemas/IssuerMix"}},"import_history":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/history/imports","readOnly":false,"method":"POST","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[!-~]{1,255}$"},"description":"Successful responses retained for 24 hours from server recording time; response record and mutation commit atomically. Retries do not extend retention; current authorization always required before replay."}],"request":{"$ref":"#/components/schemas/HistoryImport"},"status":201,"response":{"$ref":"#/components/schemas/HistoryImportResult"}},"retrieve_history":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/history","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/HistoryView"}},"history_capabilities":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/history/capabilities","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"date","in":"query","required":true,"description":"Investor position date; daily close in the investment account timezone.","schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}}],"status":200,"response":{"$ref":"#/components/schemas/HistoryCapability"}},"list_holdings":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/holdings","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"date","in":"query","required":false,"description":"Optional historical date; closed holdings remain available.","schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}}],"status":200,"response":{"$ref":"#/components/schemas/HoldingsList"}},"retrieve_holding":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/holdings/{holding}","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"holding","in":"path","required":true,"description":"Holding scoped to this portfolio.","schema":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"}}],"status":200,"response":{"$ref":"#/components/schemas/Holding"}},"holding_position":{"path":"/v1/accounts/{account}/portfolios/{portfolio}/holdings/{holding}/position","readOnly":false,"method":"GET","parameters":[{"name":"account","in":"path","required":true,"description":"Authorized account or me.","schema":{"anyOf":[{"const":"me"},{"type":"string","pattern":"^acct_[a-f0-9]{32}$"}]}},{"name":"portfolio","in":"path","required":true,"description":"Saved portfolio ID.","schema":{"type":"string","pattern":"^ptf_[a-f0-9]{32}$"}},{"name":"holding","in":"path","required":true,"description":"Holding scoped to this portfolio.","schema":{"type":"string","pattern":"^hld_[a-f0-9]{32}$"}},{"name":"date","in":"query","required":true,"description":"Investor position date.","schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Real calendar date, 1900-01-01 through today Asia/Kolkata; replacement cannot move backwards."}}],"status":200,"response":{"$ref":"#/components/schemas/HoldingPosition"}}}};
|
package/dist/errors.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidResponseError = exports.AbortError = exports.TimeoutError = exports.TransportError = exports.APIError = exports.ValidationError = exports.BharosaError = void 0;
|
|
4
|
+
class BharosaError extends Error {
|
|
5
|
+
constructor(kind, message, metadata = {}) {
|
|
6
|
+
// Parameter destructuring in the original implementation read metadata
|
|
7
|
+
// before coercing the message, including properties inherited by primitives.
|
|
8
|
+
if (metadata === null)
|
|
9
|
+
throw new TypeError("Cannot destructure null metadata");
|
|
10
|
+
const boxed = Object(metadata);
|
|
11
|
+
const status = Reflect.get(boxed, "status");
|
|
12
|
+
const requestId = Reflect.get(boxed, "requestId");
|
|
13
|
+
const code = Reflect.get(boxed, "code");
|
|
14
|
+
const param = Reflect.get(boxed, "param");
|
|
15
|
+
const type = Reflect.get(boxed, "type");
|
|
16
|
+
const outcome = Reflect.get(boxed, "outcome");
|
|
17
|
+
// Error coerces its message, but omission does not create an own property.
|
|
18
|
+
// Legacy options are the message here; they must not become Error.cause.
|
|
19
|
+
super(message === undefined ? undefined : `${message}`);
|
|
20
|
+
this.name = new.target.name;
|
|
21
|
+
Object.assign(this, {
|
|
22
|
+
kind,
|
|
23
|
+
outcome: outcome === undefined ? "not_sent" : outcome,
|
|
24
|
+
});
|
|
25
|
+
for (const [field, value] of Object.entries({
|
|
26
|
+
status,
|
|
27
|
+
requestId,
|
|
28
|
+
code,
|
|
29
|
+
param,
|
|
30
|
+
type,
|
|
31
|
+
})) {
|
|
32
|
+
if (value !== undefined)
|
|
33
|
+
Object.assign(this, { [field]: value });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BharosaError = BharosaError;
|
|
38
|
+
class ValidationError extends BharosaError {
|
|
39
|
+
constructor(_message, _options) {
|
|
40
|
+
super("validation", "Check the SDK configuration and request fields against the method documentation. The request was not sent.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ValidationError = ValidationError;
|
|
44
|
+
class APIError extends BharosaError {
|
|
45
|
+
constructor(meta = {}, _options) {
|
|
46
|
+
super("api", "Bharosa rejected the request. Check code and param for the reason, and include requestId when contacting support.", meta);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.APIError = APIError;
|
|
50
|
+
class TransportError extends BharosaError {
|
|
51
|
+
constructor(meta = {}, _options) {
|
|
52
|
+
super("transport", "Could not reach Bharosa or read its response. Check your connection. For a write, inspect outcome before retrying with the original idempotency key.", meta);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.TransportError = TransportError;
|
|
56
|
+
class TimeoutError extends BharosaError {
|
|
57
|
+
constructor(meta = {}, _options) {
|
|
58
|
+
super("timeout", "The request timed out. For a write, check outcome before retrying; the server may already have saved it.", meta);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TimeoutError = TimeoutError;
|
|
62
|
+
class AbortError extends BharosaError {
|
|
63
|
+
constructor(meta = {}, _options) {
|
|
64
|
+
super("abort", "The request was cancelled. Cancellation does not undo a write already saved by the server; check outcome before retrying.", meta);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.AbortError = AbortError;
|
|
68
|
+
class InvalidResponseError extends BharosaError {
|
|
69
|
+
constructor(meta = {}, _options) {
|
|
70
|
+
super("invalid_response", "The response did not match the expected format. Contact support with requestId. For a write, check outcome before retrying.", meta);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.InvalidResponseError = InvalidResponseError;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MutationOutcome } from "./client-types.cjs";
|
|
2
|
+
export type ErrorKind = "validation" | "api" | "transport" | "timeout" | "abort" | "invalid_response";
|
|
3
|
+
export interface ErrorMetadata {
|
|
4
|
+
status?: number;
|
|
5
|
+
requestId?: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
param?: string | null;
|
|
8
|
+
type?: string;
|
|
9
|
+
outcome?: MutationOutcome;
|
|
10
|
+
}
|
|
11
|
+
export declare class BharosaError extends Error {
|
|
12
|
+
readonly kind: ErrorKind;
|
|
13
|
+
readonly outcome: MutationOutcome;
|
|
14
|
+
readonly status?: number;
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
readonly code?: string;
|
|
17
|
+
readonly param?: string | null;
|
|
18
|
+
readonly type?: string;
|
|
19
|
+
/** Legacy declarations exposed Error-style construction. These forms preserve
|
|
20
|
+
* the original JavaScript behavior: the first argument is still `kind`, and
|
|
21
|
+
* the second argument (including an ErrorOptions object) is still the message.
|
|
22
|
+
* Prefer catching SDK errors or the explicit kind/message/metadata overload. */
|
|
23
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
24
|
+
constructor(kind: ErrorKind, message: string, metadata?: ErrorMetadata | string);
|
|
25
|
+
}
|
|
26
|
+
export declare class ValidationError extends BharosaError {
|
|
27
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
export declare class APIError extends BharosaError {
|
|
30
|
+
constructor(metadata?: ErrorMetadata);
|
|
31
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
32
|
+
}
|
|
33
|
+
export declare class TransportError extends BharosaError {
|
|
34
|
+
constructor(metadata?: ErrorMetadata);
|
|
35
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
36
|
+
}
|
|
37
|
+
export declare class TimeoutError extends BharosaError {
|
|
38
|
+
constructor(metadata?: ErrorMetadata);
|
|
39
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
export declare class AbortError extends BharosaError {
|
|
42
|
+
constructor(metadata?: ErrorMetadata);
|
|
43
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
44
|
+
}
|
|
45
|
+
export declare class InvalidResponseError extends BharosaError {
|
|
46
|
+
constructor(metadata?: ErrorMetadata);
|
|
47
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
48
|
+
}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MutationOutcome } from "./client-types.js";
|
|
2
|
+
export type ErrorKind = "validation" | "api" | "transport" | "timeout" | "abort" | "invalid_response";
|
|
3
|
+
export interface ErrorMetadata {
|
|
4
|
+
status?: number;
|
|
5
|
+
requestId?: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
param?: string | null;
|
|
8
|
+
type?: string;
|
|
9
|
+
outcome?: MutationOutcome;
|
|
10
|
+
}
|
|
11
|
+
export declare class BharosaError extends Error {
|
|
12
|
+
readonly kind: ErrorKind;
|
|
13
|
+
readonly outcome: MutationOutcome;
|
|
14
|
+
readonly status?: number;
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
readonly code?: string;
|
|
17
|
+
readonly param?: string | null;
|
|
18
|
+
readonly type?: string;
|
|
19
|
+
/** Legacy declarations exposed Error-style construction. These forms preserve
|
|
20
|
+
* the original JavaScript behavior: the first argument is still `kind`, and
|
|
21
|
+
* the second argument (including an ErrorOptions object) is still the message.
|
|
22
|
+
* Prefer catching SDK errors or the explicit kind/message/metadata overload. */
|
|
23
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
24
|
+
constructor(kind: ErrorKind, message: string, metadata?: ErrorMetadata | string);
|
|
25
|
+
}
|
|
26
|
+
export declare class ValidationError extends BharosaError {
|
|
27
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
export declare class APIError extends BharosaError {
|
|
30
|
+
constructor(metadata?: ErrorMetadata);
|
|
31
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
32
|
+
}
|
|
33
|
+
export declare class TransportError extends BharosaError {
|
|
34
|
+
constructor(metadata?: ErrorMetadata);
|
|
35
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
36
|
+
}
|
|
37
|
+
export declare class TimeoutError extends BharosaError {
|
|
38
|
+
constructor(metadata?: ErrorMetadata);
|
|
39
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
export declare class AbortError extends BharosaError {
|
|
42
|
+
constructor(metadata?: ErrorMetadata);
|
|
43
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
44
|
+
}
|
|
45
|
+
export declare class InvalidResponseError extends BharosaError {
|
|
46
|
+
constructor(metadata?: ErrorMetadata);
|
|
47
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
48
|
+
}
|