# Models

## The Error object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message"}}}}}}
```

## The InstrumentId object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"InstrumentId":{"type":"object","description":"Unique identifier for a financial instrument.","required":["admin","id"],"properties":{"admin":{"type":"string","description":"The party administering the instrument"},"id":{"type":"string","description":"The instrument identifier"}}}}}}
```

## The InstrumentInfo object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"InstrumentInfo":{"type":"object","description":"Extended information about a financial instrument.","required":["instrument_id","registry_url"],"properties":{"instrument_id":{"$ref":"#/components/schemas/InstrumentId"},"registry_url":{"type":"string","format":"uri","description":"URL of the token registry"}}},"InstrumentId":{"type":"object","description":"Unique identifier for a financial instrument.","required":["admin","id"],"properties":{"admin":{"type":"string","description":"The party administering the instrument"},"id":{"type":"string","description":"The instrument identifier"}}}}}}
```

## The TokenResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"TokenResponse":{"type":"object","description":"Token information response.","required":["instrument_id","instrument_info"],"properties":{"instrument_id":{"$ref":"#/components/schemas/InstrumentId"},"instrument_info":{"$ref":"#/components/schemas/InstrumentInfo"}}},"InstrumentId":{"type":"object","description":"Unique identifier for a financial instrument.","required":["admin","id"],"properties":{"admin":{"type":"string","description":"The party administering the instrument"},"id":{"type":"string","description":"The instrument identifier"}}},"InstrumentInfo":{"type":"object","description":"Extended information about a financial instrument.","required":["instrument_id","registry_url"],"properties":{"instrument_id":{"$ref":"#/components/schemas/InstrumentId"},"registry_url":{"type":"string","format":"uri","description":"URL of the token registry"}}}}}}
```

## The AmmIdResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"AmmIdResponse":{"type":"object","required":["amm_id"],"properties":{"amm_id":{"type":"string","description":"The AMM pool identifier"}}}}}}
```

## The AmmInspectResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"AmmInspectResponse":{"type":"object","description":"Detailed AMM pool state (V4 contract format).","required":["total_lp_token_supply","token_a_id","token_a_holdings","token_b_id","token_b_holdings","k","unclaimed_operator_fees","updated_at"],"properties":{"total_lp_token_supply":{"type":"number","format":"double","description":"Total supply of LP tokens."},"token_a_id":{"type":"string","description":"Identifier for token A."},"token_a_holdings":{"type":"number","format":"double","description":"Amount of token A in the pool."},"token_b_id":{"type":"string","description":"Identifier for token B."},"token_b_holdings":{"type":"number","format":"double","description":"Amount of token B in the pool."},"k":{"type":"number","format":"double","description":"The constant product (token_a_holdings * token_b_holdings)."},"unclaimed_operator_fees":{"type":"number","format":"double","description":"Accumulated operator fees awaiting claim (V4)."},"updated_at":{"type":"string","format":"date-time","description":"Timestamp of the last pool operation (V4)."}}}}}}
```

## The PoolInfo object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolInfo":{"type":"object","required":["token1","token2","lp_token_name","token1_holdings","token2_holdings","total_lp_tokens","lp_fee_percent","operator_fee_percent"],"properties":{"token1":{"type":"string","description":"The symbol/code of the first token in the pool."},"token2":{"type":"string","description":"The symbol/code of the second token in the pool."},"lp_token_name":{"type":"string","description":"The liquidity pool token name/identifier."},"token1_holdings":{"type":"number","format":"double","description":"Amount of token1 held in the pool."},"token2_holdings":{"type":"number","format":"double","description":"Amount of token2 held in the pool."},"total_lp_tokens":{"type":"number","format":"double","description":"Total supply of LP tokens for this pool."},"lp_fee_percent":{"type":"number","format":"double","description":"Liquidity provider fee as a percentage (e.g., 0.3 means 0.3%)."},"operator_fee_percent":{"type":"number","format":"double","description":"Operator fee as a percentage (e.g., 0.1 means 0.1%)."},"yield24h":{"type":"number","format":"double","nullable":true,"description":"24-hour annualized yield (APY) for the pool. Null if unavailable."}}}}}}
```

## The ListPoolsResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"ListPoolsResponse":{"type":"object","required":["pools"],"properties":{"pools":{"type":"array","items":{"$ref":"#/components/schemas/PoolInfo"},"description":"Array of pool information objects."}}},"PoolInfo":{"type":"object","required":["token1","token2","lp_token_name","token1_holdings","token2_holdings","total_lp_tokens","lp_fee_percent","operator_fee_percent"],"properties":{"token1":{"type":"string","description":"The symbol/code of the first token in the pool."},"token2":{"type":"string","description":"The symbol/code of the second token in the pool."},"lp_token_name":{"type":"string","description":"The liquidity pool token name/identifier."},"token1_holdings":{"type":"number","format":"double","description":"Amount of token1 held in the pool."},"token2_holdings":{"type":"number","format":"double","description":"Amount of token2 held in the pool."},"total_lp_tokens":{"type":"number","format":"double","description":"Total supply of LP tokens for this pool."},"lp_fee_percent":{"type":"number","format":"double","description":"Liquidity provider fee as a percentage (e.g., 0.3 means 0.3%)."},"operator_fee_percent":{"type":"number","format":"double","description":"Operator fee as a percentage (e.g., 0.1 means 0.1%)."},"yield24h":{"type":"number","format":"double","nullable":true,"description":"24-hour annualized yield (APY) for the pool. Null if unavailable."}}}}}}
```

