dev 2
This commit is contained in:
@@ -3,65 +3,28 @@ 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
|
||||
return c.getField(ctx, "/api/check/is_last_bar", "is_last_bar")
|
||||
}
|
||||
|
||||
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
|
||||
return c.getField(ctx, "/api/check/is_new_bar", "is_new_bar")
|
||||
}
|
||||
|
||||
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
|
||||
return c.postField(ctx, "/api/check/is_suspended_stock", map[string]any{"stockcode": stockcode}, "is_suspended")
|
||||
}
|
||||
|
||||
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
|
||||
return c.postField(ctx, "/api/check/is_sector_stock", body, "is_in_sector")
|
||||
}
|
||||
|
||||
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
|
||||
return c.postField(ctx, "/api/check/is_typed_stock", body, "result")
|
||||
}
|
||||
|
||||
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
|
||||
return c.postField(ctx, "/api/check/get_industry_name_of_stock", body, "industry_name")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user