gjdatac-api 0.2.3__tar.gz → 0.2.5__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.
Potentially problematic release.
This version of gjdatac-api might be problematic. Click here for more details.
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/PKG-INFO +1 -1
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api/data_api_class.py +13 -10
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api.egg-info/PKG-INFO +1 -1
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/setup.py +1 -1
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api/__init__.py +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api/dict_data.py +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api/dolphindb_info.py +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api/instrument_class.py +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api.egg-info/SOURCES.txt +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api.egg-info/dependency_links.txt +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api.egg-info/requires.txt +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/gjdatac_api.egg-info/top_level.txt +0 -0
- {gjdatac_api-0.2.3 → gjdatac_api-0.2.5}/setup.cfg +0 -0
|
@@ -2943,8 +2943,9 @@ class GJDataC:
|
|
|
2943
2943
|
ValueError: 参数验证失败时抛出
|
|
2944
2944
|
"""
|
|
2945
2945
|
|
|
2946
|
+
|
|
2946
2947
|
''' 根据参数的不同,调用不同的函数 '''
|
|
2947
|
-
if datetime_str and bar_count:
|
|
2948
|
+
if datetime_str and bar_count is not None:
|
|
2948
2949
|
# 参数验证
|
|
2949
2950
|
self._get_history_bar_validate_params(datetime_str, instrument_id, bar_count, frequency, fields)
|
|
2950
2951
|
|
|
@@ -2961,6 +2962,7 @@ class GJDataC:
|
|
|
2961
2962
|
# 处理结果
|
|
2962
2963
|
return self._get_history_bar_process_result(result, instrument_id, fields, bar_count)
|
|
2963
2964
|
else:
|
|
2965
|
+
print("22222")
|
|
2964
2966
|
return self.get_history_bar(instrument_id, start_date, end_date, frequency, fields)
|
|
2965
2967
|
|
|
2966
2968
|
def _get_history_bar_validate_params(self, datetime_str, instrument_id, bar_count,
|
|
@@ -2987,8 +2989,8 @@ class GJDataC:
|
|
|
2987
2989
|
self.general_validate_params_required(instrument_id, "instrument_id")
|
|
2988
2990
|
|
|
2989
2991
|
# 验证K线数量
|
|
2990
|
-
if not isinstance(bar_count, int) or bar_count <= 0:
|
|
2991
|
-
|
|
2992
|
+
# if not isinstance(bar_count, int) or bar_count <= 0:
|
|
2993
|
+
# raise ValueError("bar_count must be a positive integer")
|
|
2992
2994
|
|
|
2993
2995
|
# 验证频率
|
|
2994
2996
|
if frequency not in ['1d', '1m']:
|
|
@@ -3108,15 +3110,16 @@ class GJDataC:
|
|
|
3108
3110
|
# dolphin_date = self._get_history_bar_datetime_to_dolphin_time(datetime_str)
|
|
3109
3111
|
dolphin_date = datetime_str
|
|
3110
3112
|
|
|
3111
|
-
# 使用 DolphinDB 的 where 子句筛选数据(这里因为实际需求的原因需要对每个instrument_id进行筛选,所以需要使用 contextby)
|
|
3112
|
-
# 根据bar_count 分别对不同的instrument_id 进行筛选
|
|
3113
|
-
# 此处的逻辑是,筛选出每个instrument_id距离给定日期最近的前bar_count条数据
|
|
3114
3113
|
if isinstance(instrument_id, str):
|
|
3115
|
-
query_data = (table_data.where(f"instrument_id='{instrument_id}'")
|
|
3116
|
-
.
|
|
3114
|
+
query_data = (table_data.where(f"instrument_id='{instrument_id}'")
|
|
3115
|
+
.where(f"trading_day <= {dolphin_date}")
|
|
3116
|
+
.sort("trading_day", ascending=False)
|
|
3117
|
+
.limit(bar_count))
|
|
3117
3118
|
else:
|
|
3118
|
-
query_data = (table_data.where(f"instrument_id in {instrument_id}")
|
|
3119
|
-
.
|
|
3119
|
+
query_data = (table_data.where(f"instrument_id in {instrument_id}")
|
|
3120
|
+
.where(f"trading_day <= {dolphin_date}")
|
|
3121
|
+
.sort("trading_day", ascending=False)
|
|
3122
|
+
.limit(bar_count))
|
|
3120
3123
|
|
|
3121
3124
|
# 根据日期对数据再次进行筛选,最大程度减轻数据库压力
|
|
3122
3125
|
query_data = query_data.where(f"trade_time <= {dolphin_date}")
|
|
@@ -5,7 +5,7 @@ with open('description_info.md', 'r', encoding='utf-8') as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name='gjdatac_api', # 你的包名
|
|
8
|
-
version='0.2.
|
|
8
|
+
version='0.2.5', # 版本号
|
|
9
9
|
description='数据接口打包', # 包的简要描述
|
|
10
10
|
long_description=long_description, # 包的详细描述
|
|
11
11
|
long_description_content_type='text/markdown', # 描述文件的类型
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|