|
17 | 17 | @dataclass |
18 | 18 | class CompoundMarketData: |
19 | 19 | address: str |
| 20 | + symbol: str |
20 | 21 | borrow_apr: float |
21 | 22 | borrow_apr_change_24h: float |
22 | | - chain_id: int |
| 23 | + chain: str |
23 | 24 | supply_apr: float |
24 | 25 | supply_apr_change_24h: float |
25 | 26 |
|
@@ -83,7 +84,7 @@ async def setup(self, config: CompoundMarketConfig) -> None: |
83 | 84 | Analyze the market data and provide: |
84 | 85 | - Must be concise with clear statements about APR changes |
85 | 86 | - 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 |
87 | 88 | - Do not provide personal opinions or financial advice\ |
88 | 89 | """ |
89 | 90 | ), |
@@ -175,12 +176,21 @@ async def fetch_historical_data(address: str, chain_id: int) -> dict: |
175 | 176 | borrow_apr_change_24h = current_borrow_apr - yesterday_borrow_apr |
176 | 177 | supply_apr_change_24h = current_supply_apr - yesterday_supply_apr |
177 | 178 |
|
| 179 | + # Address to symbol mapping |
| 180 | + address_to_symbol = { |
| 181 | + "0xd98Be00b5D27fc98112BdE293e487f8D4cA57d07": "USDT", |
| 182 | + "0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA": "USDC.e", |
| 183 | + "0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf": "USDC", |
| 184 | + "0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486": "WETH", |
| 185 | + } |
| 186 | + |
178 | 187 | market_data.append( |
179 | 188 | CompoundMarketData( |
180 | 189 | address=market_address, |
| 190 | + symbol=address_to_symbol.get(market_address, ""), |
181 | 191 | borrow_apr=current_borrow_apr, |
182 | 192 | 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"]), |
184 | 194 | supply_apr=current_supply_apr, |
185 | 195 | supply_apr_change_24h=supply_apr_change_24h, |
186 | 196 | ) |
|
0 commit comments