This glossary defines the main terms used across the Stellar Portfolio Rebalancer repository, including frontend concepts, backend API patterns, and Soroban smart contract terminology.
- New contributors should read this before working on contracts, backend features, or documentation.
- If you see a term in
README.md,docs/CONTRIBUTING.md, orcontracts/CONTRACT_ABI.md, this page explains it in plain language. - Use the cross-links to jump to deeper references for contract invocation, API docs, and deployment guides.
A Portfolio is the main user-owned object in the system. It stores:
target_allocations: how the user wants funds split across assetscurrent_balances: the actual balances currently heldrebalance_threshold: the drift limit that triggers a rebalanceslippage_tolerance: how much execution slippage is allowed
In the smart contract, a portfolio is identified by a numeric portfolio_id returned by create_portfolio.
target_allocations is a mapping of asset addresses to target percentages.
- Example:
{ "XLM": 40, "USDC": 35, "BTC": 25 } - The values are percentages and should sum to 100.
- The contract checks this during
create_portfolioand rejects invalid allocations withInvalidAllocation.
Also called threshold in the UI and contract.
- A value between
1and50. - The contract uses this value to decide whether current asset weights have drifted far enough from targets to require a rebalance.
- The backend and frontend refer to this as
rebalance_threshold.
A tolerance value expressed in basis points (10..=500) used by the contract to validate actual post-trade balances.
- Example:
50means0.50%slippage is allowed. - If executed balances fall outside this tolerance,
execute_rebalancereturnsSlippageExceeded.
Reflector is the price oracle contract used by the portfolio contract to fetch asset prices.
- The contract stores
reflector_addressduring initialization. - Price checks use this oracle for drift and rebalance validation.
- See
contracts/CONTRACT_ABI.mdanddocs/soroban-cookbook.mdfor invoke examples.
An asset is a token tracked inside a portfolio.
- The contract uses Soroban
Addressvalues to represent assets. - In the backend and UI, common assets include
XLM,USDC, and token addresses supported by Stellar wallets.
The contract stores a portfolio's current_balances as Map<Address, i128>.
- This map represents the actual amounts held in each asset.
- When the backend deposits funds or executes a rebalance,
current_balancesis updated accordingly.
total_value is the portfolio's current value expressed in contract storage.
- It is typically derived from asset balances and oracle prices.
- The frontend shows this in the dashboard and performance views.
A numeric portfolio_id returned by create_portfolio.
- Used by API routes such as
GET /api/v1/portfolio/:idand contract calls likeexecute_rebalance.
A contract-level safety flag toggled by set_emergency_stop.
- When active, deposit and rebalance calls are blocked.
- Only the admin address stored during initialization may change this flag.
A time guard that prevents rebalancing too frequently.
- The contract enforces a minimum delay between successful rebalances.
- If a rebalance attempt happens too soon, it fails with a cooldown-related panic.
The contract ABI describes the exposed smart contract functions, parameter types, and error codes.
contracts/CONTRACT_ABI.mdis the canonical reference for the Rust contract interface.- Use this document together with
docs/GLOSSARY.mdto understand the terms used by contract functions.
The backend exposes a versioned REST API under /api/v1/*.
API.mdexplains how to use the endpoints.backend/docs/openapi.mdexplains how the OpenAPI spec is generated and maintained.
The frontend integrates with Stellar wallets such as Freighter and Rabet.
- Wallets are used to authorize portfolio actions and sign transactions.
- The UI uses the wallet session to call backend endpoints and contract interactions.
A user-defined rebalancing rule that enforces a minimum number of days between rebalances and only triggers when the drift-based threshold check would also fire. Configure with minDaysBetweenRebalance (0-365, default 1) in strategyConfig when creating a portfolio with strategy: custom.
- Use case: reduce trading frequency while still reacting to drift.
- See Rebalancing Strategies for configuration details.
- Backend implementation:
backend/src/services/rebalanceStrategy.ts.
Dollar-Cost Averaging is an investment technique where a fixed amount is invested at regular time intervals regardless of market price, reducing the impact of short-term volatility. In this project, the periodic strategy implements DCA-style rebalancing by triggering on a fixed schedule.
- The contract supports a dedicated
dca_executedevent emitted bycontracts/src/events.rs. - Related strategy: see Periodic strategy and Rebalancing Strategies.
- Contract module:
contracts/src/strategies/dca.rs.
A time-based rebalancing strategy that triggers on a fixed schedule (e.g. every 7 or 30 days), regardless of allocation drift. Configure with intervalDays (1-365, default 7) in strategyConfig when creating a portfolio with strategy: periodic.
- Implements a DCA (Dollar-Cost Averaging) approach to rebalancing.
- See Rebalancing Strategies for configuration details.
- Backend implementation:
backend/src/services/rebalanceStrategy.ts.
A rebalancing strategy that triggers when market volatility exceeds a configured threshold (e.g. 24h price change >= 10%) or when allocation drift exceeds the portfolio's rebalance threshold. Configure with volatilityThresholdPct (default 10) in strategyConfig when creating a portfolio with strategy: volatility.
- Combines volatility-based and drift-based triggers for more responsive rebalancing.
- See Rebalancing Strategies for configuration details.
- Backend implementation:
backend/src/services/rebalanceStrategy.ts.
Read this glossary, then follow these steps for a local contributor workflow:
- Read
README.mdfor the project overview and setup links. - Open
docs/CONTRIBUTING.mdand complete the local install steps. - If you are working on contract behavior, read
contracts/CONTRACT_ABI.mdand use the glossary to understand terms likerebalance_threshold,slippage_tolerance, andportfolio_id. - Start backend and frontend servers.
- Use the API examples in
README.mdorAPI.mdto create a portfolio, check its status, and run a rebalance.
POST /api/v1/portfolio
{
"userAddress": "G...USER_ADDRESS",
"allocations": {"XLM": 40, "USDC": 35, "BTC": 25},
"threshold": 5,
"slippageTolerance": 50
}soroban contract invoke \
--id YOUR_CONTRACT_ID \
--source deployer \
--network testnet \
-- initialize \
--admin YOUR_ADMIN_ADDRESS \
--reflector_address CDSWUUXGPWDZG76ISK6SUCVPZJMD5YUV66J2FXFXFGDX25XKZJIEITAO- Update this glossary whenever a new contract function, API field, or UI term is introduced.
- If
contracts/CONTRACT_ABI.mdorAPI.mdchanges, add or revise glossary definitions to keep the docs aligned. - Keep the examples in this file in sync with the actual API request/response shapes and contract initialization commands.
- If a term moves from backend-only to shared UI/contract usage, make sure the glossary definition reflects both sides.