diff --git a/openagent/executors/funding_rate_executor.py b/openagent/executors/funding_rate_executor.py index d37ab7bb..5968916f 100644 --- a/openagent/executors/funding_rate_executor.py +++ b/openagent/executors/funding_rate_executor.py @@ -13,7 +13,7 @@ class ARGS(BaseModel): exchange: str = Field(description="Name of the exchange (ccxt supported), e.g., 'binance'") - symbol: str = Field(description="Trading pair symbol, e.g., 'BTC/USDT:USDT'") + symbol: str = Field(description="Trading pair symbol, e.g., 'BTC/USDT'") class FundingRateExecutor(BaseTool): @@ -46,6 +46,8 @@ async def _arun( def fetch_funding_rate(exchange_name: str, symbol: str) -> float: try: + if not symbol.endswith(":USDT"): + symbol = f"{symbol}:USDT" exchange_class = getattr(ccxt, exchange_name) exchange = exchange_class() diff --git a/openagent/executors/price_executor.py b/openagent/executors/price_executor.py index ce713cc2..06d204c0 100644 --- a/openagent/executors/price_executor.py +++ b/openagent/executors/price_executor.py @@ -14,7 +14,7 @@ class ARGS(BaseModel): - token: str = Field(description="token symbol") + token: str = Field(description="token symbol, e.g., 'ETH', 'BTC'") class PriceExecutor(BaseTool): diff --git a/tests/agent_trajectory/market_analysis.py b/tests/agent_trajectory/market_analysis.py index b1c6f981..ffb021da 100644 --- a/tests/agent_trajectory/market_analysis.py +++ b/tests/agent_trajectory/market_analysis.py @@ -51,7 +51,7 @@ async def test_query_eth_price(market_analysis_agent): @pytest.mark.asyncio async def test_query_funding_rate(market_analysis_agent): events = market_analysis_agent.astream_events( - {"messages": [HumanMessage(content="What's the funding rate for BTC/USDT in binance?", name="human")]}, version="v1" + {"messages": [HumanMessage(content="What's the funding rate for BTC in binance?", name="human")]}, version="v1" ) tool_end_count = 0 @@ -76,7 +76,7 @@ async def test_query_nft_ranking(market_analysis_agent): async for event in events: if event["event"] == "on_tool_end": tool_end_count += 1 - # assert event["name"] == "NFTRankingExecutor" + assert event["name"] == "NFTRankingExecutor" assert tool_end_count > 0, "The on_tool_end event did not occur"