Files
tradingagents/tests/test_crypto_asset_mode.py
T
Yijia-Xiao 56bd98f690 refactor(cli): move the live view to cli/display.py and the prompts to cli/prompts.py
- display.py holds the message buffer, layout, status tables and report panels, the analyst wall-time tracker (CLI-only, from graph/analyst_execution) and the one Console
- utils.py is renamed prompts.py, which is what it holds; its analyst list is ANALYST_CHOICES, apart from display's ANALYST_ORDER
- get_initial_analyst_node, a one-line helper with one caller, is inlined
- the wall-time tracker tests sit with the other display tests, and tests import cli.prompts as prompts
2026-09-24 05:00:36 +00:00

57 lines
1.7 KiB
Python

import unittest
from cli.models import AnalystType, AssetType
from cli.prompts import detect_asset_type, filter_analysts_for_asset_type
from tradingagents.graph.propagation import Propagator
class CryptoAssetModeTests(unittest.TestCase):
def test_detects_crypto_pair_symbols(self):
self.assertEqual(detect_asset_type("BTC-USD"), AssetType.CRYPTO)
self.assertEqual(detect_asset_type("eth-usd"), AssetType.CRYPTO)
def test_defaults_non_crypto_symbols_to_stock(self):
self.assertEqual(detect_asset_type("AAPL"), AssetType.STOCK)
self.assertEqual(detect_asset_type("SPY"), AssetType.STOCK)
def test_filters_out_fundamentals_analyst_for_crypto(self):
analysts = [
AnalystType.MARKET,
AnalystType.SOCIAL,
AnalystType.NEWS,
AnalystType.FUNDAMENTALS,
]
self.assertEqual(
filter_analysts_for_asset_type(analysts, AssetType.CRYPTO),
[
AnalystType.MARKET,
AnalystType.SOCIAL,
AnalystType.NEWS,
],
)
def test_keeps_all_analysts_for_stock(self):
analysts = [
AnalystType.MARKET,
AnalystType.SOCIAL,
AnalystType.NEWS,
AnalystType.FUNDAMENTALS,
]
self.assertEqual(
filter_analysts_for_asset_type(analysts, AssetType.STOCK),
analysts,
)
def test_propagator_includes_asset_type_in_initial_state(self):
state = Propagator().create_initial_state(
"BTC-USD", "2026-04-18", asset_type=AssetType.CRYPTO.value
)
self.assertEqual(state["asset_type"], AssetType.CRYPTO.value)
if __name__ == "__main__":
unittest.main()