Upsert Asset Profile
upsert_asset_profileCreate or update a Ghostfolio asset profile with symbol, name, currency, and asset class, then apply optional metadata like country and sector allocations. Ensures the profile matches your input after each call.
Instructions
Create-or-update an asset profile.
POSTs an empty profile-data record (idempotent — Ghostfolio answers HTTP 400 "already exists" when the profile is already there, and HTTP 500 on some first-time-create paths while still persisting the record, so this tolerates both). Then PATCHes metadata (name, currency, asset class, optional sub-class, optional country and sector allocations). PATCH is the source of truth — if the profile doesn't exist after the POST, PATCH will surface the error. Calling twice with the same input yields the same end state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Human-readable name for the asset | |
| symbol | Yes | Symbol/ticker of the asset. Permanent — renaming orphans associated activities and market data | |
| sectors | No | Optional sector allocation. Entries must contain exactly 'name' and 'weight' (a fraction between 0 and 1, e.g. 0.2431); any extra key is rejected with HTTP 400. Omit to leave the stored value untouched; pass [] to reset (on 'MANUAL' this empties the list, on fetched sources it drops the override and the data provider's own sectors apply again) | |
| currency | Yes | Currency code of the asset (e.g., 'USD', 'CHF', 'EUR') | |
| countries | No | Optional country allocation. Entries must contain exactly 'code' (ISO 3166-1 alpha-2, e.g. 'US') and 'weight' (a fraction between 0 and 1, e.g. 0.6907) — any extra key, such as the 'continent' and 'name' that reads add, is rejected with HTTP 400. Omit to leave the stored value untouched; pass [] to reset (on 'MANUAL' this empties the list, on fetched sources it drops the override and the data provider's own countries apply again) | |
| asset_class | Yes | Asset class: 'EQUITY', 'FIXED_INCOME', 'REAL_ESTATE', 'COMMODITY', 'LIQUIDITY' (cash), or 'ALTERNATIVE_INVESTMENT'. Note: Ghostfolio's enum does not include 'CASH' — use 'LIQUIDITY' | |
| data_source | Yes | Data source for the symbol. Typically 'MANUAL' — Ghostfolio rejects profile-data writes for auto-fetched sources | |
| asset_sub_class | No | Optional asset sub-class (e.g., 'MUTUALFUND', 'CASH', 'ETF') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||