优化: 共用一次 store.GetAll() 快照,消除每 tick 两次 map 分配

This commit is contained in:
jackyu66git
2026-05-04 06:10:37 +08:00
parent 5aedcb6566
commit 2f4d03f9b1
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -208,12 +208,11 @@ func netProfit(buyPrice, sellPrice, buyFee, sellFee float64) float64 {
// ScanBGHL scans coins for arbitrage ONLY between Bitget and HyperLiquid (P3-1).
// Returns both directions (BG->HL and HL->BG) sorted by net profit descending.
func ScanBGHL(store *PriceStore) []*ArbOpportunity {
snapshot := store.GetAll()
func ScanBGHL(snap map[string]map[string]float64) []*ArbOpportunity {
var results []*ArbOpportunity
for _, coin := range TrackedCoins {
exMap := snapshot[coin.Name]
exMap := snap[coin.Name]
if exMap == nil {
continue
}