from typing import Any class MiscMixin: def context_period(self): return self._get_field("/api/context/period", "period") def context_barpos(self): return self._get_field("/api/context/barpos", "barpos") def context_time_tick_size(self): return self._get_field("/api/context/time_tick_size", "time_tick_size") def context_stockcode(self): return self._get_field("/api/context/stockcode", "stockcode") def context_dividend_type(self): return self._get_field("/api/context/dividend_type", "dividend_type") def context_market(self): return self._get_field("/api/context/market", "market") def context_do_back_test(self): return self._get_field("/api/context/do_back_test", "do_back_test") def context_benchmark(self): return self._get_field("/api/context/benchmark", "benchmark") def context_capital(self): return self._get_field("/api/context/capital", "capital") def context_universe(self): value = self._get_field("/api/context/universe", "universe") if value is None: return [] return [str(v) for v in value if str(v)] if isinstance(value, list) else [str(value)] def is_last_bar(self): return self._get_field("/api/check/is_last_bar", "is_last_bar") def is_new_bar(self): return self._get_field("/api/check/is_new_bar", "is_new_bar") def is_suspended_stock(self, stockcode): return self._post_field("/api/check/is_suspended_stock", {"stockcode": stockcode}, "is_suspended") def is_sector_stock(self, sectorname, market, stockcode): return self._post_field("/api/check/is_sector_stock", {"sectorname": sectorname, "market": market, "stockcode": stockcode}, "is_in_sector") def is_typed_stock(self, stocktypenum, market, stockcode): return self._post_field("/api/check/is_typed_stock", {"stocktypenum": stocktypenum, "market": market, "stockcode": stockcode}, "result") def industry_name_of_stock(self, industry_type, stockcode): return self._post_field("/api/check/get_industry_name_of_stock", {"industryType": industry_type, "stockcode": stockcode}, "industry_name") def ext_data(self, name, stockcode, deviation): return self._post_field("/api/ext/ext_data", {"extdataname": name, "stockcode": stockcode, "deviation": deviation}, "value") def ext_data_rank(self, name, stockcode, deviation): return self._post_field("/api/ext/ext_data_rank", {"extdataname": name, "stockcode": stockcode, "deviation": deviation}, "rank") def get_factor_value(self, name, stockcode, deviation): return self._post_field("/api/ext/get_factor_value", {"factorname": name, "stockcode": stockcode, "deviation": deviation}, "value") def get_factor_rank(self, name, stockcode, deviation): return self._post_field("/api/ext/get_factor_rank", {"factorname": name, "stockcode": stockcode, "deviation": deviation}, "rank") def python_version(self): return self._get("/api/sys/python_version") def shutdown(self): return self._post("/api/sys/shutdown", {})