1414# We ignore token holdings with a total value of less than $1
1515MIN_TOKEN_HOLDING_VALUE_USD = 1
1616
17+ # Start filtering out holdings based on MIN_TOKEN_HOLDING_VALUE_USD after this many holdings
18+ NUM_HOLDINGS_CUTOFF = 10
19+
1720
1821def get_investor_agent_prompt (
1922 tokens : List [WalletTokenHolding ],
@@ -28,7 +31,11 @@ def get_investor_agent_prompt(
2831 "amount" : token .amount ,
2932 }
3033 for token in tokens
31- if token .total_value_usd is not None and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
34+ if len (tokens ) <= NUM_HOLDINGS_CUTOFF
35+ or (
36+ token .total_value_usd is not None
37+ and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
38+ )
3239 ]
3340
3441 agent_prompt = investor_agent_template .render (
@@ -52,7 +59,11 @@ def get_suggestions_prompt(
5259 "amount" : token .amount ,
5360 }
5461 for token in tokens
55- if token .total_value_usd is not None and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
62+ if len (tokens ) <= NUM_HOLDINGS_CUTOFF
63+ or (
64+ token .total_value_usd is not None
65+ and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
66+ )
5667 ]
5768
5869 agent_prompt = suggestions_template .render (
@@ -77,7 +88,11 @@ def get_analytics_prompt(
7788 "amount" : token .amount ,
7889 }
7990 for token in tokens
80- if token .total_value_usd is not None and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
91+ if len (tokens ) <= NUM_HOLDINGS_CUTOFF
92+ or (
93+ token .total_value_usd is not None
94+ and token .total_value_usd > MIN_TOKEN_HOLDING_VALUE_USD
95+ )
8196 ]
8297
8398 analytics_agent_prompt = analytics_agent_template .render (
0 commit comments