Calculate a Weighted-Average FX Rate
finance.fx_weighted_average_rate
Overview
Perform bounded exact-decimal fx weighted average rate with every directed rate and convention explicit. Closed input, fixed precision, typed failures, and no ambient market data apply.
You receive bounded directed FX arithmetic with explicit trace evidence for finance.fx_weighted_average_rate.
Reliability
DECIMAL_INVALID means a decimal is malformed or over limit; correct it. FX_RATE_NON_POSITIVE means a required rate or factor is not positive; correct it. FX_ORIENTATION_INVALID means currencies or edge orientation are inconsistent; correct them. FX_POINT_SCALE_INVALID means point scale is outside 1..1,000,000; correct it. FX_SPREAD_INVALID means the supplied ask is lower than the supplied bid; correct the quote. FX_RATE_TABLE_INVALID or FX_RATE_DUPLICATE_PAIR means an edge table is malformed; correct it. FX_PATH_NOT_FOUND or FX_PATH_POLICY_INVALID means no bounded directed path satisfies policy; correct the graph or policy. FX_WEIGHTS_INVALID or ZERO_DENOMINATOR means aligned weights are invalid; correct them. FX_RATE_MISSING means a direct reporting-currency rate is absent; supply it. FX_LIMIT_EXCEEDED or ITEM_LIMIT_EXCEEDED means a count bound was exceeded; reduce input. This guidance applies specifically to finance.fx_weighted_average_rate.
Context footprint
The compact result replaces repeated prompt FX arithmetic for finance.fx_weighted_average_rate. A successful call costs 1 execution credit.
When to use it
When several directed rates with aligned weights must be blended into one average quote.
When the observations are unweighted, or the weights are not aligned to the rate list.
Scope
Non-goals
- Does not fetch rates, infer reciprocals, infer paths, or select market data for finance.fx_weighted_average_rate.
- Does not apply accounting, tax, hedge, settlement, or rounding policy for finance.fx_weighted_average_rate.
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| rates | array | Yes | Ordered array of one through 10,000 positive plain-decimal rate strings aligned by index with weights. |
| weights | array | Yes | Aligned non-negative plain-decimal strings with positive sum. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| averageRate | string | Yes | Weighted-average rate. Returned as a normalized plain-decimal string. |
| weightSum | string | Yes | Sum of supplied weights. Returned as a normalized plain-decimal string. |
| count | integer | Yes | Aligned value count. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"finance.fx_weighted_average_rate","input":{"rates":["1","2"],"weights":["1","3"]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("finance.fx_weighted_average_rate", {"rates":["1","2"],"weights":["1","3"]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| DECIMAL_INVALID | 400 | No | The request payload failed this skill's input validation. |
| FX_RATE_NON_POSITIVE | 400 | No | The request payload failed this skill's input validation. |
| FX_WEIGHTS_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ZERO_DENOMINATOR | 400 | No | The request payload failed this skill's input validation. |
| ITEM_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not fetch rates, infer reciprocals, infer paths, or select market data for finance.fx_weighted_average_rate.
- Does not apply accounting, tax, hedge, settlement, or rounding policy for finance.fx_weighted_average_rate.
- Market-rate lookup or inferred currency orientation
- Inputs beyond the published edge, item, value, or hop limits.
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "finance.fx_weighted_average_rate",
"input": {
"rates": [
"1",
"2"
],
"weights": [
"1",
"3"
]
}
}Examples
Verified calculation
{
"rates": [
"1",
"2"
],
"weights": [
"1",
"3"
]
}{
"weightSum": "4",
"averageRate": "1.75",
"count": 2
}Alternative calculation
{
"rates": [
"1.2"
],
"weights": [
"5"
]
}{
"weightSum": "5",
"averageRate": "1.2",
"count": 1
}Recommended use cases
- Auditable exact-decimal directed FX algebra for finance.fx_weighted_average_rate.
- Bounded conversion and orientation checks with every rate supplied explicitly.
Avoid for
- Market-rate lookup or inferred currency orientation
- Inputs beyond the published edge, item, value, or hop limits.
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.