Language

Choose a language

/build/rpc / pricing / repo

pricing.repo.quote

pricing.repo.quote "source_type" ( "registry_id" {"principal_asset":"hex","principal_is_native":bool,"principal_units":n,"interest_asset":"hex","interest_is_native":bool,"interest_units":n,"collateral_asset":"hex","collateral_is_native":bool,"collateral_units":n,"maturity_height":n,"safety_k":n} "report_asset" report_is_native compute_greeks "source" include_inception_cashflows ) Compute mark-to-market valuation for a repo contract Supports both registry-backed contracts (via registry_id) and inline term specification. Arguments: 1. source_type (string, required) Contract source: 'registry' or 'inline' 2. registry_id (string, optional) Registry contract ID (required if source_type='registry') 3. inline_terms (json object, optional) Inline repo terms (required if source_type='inline') { "principal_asset": "hex", (string, required) Principal asset ID "principal_is_native": bool, (boolean, optional, default=false) Principal is native BTC "principal_units": n, (numeric, required) Principal amount "interest_asset": "hex", (string, required) Interest asset ID "interest_is_native": bool, (boolean, optional, default=false) Interest is native BTC "interest_units": n, (numeric, required) Interest amount "collateral_asset": "hex", (string, required) Collateral asset ID "collateral_is_native": bool, (boolean, optional, default=false) Collateral is native BTC "collateral_units": n, (numeric, required) Collateral amount "maturity_height": n, (numeric, required) Maturity block height "safety_k": n, (numeric, optional, default=144) Safety window (blocks before maturity) } 4. report_asset (string, optional, default="") Reporting currency (empty for TSC) 5. report_is_native (boolean, optional, default=false) Reporting currency is native BTC 6. compute_greeks (boolean, optional, default=true) Compute option Greeks 7. source (string, optional, default="mark") Price source: 'mark' (manual) or 'market' (calibrated) 8. include_inception_cashflows (boolean, optional, default=false) Include principal cashflow at t=0 in MTM (for pre-execution views) Result: { (json object) "principal_pv" : n, (numeric) Present value of principal leg (in reporting currency) "interest_pv" : n, (numeric) Present value of interest leg "collateral_pv" : n, (numeric) Present value of collateral leg "collateral_option" : n, (numeric) Value of borrower walkaway (put) option "lender_mtm" : n, (numeric) Lender mark-to-market (principal + interest - option) "borrower_mtm" : n, (numeric) Borrower mark-to-market (-lender_mtm) "coverage_ratio" : n, (numeric) Collateral coverage ratio (collateral / (principal + interest)) "ltv_pct" : n, (numeric) Loan-to-value percentage (100 / coverage_ratio) "over_collat_pct" : n, (numeric) Over-collateralization percentage ((coverage_ratio - 1) * 100) "collateral_greeks" : { (json object, optional) Option Greeks "delta" : n, (numeric) Delta (∂V/∂S) "gamma" : n, (numeric) Gamma (∂²V/∂S²) "vega" : n, (numeric) Vega (∂V/∂σ) "theta" : n, (numeric) Theta (-∂V/∂t) "rho" : n (numeric) Rho (∂V/∂r) }, "warnings" : [ (json array) Diagnostic warnings { (json object) "severity" : "str", (string) WARNING, CRITICAL, INFO "category" : "str", (string) coverage, deadline, market_data, model "message" : "str", (string) Human-readable message "threshold" : n (numeric, optional) Threshold value if applicable }, ... ] } Examples: > bitcoin-cli pricing.repo.quote "registry" "CONTRACT_ID" > bitcoin-cli pricing.repo.quote "inline" "" '{"principal_asset":"BTC", "principal_is_native":true, ...}' > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "pricing.repo.quote", "params": ["registry", "CONTRACT_ID"]}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

pricing.repo.quote(source_type: string, registry_id?: string, inline_terms?: object, report_asset?: string, report_is_native?: boolean, compute_greeks?: boolean, source?: string, include_inception_cashflows?: boolean) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"pricing.repo.quote","params":["\"<source_type>\"","\"<registry_id>\"",{},"",false,true,"mark",false]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
source_typestringyesContract source: 'registry' or 'inline'
registry_idstringRegistry contract ID (required if source_type='registry')
inline_termsobjectInline repo terms (required if source_type='inline') { "principal_asset": "hex", (string, required) Principal asset ID "principal_is_native": bool, (boolean, optional, default=false) Principal is native BTC "principal_units": n, (numeric, required) Principal amount "interest_asset": "hex", (string, required) Interest asset ID "interest_is_native": bool, (boolean, optional, default=false) Interest is native BTC "interest_units": n, (numeric, required) Interest amount "collateral_asset": "hex", (string, required) Collateral asset ID "collateral_is_native": bool, (boolean, optional, default=false) Collateral is native BTC "collateral_units": n, (numeric, required) Collateral amount "maturity_height": n, (numeric, required) Maturity block height "safety_k": n, (numeric, optional, default=144) Safety window (blocks before maturity) }
report_assetstringReporting currency (empty for TSC)
report_is_nativebooleanReporting currency is native BTC
compute_greeksbooleanCompute option Greeks
sourcestringPrice source: 'mark' (manual) or 'market' (calibrated)
include_inception_cashflowsbooleanInclude principal cashflow at t=0 in MTM (for pre-execution views)

Result

Type:  any

{ (json object) "principal_pv" : n, (numeric) Present value of principal leg (in reporting currency) "interest_pv" : n, (numeric) Present value of interest leg "collateral_pv" : n, (numeric) Present value of collateral leg "collateral_option" : n, (numeric) Value of borrower walkaway (put) option "lender_mtm" : n, (numeric) Lender mark-to-market (principal + interest - option) "borrower_mtm" : n, (numeric) Borrower mark-to-market (-lender_mtm) "coverage_ratio" : n, (numeric) Collateral coverage ratio (collateral / (principal + interest)) "ltv_pct" : n, (numeric) Loan-to-value percentage (100 / coverage_ratio) "over_collat_pct" : n, (numeric) Over-collateralization percentage ((coverage_ratio - 1) * 100) "collateral_greeks" : { (json object, optional) Option Greeks "delta" : n, (numeric) Delta (∂V/∂S) "gamma" : n, (numeric) Gamma (∂²V/∂S²) "vega" : n, (numeric) Vega (∂V/∂σ) "theta" : n, (numeric) Theta (-∂V/∂t) "rho" : n (numeric) Rho (∂V/∂r) }, "warnings" : [ (json array) Diagnostic warnings { (json object) "severity" : "str", (string) WARNING, CRITICAL, INFO "category" : "str", (string) coverage, deadline, market_data, model "message" : "str", (string) Human-readable message "threshold" : n (numeric, optional) Threshold value if applicable }, ... ] }

Source: services/core-node/bcore/src/wallet/pricing/rpc/pricing_repo.cpp:46

C++ symbol: pricing_repo_quote