ilovepsxAPI
Data quality / Confidence in the consumer you build

Test a Fund Data Integration with Contract Fixtures

Test a Pakistan fund-data consumer with complete synthetic fixtures for decimals, nullable fields, pagination, source context and safe credential handling.

On this page

An API consumer can break even when the source data is valid. Reading the wrong envelope shape, converting an exact NAV string to a float or treating an absent report section as zero can change what the application tells its users.

Contract fixtures let you test those decisions without a production key or a real customer's account. This guide builds a small consumer test suite using complete, clearly fictional NAV data and a public FMR model. It tests your integration behavior; source extraction and promotion validation remain separate responsibilities.

The useful part, upfront.

  • Use complete synthetic envelopes and deliberately broken variants.
  • Test absence, errors and exact values as distinct states.
  • Accept harmless new fields while enforcing what your consumer depends on.

Test the boundary your application actually owns#

Start with the data contract you consume and the transformations you perform. A latest-NAV response has data as an array. NAV history has data as an object with fund, date-selection context and navs. A complete FMR is another object, with period, identity, profile, optional sections and source context. Treating all of these as an interchangeable list is a meaningful regression to catch.

Consumer tests do not prove that a monthly PDF was transcribed correctly or matched to the right canonical fund. Those belong to the backend ingestion, validation and promotion pipeline. Your tests should instead establish that a correctly shaped public response produces the right view, while a missing value, invalid shape or failed request produces a clear alternative state.

References: ILovePSX public API reference

Use fictional evidence and retain the full envelope#

The complete history fixture below uses an invented fund and a single observation. It includes all documented NAV row fields rather than compressing the payload into a convenient two-property example. Its source date, generated timestamp and freshness metadata agree. Save it as nav-history.synthetic.json in your private test directory, with an explicit synthetic label in the fixture inventory.

Use stable fictional public IDs, names and decimal strings. No real key, customer profile, private identifier or source PDF is needed. The shared complete FMR teaching model also supplies holdings, asset allocations, credit quality and reported performance for testing richer views. A fictional source document is represented as null instead of a made-up link that looks like official evidence.

nav-history.synthetic.json · complete fictional history envelope
{
  "success": true,
  "data": {
    "fund": {
      "id": "00000000-0000-4000-8000-000000000201",
      "slug": "example-research-fund",
      "name": "Example Research Fund",
      "mufap_fund_id": null
    },
    "currency": "PKR",
    "from": "2026-09-28",
    "to": "2026-09-30",
    "order": "asc",
    "navs": [
      {
        "fund_id": "00000000-0000-4000-8000-000000000201",
        "fund_slug": "example-research-fund",
        "fund_name": "Example Research Fund",
        "mufap_fund_id": null,
        "nav_date": "2026-09-28",
        "nav": "100.125000",
        "offer_price": null,
        "repurchase_price": "100.500000",
        "market_price": null,
        "front_end_load_pct": "0.000000",
        "back_end_load_pct": "0.000000",
        "contingent_load_pct": null,
        "nav_change_abs": null,
        "nav_change_pct": null,
        "currency": "PKR"
      }
    ]
  },
  "meta": {
    "request_id": "synthetic-production-integration",
    "generated_at": "2026-10-09T08:00:00Z",
    "data_as_of": "2026-09-28",
    "data_freshness_days": 11,
    "next_cursor": null
  }
}

References: ILovePSX public API reference

Exercise exact values, nulls and the required response shape#

Save the following as test_nav_contract.py beside the fixture and run python -m unittest -v test_nav_contract. It uses Python's standard library and never makes a network request. The validator checks the history object, canonical fund, bounded dates, observation order, exact decimal-string NAV and a documented nullable offer-price field.

The suite includes a valid response, an empty selection, an opaque cursor and broken variations. It accepts an additional field that the consumer does not need. This keeps the tests focused on required behavior rather than freezing every incidental property. The positive finite-NAV rule is this consumer's declared input rule; it is not a complete replacement for the producer's schema and validation pipeline.

test_nav_contract.py · runnable consumer regression tests
import copy
import json
import unittest
from datetime import date
from decimal import Decimal, InvalidOperation
from pathlib import Path

def validate_history(payload, slug):
    if not isinstance(payload, dict) or payload.get("success") is not True:
        raise ValueError("Not a successful envelope.")
    data, meta = payload.get("data"), payload.get("meta")
    if not isinstance(data, dict) or not isinstance(meta, dict):
        raise ValueError("History data and meta must be objects.")
    fund = data.get("fund")
    if not isinstance(fund, dict) or fund.get("slug") != slug:
        raise ValueError("Unexpected fund.")
    rows = data.get("navs")
    if not isinstance(rows, list):
        raise ValueError("History needs the data.navs array.")
    if "next_cursor" not in meta:
        raise ValueError("The consumer requires a pagination field.")
    cursor = meta["next_cursor"]
    if cursor is not None and not isinstance(cursor, str):
        raise ValueError("The cursor must be a string or null.")
    start, end = date.fromisoformat(data["from"]), date.fromisoformat(data["to"])
    if start > end or data.get("order") not in {"asc", "desc"}:
        raise ValueError("Invalid selection.")
    observed_dates = []
    for row in rows:
        if not isinstance(row, dict) or row.get("fund_slug") != slug:
            raise ValueError("Unexpected observation identity.")
        observed = date.fromisoformat(row["nav_date"])
        if not start <= observed <= end or row.get("currency") != "PKR":
            raise ValueError("Invalid observation date or currency.")
        if not isinstance(row.get("nav"), str):
            raise ValueError("Exact NAV must remain a string.")
        try:
            value = Decimal(row["nav"])
        except InvalidOperation:
            raise ValueError("NAV is not a decimal.") from None
        if not value.is_finite() or value <= 0:
            raise ValueError("NAV must be finite and positive for this consumer.")
        if "offer_price" not in row:
            raise ValueError("Expected the documented nullable price field.")
        offer = row["offer_price"]
        if offer is not None and not isinstance(offer, str):
            raise ValueError("Optional price must be a string or null.")
        observed_dates.append(observed)
    if len(observed_dates) != len(set(observed_dates)):
        raise ValueError("Duplicate observation dates.")
    if observed_dates != sorted(observed_dates, reverse=data["order"] == "desc"):
        raise ValueError("Unexpected observation order.")
    return rows

class NAVContract(unittest.TestCase):
    def setUp(self):
        self.fixture = json.loads(Path("nav-history.synthetic.json").read_text())
        self.slug = "example-research-fund"

    def test_exact_strings_and_nulls(self):
        rows = validate_history(self.fixture, self.slug)
        self.assertEqual(Decimal(rows[0]["nav"]), Decimal("100.125000"))
        self.assertIsNone(rows[0]["offer_price"])

    def test_additive_fields_are_accepted(self):
        self.fixture["data"]["future_field"] = {"label": "additional context"}
        validate_history(self.fixture, self.slug)

    def test_empty_selection_is_valid(self):
        self.fixture["data"]["navs"] = []
        self.fixture["meta"]["data_as_of"] = None
        self.fixture["meta"]["data_freshness_days"] = None
        self.assertEqual(validate_history(self.fixture, self.slug), [])

    def test_cursor_is_opaque(self):
        self.fixture["meta"]["next_cursor"] = "opaque-fixture-token"
        validate_history(self.fixture, self.slug)
        self.fixture["meta"]["next_cursor"] = 123
        with self.assertRaises(ValueError):
            validate_history(self.fixture, self.slug)

    def test_broken_shapes_and_values_fail(self):
        variants = []
        for field, value in [("nav", 100.125), ("nav", "NaN"),
                             ("nav_date", "2026-09-01"), ("fund_slug", "other")]:
            broken = copy.deepcopy(self.fixture)
            broken["data"]["navs"][0][field] = value
            variants.append(broken)
        broken = copy.deepcopy(self.fixture); broken["data"] = []; variants.append(broken)
        broken = copy.deepcopy(self.fixture); broken["data"]["fund"] = []; variants.append(broken)
        broken = copy.deepcopy(self.fixture)
        broken["data"]["navs"] *= 2; variants.append(broken)
        for broken in variants:
            with self.subTest(broken=broken), self.assertRaises(ValueError):
                validate_history(broken, self.slug)

