Skip to content

Commit ca32672

Browse files
committed
fix
1 parent 286d8a8 commit ca32672

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎internal/polymarket/trades.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"net/http"
99
"strconv"
10+
"strings"
1011
"sync"
1112
"time"
1213

@@ -40,6 +41,8 @@ type WalletStats struct {
4041
// GetTradeCount returns the number of trades ever made by the wallet.
4142
// Returns 999 on any error (worker skips such wallets to avoid false positives).
4243
func GetTradeCount(ctx context.Context, client *http.Client, wallet string) int {
44+
// Normalize wallet address to lowercase for consistent API calls and caching
45+
wallet = strings.ToLower(wallet)
4346
cacheKey := "trades:" + wallet
4447
if val, ok := cache.GetString(ctx, cacheKey); ok {
4548
count, err := strconv.Atoi(val)
@@ -73,6 +76,8 @@ func GetTradeCount(ctx context.Context, client *http.Client, wallet string) int
7376
// GetWalletStats fetches enriched stats for display.
7477
// Cached 15 minutes per wallet. P&L and closed-positions are fetched in parallel.
7578
func GetWalletStats(ctx context.Context, client *http.Client, wallet string) *WalletStats {
79+
// Normalize wallet address to lowercase for consistent API calls and caching
80+
wallet = strings.ToLower(wallet)
7681
cacheKey := "wstats:" + wallet
7782
var cached WalletStats
7883
if cache.GetJSON(ctx, cacheKey, &cached) {

0 commit comments

Comments
 (0)