p123api 2.2.0__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {p123api-2.2.0 → p123api-2.3.0}/PKG-INFO +1 -1
- {p123api-2.2.0 → p123api-2.3.0}/p123api/client.py +20 -1
- {p123api-2.2.0 → p123api-2.3.0}/p123api.egg-info/PKG-INFO +1 -1
- {p123api-2.2.0 → p123api-2.3.0}/setup.py +1 -1
- {p123api-2.2.0 → p123api-2.3.0}/LICENSE +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/README.md +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/p123api/__init__.py +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/p123api.egg-info/SOURCES.txt +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/p123api.egg-info/dependency_links.txt +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/p123api.egg-info/requires.txt +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/p123api.egg-info/top_level.txt +0 -0
- {p123api-2.2.0 → p123api-2.3.0}/setup.cfg +0 -0
|
@@ -3,7 +3,7 @@ import requests
|
|
|
3
3
|
import time
|
|
4
4
|
import pandas
|
|
5
5
|
from string import Template
|
|
6
|
-
from typing import IO, Callable, List, Literal, Optional, Union
|
|
6
|
+
from typing import IO, Any, Callable, List, Literal, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
ENDPOINT = "https://api.portfolio123.com"
|
|
@@ -32,6 +32,7 @@ STOCK_FACTOR_UPLOAD_PATH = Template("/stockFactor/upload/$id")
|
|
|
32
32
|
STOCK_FACTOR_CREATE_UPDATE_PATH = "/stockFactor"
|
|
33
33
|
STOCK_FACTOR_DOWNLOAD_PATH = Template("/stockFactor/$id")
|
|
34
34
|
STOCK_FACTOR_DELETE_PATH = STOCK_FACTOR_DOWNLOAD_PATH
|
|
35
|
+
STOCK_FACTOR_INFO_PATH = STOCK_FACTOR_CREATE_UPDATE_PATH
|
|
35
36
|
DATA_SERIES_UPLOAD_PATH = Template("/dataSeries/upload/$id")
|
|
36
37
|
DATA_SERIES_CREATE_UPDATE_PATH = "/dataSeries"
|
|
37
38
|
DATA_SERIES_DELETE_PATH = Template("/dataSeries/$id")
|
|
@@ -943,6 +944,24 @@ class Client:
|
|
|
943
944
|
params=get_params
|
|
944
945
|
).json()
|
|
945
946
|
return pandas.DataFrame(ret["prices"]) if to_pandas else ret
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
@overload
|
|
950
|
+
def stock_factor_info(self, *, factor_id: int) -> Any:
|
|
951
|
+
...
|
|
952
|
+
@overload
|
|
953
|
+
def stock_factor_info(self, *, name: str) -> Any:
|
|
954
|
+
...
|
|
955
|
+
def stock_factor_info(self, *, factor_id: Optional[int] = None, name: Optional[str] = None):
|
|
956
|
+
"""
|
|
957
|
+
Stock factor info, only specify factor_id or name
|
|
958
|
+
"""
|
|
959
|
+
return self._req_with_auth_fallback(
|
|
960
|
+
name="stock factor info",
|
|
961
|
+
method="GET",
|
|
962
|
+
url=self._endpoint + STOCK_FACTOR_INFO_PATH,
|
|
963
|
+
params={"name": name} if factor_id is None else {"id": factor_id}
|
|
964
|
+
).json()
|
|
946
965
|
|
|
947
966
|
|
|
948
967
|
def req_with_retry(req: Callable[..., requests.Response], max_tries=None, **kwargs):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|