{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "window": {
      "$ref": "uniswap-economic.schema.json#/properties/window"
    },
    "inventory": {
      "$ref": "uniswap-economic.schema.json#/properties/inventory"
    },
    "mode": {
      "const": "economic"
    },
    "execution": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "latency": {
          "$ref": "strategy.schema.json#/$defs/Duration"
        },
        "decision_interval": {
          "$ref": "strategy.schema.json#/$defs/Duration"
        },
        "models": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "liquidation_model": {
              "const": "immediate_underlying_v3_revision11",
              "title": "Liquidation Model",
              "type": "string"
            }
          },
          "required": [
            "liquidation_model"
          ]
        }
      },
      "required": [
        "latency",
        "models"
      ]
    },
    "data": {
      "additionalProperties": false,
      "properties": {
        "source": {
          "const": "aave_v3_archive",
          "title": "Source",
          "type": "string"
        },
        "risk_model": {
          "const": "pool_oracle_each_block",
          "title": "Risk Model",
          "type": "string"
        },
        "sample_seconds": {
          "$ref": "strategy.schema.json#/$defs/Duration"
        },
        "max_age_seconds": {
          "$ref": "strategy.schema.json#/$defs/Duration"
        },
        "max_accounting_samples": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Accounting Samples",
          "type": "integer"
        },
        "max_risk_blocks": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Risk Blocks",
          "type": "integer"
        },
        "max_risk_samples": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Risk Samples",
          "type": "integer"
        },
        "max_liquidations_per_event": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Liquidations Per Event",
          "type": "integer"
        }
      },
      "required": [
        "source",
        "risk_model",
        "sample_seconds",
        "max_age_seconds",
        "max_accounting_samples",
        "max_risk_blocks",
        "max_risk_samples",
        "max_liquidations_per_event"
      ],
      "title": "DataPolicy",
      "type": "object"
    },
    "costs": {
      "discriminator": {
        "mapping": {
          "excluded": "#/$defs/ExcludedCosts",
          "fixed_native": "#/$defs/Costs"
        },
        "propertyName": "kind"
      },
      "oneOf": [
        {
          "$ref": "#/$defs/ExcludedCosts"
        },
        {
          "$ref": "#/$defs/Costs"
        }
      ],
      "title": "Costs"
    }
  },
  "required": [
    "window",
    "inventory",
    "mode",
    "execution",
    "data",
    "costs"
  ],
  "$defs": {
    "Account": {
      "additionalProperties": false,
      "properties": {
        "chain": {
          "$ref": "#/$defs/Chain"
        },
        "address": {
          "title": "Address",
          "type": "string"
        }
      },
      "required": [
        "chain",
        "address"
      ],
      "title": "Account",
      "type": "object"
    },
    "AlchemyProvider": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "alchemy",
          "title": "Kind",
          "type": "string"
        },
        "network": {
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "title": "Network",
          "type": "string"
        },
        "api_key_env": {
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
          "title": "Api Key Env",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "network",
        "api_key_env"
      ],
      "title": "AlchemyProvider",
      "type": "object"
    },
    "AssetAmount": {
      "additionalProperties": false,
      "description": "Nonnegative base-unit amount with explicit asset identity.",
      "properties": {
        "asset": {
          "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}/[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}$",
          "title": "Asset",
          "type": "string"
        },
        "amount": {
          "minimum": 0,
          "title": "Amount",
          "type": "integer"
        }
      },
      "required": [
        "asset",
        "amount"
      ],
      "title": "AssetAmount",
      "type": "object"
    },
    "Chain": {
      "additionalProperties": false,
      "properties": {
        "chain_id": {
          "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$",
          "title": "Chain Id",
          "type": "string"
        },
        "environment": {
          "minLength": 1,
          "title": "Environment",
          "type": "string"
        }
      },
      "required": [
        "chain_id",
        "environment"
      ],
      "title": "Chain",
      "type": "object"
    },
    "CollectionLimits": {
      "additionalProperties": false,
      "properties": {
        "max_in_flight": {
          "default": 4,
          "maximum": 64,
          "minimum": 1,
          "title": "Max In Flight",
          "type": "integer"
        },
        "batch_size": {
          "default": 32,
          "maximum": 32,
          "minimum": 1,
          "title": "Batch Size",
          "type": "integer"
        },
        "requests_per_second": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Requests Per Second"
        },
        "max_retries": {
          "default": 3,
          "maximum": 8,
          "minimum": 0,
          "title": "Max Retries",
          "type": "integer"
        }
      },
      "title": "CollectionLimits",
      "type": "object"
    },
    "Costs": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "fixed_native",
          "title": "Kind",
          "type": "string"
        },
        "supply": {
          "minimum": 0,
          "title": "Supply",
          "type": "integer"
        },
        "withdraw": {
          "minimum": 0,
          "title": "Withdraw",
          "type": "integer"
        },
        "borrow": {
          "minimum": 0,
          "title": "Borrow",
          "type": "integer"
        },
        "repay": {
          "minimum": 0,
          "title": "Repay",
          "type": "integer"
        },
        "collateral": {
          "minimum": 0,
          "title": "Collateral",
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "supply",
        "withdraw",
        "borrow",
        "repay",
        "collateral"
      ],
      "title": "Costs",
      "type": "object"
    },
    "DataPolicy": {
      "additionalProperties": false,
      "properties": {
        "source": {
          "const": "aave_v3_archive",
          "title": "Source",
          "type": "string"
        },
        "risk_model": {
          "const": "pool_oracle_each_block",
          "title": "Risk Model",
          "type": "string"
        },
        "sample_seconds": {
          "exclusiveMinimum": 0,
          "title": "Sample Seconds",
          "type": "integer"
        },
        "max_age_seconds": {
          "exclusiveMinimum": 0,
          "title": "Max Age Seconds",
          "type": "integer"
        },
        "max_accounting_samples": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Accounting Samples",
          "type": "integer"
        },
        "max_risk_blocks": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Risk Blocks",
          "type": "integer"
        },
        "max_risk_samples": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Risk Samples",
          "type": "integer"
        },
        "max_liquidations_per_event": {
          "exclusiveMinimum": 0,
          "minimum": 0,
          "title": "Max Liquidations Per Event",
          "type": "integer"
        }
      },
      "required": [
        "source",
        "risk_model",
        "sample_seconds",
        "max_age_seconds",
        "max_accounting_samples",
        "max_risk_blocks",
        "max_risk_samples",
        "max_liquidations_per_event"
      ],
      "title": "DataPolicy",
      "type": "object"
    },
    "ExcludedCosts": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "excluded",
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "title": "ExcludedCosts",
      "type": "object"
    },
    "HistoryBinding": {
      "additionalProperties": false,
      "properties": {
        "chain": {
          "$ref": "#/$defs/Chain"
        },
        "provider": {
          "discriminator": {
            "mapping": {
              "alchemy": "#/$defs/AlchemyProvider",
              "rpc_url": "#/$defs/UrlProvider"
            },
            "propertyName": "kind"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/AlchemyProvider"
            },
            {
              "$ref": "#/$defs/UrlProvider"
            }
          ],
          "title": "Provider"
        },
        "collection": {
          "$ref": "#/$defs/CollectionLimits",
          "default": {
            "max_in_flight": 4,
            "batch_size": 32,
            "requests_per_second": null,
            "max_retries": 3
          }
        }
      },
      "required": [
        "chain",
        "provider"
      ],
      "title": "HistoryBinding",
      "type": "object"
    },
    "SafeRoles": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "safe_roles",
          "title": "Kind",
          "type": "string"
        },
        "fund": {
          "$ref": "#/$defs/Account"
        },
        "operator": {
          "$ref": "#/$defs/Account"
        },
        "roles_module": {
          "title": "Roles Module",
          "type": "string"
        },
        "role_key": {
          "pattern": "^0x[0-9a-f]{64}$",
          "title": "Role Key",
          "type": "string"
        },
        "safe_deployment_block": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Safe Deployment Block"
        },
        "roles_deployment_block": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Roles Deployment Block"
        }
      },
      "required": [
        "kind",
        "fund",
        "operator",
        "roles_module",
        "role_key"
      ],
      "title": "SafeRoles",
      "type": "object"
    },
    "Schedule": {
      "additionalProperties": false,
      "properties": {
        "start": {
          "maximum": 253402300799,
          "minimum": 0,
          "title": "Start",
          "type": "integer"
        },
        "end": {
          "maximum": 253402300799,
          "minimum": 0,
          "title": "End",
          "type": "integer"
        },
        "decision_interval_override_seconds": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Decision Interval Override Seconds"
        },
        "latency_seconds": {
          "minimum": 0,
          "title": "Latency Seconds",
          "type": "integer"
        },
        "end_policy": {
          "enum": [
            "mark_open",
            "teardown"
          ],
          "title": "End Policy",
          "type": "string"
        },
        "cleanup_seconds": {
          "minimum": 0,
          "title": "Cleanup Seconds",
          "type": "integer"
        }
      },
      "required": [
        "start",
        "end",
        "latency_seconds",
        "end_policy",
        "cleanup_seconds"
      ],
      "title": "Schedule",
      "type": "object"
    },
    "SimulationAccount": {
      "additionalProperties": false,
      "description": "An adapter identity without signing or installed account authority.",
      "properties": {
        "kind": {
          "const": "simulation",
          "default": "simulation",
          "title": "Kind",
          "type": "string"
        },
        "fund": {
          "$ref": "#/$defs/Account"
        },
        "payer": {
          "anyOf": [
            {
              "$ref": "#/$defs/Account"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "fund"
      ],
      "title": "SimulationAccount",
      "type": "object"
    },
    "UrlProvider": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "rpc_url",
          "title": "Kind",
          "type": "string"
        },
        "url_env": {
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
          "title": "Url Env",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "url_env"
      ],
      "title": "UrlProvider",
      "type": "object"
    },
    "almanak__backtest__config__Fund": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "minLength": 1,
          "pattern": "^\\S+$",
          "title": "Name",
          "type": "string"
        },
        "fund": {
          "$ref": "#/$defs/Account"
        },
        "balances": {
          "items": {
            "$ref": "#/$defs/AssetAmount"
          },
          "title": "Balances",
          "type": "array"
        }
      },
      "required": [
        "name",
        "fund",
        "balances"
      ],
      "title": "Fund",
      "type": "object"
    },
    "almanak__backtest__inventory__Fund": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "minLength": 1,
          "pattern": "^\\S+$",
          "title": "Name",
          "type": "string"
        },
        "profile": {
          "anyOf": [
            {
              "$ref": "#/$defs/SafeRoles"
            },
            {
              "$ref": "#/$defs/SimulationAccount"
            }
          ],
          "title": "Profile"
        },
        "balances": {
          "items": {
            "$ref": "#/$defs/AssetAmount"
          },
          "title": "Balances",
          "type": "array"
        }
      },
      "required": [
        "name",
        "profile",
        "balances"
      ],
      "title": "Fund",
      "type": "object"
    }
  }
}
