Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why tickstore cannot save the diferrent data for a symbol for many times? is there something I do wrong? #958

Open
tianjixuetu opened this issue Feb 23, 2022 · 1 comment

Comments

@tianjixuetu
Copy link

tianjixuetu commented Feb 23, 2022

Arctic Version

# Arctic version 1.80.4

Arctic Store

#TickStore

Platform and version

windows 10 64 python3.8

Description of problem and/or code sample that reproduces the issue

save tick data

count = 0
num = 0
symbol = "RM"
library_list = conn.list_libraries()
if symbol+"__tick" not in library_list:
    conn.initialize_library(symbol+"__tick",lib_type=TICK_STORE)
    print(symbol+"__tick","注册成功")
lib = conn[symbol+"__tick"]
for key in f.keys():
    if "RM911" in key:
        name = key
        df = pd.read_hdf("E:/hdf5_data/RM.hdf5", key=key)
        # df = pd.read_csv(new_data_path+file,encoding="gbk")
        df.index = df['交易日'].astype("str")+" "+df['最后修改时间'].astype("str")+"."+df['最后修改毫秒'].astype("str")
        df.index = pd.to_datetime(df.index)
        df.index = [i.replace(tzinfo=tzchina).astimezone(utc) for i in df.index]
        # print(df[['交易日','最后修改时间','最后修改毫秒']].head())
        # print(df.columns)
        num +=len(df)
        to_symbol = name.split("_")[0]
        lib.write(to_symbol, df)

read tick data

df_01 = lib.read('RM901')
df_03 = lib.read('RM903')

can I just save the data in one time for a same symbol? the data I read from the tickstore is just a small part of the tick data which I save into the tickstore?

@tianjixuetu
Copy link
Author

tianjixuetu commented Feb 25, 2022

I can get the data by add a param:date_range,for example
rb_1910 = lib.read("rb1910",date_range= DateRange('2019-01-01', '2021-12-31'))
however,when I use this code to get data ,the time is so long,is there something I go wrong?
%timeit rb_1910 = lib.read("rb1910",date_range= DateRange('2019-01-01', '2021-12-31'))
the output is below:

  zone = tzlocal.get_localzone().zone
C:\Anaconda3\lib\site-packages\arctic\tickstore\tickstore.py:419: FutureWarning: Conversion of the second argument of issubdtype from `int` to `np.signedinteger` is deprecated. In future, it will be treated as `np.int32 == np.dtype(int).type`.
  if np.issubdtype(dtype, int):
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
TimeSeries data is out of order, sorting!
1min 8s ± 949 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)```

the data is 6614866 rows × 44 columns


交易所代码 | 申卖量三 | 申买量二 | 最高价 | 上次结算价 | 申卖量五 | 最新价 | 申卖价二 | 最低价 | 昨持仓量 | ... | 申买量五 | 昨虚实度 | 最后修改时间 | 申买量四 | 成交金额 | 最后修改毫秒 | 申买价三 | 当日均价 | 申卖量四 | 申卖价四
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
NaN | 0.0 | 0.0 | 3177.0 | 3180.0 | 0.0 | 3177.0 | 0.0 | 3177.0 | 353312.0 | ... | 0.0 | 0.0 | 08:59:00 | 0.0 | 826020.0 | 500.0 | 0.0 | 31770.0000 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3177.0 | 3180.0 | 0.0 | 3177.0 | 0.0 | 3177.0 | 353312.0 | ... | 0.0 | 0.0 | 09:00:00 | 0.0 | 1080180.0 | 500.0 | 0.0 | 31770.0000 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3190.0 | 3180.0 | 0.0 | 3190.0 | 0.0 | 3177.0 | 353312.0 | ... | 0.0 | 0.0 | 09:00:01 | 0.0 | 3181180.0 | 0.0 | 0.0 | 31811.8000 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3190.0 | 3180.0 | 0.0 | 3178.0 | 0.0 | 3177.0 | 353312.0 | ... | 0.0 | 0.0 | 09:00:01 | 0.0 | 5598660.0 | 500.0 | 0.0 | 31810.5682 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3190.0 | 3180.0 | 0.0 | 3184.0 | 0.0 | 3177.0 | 353312.0 | ... | 0.0 | 0.0 | 09:00:02 | 0.0 | 5980680.0 | 0.0 | 0.0 | 31812.1277 | 0.0 | 0.0
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ...
NaN | 0.0 | 0.0 | 3630.0 | 3620.0 | 0.0 | 3630.0 | 0.0 | 3610.0 | 30360.0 | ... | 0.0 | 0.0 | 22:39:33 | 0.0 | 36947400.0 | 500.0 | 0.0 | 36222.9412 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3630.0 | 3620.0 | 0.0 | 3630.0 | 0.0 | 3610.0 | 30360.0 | ... | 0.0 | 0.0 | 22:43:27 | 0.0 | 36947400.0 | 500.0 | 0.0 | 36222.9412 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3630.0 | 3620.0 | 0.0 | 3630.0 | 0.0 | 3610.0 | 30360.0 | ... | 0.0 | 0.0 | 22:49:15 | 0.0 | 36947400.0 | 0.0 | 0.0 | 36222.9412 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3630.0 | 3620.0 | 0.0 | 3630.0 | 0.0 | 3610.0 | 30360.0 | ... | 0.0 | 0.0 | 22:57:49 | 0.0 | 36947400.0 | 500.0 | 0.0 | 36222.9412 | 0.0 | 0.0
NaN | 0.0 | 0.0 | 3630.0 | 3620.0 | 0.0 | 3630.0 | 0.0 | 3610.0 | 30360.0 | ... | 0.0 | 0.0 | 23:00:00 | 0.0 | 36947400.0 | 500.0 | 0.0 | 36222.9412 | 0.0 | 0.0


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant