48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
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
|
|
}
|