> For the complete documentation index, see [llms.txt](https://docs.keeta.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeta.com/anchors/anchor-types/fx-foreign-exchange.md).

# FX (Foreign Exchange)

The FX Anchor service enables currency and token conversions on Keeta. It connects users who want to swap between different assets with liquidity providers who offer exchange services.

### Understanding FX Anchors

An FX Anchor operates like a decentralized exchange interface:

1. **Discovery**: Clients find FX providers using the Resolver
2. **Quote Request**: User requests a price for a conversion
3. **Quote Response**: Provider returns a signed quote with rate and fees
4. **Exchange**: User submits a block swapping tokens with the provider
5. **Settlement**: Provider completes the swap atomically on-chain

The SDK handles the quote signing, verification, and atomic swap construction, ensuring both parties are protected.

### Core Concepts

**Conversion Input**

Every FX operation starts with a `ConversionInput` specifying:

* **from**: The token you have
* **to**: The token you want
* **amount**: How much to convert
* **affinity**: Whether amount refers to 'from' (you have this much) or 'to' (you want this much)

**Quotes vs Estimates**

* **Estimate**: Non-binding price indication, useful for showing users expected rates
* **Quote**: Binding commitment from provider with signature, required for execution

**Floating vs Fixed Rate**

* **Fixed Rate (with quote)**: Price locked at quote time, guaranteed regardless of market movement
* **Floating Rate (without quote)**: Price determined at execution time, may be better or worse than estimate

### Basic Client FX Flow

{% @github-files/github-code-block url="<https://github.com/KeetaNetwork/keetanet-examples/blob/main/src/anchor/fx-client.ts>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keeta.com/anchors/anchor-types/fx-foreign-exchange.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
