gitee.com/quant1x/engine@v1.8.4/trader/fee_test.go (about) 1 package trader 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestFundAllocate(t *testing.T) { 9 traderParameter.ResetPositionRatio() 10 fmt.Println(traderParameter) 11 } 12 13 func TestEvaluateFeeForBuy(t *testing.T) { 14 code := "sh600178" 15 price := 8.17 16 17 v := EvaluateFeeForBuy(code, traderParameter.BuyAmountMax, price) 18 fmt.Println(v) 19 v.log() 20 } 21 22 func TestEvaluateFeeForSell(t *testing.T) { 23 code := "sh600178" 24 price := 15.24 25 volume := 5000 26 27 v := EvaluateFeeForSell(code, price, volume) 28 fmt.Println(v) 29 v.log() 30 } 31 32 func TestEvaluatePriceForSell(t *testing.T) { 33 fixedYield := 0.03 34 code := "sh600178" 35 price := 15.24 36 volume := 5000 37 baseAmount := price * float64(volume) 38 fmt.Println(baseAmount) 39 v := EvaluatePriceForSell(code, price, volume, fixedYield) 40 fmt.Println(v, v.MarketValue/baseAmount >= (1+fixedYield)) 41 v.log() 42 }