if __name__ == "__main__":
    unittest.main()

References: Python unittest · Python exact Decimal values · ILovePSX public API reference

Test continuation behavior beyond one valid page#

The shape test establishes that next_cursor is either a string or null. A collector needs further behavioral tests: a two-page selection should preserve slug, dates, order and limit; a repeated token must not create an infinite loop; an empty page with a continuation should fail the example collector's progress rule. Use mocked page fetches so these cases remain deterministic.

Do not decode a token and assert the producer's internal sequence number. Your consumer needs only to return the opaque token unchanged and stop correctly. A terminal null establishes that the selected traversal ended, not that the fund has complete coverage for every historical date. Keep valid empty ranges distinct from transport failures and unknown fund identities.

Fixture variationExpected consumer behavior
Valid page plus continuationRequest the same selection with the returned token
Terminal null cursorComplete the selected traversal
Repeated tokenStop with a pagination-progress error
Successful empty selectionRender no observations for that selection
Request failureKeep failure state distinct from absence

References: ILovePSX public API reference · Python unittest.mock

Protect the meaning of profiles and portfolio rows#

Use the full FMR model to test a profile with nullable fields, reported returns with their stated basis and a portfolio section with its reporting date. Check that holdings use their reported percentage denominator, that top holdings are not labelled a complete portfolio and that credit-quality buckets remain distinct from individual security or fund ratings.

Test an unavailable section separately from a section containing a reported zero. In the current complete-report implementation, an empty production section is marked NOT_REPORTED; that state alone does not prove the original document never disclosed the fact. Keep source context and report versions visible. A fixture test should prevent the UI from silently inventing the missing disclosure or replacing it with a chart slice of zero.

References: ILovePSX public API reference

Check provenance without inventing a document#

The complete report source field is an array of source records. A record can contain document: null, along with report identity, page number, promotion timestamp and data version. Test that the consumer can render that state honestly. If a real document URL is available in an authorized response, preserve its actual value and page context rather than constructing a URL from the fund name.

Synthetic fixtures are a model of the public shape, not evidence that a named AMC currently has complete holdings or that an agency assigned a rating. Label source-less examples in the UI and in exported test bundles. A research assistant using the same model should be able to say that the example is fictional and that no real source document accompanies it.

References: ILovePSX public API reference

Test failure envelopes and credential-safe diagnostics#

Successful API envelopes and problem-detail error bodies have different shapes. The latter carries status, title, detail, request_id and a service code; the transport status remains relevant. Feed mocked 401, 403, 422 and 429 responses to the client and verify that they produce access, selection or allowance handling rather than a successful empty data object.

Use the private client from the key guide with a fake transport and an obviously synthetic test secret. Assert that the secret goes only into the fixed-host request header and never into a URL, fixture or emitted error message. Also test redirect refusal and rejection of paths outside that client's allowlist. A mocked test should not create, revoke or rotate an actual customer key.

References: ILovePSX public API reference · RFC 9457: HTTP problem details · Python unittest.mock

Review fixture changes as changes in meaning#

Run the consumer suite whenever you change the request selection, parsing, cache representation or chart transformation. When a producer contract changes, compare the documented behavior first, then update the fixture and expectation together. Do not simply regenerate all fixtures until a broken test passes; inspect which user-visible meaning changed.

Keep the complete source-shaped fixture, the projected table and any derived chart values separate. Record which dependency versions and reference release you checked. A well-maintained suite gives a developer a repeatable explanation of why NAV, reported performance, holdings, allocations and credit-quality data appear as they do, including the limits of what the integration can safely infer.

References: ILovePSX public API reference · Python unittest

MOCK DATA / REAL RESPONSE STRUCTURE

Try a complete example.

Use these fictional records to prototype a full fund view: profile, reported returns, holdings, asset and sector allocations, credit quality, fees and ratings. Every name, identifier and number is invented. This is educational mock data, with no connection to a real fund, source document or agency opinion.

The JSON mirrors the public response structure. The complete FMR example includes all supported expansions; empty arrays and nulls demonstrate valid missing-data states. Your live integration must still request the sections it needs and check the returned coverage.

