gjdatac-api 0.2.8__tar.gz → 0.2.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac_api
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: 数据接口打包
5
5
  Author: yin
6
6
  Author-email: 2018209921@qq.com
@@ -10,7 +10,7 @@ import chinese_calendar as calendar
10
10
  import pandas as pd
11
11
  import dolphindb as ddb
12
12
 
13
- from dict_data import (get_price_frequency_dict, get_price_data_type_dict, get_instruments_type_dict,
13
+ from .dict_data import (get_price_frequency_dict, get_price_data_type_dict, get_instruments_type_dict,
14
14
  future_delivery_fee_return_fields, future_delivery_fee_return_fields_rename,
15
15
  future_margin_ratio_return_fields, future_margin_ratio_return_fields_rename,
16
16
  future_limit_position_return_fields, future_limit_position_return_fields_rename,
@@ -18,8 +18,8 @@ from dict_data import (get_price_frequency_dict, get_price_data_type_dict, get_i
18
18
  tick_main_contract_return_fields, tick_main_contract_return_fields_rename,
19
19
  gtja_mink_main_contract_return_fields, gtja_mink_main_contract_return_fields_rename
20
20
  )
21
- from dolphindb_info import *
22
- from instrument_class import Instrument
21
+ from .dolphindb_info import *
22
+ from .instrument_class import Instrument
23
23
 
24
24
 
25
25
  class GJDataC:
@@ -3845,8 +3845,7 @@ class GJDataC:
3845
3845
 
3846
3846
  return trading_dates
3847
3847
 
3848
- @staticmethod
3849
- def get_trading_days(trading_dates, trade_time, date_count):
3848
+ def get_trading_days(self, trading_dates, trade_time, date_count):
3850
3849
  """
3851
3850
  查询前后 N 个交易日
3852
3851
  :param trading_dates: 交易日历数据
@@ -3862,10 +3861,13 @@ class GJDataC:
3862
3861
  # 向前查询
3863
3862
  filtered_dates = trading_dates[trading_dates['trading_day'] < trade_time]
3864
3863
  result = filtered_dates['trading_day'].sort_values(ascending=False).head(abs(date_count))
3865
- else:
3864
+ elif date_count > 0:
3866
3865
  # 向后查询
3867
3866
  filtered_dates = trading_dates[trading_dates['trading_day'] > trade_time]
3868
3867
  result = filtered_dates['trading_day'].sort_values().head(date_count)
3868
+ else:
3869
+ filtered_dates = trading_dates[trading_dates['trading_day'] == trade_time]
3870
+ result = filtered_dates['trading_day']
3869
3871
 
3870
3872
  # 将结果转换为指定格式的字符串列表
3871
3873
  fina_result = sorted(result.dt.strftime('%Y.%m.%d').tolist())
@@ -3908,9 +3910,11 @@ class GJDataC:
3908
3910
  if date_count < 0:
3909
3911
  # 向前查询
3910
3912
  result = [p for p in valid_time_points if pd.to_datetime(p) < trade_time][-abs(date_count):]
3911
- else:
3913
+ elif date_count > 0:
3912
3914
  # 向后查询
3913
3915
  result = [p for p in valid_time_points if pd.to_datetime(p) > trade_time][:date_count]
3916
+ else:
3917
+ result = [p for p in valid_time_points if pd.to_datetime(p) == trade_time]
3914
3918
 
3915
3919
  # return sorted(result) if len(result) > 1 else result[0]
3916
3920
  return sorted(result) if len(result) > 1 else result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gjdatac-api
3
- Version: 0.2.8
3
+ Version: 0.2.9
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.8', # 版本号
8
+ version='0.2.9', # 版本号
9
9
  description='数据接口打包', # 包的简要描述
10
10
  long_description=long_description, # 包的详细描述
11
11
  long_description_content_type='text/markdown', # 描述文件的类型
File without changes