Skip to content

Commit 544ddd8

Browse files
committed
chore: refactors data parsing and response formatting
1 parent 3810e24 commit 544ddd8

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

openagent/tools/pendle/data_tracker.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,43 +119,15 @@ async def __call__(self) -> str:
119119
self.session.add(stats)
120120
self.session.commit()
121121

122-
# Calculate volume change
123-
volume_change = "up" if volume_today > volume_prev else "down"
124-
volume_change_pct = (
125-
((volume_today - volume_prev) / volume_prev * 100)
126-
if volume_prev > 0
127-
else 0
128-
)
129-
130-
# Format TVL change direction
131-
tvl_direction = (
132-
"up"
133-
if tvl_change_percent > 0
134-
else "down"
135-
if tvl_change_percent < 0
136-
else "flat"
137-
)
138-
139-
# Format response with explicit guidance for the AI
122+
# Format response with basic statistics only
140123
formatted_response = f"""
141124
=== Pendle Data Statistics ===
142125
Latest TVL: {data["Latest TVL"]}
143-
TVL 24h Change: {data["TVL 24h Change"]} (Direction: {tvl_direction})
126+
TVL 24h Change: {data["TVL 24h Change"]}
144127
Total 7d Volume: {data["Total 7d Volume"]}
145128
Today's Volume: {data["Today's Volume"]}
146129
Previous Day's Volume: {data["Previous Day's Volume"]}
147-
Volume Change: {volume_change} {abs(volume_change_pct):.2f}%
148130
Statistics time: {datetime.now().strftime("%Y-%m-%d %H:%M")}
149-
150-
FORMATTED DATA FOR TWEET:
151-
- TVL: ${tvl_value / 1e9:.2f}B ({tvl_direction} {abs(tvl_change_percent):.2f}%)
152-
- Today's Volume: ${volume_today / 1e6:.2f}M ({volume_change} {abs(volume_change_pct):.2f}% from yesterday)
153-
- 7-Day Volume: ${volume_7d / 1e9:.2f}B
154-
155-
EXAMPLE TWEET FORMAT:
156-
pendle tvl at ${tvl_value / 1e9:.2f}B, {tvl_direction} {abs(tvl_change_percent):.2f}%
157-
daily volume ${volume_today / 1e6:.2f}M, {volume_change} {abs(volume_change_pct):.2f}% from yesterday
158-
yield farmers [your sarcastic comment here]
159131
"""
160132

161133
logger.info(f"{self.name} tool response: {formatted_response.strip()}.")

0 commit comments

Comments
 (0)