Crypto.com AI Agent SDK
  • Getting Started
    • Introduction
    • Quick Start Guide: Simulation Entry Point
  • Core Concepts Overview
    • Plugins
    • Tools
    • Blockchain Functions
      • Wallet Management
      • Token Interaction
      • Transaction Queries
      • Block Information
      • Contract Operations
      • CronosID Operations
      • Defi Operations
      • Crypto.com Exchange
    • Built-in Telegram Feature
    • Advanced Usage: Custom Instructions
    • Dynamic AI Model Manager
  • Crypto.com On-Chain Developer Platform
    • Developer Platform API Methods
  • On-Chain Functions and Examples
    • AI Agent Chatbot
    • "Magic Link" Signer
  • Resources for Developers
Powered by GitBook
On this page

Was this helpful?

  1. Core Concepts Overview
  2. Blockchain Functions

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.

8.1 Get all tickers

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

  • Arguments

  • Example Query

    "Get all tickers"
  • Returns

    str: A formatted string containing information about all available tickers.
  • Example Response

    Here are some of the current tickers available:
    
    1. <example-pair>
       - Last Price: <example-price>
       - High: <example-high-price>
       - Low: <example-low-price>
       - Volume: <example-volume>
    2. <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!

Example Code

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",
    },
    blockchain_config={
         "chainId": "chain-id",
         "explorer-api-key": "your-api-key",
         "private-key": "your-private-key",
         "sso-wallet-url": "your-sso-wallet-url",
    },
)
response = agent.interact("Get all tickers")
print(response)

8.2 Get ticker by instrument

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

  • Arguments

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

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

    str: A formatted string containing the ticker information for the specified instrument.
  • Errors

    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!

Example Code

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",
    },
    blockchain_config={
         "chainId": "chain-id",
         "explorer-api-key": "your-api-key",
         "private-key": "your-private-key",
         "sso-wallet-url": "your-sso-wallet-url",
    },
)

response = agent.interact("What's the ticker information of <example-instrument>")
print(response)
PreviousDefi OperationsNextBuilt-in Telegram Feature

Last updated 2 days ago

Was this helpful?