Deep Dive: Pricing Module (pricing + rmbestx)
Narrative
The Pricing module is the quantitative engine of PowerSeller. It handles the complete lifecycle of mortgage pricing -- from ingesting raw market prices through DDE feeds, through validation, par rate computation, DPC calculation, feature adjustments, all the way to Best Execution analysis that determines the optimal investor and delivery scenario for every loan in a portfolio.
The module operates across two folders:
- pricing/ -- Core price ingestion, validation, calculation (par rates, DPCs, feature adjustments, coupon shifts), and archiving
- rmbestx/ -- Best Execution analysis engine that ranks investor/delivery scenarios per loan
Best Execution Process Flow
Key Calculations
Par Rate Formula
The par rate is the note rate at which an instrument prices at par (100).
Interpolation (standard case):
par_rate = low_rate + (par_basis - low_price) * (high_rate - low_rate) / (high_price - low_price)
Daily price change (for window interpolation):
daily_price_change = (price_from - price_to) / (window_to - window_from)
price = days_to_delivery * daily_price_change + base_price
DPC (Dollar Price Change)
Raw DPCs:
lower_rate_dpc = (next_price - current_price) / (next_rate - current_rate)
higher_rate_dpc = (current_price - prev_price) / (current_rate - prev_rate)
Continuum DPCs extend raw DPCs to arbitrary rate shifts using increment bias weighting:
potential_dpc = primary_dpc * increment_bias + contrary_dpc * (1 - increment_bias)
computed_dpc = |achieved_value_shift + potential_dpc * residual_shift| / |total_shift|
Total Price Calculation
calc_price = base_price
+ required_servicing + excess_servicing_value + msr_price_adjustment
- msr_fee_adjustment_normalized
+ buyup_value
- junk_fee
+ total_price_adjustment
- fee_adjustment_normalized
+ early_delivery_credit
total_price = MIN(calc_price, investor_max_price) [if cap exists]
total_price += warehouse_income - finance_cost
Unit Gain
unit_gain = total_price - cost_basis
profit_amount = ROUND((total_price - cost_basis) / 100 * loan_amount, 2)
Scenario Ranking
Profiles define ranking criteria applied via SQL RANK():
| Code | Meaning |
|---|---|
| tpe | Total price excluding factor (DESC) |
| tpi | Total price including factor (DESC) |
| ipf | Investor price factor |
| inv | Investor rank from counterparty config |
| del | Delivery window (days) |
| edc | Early delivery credit |
Business Rules
Price Validity
- Prices must be no more than 7 days old
- Only numeric, positive result values are accepted
- MBS/WL/BE prices must be monotonic (higher rate = higher price; non-monotonic rows are deleted)
- Each instrument/window combination requires at least 3 rate/price pairs
- Only active instruments with authorized hedging flag are included
- Prices exactly equal to 100 are deleted post-archiving (prevents pollution of par rate calcs)
Feature Adjustments
- Grouped by
price_adjustment_groupandprice_adjustment_name - Each has a
sequence_number; when multiple adjustments in the same group match a loan, only the lowest sequence number applies - Three dimensions: price_adjustment, rate_adjustment, fee_adjustment
- 9 distinct contexts (Risk, BestEx, Bulk Sales, What-If variants, Rate Sheet variants, Best Efforts)
Interpolated Pricing
- Only for instruments with
interpolate_prices = 'y' - Only for FRE, FNM, FHLB guarantors
- Handles both pass-through and note-rate cash grid types
- Uses linear interpolation between rate brackets
Source Price Management
- Prices are either 'd' (DDE) or 'm' (modified/manual)
- Modified prices cannot be auto-removed when DDE links change
- New BestEx instrument mappings auto-configure with DDE delivery windows
Data Model
Price Source Tables
| Table | Role |
|---|---|
pscat_instrument_dde_links | Single-value DDE prices (treasury/futures) |
pscat_inst_dde_links_multi | Multi-rate DDE prices (MBS/WL/BE) |
rmcat_inv_modified_prices | Manually entered non-MBS prices |
rmcat_inv_mbs_modified_prices | Manually entered MBS prices |
pscat_rm_inv_delivery_win | Delivery window config per instrument/investor |
Calculated Price Tables
| Table | Role |
|---|---|
rmtmp_prices | Staging table for raw ingested prices |
rmcat_todays_prices | Validated current prices |
rmcat_todays_par_rates | Computed par rates |
rmcat_dpcs | Raw DPC values |
rmcat_dpc_values | Continuum DPC values |
Feature Adjustment Tables
| Table | Role |
|---|---|
rmcat_price_adjustments | Adjustment rule definitions |
rmcat_price_adjustment_values | Adjustment values by investor |
rmcat_adj_agg_values_* | Aggregated adjustments (by context) |
rmcat_adj_ind_values_* | Individual adjustments (by context) |
Archive Tables
| Table | Role |
|---|---|
rmarc_prices | Archived prices (MBS/WL/BE/FC) |
rmarc_yields | Archived yields (Treasury) |
rmarc_par_rates | Archived par rates |
rmcat_pricing_analysis_history | Analysis run history |