Fix concurrent map read/write race condition in MarketData

Add sync.RWMutex to protect future and spot price maps accessed by
WebSocket handlers (writers) and Telegram bot handlers (readers).
Also adds Alpha token support with caching.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
thuanleandClaude Opus 4.7 committed 2026-04-25 00:15:22 +07:00
1 parent 248d3153e7
commit 440fa3bacd
9 files changed
+297 -31

No files matched your search

+6
View File
@@ -1,9 +1,15 @@
package data
import "me.thuanle/bbot/internal/data/market"
type IMarket interface {
GetFuturePrice(symbol string) (float64, float64, int64, bool)
GetAllFundRate() (map[string]float64, map[string]int64)
GetSpotPrice(symbol string) (float64, bool)
GetMarginInterestRates() map[string]float64
// Alpha token methods
IsAlphaToken(symbol string) bool
GetAlphaToken(symbol string) (market.AlphaTokenInfo, bool)
}