## The RatioResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"RatioResponse":{"type":"object","required":["price_of_b_in_a"],"properties":{"price_of_b_in_a":{"type":"number","format":"double","description":"The price of token B expressed in token A (tokenB_holdings / tokenA_holdings)."}}}}}}
```

## The FeeAmountResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"FeeAmountResponse":{"type":"object","required":["fee_amount","operator_fee_amount"],"properties":{"fee_amount":{"type":"number","format":"double","description":"Liquidity provider fee percentage."},"operator_fee_amount":{"type":"number","format":"double","description":"Operator fee percentage."}}}}}}
```

## The QuoteTradeFixedInputResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"QuoteTradeFixedInputResponse":{"type":"object","required":["user_gets"],"properties":{"user_gets":{"type":"number","format":"double","description":"The amount of output token the user will receive."}}}}}}
```

## The QuoteTradeFixedOutputResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"QuoteTradeFixedOutputResponse":{"type":"object","required":["user_gives"],"properties":{"user_gives":{"type":"number","format":"double","description":"The amount of input token the user must provide."}}}}}}
```

## The QuoteLPWithdrawalResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"QuoteLPWithdrawalResponse":{"type":"object","required":["amount_instrument_1","amount_instrument_2"],"properties":{"amount_instrument_1":{"type":"number","format":"double","description":"Amount of instrument 1 to receive."},"amount_instrument_2":{"type":"number","format":"double","description":"Amount of instrument 2 to receive."}}}}}}
```

## The QuoteLPDepositResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"QuoteLPDepositResponse":{"type":"object","required":["lp_tokens_to_mint","instrument_1_to_deposit","instrument_2_to_deposit"],"properties":{"lp_tokens_to_mint":{"type":"number","format":"double","description":"Amount of LP tokens that will be minted."},"instrument_1_to_deposit":{"type":"number","format":"double","description":"Amount of instrument 1 required for deposit."},"instrument_2_to_deposit":{"type":"number","format":"double","description":"Amount of instrument 2 required for deposit."}}}}}}
```

## The PoolYieldResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolYieldResponse":{"type":"object","required":["pool_id","yield"],"properties":{"pool_id":{"type":"string","description":"The AMM pool identifier"},"yield":{"type":"object","additionalProperties":{"type":"number","format":"double"},"description":"Map of time period labels to annualized percentage yield (APY) values.\nKeys are time periods (1h, 4h, 12h, 1d, 2d, 3d, 7d, 14d, 30d).\nValues are APY as decimals (e.g., 0.05 = 5% APY).\nA value of 0 indicates insufficient data for that period.\n"}}}}}}
```

## The PoolVolumeResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolVolumeResponse":{"type":"object","required":["pool_id","volume_usd"],"properties":{"pool_id":{"type":"string","description":"The AMM pool identifier"},"volume_usd":{"type":"object","additionalProperties":{"type":"number","format":"double"},"description":"Map of time period labels to USD-denominated trading volume.\nKeys are time periods (1h, 4h, 12h, 1d, 2d, 3d, 7d, 14d, 30d).\nValues are the total swap volume in USD for that period.\nUSD conversion uses stablecoin rates (1:1) or CC exchange rate from Scan API.\n"}}}}}}
```

