fix bug
This commit is contained in:
44
py-client/sdk/get.py
Normal file
44
py-client/sdk/get.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
class GetMixin:
|
||||
def stock_name(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("stock_name", stock_code)
|
||||
|
||||
def open_date(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("open_date", stock_code)
|
||||
|
||||
def last_volume(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("last_volume", stock_code)
|
||||
|
||||
def total_share(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("total_share", stock_code)
|
||||
|
||||
def svol(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("svol", stock_code)
|
||||
|
||||
def bvol(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("bvol", stock_code)
|
||||
|
||||
def divid_factors(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("divid_factors", stock_code)
|
||||
|
||||
def etf_info(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("etf_info", stock_code)
|
||||
|
||||
def etf_iopv(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("etf_iopv", stock_code)
|
||||
|
||||
def instrument_detail(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("instrumentdetail", stock_code)
|
||||
|
||||
def his_st_data(self, stock_code: str) -> Any:
|
||||
return self._stock_ref("his_st_data", stock_code)
|
||||
|
||||
def _stock_ref(self, endpoint: str, stock_code: str) -> Any:
|
||||
query = urlencode({"stock_code": stock_code})
|
||||
data = self._get_json(f"/api/get/{endpoint}?{query}") or {}
|
||||
return data.get("ref")
|
||||
Reference in New Issue
Block a user