Optimizer
Optimize Allocations
Calculate optimal capital allocation across protocols
POST
Documentation Index
Fetch the complete documentation index at: https://docs.gizatech.xyz/llms.txt
Use this file to discover all available pages before exploring further.
SDK Alternative: Use
giza.optimize(options) for a simpler TypeScript interface. See SDK docsDescription
Calculates the optimal capital allocation across DeFi lending protocols. Returns the optimal allocation, an action plan to achieve it, and execution-ready calldata. This endpoint is the core of the IaaS (Intelligence as a Service) integration.Path Parameters
The blockchain chain ID
Request Body
Total capital to allocate (as bigint string, e.g., “1000000000” for 1000 USDC)
Token address to optimize for
Current allocations by protocol (protocol name → amount as bigint string)Example:
{"aave": "500000000", "compound": "500000000"}List of protocol names to consider for optimization
Optional constraints for optimization. Each constraint is an object with
Example:
kind and params.Constraint types and required parameters:| Kind | Params | Description |
|---|---|---|
min_protocols | min_protocols (int), min_fraction_per_protocol (float, optional) | Minimum number of protocols to use |
max_amount_per_protocol | protocol (string), max_ratio (float 0-1) | Cap a protocol at a percentage of total capital |
max_allocation_amount_per_protocol | protocol (string), max_amount (int) | Cap a protocol at an absolute amount |
min_amount | min_amount (int) | Minimum amount for any used protocol |
min_allocation_amount_per_protocol | protocol (string), min_amount (int) | Minimum amount for a specific protocol |
exclude_protocol | protocol (string) | Exclude a protocol from optimization |
Optional wallet address that will execute the transactions.
Example:
"0x1234567890123456789012345678901234567890"Response
Optimization results
Ordered list of actions to execute
Execution-ready transaction data