Skip to content

Commit 06cdecb

Browse files
committed
chore: add compound borrow symbol
1 parent 0769bea commit 06cdecb

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

openagent/tools/compound/market_analysis.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
@dataclass
1818
class CompoundMarketData:
1919
address: str
20+
symbol: str
2021
borrow_apr: float
2122
borrow_apr_change_24h: float
22-
chain_id: int
23+
chain: str
2324
supply_apr: float
2425
supply_apr_change_24h: float
2526

@@ -83,7 +84,7 @@ async def setup(self, config: CompoundMarketConfig) -> None:
8384
Analyze the market data and provide:
8485
- Must be concise with clear statements about APR changes
8586
- Include both supply and borrow APR changes
86-
- Include list of supported collateral assets
87+
- Include the symbol of the market, if the symbol is not available, use the address
8788
- Do not provide personal opinions or financial advice\
8889
"""
8990
),
@@ -175,12 +176,21 @@ async def fetch_historical_data(address: str, chain_id: int) -> dict:
175176
borrow_apr_change_24h = current_borrow_apr - yesterday_borrow_apr
176177
supply_apr_change_24h = current_supply_apr - yesterday_supply_apr
177178

179+
# Address to symbol mapping
180+
address_to_symbol = {
181+
"0xd98Be00b5D27fc98112BdE293e487f8D4cA57d07": "USDT",
182+
"0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA": "USDC.e",
183+
"0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf": "USDC",
184+
"0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486": "WETH",
185+
}
186+
178187
market_data.append(
179188
CompoundMarketData(
180189
address=market_address,
190+
symbol=address_to_symbol.get(market_address, ""),
181191
borrow_apr=current_borrow_apr,
182192
borrow_apr_change_24h=borrow_apr_change_24h,
183-
chain_id=market["chain_id"],
193+
chain_id=CHAIN_ID_TO_NETWORK.get(market["chain_id"]),
184194
supply_apr=current_supply_apr,
185195
supply_apr_change_24h=supply_apr_change_24h,
186196
)

0 commit comments

Comments
 (0)