# Crypto.com Exchange

The AI Agent SDK offers comprehensive Exchange-related features by retrieving information about all available trading pairs and their current market data from the Crypto.com Exchange. It also supports fetching real-time market data for a specified trading instrument, providing developers with valuable insights for building trading and analytics applications.

To learn more about the underlying Developer Platform functionalities, please visit [Developer Platform Client SDK Exchange Module](https://ai-agent-sdk-docs.crypto.com/crypto.com-developer-platform/on-chain-developer-platform-client-sdk/exchange-module).

#### 7.1 Get all tickers

Retrieve information about all available trading pairs and their current market data from the Crypto.com Exchange.

{% tabs %}
{% tab title="Query" %}

* Example Query

  ```
  "Get all tickers"
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```python
  str: A formatted string containing information about all available tickers.
  ```
* Example Response

  <pre><code>Here are some of the current tickers available:

  <strong>1. &#x3C;example-pair>
  </strong>   - Last Price: &#x3C;example-price>
     - High: &#x3C;example-high-price>
     - Low: &#x3C;example-low-price>
     - Volume: &#x3C;example-volume>
  2. &#x3C;example-pair>
  ...

  This is just a selection of available tickers. If you would like more details or specific information regarding other tickers, please let me know!
  </code></pre>

{% endtab %}
{% endtabs %}

Example Code

```python
from crypto_com_agent_client import Agent

agent = Agent.init(
    llm_config={
        "provider": "OpenAI",
        "model": "gpt-4",
        "provider-api-key": "sk-proj-example-key",
        "temperature": "float-controlling-output-randomness",
        "transfer-limit": -1,  # -1 means no limit (unlimited), 0 disables transfers completely, any positive number (e.g. 5) allows exactly that transfer amount
    },
    blockchain_config={
        "api-key": "your-crypto.com-developer-platform-api-key",
        "private-key": "your-private-key",
        "sso-wallet-url": "your-sso-wallet-url",
        "timeout": "timeout-in-seconds-for-API-calls-default-20s")
    },
)
response = agent.interact("Get all tickers")
print(response)
```

#### 7.2 Get ticker by instrument&#x20;

Retrieve current market data for a specified trading instrument from the Crypto.com Exchange.

{% tabs %}
{% tab title="Query" %}

* Arguments

  ```python
  instrument_name (str): The name of the trading instrument (e.g., "BTC_USDT").
  ```
* Example Query

  ```
  "What's the ticker information of <example-instrument>"
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```python
  str: A formatted string containing the ticker information for the specified instrument.
  ```
* Errors

  ```python
  ValueError: If instrument_name is empty or None.
  ```
* Example Response

  ```
  Here is the ticker information for the <example-instrument> trading pair:

  - Instrument Name: <example-instrument>
  - High Price: <example-high-price>
  - Low Price: <example-low-price>
  - Last Price: <example-last-price>
  - 24h Volume: <example-volume>
  - 24h Volume Value: <example-volume-value>
  - Price Change: <example-price-change> (approximately <example-percentage>)
  - Best Bid: <example-best-bid-price>
  - Best Ask: <example-best-ask-price>
  - Open Interest: <example-open-interest>
  - Timestamp: <example-timestamp>

  If you need further information, feel free to ask!
  ```

{% endtab %}
{% endtabs %}

Example Code

```python
from crypto_com_agent_client import Agent

agent = Agent.init(
    llm_config={
        "provider": "OpenAI",
        "model": "gpt-4",
        "provider-api-key": "sk-proj-example-key",
        "temperature": "float-controlling-output-randomness",
        "transfer-limit": -1,  # -1 means no limit (unlimited), 0 disables transfers completely, any positive number (e.g. 5) allows exactly that transfer amount
    },
    blockchain_config={
        "api-key": "your-crypto.com-developer-platform-api-key",
        "private-key": "your-private-key",
        "sso-wallet-url": "your-sso-wallet-url",
        "timeout": "timeout-in-seconds-for-API-calls-default-20s")
    },
)

response = agent.interact("What's the ticker information of <example-instrument>")
print(response)
```


---

# 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://ai-agent-sdk-docs.crypto.com/crypto.com-ai-agent-sdk/core-concepts-overview/blockchain-functions/crypto.com-exchange.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.
