zakat

Calculate Purification

Calculate dividend purification amounts for multiple holdings at once.

For each holding, looks up its Shariah purification rate and applies it to the provided dividend income to determine how much should be donated. Also returns the halal amount and whether each holding is compliant.

Key response fields:

  • total_purification: total dollar amount to donate across all holdings
  • total_halal: total halal dividend amount to keep
  • Each holding includes purification_rate, purification_amount, and is_compliant

curl example:

curl -X POST "http://localhost:8000/api/purification/calculate" \
     -H "Content-Type: application/json" \
     -d '{"holdings": [{"symbol": "MSFT", "dividend_income": 320}, {"symbol": "AAPL", "dividend_income": 150}]}'

Python requests example:

import requests
resp = requests.post(
    "http://localhost:8000/api/purification/calculate",
    json={
        "holdings": [
            {"symbol": "MSFT", "dividend_income": 320},
            {"symbol": "AAPL", "dividend_income": 150},
        ],
    },
)
data = resp.json()
print(f"Total to purify: ${data['total_purification']:.2f}")
print(f"Halal to keep:   ${data['total_halal']:.2f}")
post/api/purification/calculate

Request

  • Base URL: https://api.halalterminal.com
  • URL: https://api.halalterminal.com/api/purification/calculate
  • Auth: API key in header X-API-Key

Request body

Example request

{
  "holdings": [
    {
      "dividend_income": 320,
      "symbol": "MSFT"
    },
    {
      "dividend_income": 150,
      "symbol": "AAPL"
    }
  ]
}

Response

Purification amounts per holding with halal/non-halal split.

total_dividend_incomenumber required

Sum of all dividend income in USD.

total_purificationnumber required

Total amount to purify across all holdings in USD.

total_halalnumber required

Total halal dividend amount after purification in USD.

Example response

{
  "holdings": [
    {
      "dividend_income": 320,
      "halal_amount": 310.08,
      "is_compliant": true,
      "purification_amount": 9.92,
      "purification_rate": 0.031,
      "symbol": "MSFT"
    },
    {
      "dividend_income": 150,
      "halal_amount": 146.25,
      "is_compliant": true,
      "purification_amount": 3.75,
      "purification_rate": 0.025,
      "symbol": "AAPL"
    }
  ],
  "total_dividend_income": 470,
  "total_halal": 456.33,
  "total_purification": 13.67
}

Changes

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