fix(listing): 主站加速出售买家价不再误锚到参考比例
分站解耦只应改分站收号侧;主站加速出售仍跟卖家比例联动买家价,并同步分销后台列表与发布页文案。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,8 +83,14 @@ func applyMainSiteReceivePricing(req *CreateRequest, options systemconfig.Publis
|
||||
consumablePrice := consumableValue(req.AssetSummary)
|
||||
sellerTotalPrice := roundMoney(sellerCoinBasePrice + consumablePrice)
|
||||
dailyLoss := readSummaryNumber(req.AssetSummary["daily_loss_m"])
|
||||
// 买家价始终按主站口径推导:分站只改收号侧,卖价与主站同基准(压价差进入三方分成池)。
|
||||
pricing := calculateExternalPlatformPricing(coinM, referenceRatio, referenceSellerCoinBasePrice(coinWan, referenceRatio), consumablePrice, config)
|
||||
// 主站买家价仍跟 sellerRatio(含加速出售);分站买家价锚定 R,压价差进入三方分成池。
|
||||
buyerAnchorRatio := sellerRatio
|
||||
buyerAnchorCoinBase := sellerCoinBasePrice
|
||||
if onDistributionSite {
|
||||
buyerAnchorRatio = referenceRatio
|
||||
buyerAnchorCoinBase = referenceSellerCoinBasePrice(coinWan, referenceRatio)
|
||||
}
|
||||
pricing := calculateExternalPlatformPricing(coinM, buyerAnchorRatio, buyerAnchorCoinBase, consumablePrice, config)
|
||||
breakdown["seller_reference_ratio"] = referenceRatio
|
||||
breakdown["seller_ratio"] = sellerRatio
|
||||
breakdown["seller_coin_base_price"] = sellerCoinBasePrice
|
||||
|
||||
@@ -69,6 +69,16 @@ func TestApplyMainSiteReceivePricingKeepsAcceleratedRatioWithinMainSiteRange(t *
|
||||
if readSummaryNumber(breakdown["seller_reference_ratio"]) != 43 {
|
||||
t.Fatalf("seller_reference_ratio = %v, want 43", breakdown["seller_reference_ratio"])
|
||||
}
|
||||
if got := readSummaryNumber(breakdown["seller_coin_base_price"]); got != 200 {
|
||||
t.Fatalf("accelerated seller_coin_base_price = %v, want 200", got)
|
||||
}
|
||||
// 主站加速出售买卖仍联动:买家比例 = 50 − 5 = 45,不能被误锚到参考比例 38。
|
||||
if readSummaryNumber(breakdown["buyer_ratio"]) != 45 {
|
||||
t.Fatalf("accelerated buyer_ratio = %v, want 45 (follows seller ratio, not reference 38)", breakdown["buyer_ratio"])
|
||||
}
|
||||
if req.PriceCent != 22220 {
|
||||
t.Fatalf("accelerated PriceCent = %d, want 22220", req.PriceCent)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistributionReceiveCostDeltaZeroKeepsMainSitePrice(t *testing.T) {
|
||||
|
||||
@@ -1172,6 +1172,9 @@ func TestCreateDistributionListingAppliesSiteReceiveCostDelta(t *testing.T) {
|
||||
if pricing.SellerRatio != 46 {
|
||||
t.Fatalf("seller_ratio = %v, want 46 after site cost delta 3 (R=43+3) under decoupled model", pricing.SellerRatio)
|
||||
}
|
||||
if dto.PriceCent != 26320 {
|
||||
t.Fatalf("listing PriceCent = %d, want 26320 (buyer price stays anchored to main-site R)", dto.PriceCent)
|
||||
}
|
||||
}
|
||||
|
||||
func mustMarshalSummary(t *testing.T, summary map[string]any) []byte {
|
||||
|
||||
Reference in New Issue
Block a user