Files
big-qmt/go-client/sdk/check.go
2026-08-25 16:40:18 +08:00

68 lines
2.0 KiB
Go

package sdk
import "context"
func (c *Client) IsLastBar(ctx context.Context) (any, error) {
var out struct {
IsLastBar any `json:"is_last_bar"`
}
if err := c.get(ctx, "/api/check/is_last_bar", &out); err != nil {
return nil, err
}
return out.IsLastBar, nil
}
func (c *Client) IsNewBar(ctx context.Context) (any, error) {
var out struct {
IsNewBar any `json:"is_new_bar"`
}
if err := c.get(ctx, "/api/check/is_new_bar", &out); err != nil {
return nil, err
}
return out.IsNewBar, nil
}
func (c *Client) IsSuspendedStock(ctx context.Context, stockcode string) (any, error) {
var out struct {
Stockcode string `json:"stockcode"`
IsSuspended any `json:"is_suspended"`
}
if err := c.post(ctx, "/api/check/is_suspended_stock", map[string]any{"stockcode": stockcode}, &out); err != nil {
return nil, err
}
return out.IsSuspended, nil
}
func (c *Client) IsSectorStock(ctx context.Context, sectorname, market, stockcode string) (any, error) {
var out struct {
IsInSector any `json:"is_in_sector"`
}
body := map[string]any{"sectorname": sectorname, "market": market, "stockcode": stockcode}
if err := c.post(ctx, "/api/check/is_sector_stock", body, &out); err != nil {
return nil, err
}
return out.IsInSector, nil
}
func (c *Client) IsTypedStock(ctx context.Context, stocktypenum int, market, stockcode string) (any, error) {
var out struct {
Result any `json:"result"`
}
body := map[string]any{"stocktypenum": stocktypenum, "market": market, "stockcode": stockcode}
if err := c.post(ctx, "/api/check/is_typed_stock", body, &out); err != nil {
return nil, err
}
return out.Result, nil
}
func (c *Client) IndustryNameOfStock(ctx context.Context, industryType, stockcode string) (any, error) {
var out struct {
IndustryName any `json:"industry_name"`
}
body := map[string]any{"industryType": industryType, "stockcode": stockcode}
if err := c.post(ctx, "/api/check/get_industry_name_of_stock", body, &out); err != nil {
return nil, err
}
return out.IndustryName, nil
}