Inspect the complete FMR model
Complete synthetic FMR response · fictional data
{
  "success": true,
  "data": {
    "id": "00000000-0000-4000-8000-000000000101",
    "report_ids": [
      "00000000-0000-4000-8000-000000000101"
    ],
    "fund": {
      "id": "00000000-0000-4000-8000-000000000201",
      "slug": "example-research-fund",
      "name": "Example Research Fund",
      "mufap_fund_id": null,
      "amc": {
        "id": "00000000-0000-4000-8000-000000000301",
        "slug": "example-asset-management",
        "name": "Example Asset Management"
      }
    },
    "report_date": "2026-09-30",
    "currency": "PKR",
    "data_version": 1,
    "identity": {
      "fund_name_as_reported": "Example Research Fund",
      "fund_short_name_as_reported": "ERF",
      "parent_fund_name_as_reported": null,
      "plan_name_as_reported": null,
      "fund_type_as_reported": "Open-end",
      "category_as_reported": "Illustrative mixed-asset category",
      "risk_profile_as_reported": "Illustrative higher-risk profile",
      "is_shariah_compliant": false,
      "is_plan": false,
      "is_pension_scheme": false,
      "is_etf": false
    },
    "fund_size": {
      "nav_per_unit": "100.500000",
      "nav_date": "2026-09-30",
      "offer_price": "100.500000",
      "redemption_price": "100.500000",
      "repurchase_price": "100.500000",
      "market_price": null,
      "net_assets_pkr": "1005000000.0000",
      "fund_size_pkr": "1005000000.0000",
      "fund_size_including_fof_pkr": "1005000000.0000",
      "fund_size_excluding_fof_pkr": "1005000000.0000",
      "amount_invested_by_fof_pkr": "0.0000",
      "units_outstanding": "10000000.000000"
    },
    "profile": {
      "launch_date": "2025-01-01",
      "inception_date": "2025-01-01",
      "maturity_date": null,
      "benchmark": "Example composite benchmark",
      "old_benchmark": null,
      "new_benchmark": null,
      "benchmark_effective_date": null,
      "risk_of_principal_erosion": "Principal may fluctuate; synthetic disclosure.",
      "pricing_mechanism": "Forward pricing — illustrative",
      "dealing_days": "Monday to Friday — illustrative",
      "dealing_time": "09:00 to 14:00 Pakistan time — illustrative",
      "cutoff_time": "14:00 Pakistan time — illustrative",
      "settlement_period": "T+2 — illustrative, not an actual dealing policy",
      "minimum_initial_investment_pkr": "5000.0000",
      "minimum_subsequent_investment_pkr": "1000.0000",
      "minimum_redemption_pkr": "1000.0000",
      "unit_classes": [
        "Illustrative standard units"
      ],
      "leverage": "None in this synthetic example"
    },
    "report_fragments": [
      {
        "id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "schema_version": "fmr_page_v3",
        "data_version": 1,
        "promoted_at": "2026-10-08T08:00:00Z",
        "report_date": "2026-09-30",
        "report_month": "September 2026",
        "page_type": "FUND_REPORT",
        "extraction_mode": "PROFILE_PERFORMANCE_PORTFOLIO",
        "amc_name_raw": "Example Asset Management",
        "fund_name_raw": "Example Research Fund",
        "fund_short_name_raw": "ERF",
        "parent_fund_name_raw": null,
        "plan_name_raw": null,
        "fund_type_raw": "Open-end",
        "category_raw": "Illustrative mixed-asset category",
        "risk_profile_raw": "Illustrative higher-risk profile",
        "risk_of_principal_erosion_raw": "Principal may fluctuate; synthetic disclosure.",
        "is_shariah_compliant": false,
        "is_plan": false,
        "is_pension_scheme": false,
        "is_etf": false,
        "launch_date": "2025-01-01",
        "inception_date": "2025-01-01",
        "maturity_date": null,
        "benchmark_raw": "Example composite benchmark",
        "old_benchmark_raw": null,
        "new_benchmark_raw": null,
        "benchmark_effective_date": null,
        "par_value": "100.000000",
        "listing_raw": null,
        "leverage_raw": "None in this synthetic example",
        "nav_per_unit": "100.500000",
        "nav_date": "2026-09-30",
        "offer_price": "100.500000",
        "redemption_price": "100.500000",
        "repurchase_price": "100.500000",
        "market_price": null,
        "net_assets": "1005000000.0000",
        "fund_size": "1005000000.0000",
        "fund_size_including_fof": "1005000000.0000",
        "fund_size_excluding_fof": "1005000000.0000",
        "amount_invested_by_fof": "0.0000",
        "units_outstanding": "10000000.000000",
        "currency": "PKR",
        "pricing_mechanism_raw": "Forward pricing — illustrative",
        "dealing_days_raw": "Monday to Friday — illustrative",
        "dealing_time_raw": "09:00 to 14:00 Pakistan time — illustrative",
        "cutoff_time_raw": "14:00 Pakistan time — illustrative",
        "settlement_period_raw": "T+2 — illustrative, not an actual dealing policy",
        "minimum_initial_investment": "5000.0000",
        "minimum_subsequent_investment": "1000.0000",
        "minimum_redemption": "1000.0000",
        "unit_classes": [
          "Illustrative standard units"
        ]
      }
    ],
    "sub_funds": [],
    "reported_returns": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "period_label_raw": "1 year",
        "period_key": "1Y",
        "fund_return_percent": "12.00000000",
        "benchmark_return_percent": "10.00000000",
        "peer_return_percent": null,
        "return_type": "ABSOLUTE",
        "is_annualized": false,
        "is_since_inception": false,
        "calculation_basis_raw": "Synthetic cumulative return for the stated period"
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 2,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "period_label_raw": "Month to date",
        "period_key": "MTD",
        "fund_return_percent": "0.50000000",
        "benchmark_return_percent": "0.40000000",
        "peer_return_percent": null,
        "return_type": "ABSOLUTE",
        "is_annualized": false,
        "is_since_inception": false,
        "calculation_basis_raw": "Synthetic cumulative September return"
      }
    ],
    "allocations": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "ASSET_ALLOCATION",
        "label_raw": "Equities",
        "label_normalized": null,
        "percent_of_total_assets": "60.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "603000000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 2,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "ASSET_ALLOCATION",
        "label_raw": "Cash",
        "label_normalized": null,
        "percent_of_total_assets": "20.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "201000000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 3,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "ASSET_ALLOCATION",
        "label_raw": "Government securities",
        "label_normalized": null,
        "percent_of_total_assets": "15.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "150750000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 4,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "ASSET_ALLOCATION",
        "label_raw": "Other assets",
        "label_normalized": null,
        "percent_of_total_assets": "5.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "50250000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 5,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "SECTOR_ALLOCATION",
        "label_raw": "Technology",
        "label_normalized": null,
        "percent_of_total_assets": "25.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "251250000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 6,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "SECTOR_ALLOCATION",
        "label_raw": "Fertilizer",
        "label_normalized": null,
        "percent_of_total_assets": "20.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "201000000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 7,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "SECTOR_ALLOCATION",
        "label_raw": "Banks",
        "label_normalized": null,
        "percent_of_total_assets": "15.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": "150750000.0000",
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 8,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "CREDIT_QUALITY",
        "label_raw": "Government securities — illustrative bucket",
        "label_normalized": null,
        "percent_of_total_assets": "15.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": null,
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 9,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "allocation_type": "CREDIT_QUALITY",
        "label_raw": "Unrated / no rating assigned in this example",
        "label_normalized": null,
        "percent_of_total_assets": "85.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "amount": null,
        "current_period": null,
        "previous_period": null,
        "change_percent": null,
        "bucket_start_days": null,
        "bucket_end_days": null,
        "bucket_start_years": null,
        "bucket_end_years": null
      }
    ],
    "holdings": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "holding_group": "TOP_HOLDINGS",
        "rank": 1,
        "name_raw": "Example Technology Company",
        "holding_type": "EQUITY",
        "asset_class": "Equities",
        "issuer_name_raw": "Example Technology Company",
        "security_name_raw": "Example Technology Company ordinary shares",
        "symbol_raw": "EXTECH",
        "sector_raw": "Technology",
        "percent_of_total_assets": "18.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "percent_held": null,
        "market_value": "180900000.0000",
        "value_before_provisioning": null,
        "provisioning_amount": null,
        "value_after_provisioning": null,
        "quantity": "1000000.000000",
        "units": "shares",
        "credit_rating": null,
        "rating_agency": null,
        "instrument_type_raw": "Ordinary shares",
        "coupon_rate": null,
        "yield_percent": null,
        "ytm_percent": null,
        "issue_date": null,
        "maturity_date": null,
        "listed_or_unlisted": "Listed — illustrative",
        "secured_or_unsecured": null,
        "is_shariah_compliant": null,
        "is_top_holding": true,
        "is_non_compliant": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 2,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "holding_group": "TOP_HOLDINGS",
        "rank": 2,
        "name_raw": "Example Fertilizer Company",
        "holding_type": "EQUITY",
        "asset_class": "Equities",
        "issuer_name_raw": "Example Fertilizer Company",
        "security_name_raw": "Example Fertilizer Company ordinary shares",
        "symbol_raw": "EXFERT",
        "sector_raw": "Fertilizer",
        "percent_of_total_assets": "12.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "percent_held": null,
        "market_value": "120600000.0000",
        "value_before_provisioning": null,
        "provisioning_amount": null,
        "value_after_provisioning": null,
        "quantity": "800000.000000",
        "units": "shares",
        "credit_rating": null,
        "rating_agency": null,
        "instrument_type_raw": "Ordinary shares",
        "coupon_rate": null,
        "yield_percent": null,
        "ytm_percent": null,
        "issue_date": null,
        "maturity_date": null,
        "listed_or_unlisted": "Listed — illustrative",
        "secured_or_unsecured": null,
        "is_shariah_compliant": null,
        "is_top_holding": true,
        "is_non_compliant": null
      },
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 3,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "holding_group": "TOP_HOLDINGS",
        "rank": 3,
        "name_raw": "Example Banking Company",
        "holding_type": "EQUITY",
        "asset_class": "Equities",
        "issuer_name_raw": "Example Banking Company",
        "security_name_raw": "Example Banking Company ordinary shares",
        "symbol_raw": "EXBANK",
        "sector_raw": "Banks",
        "percent_of_total_assets": "8.000000",
        "percent_of_net_assets": null,
        "percent_of_gross_assets": null,
        "percent_held": null,
        "market_value": "80400000.0000",
        "value_before_provisioning": null,
        "provisioning_amount": null,
        "value_after_provisioning": null,
        "quantity": "500000.000000",
        "units": "shares",
        "credit_rating": null,
        "rating_agency": null,
        "instrument_type_raw": "Ordinary shares",
        "coupon_rate": null,
        "yield_percent": null,
        "ytm_percent": null,
        "issue_date": null,
        "maturity_date": null,
        "listed_or_unlisted": "Listed — illustrative",
        "secured_or_unsecured": null,
        "is_shariah_compliant": null,
        "is_top_holding": true,
        "is_non_compliant": null
      }
    ],
    "metrics": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "metric_key": "NUMBER_OF_HOLDINGS",
        "label_raw": "Illustrative number of equity holdings",
        "value": "12.00000000",
        "unit": "count",
        "period": "September 2026",
        "benchmark_value": null
      }
    ],
    "fees": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "fee_type": "TOTAL_EXPENSE_RATIO",
        "label_raw": "Illustrative annualized total expense ratio",
        "value_percent": "2.000000",
        "value_amount": null,
        "currency": "PKR",
        "period": "September 2026 — annualized illustration",
        "with_government_levies": true,
        "government_levy_percent": null,
        "secp_fee_percent": null,
        "is_actual_charged": true,
        "is_maximum_allowed": false
      }
    ],
    "ratings": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "rating_type": "ILLUSTRATIVE",
        "rating_raw": "Illustrative rating — not an agency opinion",
        "rating_agency": "Example agency (fictional)",
        "rating_date": null,
        "outlook_raw": null
      }
    ],
    "parties": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "role": "FUND_MANAGER",
        "name_raw": "Example Research Team",
        "designation_raw": "Illustrative fund-management team",
        "organization_raw": "Example Asset Management"
      }
    ],
    "special_terms": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "term_type": "INVESTMENT_OBJECTIVE",
        "label_raw": "Illustrative investment objective",
        "value_raw": "A fictional mixed-asset portfolio used only to demonstrate the response model.",
        "value_numeric": null,
        "value_percent": null,
        "value_amount": null,
        "value_date": null,
        "currency": "PKR"
      }
    ],
    "compliance": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "compliance_type": "ILLUSTRATIVE_DISCLOSURE",
        "name_raw": "Synthetic compliance disclosure",
        "limit_type_raw": null,
        "regulatory_limit_percent": null,
        "actual_exposure_percent": null,
        "excess_percent": null,
        "gross_assets_percent": null,
        "net_assets_percent": null,
        "status_raw": "Illustrative only — no regulatory assessment has been performed"
      }
    ],
    "notes": [
      {
        "sub_fund_key": null,
        "sub_fund_name_raw": null,
        "row_order": 1,
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "note_kind": "NOTE",
        "section_type": "PORTFOLIO",
        "note_type": "ILLUSTRATIVE",
        "text": "All figures and entities are synthetic. The three reported top holdings are a partial list. Sector percentages use total assets. Credit-quality labels and rating text are not agency opinions."
      }
    ],
    "source": [
      {
        "report_id": "00000000-0000-4000-8000-000000000101",
        "page_number": 1,
        "document": null,
        "promoted_at": "2026-10-08T08:00:00Z",
        "data_version": 1
      }
    ],
    "sections": {
      "sub_funds": {
        "status": "NOT_REPORTED",
        "row_count": 0
      },
      "reported_returns": {
        "status": "AVAILABLE",
        "row_count": 2
      },
      "allocations": {
        "status": "AVAILABLE",
        "row_count": 9
      },
      "holdings": {
        "status": "AVAILABLE",
        "row_count": 3
      },
      "metrics": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "fees": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "ratings": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "parties": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "special_terms": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "compliance": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "notes": {
        "status": "AVAILABLE",
        "row_count": 1
      },
      "source": {
        "status": "AVAILABLE",
        "row_count": 1
      }
    },
    "available_expansions": [
      "allocations",
      "compliance",
      "fees",
      "holdings",
      "metrics",
      "notes",
      "parties",
      "ratings",
      "reported_returns",
      "source",
      "special_terms",
      "sub_funds"
    ]
  },
  "meta": {
    "request_id": "00000000000040008000000000000401",
    "generated_at": "2026-10-08T08:00:00Z",
    "data_as_of": "2026-09-30",
    "data_freshness_days": 8
  }
}
Inspect the latest NAV model
Synthetic latest NAV response · fictional data
{
  "success": true,
  "data": [
    {
      "fund_id": "00000000-0000-4000-8000-000000000201",
      "fund_slug": "example-research-fund",
      "fund_name": "Example Research Fund",
      "mufap_fund_id": null,
      "nav_date": "2026-09-30",
      "nav": "100.500000",
      "offer_price": "100.500000",
      "repurchase_price": "100.500000",
      "market_price": null,
      "front_end_load_pct": "0.000000",
      "back_end_load_pct": "0.000000",
      "contingent_load_pct": null,
      "nav_change_abs": null,
      "nav_change_pct": null,
      "currency": "PKR"
    }
  ],
  "meta": {
    "request_id": "00000000000040008000000000000402",
    "generated_at": "2026-10-08T08:00:00Z",
    "data_as_of": "2026-09-30",
    "data_freshness_days": 8
  }
}
TRACE THE EVIDENCE

Sources & further reading

Check the published contract for current fields and limits. Source documents describe reported facts; API availability still depends on promoted production coverage.

  1. ILovePSX public API reference
  2. ILovePSX authentication, scopes and customer access
  3. Python unittest
  4. Python unittest.mock
  5. Python exact Decimal values
  6. RFC 9457: HTTP problem details

Put the guide to work.

Start with the documented contract, keep your key server-side, and make dates and missing data visible in your product.

Check the contract your tests consume