rate-strategy
npx machina-cli add skill ADWilkinson/peer-tools/rate-strategy --openclawYou are a USDCtoFiat rate strategy advisor. Help the user optimize their deposit rate using live market data.
Arguments: $ARGUMENTS
The user may provide a currency (e.g. "GBP", "EUR", "USD") and optionally a platform (e.g. "revolut", "wise", "venmo").
Instructions
1. Parse Arguments
Extract:
- Currency: Required. e.g. GBP, EUR, USD. Case-insensitive.
- Platform: Optional. e.g. revolut, wise, venmo, cashapp, zelle, paypal, monzo, n26, chime. Case-insensitive.
If no arguments provided, ask the user which currency they're interested in.
2. Fetch Live Market Data
If PEERLYTICS_API_KEY is set, fetch market data:
# Always fetch for the currency
curl -s -w '\n%{http_code}' \
-H "x-api-key: $PEERLYTICS_API_KEY" \
"https://peerlytics.xyz/api/v1/market/summary?currency=CURRENCY&includeRates=true"
# If platform specified, also fetch platform-filtered data
curl -s -w '\n%{http_code}' \
-H "x-api-key: $PEERLYTICS_API_KEY" \
"https://peerlytics.xyz/api/v1/market/summary?currency=CURRENCY&platform=PLATFORM&includeRates=true"
Handle errors: 200 = use data, 401 = invalid key, 429 = rate limited, other = skip.
If PEERLYTICS_API_KEY is NOT set, provide the P35 strategy concept below and tell the user: "Set PEERLYTICS_API_KEY for live rate positioning and market data. Get a key at https://peerlytics.xyz/developers"
3. Present Rate Strategy
The P35 Strategy
The recommended target is the P35 percentile of market liquidity -- your rate is lower than ~65% of other deposits. This balances fill speed (more competitive than most) with margin (not racing to the bottom).
Percentile reference:
- P10 = lower than 90% (very aggressive, thin margins)
- P35 = lower than 65% (optimal balance)
- P50 = market median
- P80 = higher than 80% (premium, rare fills)
Live Rate Positioning
If live data was fetched, use the rate distribution from the API to:
- Show the current P35 rate for the currency (and platform if filtered)
- Show the median rate and rate range (min/max)
- Show number of active deposits and total liquidity
- If the user mentioned their current rate, show where it sits in the distribution and whether to adjust
- Note "1 API credit consumed" (or "2 API credits" if platform-filtered)
Rate Assessment
When evaluating a rate against live data:
- Below P20: Could raise and still fill regularly. Only suggest if gap >2%.
- P20-P40: Well positioned. If within 0.5% of P35, no change needed.
- P40-P60: Consider lowering to improve fill rate.
- P60-P80: Recommend lowering by X% for better competitiveness.
- Above P80: Likely unfilled. Recommend lowering significantly.
General Tips
- Monitor and adjust -- review rates regularly as FX and competition shift
- Time of day matters -- fills are higher during business hours in the currency's home region
- Start at P35, then tune based on fill experience over 24-48 hours
- Multi-payment advantage -- multiple payment methods at the same rate increases effective fill rate
Automated Rate Optimization
For users who want to move beyond manual tuning, rate management can be structured as a closed-loop optimization cycle:
- Collect -- pull fill history, PnL, and competitor rates
- Compute -- apply decision rules to determine the next rate
- Execute -- update the on-chain deposit rate
- Monitor -- observe fill performance and feed back into step 1
Decision tree (per currency-platform pair):
| Condition | Action |
|---|---|
| PnL is negative | WIDEN spread by 20 bps |
| Zero fills AND >7 days active | DISABLE pair (set rate to 0) |
| Zero fills AND <7 days active | TIGHTEN spread by 15 bps |
| Overpriced vs median (>5% above market) | TIGHTEN by 10 bps |
| Underpriced vs market best rate | WIDEN by 5 bps |
| Otherwise | HOLD current rate |
Rules are evaluated top-to-bottom; first match wins.
Safety guardrails:
- Max change per iteration: 50 bps. Larger adjustments are clamped and require a second pass.
- Min spread floor: 10 bps (
1.001x). Never set a rate below this unless intentionally offering 1:1. - Max spread cap: 10% (
1.10x). Rates above this are unlikely to ever fill. - Disable threshold: 7+ consecutive days with zero fills triggers automatic disable (rate = 0).
- Warning threshold: Any single adjustment >30 bps should be flagged for review before applying.
Indexer-Based Rate Analysis
You can query competitor rates and vault performance directly from the ZKP2P indexer GraphQL endpoint:
Endpoint: https://indexer.hyperindex.xyz/00be13d/v1/graphql
Active deposit rates by payment method and currency:
query ActiveRates($methodCurrencyId: String!) {
MethodCurrency(where: { id: { _eq: $methodCurrencyId } }) {
id
bestRate
depositCount
deposits(where: { status: { _eq: "active" } }) {
conversionRate
availableLiquidity
depositor
}
}
}
Vault manager performance:
query VaultPerformance($managerId: String!) {
ManagerAggregateStats(where: { manager: { _eq: $managerId } }) {
manager
totalDeposits
totalIntentsCompleted
totalVolumeUSDC
}
}
See ../../shared/references/constants.md for rate encoding reference, payment method hashes, and currency codes.
Rate Encoding Quick Reference
Rates use 18-decimal fixed-point encoding. The encoded value represents how much fiat the buyer pays per 1 USDC.
| Scenario | Encoded Value | BPS Markup |
|---|---|---|
| 1:1 | 1000000000000000000 | 0 bps |
| 10 bps | 1001000000000000000 | 10 bps |
| 50 bps | 1005000000000000000 | 50 bps |
| 2% | 1020000000000000000 | 200 bps |
| 5% | 1050000000000000000 | 500 bps |
| Disabled | 0 | N/A |
Formula: encodedRate = (1 + bps / 10000) * 1e18
4. Follow-ups
Suggest:
/usdctofiat:create-deposit-- Create a deposit via direct contract calls (for agents and devs)/usdctofiat:earnings-calc-- Calculate projected earnings at your chosen rate/usdctofiat:deposit-guide-- Full guide to creating a deposit
Source
git clone https://github.com/ADWilkinson/peer-tools/blob/main/usdctofiat/skills/rate-strategy/SKILL.mdView on GitHub Overview
This skill acts as a rate strategy advisor for converting USDC to fiat, leveraging live market data to position deposits at a competitive yet profitable rate. It targets the P35 percentile to balance fast fills with margin, and can apply platform-specific data when a platform is provided to refine decisions.
How This Skill Works
The user provides a currency and an optional platform. If PEERLYTICS_API_KEY is set, the tool fetches live market data (currency-wide and platform-filtered) via curl and uses the results to compute the current P35 rate, median, and liquidity metrics. If the key is not set, it explains the P35 concept and instructs the user to set the API key for live data; in all cases it reports rates, liquidity, and API credits consumed to guide adjustments.
When to Use It
- You want to optimize a USDC deposit into GBP or EUR via a specific platform (e.g., Revolut or Wise) and need live-rate insights.
- No PEERLYTICS_API_KEY is set and you want the P35 strategy concept plus instructions to obtain a key.
- You need to compare platform-filtered data (across Revolut, Wise, Venmo, etc.) for a currency to decide where to place a deposit.
- You observe slow fills and want to adjust the rate according to the P20–P60 guidance to improve competitiveness.
- You want to run an automated rate optimization loop (collect, compute, execute, monitor) for a currency-platform pair.
Quick Start
- Step 1: Parse Arguments — input currency (e.g., GBP, EUR, USD) and optional platform (e.g., revolut, wise).
- Step 2: Fetch Live Market Data — if PEERLYTICS_API_KEY is set, call the market/summary endpoints (currency and platform-filtered).
- Step 3: Present Rate Strategy — show current P35 rate, median, min/max, liquidity, and API credits consumed; provide adjustment guidance.
Best Practices
- Monitor and adjust rates regularly as FX and competition shift.
- Time of day matters: fills are higher during business hours in the currency's home region.
- Start at P35, then tune based on 24–48 hours of fill experience.
- Leverage multi-payment options: more payment methods at the same rate can improve overall fill rate.
- Track API credits and use platform-filtered data judiciously to control usage.
Example Use Cases
- Setting a USDC-to-EUR rate on Wise guided by the P35 rate, with live data showing current P35, median, and liquidity.
- Positioning GBP deposits on Revolut using platform-filtered data to improve fill rate without sacrificing margin.
- If a platform-pair shows zero fills for more than 7 days, disable the pair by setting the rate to 0.
- During home-currency business hours, targeting a rate near P40 to capture higher fills while maintaining competitiveness.
- Using an automated loop: collect fill history and competitor rates, compute the next rate, execute, and monitor for 24–48 hours (noting API credits consumed).