dev 1
This commit is contained in:
47
go-client/sdk/ext.go
Normal file
47
go-client/sdk/ext.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package sdk
|
||||
|
||||
import "context"
|
||||
|
||||
func (c *Client) ExtData(ctx context.Context, extdataname, stockcode string, deviation int) (any, error) {
|
||||
var out struct {
|
||||
Value any `json:"value"`
|
||||
}
|
||||
body := map[string]any{"extdataname": extdataname, "stockcode": stockcode, "deviation": deviation}
|
||||
if err := c.post(ctx, "/api/ext/ext_data", body, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out.Value, nil
|
||||
}
|
||||
|
||||
func (c *Client) ExtDataRank(ctx context.Context, extdataname, stockcode string, deviation int) (any, error) {
|
||||
var out struct {
|
||||
Rank any `json:"rank"`
|
||||
}
|
||||
body := map[string]any{"extdataname": extdataname, "stockcode": stockcode, "deviation": deviation}
|
||||
if err := c.post(ctx, "/api/ext/ext_data_rank", body, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out.Rank, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetFactorValue(ctx context.Context, factorname, stockcode string, deviation int) (any, error) {
|
||||
var out struct {
|
||||
Value any `json:"value"`
|
||||
}
|
||||
body := map[string]any{"factorname": factorname, "stockcode": stockcode, "deviation": deviation}
|
||||
if err := c.post(ctx, "/api/ext/get_factor_value", body, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out.Value, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetFactorRank(ctx context.Context, factorname, stockcode string, deviation int) (any, error) {
|
||||
var out struct {
|
||||
Rank any `json:"rank"`
|
||||
}
|
||||
body := map[string]any{"factorname": factorname, "stockcode": stockcode, "deviation": deviation}
|
||||
if err := c.post(ctx, "/api/ext/get_factor_rank", body, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out.Rank, nil
|
||||
}
|
||||
Reference in New Issue
Block a user