gjdatac-api 0.2.4__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac_api
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: 数据接口打包
5
5
  Author: yin
6
6
  Author-email: 2018209921@qq.com
@@ -2952,7 +2952,6 @@ class GJDataC:
2952
2952
  # 转换日期格式
2953
2953
  # query_time = self._get_history_bar_parse_datetime(datetime_str)
2954
2954
 
2955
- # 1d ['v2505'] 2025.01.21 1
2956
2955
  # 执行查询并筛选数据
2957
2956
  result, bar_db_session = self._get_history_bar_execute_query(frequency, instrument_id, datetime_str,
2958
2957
  bar_count)
@@ -3055,7 +3054,6 @@ class GJDataC:
3055
3054
 
3056
3055
  # 获取表信息
3057
3056
  table_info = self._get_history_bar_get_table_info(frequency, instrument_id)
3058
- print(table_info)
3059
3057
 
3060
3058
  # 获取数据
3061
3059
  table_data, bar_db_session = self.connect_db(table_info[0], table_info[1])
@@ -3112,22 +3110,16 @@ class GJDataC:
3112
3110
  # dolphin_date = self._get_history_bar_datetime_to_dolphin_time(datetime_str)
3113
3111
  dolphin_date = datetime_str
3114
3112
 
3115
- # 使用 DolphinDB 的 where 子句筛选数据(这里因为实际需求的原因需要对每个instrument_id进行筛选,所以需要使用 contextby)
3116
- # 根据bar_count 分别对不同的instrument_id 进行筛选
3117
- # 此处的逻辑是,筛选出每个instrument_id距离给定日期最近的前bar_count条数据
3118
-
3119
3113
  if isinstance(instrument_id, str):
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}")
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))
3125
3118
  else:
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}")
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))
3131
3123
 
3132
3124
  # 根据日期对数据再次进行筛选,最大程度减轻数据库压力
3133
3125
  query_data = query_data.where(f"trade_time <= {dolphin_date}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac-api
3
- Version: 0.2.4
3
+ Version: 0.2.5
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.4', # 版本号
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