问答交流

数据报错——stockData

由user02创建,最终由small_q 被浏览 25 用户

from bigdatasource.api import DataSource
from bigdata.api.datareader import D
from biglearning.api import M
from biglearning.api import tools as T
from biglearning.module2.common.data import Outputs
 
import pandas as pd
import numpy as np
import math
import warnings
import datetime
 
from zipline.finance.commission import PerOrder
from zipline.api import get_open_orders
from zipline.api import symbol
#  import sys

# !{sys.executable} -m pip install akshare==0.6.8
# !{sys.executable} -m pip install backtrader==1.9.76.123

# import akshare as ak
# import backtrader as bt

# 继续编写你的代码...
from bigtrader.sdk import *
from bigtrader.utils.my_collections import NumPyDeque
from bigtrader.constant import OrderType
from bigtrader.constant import Direction

m3 = M.input_features.v1(
    features="""open_0
close_0
high_0
low_0"""
)

m9 = M.instruments.v2(
    start_date=T.live_run_param('trading_date', '2021-01-01'),
    end_date=T.live_run_param('trading_date', '2021-12-31'),
    market='CN_STOCK_A',
    instrument_list='',
    max_count=0
)

m1 = M.use_datasource.v2(
    instruments=m9.data,
    features=m3.data,
    datasource_id='stockData',
    start_date='',
    end_date='',
    before_start_days=90
)




下面的是输出的日志错误:--------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /var/app/enabled/bigdatasource/impl/dsimpl/hdf.py:40, in write_df_helper(df, path, key)
AttributeError: 'NoneType' object has no attribute 'to_hdf'
During handling of the above exception, another exception occurred:
AttributeError                            Traceback (most recent call last)
Cell In[6], line 69
     40 # m4 = M.trade.v2(
     41 #     instruments=m3.data,
     42 #     options={
   (...)
     59 #     collect_all=True
     60 # )
     61 m9 = M.instruments.v2(
     62     start_date=T.live_run_param('trading_date', '2021-01-01'),
     63     end_date=T.live_run_param('trading_date', '2021-12-31'),
   (...)
     66     max_count=0
     67 )
---> 69 m1 = M.use_datasource.v2(
     70     instruments=m9.data,
     71     features=m3.data,
     72     datasource_id='stockData',
     73     start_date='',
     74     end_date='',
     75     before_start_days=90
     76 )
File module2/common/modulemanagerv2.py:88, in biglearning.module2.common.modulemanagerv2.BigQuantModuleVersion.__call__()
File module2/common/moduleinvoker.py:331, in biglearning.module2.common.moduleinvoker.module_invoke()
File module2/common/moduleinvoker.py:253, in biglearning.module2.common.moduleinvoker._invoke_with_cache()
File module2/common/moduleinvoker.py:214, in biglearning.module2.common.moduleinvoker._invoke_with_cache()
File module2/common/moduleinvoker.py:173, in biglearning.module2.common.moduleinvoker._module_run()
File module2/modules/use_datasource/v2/__init__.py:60, in biglearning.module2.modules.use_datasource.v2.__init__.BigQuantModule.run()
File /var/app/enabled/bigdatasource/api/v6/__init__.py:48, in write_df(cls, df, key, use_cache, **kwargs)
File /var/app/enabled/bigdatasource/impl/dsimpl/hdf.py:79, in write_df(df, key, use_cache, **kwargs)
File /var/app/enabled/bigdatasource/impl/dsimpl/hdf.py:65, in _write(df, key, **kwargs)
File /var/app/enabled/bigdatasource/impl/dsimpl/hdf.py:42, in write_df_helper(df, path, key)
AttributeError: 'NoneType' object has no attribute 'to_hdf'

\

标签

data
评论
  • stockData 这个是你自己的表吗?报错的原因是这个表里没有数据。