gjdatac-api 0.2.2__tar.gz → 0.2.4__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac_api
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: 数据接口打包
5
5
  Author: yin
6
6
  Author-email: 2018209921@qq.com
@@ -2943,14 +2943,16 @@ 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
 
2951
2952
  # 转换日期格式
2952
2953
  # query_time = self._get_history_bar_parse_datetime(datetime_str)
2953
2954
 
2955
+ # 1d ['v2505'] 2025.01.21 1
2954
2956
  # 执行查询并筛选数据
2955
2957
  result, bar_db_session = self._get_history_bar_execute_query(frequency, instrument_id, datetime_str,
2956
2958
  bar_count)
@@ -2961,6 +2963,7 @@ class GJDataC:
2961
2963
  # 处理结果
2962
2964
  return self._get_history_bar_process_result(result, instrument_id, fields, bar_count)
2963
2965
  else:
2966
+ print("22222")
2964
2967
  return self.get_history_bar(instrument_id, start_date, end_date, frequency, fields)
2965
2968
 
2966
2969
  def _get_history_bar_validate_params(self, datetime_str, instrument_id, bar_count,
@@ -2987,8 +2990,8 @@ class GJDataC:
2987
2990
  self.general_validate_params_required(instrument_id, "instrument_id")
2988
2991
 
2989
2992
  # 验证K线数量
2990
- if not isinstance(bar_count, int) or bar_count <= 0:
2991
- raise ValueError("bar_count must be a positive integer")
2993
+ # if not isinstance(bar_count, int) or bar_count <= 0:
2994
+ # raise ValueError("bar_count must be a positive integer")
2992
2995
 
2993
2996
  # 验证频率
2994
2997
  if frequency not in ['1d', '1m']:
@@ -3052,6 +3055,7 @@ class GJDataC:
3052
3055
 
3053
3056
  # 获取表信息
3054
3057
  table_info = self._get_history_bar_get_table_info(frequency, instrument_id)
3058
+ print(table_info)
3055
3059
 
3056
3060
  # 获取数据
3057
3061
  table_data, bar_db_session = self.connect_db(table_info[0], table_info[1])
@@ -3111,12 +3115,19 @@ class GJDataC:
3111
3115
  # 使用 DolphinDB 的 where 子句筛选数据(这里因为实际需求的原因需要对每个instrument_id进行筛选,所以需要使用 contextby)
3112
3116
  # 根据bar_count 分别对不同的instrument_id 进行筛选
3113
3117
  # 此处的逻辑是,筛选出每个instrument_id距离给定日期最近的前bar_count条数据
3118
+
3114
3119
  if isinstance(instrument_id, str):
3115
- query_data = (table_data.where(f"instrument_id='{instrument_id}'").where(f"trade_time <= {dolphin_date}")
3116
- .contextby("instrument_id").sort("trade_time", ascending=True).limit(-bar_count))
3120
+ if bar_count != 0:
3121
+ query_data = (table_data.where(f"instrument_id='{instrument_id}'").where(f"trading_day <= {dolphin_date}")
3122
+ .contextby("instrument_id").sort("trading_day", ascending=True).limit(-bar_count))
3123
+ else:
3124
+ query_data = table_data.where(f"instrument_id='{instrument_id}'").where(f"trading_day = {dolphin_date}")
3117
3125
  else:
3118
- query_data = (table_data.where(f"instrument_id in {instrument_id}").where(f"trade_time <= {dolphin_date}")
3119
- .contextby("instrument_id").sort("trade_time", ascending=True).limit(-bar_count))
3126
+ if bar_count != 0:
3127
+ query_data = (table_data.where(f"instrument_id in {instrument_id}").where(f"trading_day <= {dolphin_date}")
3128
+ .contextby("instrument_id").sort("trading_day", ascending=True).limit(-bar_count))
3129
+ else:
3130
+ query_data = table_data.where(f"instrument_id in {instrument_id}").where(f"trading_day = {dolphin_date}")
3120
3131
 
3121
3132
  # 根据日期对数据再次进行筛选,最大程度减轻数据库压力
3122
3133
  query_data = query_data.where(f"trade_time <= {dolphin_date}")
@@ -148,4 +148,4 @@ subscribe_min_db_table_name = "QcMinKlineTable" # 表名
148
148
 
149
149
 
150
150
  ''' 仿真服务器 '''
151
- dolphindb_service = ["10.74.56.101:8902", "10.74.56.102:8902", "10.74.56.103:8902"]
151
+ dolphindb_service = ["10.74.56.101:8902", "10.74.56.102:8902", "10.74.56.103:8902", "10.74.56.104 8902"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac-api
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: 数据接口打包
5
5
  Author: yin
6
6
  Author-email: 2018209921@qq.com
@@ -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.2', # 版本号
8
+ version='0.2.4', # 版本号
9
9
  description='数据接口打包', # 包的简要描述
10
10
  long_description=long_description, # 包的详细描述
11
11
  long_description_content_type='text/markdown', # 描述文件的类型
File without changes