fix: map CoinGlass heatmap range bounds
Some checks failed
ci / build + vet + guard + race (push) Has been cancelled
Some checks failed
ci / build + vet + guard + race (push) Has been cancelled
This commit is contained in:
@@ -26,7 +26,7 @@ type CGEnvelope struct {
|
||||
// 真实响应的 plaintext 是 data 本体(例如 {"instrument":...,"liq":[...]})。
|
||||
// 为兼容早期 fixture,如 plaintext 仍带 success/code/data envelope,则先拆 data。
|
||||
// PR-1 阶段做最薄映射:data 整体进 RawGrid;
|
||||
// 若顶层有 minPrice/maxPrice/priceMin/priceMax 字段则抽出(容忍命名漂移)。
|
||||
// 若顶层有 rangeLow/rangeHigh/minPrice/maxPrice/priceMin/priceMax 字段则抽出(容忍命名漂移)。
|
||||
// 真实 schema 经 spike dump 后回填到 spec §5(mapper 同步加显式字段)。
|
||||
//
|
||||
// 数值边界(ADR-0004 D3):解 JSON number 默认 float64 是 transient,
|
||||
@@ -45,8 +45,8 @@ func MapLiqHeatMap(symbol string, interval string, ts int64, plaintext []byte) (
|
||||
|
||||
var probe map[string]json.RawMessage
|
||||
if err := json.Unmarshal(raw, &probe); err == nil {
|
||||
out.PriceMin = pickFloatField(probe, "priceMin", "minPrice", "min")
|
||||
out.PriceMax = pickFloatField(probe, "priceMax", "maxPrice", "max")
|
||||
out.PriceMin = pickFloatField(probe, "priceMin", "rangeLow", "minPrice", "min")
|
||||
out.PriceMax = pickFloatField(probe, "priceMax", "rangeHigh", "maxPrice", "max")
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestMapLiqHeatMap_FloatToString(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "real decrypted data object",
|
||||
plaintext: `{"instrument":{"exName":"Binance","instrumentId":"BTCUSDT"},"liq":[[1,2,3.4]],"priceMin":110234.5,"priceMax":118888.0}`,
|
||||
plaintext: `{"instrument":{"exName":"Binance","instrumentId":"BTCUSDT"},"liq":[[1,2,3.4]],"prices":[110000,111000],"rangeLow":110234.5,"rangeHigh":118888.0,"updateTime":1779717600600,"y":[]}`,
|
||||
wantSymbol: "Binance_BTCUSDT",
|
||||
wantMin: "110234.5",
|
||||
wantMax: "118888",
|
||||
|
||||
Reference in New Issue
Block a user