Refactor market package filenames for consistent data-dimension naming #26
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Chuẩn hóa tên file trong
internal/data/markettheo dimension dữ liệu để dễ đọc và nhất quán, tránh naming theo endpoint/lịch sử implementation.Problem
Hiện tại package market có naming lẫn lộn (
trading_pairs.go,future_price.go,spot_price.go,alpha_tokens.go), làm khó nhận biết trách nhiệm file khi đọc nhanh.Proposed Direction
Đổi naming về dạng nhất quán theo nhóm dữ liệu:
spot_pairs.gofutures_pairs.gospot_prices.gofutures_prices.goalpha_tokens.goNguyên tắc: nhìn tên file là biết ngay loại dữ liệu mà file quản lý.
Scope
Why separate issue/PR
Mình đã rà lại code hiện tại sau PR canonical maps.
Issue này vẫn hợp lý, nhưng nên chỉnh scope một chút:
trading_pairs.gohiện không chỉ là “trading pairs” nữa mà đang chứa cả:Vì vậy nếu chỉ rename file thì vẫn chưa sạch về mặt boundary. Đề nghị làm PR này theo hướng move-only / no behavior change:
Rename price files:
spot_price.go->spot_prices.gofuture_price.go->futures_prices.goSplit
trading_pairs.gotheo responsibility:spot_pairs.go:refreshSpotPairCache,IsSpotPair,GetSpotSymbolByTokenfutures_pairs.go:refreshFuturePairCache,IsFuturesPair,GetFutureSymbolByToken,futureCacheTokenKeypair_symbols.gohoặcsymbol_canonical.go: shared helpers nhưparseTokenFromSymbolByQuotePriority,selectCanonicalSymbolByQuotePrioritycache_refresh.go:refreshTradingPairCache,refreshAllCaches,cacheRefreshLoopClean up small dead-code item:
alphaCacheRefreshLooptrongmain.gohiện không còn được gọi sau khi cócacheRefreshLoop; nên remove trong cùng PR nếu vẫn giữ no-behavior-change.Acceptance:
go test ./...pass.Như vậy issue #26 vẫn là refactor naming/structure, nhưng tránh rename nửa vời khiến
trading_pairs.gotiếp tục là “god file” của market cache.