Portfolio context for chat
Supply the positions and investor context a conversation should use.
Partner portfolio contexts are separate from native accounts. They supply current holdings, closed positions, trade history, and optional investor context to Clarity chat and embeds. They do not run native valuation or become snapshot-feed accounts.
Persist a context
curl --fail-with-body "$MOTIF_BASE_URL/v1/sdk/partner-portfolios" \
-H "x-api-key: $MOTIF_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"externalId":"conversation-account-001",
"baseCurrency":"USD",
"currentHoldings":[{"ticker":"AAPL","quantity":"10","currency":"USD"}],
"profile":{"riskTolerance":"moderate","horizonYears":10,"goals":["Long-term capital growth"]}
}'Save the returned id and pass it as portfolioId in chat or embed requests. A duplicate externalId conflicts. The context's ID is not a native portfolio ID.
Update holdings and history
PATCH /v1/sdk/partner-portfolios/{id} with the fields you intend to replace. Current holdings allow up to 500 entries, historic holdings up to 2,000, and stored trades up to 5,000.
POST /v1/sdk/partner-portfolios/{id}/trades accepts 1–500 new trades plus the complete post-trade currentHoldings. The operation appends the trade log and replaces current holdings together. It does not infer holdings from executions. The retained trade log is bounded to its most recent 5,000 entries.
Trade fields include ticker, BUY/SELL, quantity, price, execution time, and optional currency. These are historical context records, not order submissions. Do not blindly retry an append as though it were an idempotent snapshot write.
Send inline context
For an ephemeral request, pass portfolio instead of portfolioId. The inline shape matches the persisted input, with optional externalId. Supply one form of context per request. An inline embed is bound to the exact payload; changing it requires a new token.
Quantity and price fields in this context contract accept numbers or strings. Prefer strings for financial precision, and do not confuse that permissiveness with the stricter native snapshot contract.
Use Chat, Embeds, and the context reference.
Last updated