refactor: standardize market filenames by data dimension
Split market pair logic into spot and futures files and rename price files to plural data-dimension names without changing behavior. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -54,3 +54,47 @@ func (ms *MarketData) alphaCacheRefreshLoop() {
|
||||
ms.refreshAlphaTokenCache()
|
||||
}
|
||||
}
|
||||
|
||||
func (ms *MarketData) refreshTradingPairCache() error {
|
||||
if err := ms.refreshSpotPairCache(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ms.refreshFuturePairCache(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ms.pairCacheMutex.RLock()
|
||||
spotCount := len(ms.spotPairs)
|
||||
futureCount := len(ms.futuresPairs)
|
||||
ms.pairCacheMutex.RUnlock()
|
||||
|
||||
log.Info().
|
||||
Int("spot", spotCount).
|
||||
Int("futures", futureCount).
|
||||
Msg("Trading pair cache refreshed")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms *MarketData) cacheRefreshLoop() {
|
||||
ms.refreshAllCaches()
|
||||
ticker := time.NewTicker(time.Hour)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
ms.refreshAllCaches()
|
||||
}
|
||||
}
|
||||
|
||||
func (ms *MarketData) refreshAllCaches() {
|
||||
if err := ms.refreshSpotPairCache(); err != nil {
|
||||
log.Error().Err(err).Msg("Failed spot pair refresh")
|
||||
}
|
||||
if err := ms.refreshFuturePairCache(); err != nil {
|
||||
log.Error().Err(err).Msg("Failed futures pair refresh")
|
||||
}
|
||||
ms.refreshAlphaTokenCache()
|
||||
}
|
||||
|
||||
func (ms *MarketData) RefreshTradingPairCache() error {
|
||||
return ms.refreshTradingPairCache()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user