What you will learn in Build a Robo-Advisor with Python (From Scratch)
Automate your financial and investment decisions
Chapter by chapter
Concepts explained in this book
- meanAn arithmetic average return is the sum of periodic investment returns divided by the number of periods.
- wash-sale ruleThe wash-sale rule is a tax rule that generally disallows recognizing an investment loss when the taxpayer acquires a substantially identical security within the specified surrounding period.
- tax lotA tax lot is a distinct group of investment shares acquired in a particular transaction and tracked with its acquisition details for tax purposes.
- risk contributionA risk contribution is the fraction of a portfolio's variance risk attributable to an asset or subportfolio, calculated as its covariance with the full portfolio divided by the portfolio variance.
- reward signalA reward is a numerical feedback signal representing the benefit or cost an agent receives after taking an action.
- Black–Litterman modelThe Black–Litterman model is an asset-allocation framework that combines market-implied equilibrium returns with investor views to produce adjusted return estimates and portfolio weights.
- realized gain or lossA gain on an investment that becomes recognized for tax or accounting purposes when the investment is disposed of.
- covariance matrixA covariance matrix is a square symmetric matrix containing asset variances on its diagonal and pairwise covariances off the diagonal.
- asset allocationAsset allocation is the distribution of an investment portfolio across asset classes selected to match an investor's risk tolerance and objectives.
- risk parityWeighted risk parity is a portfolio-construction technique that assigns different optimization weights to instruments so aggregate risk contributions follow a specified asset-class structure.
- portfolio optimizationPortfolio optimization is the technique of selecting portfolio holdings or weights by optimizing a specified investment objective.
- normal distributionA normal distribution is a continuous probability distribution characterized by a symmetric bell-shaped density determined by its mean and standard deviation.
- constraintA constraint is a mathematical restriction that limits the values or combinations permitted for optimization variables.
- robo-advisorThe provision of automated investment advice or portfolio-management services through algorithmic software.
- opportunity costThe value of a benefit forgone when choosing one action prevents or limits an alternative action.
- risk-free assetAn investment whose return over a specified horizon is known with certainty and is not exposed to interim price or reinvestment uncertainty.
- asset locationAsset location is the strategic placement of assets among account types to improve after-tax investment outcomes.
- dynamic programmingDynamic programming is a computational technique that solves sequential decision problems by decomposing them into states, actions, transition probabilities, and recursively computed value functions.
- portfolio weightA portfolio weight is the proportion of a portfolio allocated to a particular asset, with weights commonly constrained to sum to one.
- tax bracketA tax bracket is a range of taxable income to which a specified marginal tax rate applies.
- standard deviationStandard deviation is a measure of the dispersion of investment returns around their mean, commonly interpreted as return volatility.
- policyA policy is a rule or mapping that specifies which action an agent should take for each state.
- hierarchical risk parityHierarchical risk parity is a portfolio-construction technique that clusters assets by correlation, orders the covariance matrix by those clusters, and allocates weights through recursive bisection.
- investor viewAn investor view is a stated expectation about the relative or absolute future performance of one or more assets or portfolios.
- reinforcement learningReinforcement learning is a machine-learning approach in which an agent learns a decision policy through interactions with an environment and feedback from rewards or penalties.
- transition probabilityA transition probability is the probability of moving from one state to a particular subsequent state under an action or allocation.
- cost-basis adjustmentA cost-basis adjustment is a change to an investment's tax basis to account for a tax-relevant transaction such as a wash sale.
- agglomerative clusteringAgglomerative clustering is a bottom-up clustering technique in which each object starts as a singleton cluster and clusters are successively combined.
- distance matrixA distance matrix is a square array whose entries represent pairwise dissimilarities between objects.
- hierarchical clusteringHierarchical clustering is a clustering technique that organizes objects into progressively combined or subdivided groups according to a distance measure.
- linkage matrixA linkage matrix is a tabular numerical representation of the successive cluster combinations, their intercluster distances, and the sizes of the resulting clusters.
- quasi-diagonalizationQuasi-diagonalization is the reordering of a matrix so that similar or closely related items are positioned near one another, producing an approximately block-diagonal structure.
- recursive bisectionRecursive bisection is a portfolio-weighting technique that repeatedly splits ordered asset groups into two parts and adjusts their weights according to the variances of their subportfolios.
- correlationCorrelation is a statistical measure of the direction and strength of dependence between two variables or asset returns.
- tax dragTax drag is the reduction in investment growth or portfolio value caused by taxes on income, gains, or distributions.
- tax deferralTax deferral is the postponement of tax recognition or payment until a later taxable event.
- tax-loss harvestingThe optimization of investment transactions to capture tax losses or otherwise improve after-tax returns.
- alphaAlpha is the intercept of a return regression and represents performance not explained by the benchmark or specified risk factors.
- convex optimizationOptimization with a convex objective function and a convex feasible set, for which efficient algorithms can provide globally optimal solutions.
- longevity riskLongevity risk is the risk of living longer than expected and exhausting financial resources during one's lifetime.
- after-tax valueAfter-tax value is the value of an investment or account balance remaining after applicable taxes are deducted.
- posterior probabilityA posterior distribution is a probability distribution representing updated beliefs about an unknown quantity after incorporating data or observations.
- bid-ask spreadA bid-ask spread is the difference between the highest price a buyer offers and the lowest price a seller accepts for a traded investment.
- PythonA general-purpose, high-level programming language with dynamic typing and extensive support for scripting, data analysis, and application development.
- optimal sequencing of withdrawalsA planned method for determining how and when assets are withdrawn from investment accounts.
- Monte Carlo simulationA Monte Carlo simulation is a computational technique that estimates outcomes by repeatedly sampling from specified probability distributions or scenarios.
- feasible regionA feasible set is the set of variable values that satisfy all constraints of an optimization problem.
- prior probabilityA prior distribution is a probability distribution representing beliefs about an unknown quantity before incorporating observed data.
- actionAn action is a decision selected by an agent that can change the state of its environment.
- stateA state is a representation of the relevant current variables of an environment that determine an agent's possible decisions.
- cost basisCost basis is the tax-accounting value assigned to an investment for determining taxable gain or loss when it is disposed of.
- glide pathA glide path is a sequence of portfolios or asset allocations that gradually changes an investor's risk level over time.
- required minimum distributionA required minimum distribution is the minimum amount that must be withdrawn annually from certain tax-advantaged retirement accounts after the account owner reaches a legally specified age.
- tracking errorTracking error is the variability or magnitude of an investment's return difference from the benchmark or reference portfolio it is intended to follow.
- betaBeta is a measure of an asset's sensitivity to movements in the overall market, with the market portfolio conventionally assigned a beta of one.
- time horizonAn investment horizon, or time horizon, is the period over which an investment is expected to be held or evaluated.
- tax savingsA reduction in tax liability attributable to a deduction, exclusion, credit, or other tax-favored treatment.
- binomial treeA discrete lattice model that represents possible successive movements in an asset price for valuing derivatives.
- option-priceA Python package that computes option prices using supported analytical and numerical pricing methods.
- option pricingOption pricing is the process of estimating the fair value of a financial option from its contractual terms and the behavior of relevant underlying variables.
- option valueThe monetary value of an option contract, reflecting the potential benefit from exercising its rights.
- put optionA financial contract giving its holder the right, but not the obligation, to sell an underlying asset at a specified strike price before or at expiration.
- exchange-traded fundAn exchange-traded fund is an investment fund whose shares trade on a stock exchange and typically track an index, asset class, or portfolio strategy.
- backtestingBacktesting is the evaluation of an investment strategy by simulating its application to historical market data.
- cvxpyCVXPY is a Python library for modeling and solving convex optimization problems with a declarative mathematical syntax.
- closed tax lotA closed tax lot is a tax lot whose remaining share quantity has reached zero after disposal.
- tax efficiencyTax efficiency is the degree to which an investment strategy minimizes taxes relative to its returns or transactions.
- threshold-based rebalancingThreshold-based rebalancing is a rebalancing method that trades when an asset's portfolio weight deviates beyond a specified tolerance from its target.
- turnoverPortfolio turnover, or turnover rate, is the proportion of a portfolio or fund's holdings sold or replaced during a specified period.
- cyclically adjusted price-to-earnings ratioA stock valuation ratio that divides price by inflation-adjusted average earnings over the prior ten years.
- excess returnAn investment return measured above the return of a specified risk-free benchmark.
- price-to-earnings ratioA valuation ratio comparing a stock's market price with its earnings per share.
- total returnA total return index measures investment performance including both price changes and reinvested cash distributions.
- yieldThe income rate or implied return generated by a debt security, commonly expressed as a percentage of its value or face amount.
- infinity normThe infinity norm of a vector is the maximum of the absolute values of its components.
- inner productThe dot product is an operation that sums the pairwise products of corresponding components of two vectors to produce a scalar.
- capital asset pricing modelThe capital asset pricing model is a financial model that estimates an asset's expected return from the risk-free rate, market expected return, and the asset's sensitivity to market returns.
- wealth pathA wealth path is a chronological sequence of portfolio wealth values representing one simulated financial trajectory.
- constraint classA constraint class is a software class representing an optimization constraint and generating its solver-specific form.
- full-investment constraintA full-investment constraint requires the total amount invested to equal a specified amount.
- long-only constraintA long-only constraint requires every portfolio weight to be nonnegative, prohibiting short positions.
- inflation riskThe risk that rising prices will reduce the purchasing power of money or the real value of investment returns.
- substantially identical instrumentA substantially identical security is an investment security considered equivalent to another security for applicable tax-law purposes.
- portfolio rebalancingA rule or procedure for deciding when and how portfolio holdings should be traded toward target allocations.
- reference portfolioA reference portfolio is a portfolio selected as the baseline against which another portfolio's characteristics or performance are compared.
- equilibrium returnAn equilibrium return is an expected investment return implied by market portfolio weights, investor expectations, and risk aversion.
- ETF creation and redemptionETF creation and redemption is the mechanism by which authorized participants exchange ETF shares for baskets of underlying securities and vice versa.
- tax rateA tax rate is the percentage or marginal proportion applied to a specified taxable base to determine tax owed.
- taxable accountA taxable account is an investment account whose income, gains, or distributions are generally subject to taxation rather than receiving retirement-account tax treatment.
- Roth IRAA Roth IRA is an individual retirement account whose qualified withdrawals are generally tax-free and whose contributions are not generally tax-deductible.
- inflationInflation is a sustained increase in the general price level of goods and services that reduces the purchasing power of money.
- information ratioThe information ratio is the expected return above a benchmark divided by the volatility of the portfolio's return difference from that benchmark.
- market returnMarket return is the return of the broad market portfolio over a specified period.
- consumptionConsumption is the use of resources for present satisfaction, including expenditures from wealth.
- spendingSpending is the use of financial resources to purchase goods, services, or other benefits.
- conditional probabilityConditional probability is the probability of an event given that another event or condition is known to occur.
- likelihoodA likelihood is the probability of observed data conditional on a specified parameter value or hypothesis.
- SciPySciPy is a Python library of algorithms and functions for scientific and numerical computing, including optimization, integration, root-finding, and statistics.
- curse of dimensionalityThe curse of dimensionality is the rapid growth in computational and data requirements as the number of states, variables, or dimensions in a problem increases.
- ordinary incomeOrdinary income is taxable income arising from sources such as wages, interest, and non-preferentially taxed distributions rather than preferentially taxed capital gains.
- capital gains tax rateA capital gains tax rate is the tax rate applied to taxable gains from disposing of an investment.
- covarianceCovariance is a measure of how two asset returns vary together, combining their volatilities with their correlation.
- volatilityVolatility is a statistical measure of the variability of an asset's or portfolio's returns.
- esg ratingA quantitative assessment of an investment's environmental, social, and governance characteristics.
- stepped-up cost basisA stepped-up cost basis is a tax basis adjustment that resets an inherited asset's basis to its fair market value at the owner's death or another legally specified date.
- management feeAn expense ratio is the percentage of an investment fund's assets charged annually to cover its operating expenses.
- Sharpe ratioThe Sharpe ratio is the expected return above the risk-free rate divided by the investment's volatility, measuring expected reward per unit of risk.
- convexityA mathematical property of functions or sets that ensures line-segment combinations remain compatible with global optimization guarantees.
- high-growth stock fundA high-growth stock fund is an investment fund focused on stocks associated with expectations of comparatively high future growth.
- risk-aversion parameterA risk-aversion parameter is a coefficient in an investment objective that controls the penalty assigned to portfolio risk relative to expected return.
- time value of moneyThe time value of money is the principle that a given amount of money available today has greater economic value than the same nominal amount available in the future because it can earn a return.
- backward inductionBackward induction is a solution method that computes decisions or values from a final state backward through earlier states.
- cumulative distribution functionA cumulative distribution function gives the probability that a random variable is less than or equal to a specified value.
- efficient frontierThe efficient frontier is the set of portfolios offering the highest expected return for each level of risk or the lowest risk for each expected return.
- socially responsible investingSRI, or socially responsible investing, is an investment approach that selects investments according to their perceived social or environmental benefits.
- minimum-variance frontierThe minimum-variance frontier is the set of portfolios that achieve the lowest possible variance for specified expected returns when no risk-free asset is included.
- dollar-weighted returnA dollar-weighted return is an investment return that accounts for the timing and amount of external cash flows, commonly through an internal-rate-of-return calculation.
- matrix-matrix multiplicationMatrix multiplication is an algebraic operation that combines rows of one matrix with columns of another to produce a new matrix or vector.
- risk-adjusted returnRisk-adjusted return, or risk-adjusted performance, is investment performance evaluated in relation to the amount or type of risk taken to achieve it.
- discount rateA discount rate in reinforcement learning is a parameter that determines how strongly future rewards are weighted relative to immediate rewards.
- epsilon-greedyEpsilon-greedy is an action-selection strategy that chooses a random action with probability epsilon and a currently best-known action otherwise.
- exploration-exploitation trade-offThe exploration-exploitation tradeoff is the decision problem of balancing actions that gather new information against actions expected to yield the best known outcome.
- Q-learningQ-learning is a model-free reinforcement-learning algorithm that estimates the value of taking each action in each state and uses those estimates to derive a policy.
- action-value functionA Q-function maps a state and an action to the estimated cumulative reward obtained by taking that action and following a policy afterward.
- temporal-difference errorA temporal difference is the discrepancy between a current value estimate and a reward-adjusted estimate based on a subsequent state.
- Roth conversionA Roth conversion is a transaction that transfers or converts assets from a traditional retirement account into a Roth IRA, generally creating taxable income at conversion.
- discount rateA financial discount rate is an expected rate of return used to convert a future cash flow into its value today.
- annuityAn annuity is a financial contract that provides a series of payments, often for the holder's lifetime.
- authorized participantA designated financial-market participant permitted to exchange an exchange-traded fund's underlying asset basket for fund shares and vice versa.
- certainty equivalent valueA certainty equivalent is the guaranteed amount that provides the same utility as a specified risky prospect.
- risk toleranceRisk tolerance is an investor's willingness to accept uncertainty and potential investment losses in exchange for possible returns.
- risk-free returnThe risk-free rate is the return associated with an investment assumed to have no default risk over the relevant time horizon.
- ordinary income tax rateAn ordinary income tax rate is the tax rate applied to income taxed under ordinary income-tax rules rather than preferential capital-gains rules.
- autoregressive modelA time-series model in which the current value depends linearly on one or more previous values and a random error term.
- mutual fundAn investment fund whose shares are bought from or sold to the fund provider at a price based on the value of the fund's holdings, typically once per trading day.
- present valuePresent value is the value today of future cash flows discounted to reflect the timing of those cash flows.
- evaluate_all_harvestevaluate_all_harvest is a book-specific function that evaluates harvesting trades across all holdings in an exchangeable ETF set.
- evaluate_harvestevaluate_harvest is a book-specific function that evaluates whether harvesting a single tax lot with a specified replacement investment has positive net benefits.
- net asset valueThe per-share value of an investment fund's net underlying assets, calculated as total assets minus liabilities divided by shares outstanding.
- periodic rebalancingA rebalancing strategy that generates trades when the current date appears in a specified list of rebalancing dates.
- inherited IRAAn individual retirement account received by a beneficiary after the original account owner's death and governed by beneficiary-specific distribution rules.
- traditional IRAA traditional IRA is an individual retirement account whose contributions or earnings receive tax treatment that generally defers taxation until withdrawal.
- dynamic modelA lifecycle model is an economic model of decisions and resources across multiple periods of an individual's or household's life.
- marginal tax rateA marginal tax rate is the tax rate applied to the next unit of taxable income within a tax system.
- time-weighted returnA time-weighted return is an investment return calculated by linking subperiod returns between external cash flows so that the timing and size of investor contributions do not determine the result.
- mortality tableA mortality table is a statistical table giving the probability of death or survival for members of a population at different ages.
- do-not-increase-deviation constraintA do-not-increase-deviation constraint prevents an optimized position from being farther from its target than the current position.
- do-not-trade-past-target constraintA do-not-trade-past-target constraint prevents trading an asset from one side of its target position to the other side.
- generate_constraintgenerate_constraint is a method that constructs the optimization constraint represented by a constraint object from supplied problem data.
- generate_objectivegenerate_objective is a method that constructs an optimization objective from supplied portfolio and problem data.
- max-deviation constraintA max-deviation constraint bounds each optimized position within an interval around its target position.
- MinTaxObjectiveMinTaxObjective is a book-specific optimization objective that selects trades to minimize their total tax cost.
- MinTrackingErrorObjectiveMinTrackingErrorObjective is an optimization objective that selects portfolio trades to minimize tracking error relative to a target portfolio without considering taxes.
- objective classAn objective class is a software class that generates an objective function for portfolio optimization.
- volatility-based deviation constraintA volatility-based deviation constraint bounds position deviations according to asset volatility, allowing larger deviations for lower-volatility assets.
- budget constraintA budget constraint is an equation or inequality limiting feasible spending and investment choices according to available resources.
- consumption smoothingConsumption smoothing is the practice of distributing consumption more evenly across time rather than concentrating it in particular periods.
- fsolvefsolve is a SciPy function that numerically solves nonlinear equations by finding their roots.
- VariableVariable is the CVXPY constructor for creating symbolic decision variables with a specified shape.
- retirement accountAn investment account that receives preferential tax treatment for contributions, investment growth, withdrawals, or some combination of these.
- taxA compulsory charge imposed by a government on income, transactions, property, or other taxable bases.
- payout rateA payout rate is the annual percentage of an asset's value distributed as dividends or interest.
- environmentAn environment is the external system in which a reinforcement-learning agent takes actions and from which it receives observations and rewards.
- Markov propertyThe Markov property is the condition that the probabilities of future states depend on the current state and action but not on earlier history.
- transaction costA transaction cost is an expense incurred when buying, selling, transferring, or modifying an asset or contract.
- ETF premium or discountThe amount by which an ETF's market price is above or below its net asset value.
- GARCH modelA generalized autoregressive conditional heteroskedasticity model estimates time-varying conditional volatility from past observations and volatility shocks.
- defined-benefit pension planA pension plan that promises retirement payments determined by a formula, rather than by an individual's account balance.
- adjusted close priceAn adjusted closing price, or adjusted close, is a historical closing price adjusted for corporate actions such as dividends and stock splits.
- volatility clusteringVolatility clustering is the tendency for large changes in returns to be followed by large changes and small changes to be followed by small changes.
- CPI-UCPI-U is the Consumer Price Index for All Urban Consumers, a measure of average consumer prices paid by urban households in the United States.
- inflation rateThe inflation rate is the percentage rate at which the general price level of goods and services increases over a specified period.
- mean-reverting processA mean-reverting process is a stochastic process whose values tend to move back toward a long-run average.
- Ornstein–Uhlenbeck processAn Ornstein–Uhlenbeck process is a continuous-time stochastic process that is pulled toward a long-run mean while being perturbed by random noise.
- financial advisorA financial advisor is a professional who advises clients on financial goals, plans, and investments and may manage their money.
- smart betaSmart beta is an investment approach that selects or weights securities using systematic rules based on factors or characteristics beyond traditional market capitalization.
- financial leverageLeverage is the use of borrowed funds to increase the size of an investment position relative to the investor's own capital.
- 95% worst-case lossA 95% worst-case loss is a loss threshold intended to be exceeded in only the worst five percent of modeled outcomes over a specified horizon.
- loss aversionLoss aversion is a behavioral bias in which losses have greater psychological impact than comparable gains.
- effective tax rateAn effective tax rate is the percentage of a sale's gain or loss used to determine the applicable tax impact for a particular holding.
- incomplete tradingIncomplete trading is a rebalancing approach that restores an asset only partway toward its target weight rather than fully returning it to target.
- tax heuristicA tax heuristic is a rule of thumb for selecting investment transactions or holdings to improve their tax consequences.
- dividendA dividend is a distribution of a company's earnings or capital to its shareholders.
- individual position constraintAn individual position constraint limits the allocation or magnitude of a single portfolio holding.
- interestInterest income is compensation received for lending money or holding an interest-bearing investment.
- qualified dividendA qualified dividend is a dividend that meets applicable tax-law requirements for taxation at preferential capital-gains rates.
- relative weight constraintA relative weight constraint limits how far the weights of two or more assets may differ in ratio or absolute amount.
- rate conversionRate conversion is a tax strategy that offsets higher-taxed short-term gains with losses and later realizes replacement-asset gains under lower long-term capital-gains rates.
- historical dataHistorical data is recorded information about past asset prices, dividends, and other market events.
- asset classA category of investments that share broadly similar financial characteristics and market behavior.
- historical returnA historical return is the realized percentage change in an investment's value over a completed past period.
- state taxA state tax is a tax imposed by a subnational state government on specified income, transactions, property, or other taxable bases.
- arch_modelarch_model is a Python API function in the arch library that constructs ARCH-family volatility models.
- temporal autocorrelationAutocorrelation is the correlation between a time series and a lagged version of itself.
- volatility mean reversionVolatility mean reversion is the tendency of volatility to move back toward a long-run or pre-shock level after a temporary deviation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