## The PoolVolumeHistoryResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolVolumeHistoryResponse":{"type":"object","required":["pool_id","window","history"],"properties":{"pool_id":{"type":"string","description":"The AMM pool identifier"},"window":{"type":"string","description":"The requested time window","enum":["hour","day","week"]},"history":{"type":"array","description":"Array of timestamped volume data points, ordered from oldest to newest","items":{"$ref":"#/components/schemas/VolumeHistoryDataPoint"}}}},"VolumeHistoryDataPoint":{"type":"object","required":["timestamp","volume_usd"],"properties":{"timestamp":{"type":"string","format":"date-time","description":"The start of the time interval (RFC3339 format)"},"volume_usd":{"type":"number","format":"double","description":"Trading volume in USD during this interval"}}}}}}
```

## The VolumeHistoryDataPoint object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"VolumeHistoryDataPoint":{"type":"object","required":["timestamp","volume_usd"],"properties":{"timestamp":{"type":"string","format":"date-time","description":"The start of the time interval (RFC3339 format)"},"volume_usd":{"type":"number","format":"double","description":"Trading volume in USD during this interval"}}}}}}
```

## The PoolYieldHistoryResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolYieldHistoryResponse":{"type":"object","required":["pool_id","window","history"],"properties":{"pool_id":{"type":"string","description":"The AMM pool identifier"},"window":{"type":"string","description":"The requested time window","enum":["hour","day","week"]},"history":{"type":"array","description":"Array of timestamped APY data points, ordered from oldest to newest","items":{"$ref":"#/components/schemas/YieldHistoryDataPoint"}}}},"YieldHistoryDataPoint":{"type":"object","required":["timestamp","apy"],"properties":{"timestamp":{"type":"string","format":"date-time","description":"The start of the time interval (RFC3339 format)"},"apy":{"type":"number","format":"double","description":"Annualized percentage yield during this interval (e.g., 0.05 = 5% APY)"}}}}}}
```

## The YieldHistoryDataPoint object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"YieldHistoryDataPoint":{"type":"object","required":["timestamp","apy"],"properties":{"timestamp":{"type":"string","format":"date-time","description":"The start of the time interval (RFC3339 format)"},"apy":{"type":"number","format":"double","description":"Annualized percentage yield during this interval (e.g., 0.05 = 5% APY)"}}}}}}
```

## The DisclosedContract object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"DisclosedContract":{"type":"object","description":"A disclosed contract blob from the Canton ledger, required for submitting transactions.","required":["templateId","contractId","createdEventBlob","synchronizerId"],"properties":{"templateId":{"type":"string","description":"Fully qualified template identifier (packageId:moduleName:entityName)"},"contractId":{"type":"string","description":"The contract ID on the ledger"},"createdEventBlob":{"type":"string","format":"byte","description":"Base64-encoded created event blob"},"synchronizerId":{"type":"string","description":"The synchronizer (domain) ID where this contract lives"}}}}}}
```

## The PoolDisclosuresResponse object

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.8.7"},"components":{"schemas":{"PoolDisclosuresResponse":{"type":"object","description":"Disclosed contracts needed to submit transactions against this pool.\nIncludes the AMM, fees, rules, LP instrument config, allocation factory,\nand optionally the featured app right contract.\n","required":["amm","amm_fees","instrument_config","allocation_factory","amm_data","amm_fees_data"],"properties":{"amm":{"$ref":"#/components/schemas/DisclosedContract"},"amm_fees":{"$ref":"#/components/schemas/DisclosedContract"},"amm_rules":{"$ref":"#/components/schemas/DisclosedContract"},"instrument_config":{"$ref":"#/components/schemas/DisclosedContract"},"allocation_factory":{"$ref":"#/components/schemas/DisclosedContract"},"featured_app_right":{"$ref":"#/components/schemas/DisclosedContract"},"amm_data":{"type":"object","description":"Parsed V4 AMM contract data"},"amm_fees_data":{"type":"object","description":"Parsed V4 AMMFees contract data"},"amm_rules_data":{"type":"object","description":"Parsed AMMRules contract data (if present)"},"featured_app_right_id":{"type":"string","nullable":true,"description":"Contract ID of the FeaturedAppRight (if present)"}}},"DisclosedContract":{"type":"object","description":"A disclosed contract blob from the Canton ledger, required for submitting transactions.","required":["templateId","contractId","createdEventBlob","synchronizerId"],"properties":{"templateId":{"type":"string","description":"Fully qualified template identifier (packageId:moduleName:entityName)"},"contractId":{"type":"string","description":"The contract ID on the ledger"},"createdEventBlob":{"type":"string","format":"byte","description":"Base64-encoded created event blob"},"synchronizerId":{"type":"string","description":"The synchronizer (domain) ID where this contract lives"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tradecraft.fi/api/routes/models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
