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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user