etf

Calculate Etf Purification

Calculate the purification amount for an ETF investment.

Given an investment amount and optional dividend income, computes how much money should be donated to purify returns based on each holding's purification rate. Returns both aggregate amounts and a per-holding breakdown.

curl example:

curl -X POST "http://localhost:8000/api/etf/VTI/purification" \
     -H "Content-Type: application/json" \
     -d '{"investment_amount": 50000, "dividend_income": 1200}'

Python requests example:

import requests
resp = requests.post(
    "http://localhost:8000/api/etf/VTI/purification",
    json={"investment_amount": 50000, "dividend_income": 1200},
)
data = resp.json()
print(f"Total to purify: ${data['total_purification_amount']:.2f}")
post/api/etf/{symbol}/purification

Request

  • Base URL: https://api.halalterminal.com
  • URL: https://api.halalterminal.com/api/etf/{symbol}/purification
  • Auth: API key in header X-API-Key

Path parameters

symbolstring required

ETF ticker symbol.

Request body

investment_amountnumber required

Total investment amount in USD.

dividend_incomenumber nullable

Dividend income received from the ETF in USD.

Example request

{
  "dividend_income": 1200,
  "investment_amount": 50000
}

Response

Purification amounts for the investment and optional dividend income.

symbolstring required

ETF ticker symbol.

investment_amountnumber

Original investment amount in USD.

dividend_incomenumber nullable

Dividend income in USD, if provided.

etf_purification_ratenumber

Purification rate in percent over the WHOLE fund: 4.17 means 4.17%. Compliant rated holdings contribute their own rate, and every non-compliant or unscreened holding is charged at 100% by prudence. This is the conservative figure and the one to show an investor. GET /api/etf/{symbol}/screening returns purification_rate, which averages the compliant rated holdings only and is therefore lower.

purification_basisstring

Denominator behind etf_purification_rate. Always 'whole_fund_conservative' on this endpoint, against 'compliant_rated_holdings' on the screening endpoint.

investment_purification_amountnumber

Amount to purify from investment gains.

dividend_purification_amountnumber nullable

Amount to purify from dividends.

total_purification_amountnumber

Total purification amount (investment + dividends).

Example response

{
  "dividend_income": 1200,
  "dividend_purification_amount": 38.4,
  "etf_purification_rate": 3.2,
  "holdings": [],
  "investment_amount": 50000,
  "investment_purification_amount": 1600,
  "purification_basis": "whole_fund_conservative",
  "symbol": "VTI",
  "total_purification_amount": 1638.4
}

Changes

No recorded changes to this operation across all 1 revision of this API.