gitee.com/quant1x/engine@v1.8.4/factors/feature_misc_test.go (about)

     1  package factors
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  	"gitee.com/quant1x/engine/cache"
     7  	"gitee.com/quant1x/exchange"
     8  	"gitee.com/quant1x/gox/api"
     9  	"testing"
    10  )
    11  
    12  func TestFeatureMisc(t *testing.T) {
    13  	code := "sh880652"
    14  	code = "sz300904"
    15  	code = "sh603038"
    16  	code = "sh600178"
    17  	code = "sz300261"
    18  	date := "2024-03-27"
    19  	cacheDate, featureDate := cache.CorrectDate(date)
    20  	misc := NewMisc(code, date)
    21  	misc.Update(code, cacheDate, featureDate, false)
    22  	fmt.Println(misc.Shape & KLineShapeDoji)
    23  	data, _ := json.Marshal(misc)
    24  	text := api.Bytes2String(data)
    25  	fmt.Println(text)
    26  }
    27  
    28  func TestMisc_MarginTradingTargets(t *testing.T) {
    29  	date := cache.DefaultCanReadDate()
    30  	MarginTradingTargetInit(date)
    31  	code := "000099"
    32  	v, ok := GetMarginTradingTarget(code)
    33  	fmt.Println(v, ok)
    34  }
    35  
    36  func TestMisc_AuctionWeaknessToStrength(t *testing.T) {
    37  	date := cache.DefaultCanReadDate()
    38  	code := "300107"
    39  	code = "603679"
    40  	date = "2024-04-19"
    41  	code = exchange.CorrectSecurityCode(code)
    42  	misc := GetL5Misc(code, date)
    43  	v := misc.AuctionWeaknessToStrength()
    44  	fmt.Println(v)
    45  }
    46  
    47  func TestMisc_AuctionStrengthToWeakness(t *testing.T) {
    48  	date := cache.DefaultCanReadDate()
    49  	code := "000612"
    50  	//code = "000099"
    51  	date = "2024-04-19"
    52  	code = exchange.CorrectSecurityCode(code)
    53  	misc := GetL5Misc(code, date)
    54  	v := misc.AuctionStrengthToWeakness()
    55  	fmt.Println(v)
    56  }