package sdk import "context" type ContextInfo struct { Period any `json:"period"` Barpos any `json:"barpos"` TimeTickSize any `json:"time_tick_size"` Stockcode any `json:"stockcode"` DividendType any `json:"dividend_type"` Market any `json:"market"` DoBackTest any `json:"do_back_test"` Benchmark any `json:"benchmark"` Capital any `json:"capital"` Universe any `json:"universe"` } func (c *Client) ContextPeriod(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/period", "period") } func (c *Client) ContextBarpos(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/barpos", "barpos") } func (c *Client) ContextTimeTickSize(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/time_tick_size", "time_tick_size") } func (c *Client) ContextStockcode(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/stockcode", "stockcode") } func (c *Client) ContextDividendType(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/dividend_type", "dividend_type") } func (c *Client) ContextMarket(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/market", "market") } func (c *Client) ContextDoBackTest(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/do_back_test", "do_back_test") } func (c *Client) ContextBenchmark(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/benchmark", "benchmark") } func (c *Client) ContextCapital(ctx context.Context) (any, error) { return c.getField(ctx, "/api/context/capital", "capital") } func (c *Client) ContextUniverse(ctx context.Context) ([]string, error) { v, err := c.getField(ctx, "/api/context/universe", "universe") if err != nil { return nil, err } switch u := v.(type) { case nil: return nil, nil case []any: codes := make([]string, 0, len(u)) for _, item := range u { if s := asString(item); s != "" { codes = append(codes, s) } } return codes, nil case []string: return u, nil default: if s := asString(u); s != "" { return []string{s}, nil } return nil, nil } }