repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/main.py | QA_SU_save_stock_xdxr | def QA_SU_save_stock_xdxr(engine, client=DATABASE):
"""save stock_xdxr
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_stock_xdxr(client=client) | python | def QA_SU_save_stock_xdxr(engine, client=DATABASE):
"""save stock_xdxr
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_stock_xdxr(client=client) | [
"def",
"QA_SU_save_stock_xdxr",
"(",
"engine",
",",
"client",
"=",
"DATABASE",
")",
":",
"engine",
"=",
"select_save_engine",
"(",
"engine",
")",
"engine",
".",
"QA_SU_save_stock_xdxr",
"(",
"client",
"=",
"client",
")"
] | save stock_xdxr
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_xdxr"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/main.py#L315-L326 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/main.py | QA_SU_save_stock_block | def QA_SU_save_stock_block(engine, client=DATABASE):
"""save stock_block
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_stock_block(client=client) | python | def QA_SU_save_stock_block(engine, client=DATABASE):
"""save stock_block
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_stock_block(client=client) | [
"def",
"QA_SU_save_stock_block",
"(",
"engine",
",",
"client",
"=",
"DATABASE",
")",
":",
"engine",
"=",
"select_save_engine",
"(",
"engine",
")",
"engine",
".",
"QA_SU_save_stock_block",
"(",
"client",
"=",
"client",
")"
] | save stock_block
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_block"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/main.py#L329-L340 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/main.py | select_save_engine | def select_save_engine(engine, paralleled=False):
'''
select save_engine , tushare ts Tushare 使用 Tushare 免费数据接口, tdx 使用通达信数据接口
:param engine: 字符串Str
:param paralleled: 是否并行处理;默认为False
:return: sts means save_tushare_py or stdx means save_tdx_py
'''
if engine in ['tushare', 'ts', 'Tushare']:... | python | def select_save_engine(engine, paralleled=False):
'''
select save_engine , tushare ts Tushare 使用 Tushare 免费数据接口, tdx 使用通达信数据接口
:param engine: 字符串Str
:param paralleled: 是否并行处理;默认为False
:return: sts means save_tushare_py or stdx means save_tdx_py
'''
if engine in ['tushare', 'ts', 'Tushare']:... | [
"def",
"select_save_engine",
"(",
"engine",
",",
"paralleled",
"=",
"False",
")",
":",
"if",
"engine",
"in",
"[",
"'tushare'",
",",
"'ts'",
",",
"'Tushare'",
"]",
":",
"return",
"sts",
"elif",
"engine",
"in",
"[",
"'tdx'",
"]",
":",
"if",
"paralleled",
... | select save_engine , tushare ts Tushare 使用 Tushare 免费数据接口, tdx 使用通达信数据接口
:param engine: 字符串Str
:param paralleled: 是否并行处理;默认为False
:return: sts means save_tushare_py or stdx means save_tdx_py | [
"select",
"save_engine",
"tushare",
"ts",
"Tushare",
"使用",
"Tushare",
"免费数据接口,",
"tdx",
"使用通达信数据接口",
":",
"param",
"engine",
":",
"字符串Str",
":",
"param",
"paralleled",
":",
"是否并行处理;默认为False",
":",
"return",
":",
"sts",
"means",
"save_tushare_py",
"or",
"stdx",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/main.py#L343-L362 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_day | def QA_fetch_stock_day(code, start, end, format='numpy', frequence='day', collections=DATABASE.stock_day):
"""'获取股票日线'
Returns:
[type] -- [description]
感谢@几何大佬的提示
https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-on... | python | def QA_fetch_stock_day(code, start, end, format='numpy', frequence='day', collections=DATABASE.stock_day):
"""'获取股票日线'
Returns:
[type] -- [description]
感谢@几何大佬的提示
https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-on... | [
"def",
"QA_fetch_stock_day",
"(",
"code",
",",
"start",
",",
"end",
",",
"format",
"=",
"'numpy'",
",",
"frequence",
"=",
"'day'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_day",
")",
":",
"start",
"=",
"str",
"(",
"start",
")",
"[",
"0",
":",
... | 获取股票日线'
Returns:
[type] -- [description]
感谢@几何大佬的提示
https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-only | [
"获取股票日线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L48-L96 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_min | def QA_fetch_stock_min(code, start, end, format='numpy', frequence='1min', collections=DATABASE.stock_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15min', '15m']:
frequence = '15min'
... | python | def QA_fetch_stock_min(code, start, end, format='numpy', frequence='1min', collections=DATABASE.stock_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15min', '15m']:
frequence = '15min'
... | [
"def",
"QA_fetch_stock_min",
"(",
"code",
",",
"start",
",",
"end",
",",
"format",
"=",
"'numpy'",
",",
"frequence",
"=",
"'1min'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_min",
")",
":",
"if",
"frequence",
"in",
"[",
"'1min'",
",",
"'1m'",
"]",... | 获取股票分钟线 | [
"获取股票分钟线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L99-L143 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_list | def QA_fetch_stock_list(collections=DATABASE.stock_list):
'获取股票列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | python | def QA_fetch_stock_list(collections=DATABASE.stock_list):
'获取股票列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | [
"def",
"QA_fetch_stock_list",
"(",
"collections",
"=",
"DATABASE",
".",
"stock_list",
")",
":",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
")",
".",
"drop",
"(",
"'_id'",
",",
"ax... | 获取股票列表 | [
"获取股票列表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L151-L154 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_etf_list | def QA_fetch_etf_list(collections=DATABASE.etf_list):
'获取ETF列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | python | def QA_fetch_etf_list(collections=DATABASE.etf_list):
'获取ETF列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | [
"def",
"QA_fetch_etf_list",
"(",
"collections",
"=",
"DATABASE",
".",
"etf_list",
")",
":",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
")",
".",
"drop",
"(",
"'_id'",
",",
"axis",... | 获取ETF列表 | [
"获取ETF列表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L157-L160 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_index_list | def QA_fetch_index_list(collections=DATABASE.index_list):
'获取指数列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | python | def QA_fetch_index_list(collections=DATABASE.index_list):
'获取指数列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | [
"def",
"QA_fetch_index_list",
"(",
"collections",
"=",
"DATABASE",
".",
"index_list",
")",
":",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
")",
".",
"drop",
"(",
"'_id'",
",",
"ax... | 获取指数列表 | [
"获取指数列表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L163-L165 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_terminated | def QA_fetch_stock_terminated(collections=DATABASE.stock_terminated):
'获取股票基本信息 , 已经退市的股票列表'
# 🛠todo 转变成 dataframe 类型数据
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | python | def QA_fetch_stock_terminated(collections=DATABASE.stock_terminated):
'获取股票基本信息 , 已经退市的股票列表'
# 🛠todo 转变成 dataframe 类型数据
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | [
"def",
"QA_fetch_stock_terminated",
"(",
"collections",
"=",
"DATABASE",
".",
"stock_terminated",
")",
":",
"# 🛠todo 转变成 dataframe 类型数据",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
")",
... | 获取股票基本信息 , 已经退市的股票列表 | [
"获取股票基本信息",
"已经退市的股票列表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L168-L171 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_basic_info_tushare | def QA_fetch_stock_basic_info_tushare(collections=DATABASE.stock_info_tushare):
'''
purpose:
tushare 股票列表数据库
code,代码
name,名称
industry,所属行业
area,地区
pe,市盈率
outstanding,流通股本(亿)
totals,总股本(亿)
totalAssets,总资产(万)
liquidAssets,流动资产
... | python | def QA_fetch_stock_basic_info_tushare(collections=DATABASE.stock_info_tushare):
'''
purpose:
tushare 股票列表数据库
code,代码
name,名称
industry,所属行业
area,地区
pe,市盈率
outstanding,流通股本(亿)
totals,总股本(亿)
totalAssets,总资产(万)
liquidAssets,流动资产
... | [
"def",
"QA_fetch_stock_basic_info_tushare",
"(",
"collections",
"=",
"DATABASE",
".",
"stock_info_tushare",
")",
":",
"'获取股票基本信息'",
"items",
"=",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
"# 🛠todo 转变成 dataframe 类型数据",
"return",
... | purpose:
tushare 股票列表数据库
code,代码
name,名称
industry,所属行业
area,地区
pe,市盈率
outstanding,流通股本(亿)
totals,总股本(亿)
totalAssets,总资产(万)
liquidAssets,流动资产
fixedAssets,固定资产
reserved,公积金
reservedPerShare,每股公积金
esp,每股收益
... | [
"purpose",
":",
"tushare",
"股票列表数据库"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L174-L211 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_full | def QA_fetch_stock_full(date, format='numpy', collections=DATABASE.stock_day):
'获取全市场的某一日的数据'
Date = str(date)[0:10]
if QA_util_date_valid(Date) is True:
__data = []
for item in collections.find({
"date_stamp": QA_util_date_stamp(Date)}, batch_size=10000):
__data... | python | def QA_fetch_stock_full(date, format='numpy', collections=DATABASE.stock_day):
'获取全市场的某一日的数据'
Date = str(date)[0:10]
if QA_util_date_valid(Date) is True:
__data = []
for item in collections.find({
"date_stamp": QA_util_date_stamp(Date)}, batch_size=10000):
__data... | [
"def",
"QA_fetch_stock_full",
"(",
"date",
",",
"format",
"=",
"'numpy'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_day",
")",
":",
"Date",
"=",
"str",
"(",
"date",
")",
"[",
"0",
":",
"10",
"]",
"if",
"QA_util_date_valid",
"(",
"Date",
")",
"is... | 获取全市场的某一日的数据 | [
"获取全市场的某一日的数据"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L226-L252 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_index_min | def QA_fetch_index_min(
code,
start, end,
format='numpy',
frequence='1min',
collections=DATABASE.index_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15min... | python | def QA_fetch_index_min(
code,
start, end,
format='numpy',
frequence='1min',
collections=DATABASE.index_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15min... | [
"def",
"QA_fetch_index_min",
"(",
"code",
",",
"start",
",",
"end",
",",
"format",
"=",
"'numpy'",
",",
"frequence",
"=",
"'1min'",
",",
"collections",
"=",
"DATABASE",
".",
"index_min",
")",
":",
"if",
"frequence",
"in",
"[",
"'1min'",
",",
"'1m'",
"]",... | 获取股票分钟线 | [
"获取股票分钟线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L291-L334 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_future_min | def QA_fetch_future_min(
code,
start, end,
format='numpy',
frequence='1min',
collections=DATABASE.future_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15m... | python | def QA_fetch_future_min(
code,
start, end,
format='numpy',
frequence='1min',
collections=DATABASE.future_min):
'获取股票分钟线'
if frequence in ['1min', '1m']:
frequence = '1min'
elif frequence in ['5min', '5m']:
frequence = '5min'
elif frequence in ['15m... | [
"def",
"QA_fetch_future_min",
"(",
"code",
",",
"start",
",",
"end",
",",
"format",
"=",
"'numpy'",
",",
"frequence",
"=",
"'1min'",
",",
"collections",
"=",
"DATABASE",
".",
"future_min",
")",
":",
"if",
"frequence",
"in",
"[",
"'1min'",
",",
"'1m'",
"]... | 获取股票分钟线 | [
"获取股票分钟线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L373-L416 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_future_list | def QA_fetch_future_list(collections=DATABASE.future_list):
'获取期货列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | python | def QA_fetch_future_list(collections=DATABASE.future_list):
'获取期货列表'
return pd.DataFrame([item for item in collections.find()]).drop('_id', axis=1, inplace=False).set_index('code', drop=False) | [
"def",
"QA_fetch_future_list",
"(",
"collections",
"=",
"DATABASE",
".",
"future_list",
")",
":",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
")",
"]",
")",
".",
"drop",
"(",
"'_id'",
",",
"... | 获取期货列表 | [
"获取期货列表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L419-L421 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_ctp_tick | def QA_fetch_ctp_tick(code, start, end, frequence, format='pd', collections=DATABASE.ctp_tick):
"""仅供存储的ctp tick使用
Arguments:
code {[type]} -- [description]
Keyword Arguments:
format {str} -- [description] (default: {'pd'})
collections {[type]} -- [description] (default: {DATABASE.... | python | def QA_fetch_ctp_tick(code, start, end, frequence, format='pd', collections=DATABASE.ctp_tick):
"""仅供存储的ctp tick使用
Arguments:
code {[type]} -- [description]
Keyword Arguments:
format {str} -- [description] (default: {'pd'})
collections {[type]} -- [description] (default: {DATABASE.... | [
"def",
"QA_fetch_ctp_tick",
"(",
"code",
",",
"start",
",",
"end",
",",
"frequence",
",",
"format",
"=",
"'pd'",
",",
"collections",
"=",
"DATABASE",
".",
"ctp_tick",
")",
":",
"code",
"=",
"QA_util_code_tolist",
"(",
"code",
",",
"auto_fill",
"=",
"False"... | 仅供存储的ctp tick使用
Arguments:
code {[type]} -- [description]
Keyword Arguments:
format {str} -- [description] (default: {'pd'})
collections {[type]} -- [description] (default: {DATABASE.ctp_tick})
Returns:
[type] -- [description] | [
"仅供存储的ctp",
"tick使用"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L428-L459 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_xdxr | def QA_fetch_stock_xdxr(code, format='pd', collections=DATABASE.stock_xdxr):
'获取股票除权信息/数据库'
code = QA_util_code_tolist(code)
data = pd.DataFrame([item for item in collections.find(
{'code': {'$in': code}}, batch_size=10000)]).drop(['_id'], axis=1)
data['date'] = pd.to_datetime(data['date'])
... | python | def QA_fetch_stock_xdxr(code, format='pd', collections=DATABASE.stock_xdxr):
'获取股票除权信息/数据库'
code = QA_util_code_tolist(code)
data = pd.DataFrame([item for item in collections.find(
{'code': {'$in': code}}, batch_size=10000)]).drop(['_id'], axis=1)
data['date'] = pd.to_datetime(data['date'])
... | [
"def",
"QA_fetch_stock_xdxr",
"(",
"code",
",",
"format",
"=",
"'pd'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_xdxr",
")",
":",
"code",
"=",
"QA_util_code_tolist",
"(",
"code",
")",
"data",
"=",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"... | 获取股票除权信息/数据库 | [
"获取股票除权信息",
"/",
"数据库"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L462-L468 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_quotations | def QA_fetch_quotations(date=datetime.date.today(), db=DATABASE):
'获取全部实时5档行情的存储结果'
try:
collections = db.get_collection(
'realtime_{}'.format(date))
data = pd.DataFrame([item for item in collections.find(
{}, {"_id": 0}, batch_size=10000)])
return data.assign(dat... | python | def QA_fetch_quotations(date=datetime.date.today(), db=DATABASE):
'获取全部实时5档行情的存储结果'
try:
collections = db.get_collection(
'realtime_{}'.format(date))
data = pd.DataFrame([item for item in collections.find(
{}, {"_id": 0}, batch_size=10000)])
return data.assign(dat... | [
"def",
"QA_fetch_quotations",
"(",
"date",
"=",
"datetime",
".",
"date",
".",
"today",
"(",
")",
",",
"db",
"=",
"DATABASE",
")",
":",
"try",
":",
"collections",
"=",
"db",
".",
"get_collection",
"(",
"'realtime_{}'",
".",
"format",
"(",
"date",
")",
"... | 获取全部实时5档行情的存储结果 | [
"获取全部实时5档行情的存储结果"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L524-L533 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_account | def QA_fetch_account(message={}, db=DATABASE):
"""get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description]
"""
collection = DATABASE.account
return ... | python | def QA_fetch_account(message={}, db=DATABASE):
"""get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description]
"""
collection = DATABASE.account
return ... | [
"def",
"QA_fetch_account",
"(",
"message",
"=",
"{",
"}",
",",
"db",
"=",
"DATABASE",
")",
":",
"collection",
"=",
"DATABASE",
".",
"account",
"return",
"[",
"res",
"for",
"res",
"in",
"collection",
".",
"find",
"(",
"message",
",",
"{",
"\"_id\"",
":"... | get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description] | [
"get",
"the",
"account"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L536-L549 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_risk | def QA_fetch_risk(message={}, params={"_id": 0, 'assets': 0, 'timeindex': 0, 'totaltimeindex': 0, 'benchmark_assets': 0, 'month_profit': 0}, db=DATABASE):
"""get the risk message
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default... | python | def QA_fetch_risk(message={}, params={"_id": 0, 'assets': 0, 'timeindex': 0, 'totaltimeindex': 0, 'benchmark_assets': 0, 'month_profit': 0}, db=DATABASE):
"""get the risk message
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default... | [
"def",
"QA_fetch_risk",
"(",
"message",
"=",
"{",
"}",
",",
"params",
"=",
"{",
"\"_id\"",
":",
"0",
",",
"'assets'",
":",
"0",
",",
"'timeindex'",
":",
"0",
",",
"'totaltimeindex'",
":",
"0",
",",
"'benchmark_assets'",
":",
"0",
",",
"'month_profit'",
... | get the risk message
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description] | [
"get",
"the",
"risk",
"message"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L552-L565 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_user | def QA_fetch_user(user_cookie, db=DATABASE):
"""
get the user
Arguments:
user_cookie : str the unique cookie_id for a user
Keyword Arguments:
db: database for query
Returns:
list --- [ACCOUNT]
"""
collection = DATABASE.account
return [res for res in collection... | python | def QA_fetch_user(user_cookie, db=DATABASE):
"""
get the user
Arguments:
user_cookie : str the unique cookie_id for a user
Keyword Arguments:
db: database for query
Returns:
list --- [ACCOUNT]
"""
collection = DATABASE.account
return [res for res in collection... | [
"def",
"QA_fetch_user",
"(",
"user_cookie",
",",
"db",
"=",
"DATABASE",
")",
":",
"collection",
"=",
"DATABASE",
".",
"account",
"return",
"[",
"res",
"for",
"res",
"in",
"collection",
".",
"find",
"(",
"{",
"'user_cookie'",
":",
"user_cookie",
"}",
",",
... | get the user
Arguments:
user_cookie : str the unique cookie_id for a user
Keyword Arguments:
db: database for query
Returns:
list --- [ACCOUNT] | [
"get",
"the",
"user"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L568-L582 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_strategy | def QA_fetch_strategy(message={}, db=DATABASE):
"""get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description]
"""
collection = DATABASE.strategy
retur... | python | def QA_fetch_strategy(message={}, db=DATABASE):
"""get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description]
"""
collection = DATABASE.strategy
retur... | [
"def",
"QA_fetch_strategy",
"(",
"message",
"=",
"{",
"}",
",",
"db",
"=",
"DATABASE",
")",
":",
"collection",
"=",
"DATABASE",
".",
"strategy",
"return",
"[",
"res",
"for",
"res",
"in",
"collection",
".",
"find",
"(",
"message",
",",
"{",
"\"_id\"",
"... | get the account
Arguments:
query_mes {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
Returns:
[type] -- [description] | [
"get",
"the",
"account"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L585-L598 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_lhb | def QA_fetch_lhb(date, db=DATABASE):
'获取某一天龙虎榜数据'
try:
collections = db.lhb
return pd.DataFrame([item for item in collections.find(
{'date': date}, {"_id": 0})]).set_index('code', drop=False).sort_index()
except Exception as e:
raise e | python | def QA_fetch_lhb(date, db=DATABASE):
'获取某一天龙虎榜数据'
try:
collections = db.lhb
return pd.DataFrame([item for item in collections.find(
{'date': date}, {"_id": 0})]).set_index('code', drop=False).sort_index()
except Exception as e:
raise e | [
"def",
"QA_fetch_lhb",
"(",
"date",
",",
"db",
"=",
"DATABASE",
")",
":",
"try",
":",
"collections",
"=",
"db",
".",
"lhb",
"return",
"pd",
".",
"DataFrame",
"(",
"[",
"item",
"for",
"item",
"in",
"collections",
".",
"find",
"(",
"{",
"'date'",
":",
... | 获取某一天龙虎榜数据 | [
"获取某一天龙虎榜数据"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L601-L608 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_financial_report | def QA_fetch_financial_report(code, report_date, ltype='EN', db=DATABASE):
"""获取专业财务报表
Arguments:
code {[type]} -- [description]
report_date {[type]} -- [description]
Keyword Arguments:
ltype {str} -- [description] (default: {'EN'})
db {[type]} -- [description] (default: {DAT... | python | def QA_fetch_financial_report(code, report_date, ltype='EN', db=DATABASE):
"""获取专业财务报表
Arguments:
code {[type]} -- [description]
report_date {[type]} -- [description]
Keyword Arguments:
ltype {str} -- [description] (default: {'EN'})
db {[type]} -- [description] (default: {DAT... | [
"def",
"QA_fetch_financial_report",
"(",
"code",
",",
"report_date",
",",
"ltype",
"=",
"'EN'",
",",
"db",
"=",
"DATABASE",
")",
":",
"if",
"isinstance",
"(",
"code",
",",
"str",
")",
":",
"code",
"=",
"[",
"code",
"]",
"if",
"isinstance",
"(",
"report... | 获取专业财务报表
Arguments:
code {[type]} -- [description]
report_date {[type]} -- [description]
Keyword Arguments:
ltype {str} -- [description] (default: {'EN'})
db {[type]} -- [description] (default: {DATABASE})
Raises:
e -- [description]
Returns:
pd.DataFrame -... | [
"获取专业财务报表",
"Arguments",
":",
"code",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"report_date",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"Keyword",
"Arguments",
":",
"ltype",
"{",
"str",
"}",
"--",
"[",
"description",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L713-L801 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery.py | QA_fetch_stock_divyield | def QA_fetch_stock_divyield(code, start, end=None, format='pd', collections=DATABASE.stock_divyield):
'获取股票日线'
#code= [code] if isinstance(code,str) else code
# code checking
code = QA_util_code_tolist(code)
if QA_util_date_valid(end):
__data = []
cursor = collections.find({
... | python | def QA_fetch_stock_divyield(code, start, end=None, format='pd', collections=DATABASE.stock_divyield):
'获取股票日线'
#code= [code] if isinstance(code,str) else code
# code checking
code = QA_util_code_tolist(code)
if QA_util_date_valid(end):
__data = []
cursor = collections.find({
... | [
"def",
"QA_fetch_stock_divyield",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"format",
"=",
"'pd'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_divyield",
")",
":",
"#code= [code] if isinstance(code,str) else code",
"# code checking",
"code",
"=",... | 获取股票日线 | [
"获取股票日线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L844-L882 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_day | def QA_SU_save_stock_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
save stock_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用
'''
stock_list = QA_fetch_get_stock_list().code.unique().tolist... | python | def QA_SU_save_stock_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
save stock_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用
'''
stock_list = QA_fetch_get_stock_list().code.unique().tolist... | [
"def",
"QA_SU_save_stock_day",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"code",
".",
"unique",
"(",
")",
".",
"tolist",
"(",
")",
"... | save stock_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用 | [
"save",
"stock_day",
"保存日线数据",
":",
"param",
"client",
":",
":",
"param",
"ui_log",
":",
"给GUI",
"qt",
"界面使用",
":",
"param",
"ui_progress",
":",
"给GUI",
"qt",
"界面使用",
":",
"param",
"ui_progress_int_value",
":",
"给GUI",
"qt",
"界面使用"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L82-L184 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_week | def QA_SU_save_stock_week(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_week
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll_stock_week = client.stock_week
coll_stock_week.... | python | def QA_SU_save_stock_week(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_week
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll_stock_week = client.stock_week
coll_stock_week.... | [
"def",
"QA_SU_save_stock_week",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"code",
".",
"unique",
"(",
")",
".",
"tolist",
"(",
")",
... | save stock_week
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_week"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L196-L292 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_xdxr | def QA_SU_save_stock_xdxr(client=DATABASE, ui_log=None, ui_progress=None):
"""[summary]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
# client.drop_collection('stock_xdxr')
try:
coll =... | python | def QA_SU_save_stock_xdxr(client=DATABASE, ui_log=None, ui_progress=None):
"""[summary]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
# client.drop_collection('stock_xdxr')
try:
coll =... | [
"def",
"QA_SU_save_stock_xdxr",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"code",
".",
"unique",
"(",
")",
".",
"tolist",
"(",
")",
... | [summary]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"[",
"summary",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L494-L555 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_min | def QA_SU_save_stock_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.stock_min
coll.create_index(
[
... | python | def QA_SU_save_stock_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.stock_min
coll.create_index(
[
... | [
"def",
"QA_SU_save_stock_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"code",
".",
"unique",
"(",
")",
".",
"tolist",
"(",
")",
"... | save stock_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_min"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L558-L679 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_index_day | def QA_SU_save_index_day(client=DATABASE, ui_log=None, ui_progress=None):
"""save index_day
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
__index_list = QA_fetch_get_stock_list('index')
coll = client.index_day
coll.create_index(
[('code',
... | python | def QA_SU_save_index_day(client=DATABASE, ui_log=None, ui_progress=None):
"""save index_day
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
__index_list = QA_fetch_get_stock_list('index')
coll = client.index_day
coll.create_index(
[('code',
... | [
"def",
"QA_SU_save_index_day",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"__index_list",
"=",
"QA_fetch_get_stock_list",
"(",
"'index'",
")",
"coll",
"=",
"client",
".",
"index_day",
"coll",
".",
"... | save index_day
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"index_day"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L682-L790 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_index_min | def QA_SU_save_index_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save index_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
__index_list = QA_fetch_get_stock_list('index')
coll = client.index_min
coll.create_index(
[
('c... | python | def QA_SU_save_index_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save index_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
__index_list = QA_fetch_get_stock_list('index')
coll = client.index_min
coll.create_index(
[
('c... | [
"def",
"QA_SU_save_index_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"__index_list",
"=",
"QA_fetch_get_stock_list",
"(",
"'index'",
")",
"coll",
"=",
"client",
".",
"index_min",
"coll",
".",
"... | save index_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"index_min"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L793-L916 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_list | def QA_SU_save_stock_list(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_list')
coll = client.stock_list
coll.create_index('code')
try:
# 🛠todo ... | python | def QA_SU_save_stock_list(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_list')
coll = client.stock_list
coll.create_index('code')
try:
# 🛠todo ... | [
"def",
"QA_SU_save_stock_list",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"client",
".",
"drop_collection",
"(",
"'stock_list'",
")",
"coll",
"=",
"client",
".",
"stock_list",
"coll",
".",
"create_... | save stock_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_list"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L1140-L1171 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_etf_list | def QA_SU_save_etf_list(client=DATABASE, ui_log=None, ui_progress=None):
"""save etf_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
try:
QA_util_log_info(
'##JOB16 Now Saving ETF_LIST ====',
ui_log=ui_log,
ui_progre... | python | def QA_SU_save_etf_list(client=DATABASE, ui_log=None, ui_progress=None):
"""save etf_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
try:
QA_util_log_info(
'##JOB16 Now Saving ETF_LIST ====',
ui_log=ui_log,
ui_progre... | [
"def",
"QA_SU_save_etf_list",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"try",
":",
"QA_util_log_info",
"(",
"'##JOB16 Now Saving ETF_LIST ===='",
",",
"ui_log",
"=",
"ui_log",
",",
"ui_progress",
"=",... | save etf_list
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"etf_list"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L1174-L1205 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_block | def QA_SU_save_stock_block(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_block
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_block')
coll = client.stock_block
coll.create_index('code')
try:
QA_u... | python | def QA_SU_save_stock_block(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_block
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_block')
coll = client.stock_block
coll.create_index('code')
try:
QA_u... | [
"def",
"QA_SU_save_stock_block",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"client",
".",
"drop_collection",
"(",
"'stock_block'",
")",
"coll",
"=",
"client",
".",
"stock_block",
"coll",
".",
"crea... | save stock_block
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_block"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L1208-L1257 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_info | def QA_SU_save_stock_info(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_info
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_info')
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.s... | python | def QA_SU_save_stock_info(client=DATABASE, ui_log=None, ui_progress=None):
"""save stock_info
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
client.drop_collection('stock_info')
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.s... | [
"def",
"QA_SU_save_stock_info",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"client",
".",
"drop_collection",
"(",
"'stock_info'",
")",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"cod... | save stock_info
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_info"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L1260-L1306 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_stock_transaction | def QA_SU_save_stock_transaction(
client=DATABASE,
ui_log=None,
ui_progress=None
):
"""save stock_transaction
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.st... | python | def QA_SU_save_stock_transaction(
client=DATABASE,
ui_log=None,
ui_progress=None
):
"""save stock_transaction
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
stock_list = QA_fetch_get_stock_list().code.unique().tolist()
coll = client.st... | [
"def",
"QA_SU_save_stock_transaction",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"stock_list",
"=",
"QA_fetch_get_stock_list",
"(",
")",
".",
"code",
".",
"unique",
"(",
")",
".",
"tolist",
"(",
... | save stock_transaction
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"stock_transaction"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L1309-L1368 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_option_commodity_day | def QA_SU_save_option_commodity_day(
client=DATABASE,
ui_log=None,
ui_progress=None
):
'''
:param client:
:return:
'''
_save_option_commodity_cu_day(
client=client,
ui_log=ui_log,
ui_progress=ui_progress
)
_save_option_commodity_m_day(
... | python | def QA_SU_save_option_commodity_day(
client=DATABASE,
ui_log=None,
ui_progress=None
):
'''
:param client:
:return:
'''
_save_option_commodity_cu_day(
client=client,
ui_log=ui_log,
ui_progress=ui_progress
)
_save_option_commodity_m_day(
... | [
"def",
"QA_SU_save_option_commodity_day",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"_save_option_commodity_cu_day",
"(",
"client",
"=",
"client",
",",
"ui_log",
"=",
"ui_log",
",",
"ui_progress",
"=",... | :param client:
:return: | [
":",
"param",
"client",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L2292-L2331 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_option_commodity_min | def QA_SU_save_option_commodity_min(
client=DATABASE,
ui_log=None,
ui_progress=None
):
'''
:param client:
:return:
'''
# 测试中发现, 一起回去,容易出现错误,每次获取一个品种后 ,更换服务ip继续获取 ?
_save_option_commodity_cu_min(
client=client,
ui_log=ui_log,
ui_progress=ui... | python | def QA_SU_save_option_commodity_min(
client=DATABASE,
ui_log=None,
ui_progress=None
):
'''
:param client:
:return:
'''
# 测试中发现, 一起回去,容易出现错误,每次获取一个品种后 ,更换服务ip继续获取 ?
_save_option_commodity_cu_min(
client=client,
ui_log=ui_log,
ui_progress=ui... | [
"def",
"QA_SU_save_option_commodity_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"# 测试中发现, 一起回去,容易出现错误,每次获取一个品种后 ,更换服务ip继续获取 ?",
"_save_option_commodity_cu_min",
"(",
"client",
"=",
"client",
",",
"ui_log",... | :param client:
:return: | [
":",
"param",
"client",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L3384-L3427 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_option_min | def QA_SU_save_option_min(client=DATABASE, ui_log=None, ui_progress=None):
'''
:param client:
:return:
'''
option_contract_list = QA_fetch_get_option_contract_time_to_market()
coll_option_min = client.option_day_min
coll_option_min.create_index(
[("code",
pymongo.ASCENDING)... | python | def QA_SU_save_option_min(client=DATABASE, ui_log=None, ui_progress=None):
'''
:param client:
:return:
'''
option_contract_list = QA_fetch_get_option_contract_time_to_market()
coll_option_min = client.option_day_min
coll_option_min.create_index(
[("code",
pymongo.ASCENDING)... | [
"def",
"QA_SU_save_option_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"option_contract_list",
"=",
"QA_fetch_get_option_contract_time_to_market",
"(",
")",
"coll_option_min",
"=",
"client",
".",
"optio... | :param client:
:return: | [
":",
"param",
"client",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L3430-L3563 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_option_day | def QA_SU_save_option_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
:param client:
:return:
'''
option_contract_list = QA_fetch_get_option_50etf_contract_time_to_market()
coll_option_day = client.option_day
coll_option_day.create_index(
[("code",
pymongo.ASCENDIN... | python | def QA_SU_save_option_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
:param client:
:return:
'''
option_contract_list = QA_fetch_get_option_50etf_contract_time_to_market()
coll_option_day = client.option_day
coll_option_day.create_index(
[("code",
pymongo.ASCENDIN... | [
"def",
"QA_SU_save_option_day",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"option_contract_list",
"=",
"QA_fetch_get_option_50etf_contract_time_to_market",
"(",
")",
"coll_option_day",
"=",
"client",
".",
... | :param client:
:return: | [
":",
"param",
"client",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L3566-L3710 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_future_day | def QA_SU_save_future_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
save future_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用
:return:
'''
future_list = [
item for item in QA_... | python | def QA_SU_save_future_day(client=DATABASE, ui_log=None, ui_progress=None):
'''
save future_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用
:return:
'''
future_list = [
item for item in QA_... | [
"def",
"QA_SU_save_future_day",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"future_list",
"=",
"[",
"item",
"for",
"item",
"in",
"QA_fetch_get_future_list",
"(",
")",
".",
"code",
".",
"unique",
"... | save future_day
保存日线数据
:param client:
:param ui_log: 给GUI qt 界面使用
:param ui_progress: 给GUI qt 界面使用
:param ui_progress_int_value: 给GUI qt 界面使用
:return: | [
"save",
"future_day",
"保存日线数据",
":",
"param",
"client",
":",
":",
"param",
"ui_log",
":",
"给GUI",
"qt",
"界面使用",
":",
"param",
"ui_progress",
":",
"给GUI",
"qt",
"界面使用",
":",
"param",
"ui_progress_int_value",
":",
"给GUI",
"qt",
"界面使用",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L3804-L3909 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx.py | QA_SU_save_future_min | def QA_SU_save_future_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save future_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
future_list = [
item for item in QA_fetch_get_future_list().code.unique().tolist()
if str(item)[-2:] in ['... | python | def QA_SU_save_future_min(client=DATABASE, ui_log=None, ui_progress=None):
"""save future_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
future_list = [
item for item in QA_fetch_get_future_list().code.unique().tolist()
if str(item)[-2:] in ['... | [
"def",
"QA_SU_save_future_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"future_list",
"=",
"[",
"item",
"for",
"item",
"in",
"QA_fetch_get_future_list",
"(",
")",
".",
"code",
".",
"unique",
"... | save future_min
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE}) | [
"save",
"future_min"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx.py#L4016-L4146 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QACmd/__init__.py | CLI.do_shell | def do_shell(self, arg):
"run a shell commad"
print(">", arg)
sub_cmd = subprocess.Popen(arg, shell=True, stdout=subprocess.PIPE)
print(sub_cmd.communicate()[0]) | python | def do_shell(self, arg):
"run a shell commad"
print(">", arg)
sub_cmd = subprocess.Popen(arg, shell=True, stdout=subprocess.PIPE)
print(sub_cmd.communicate()[0]) | [
"def",
"do_shell",
"(",
"self",
",",
"arg",
")",
":",
"print",
"(",
"\">\"",
",",
"arg",
")",
"sub_cmd",
"=",
"subprocess",
".",
"Popen",
"(",
"arg",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"print",
"(",
"sub_... | run a shell commad | [
"run",
"a",
"shell",
"commad"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QACmd/__init__.py#L84-L88 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_min_adv | def QA_fetch_stock_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.stock_min):
'''
'获取股票分钟线'
:param code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
... | python | def QA_fetch_stock_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.stock_min):
'''
'获取股票分钟线'
:param code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
... | [
"def",
"QA_fetch_stock_min_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"frequence",
"=",
"'1min'",
",",
"if_drop_index",
"=",
"True",
",",
"# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉",
"collections",
"=",
"DATABASE",
".",
"stock_min",
")",
... | '获取股票分钟线'
:param code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg 2011-05-01
:param frequence: 字符串str 分钟线的类型 支持 1min 1m 5min 5m 15min 15m 30min 30m 60min 60m 类型
:param if_drop_index: Ture False , dataframe drop index or not
:param collections: mongodb ... | [
"获取股票分钟线",
":",
"param",
"code",
":",
"字符串str",
"eg",
"600085",
":",
"param",
"start",
":",
"字符串str",
"开始日期",
"eg",
"2011",
"-",
"01",
"-",
"01",
":",
"param",
"end",
":",
"字符串str",
"结束日期",
"eg",
"2011",
"-",
"05",
"-",
"01",
":",
"param",
"frequen... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L123-L182 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_day_full_adv | def QA_fetch_stock_day_full_adv(date):
'''
'返回全市场某一天的数据'
:param date:
:return: QA_DataStruct_Stock_day类 型数据
'''
# 🛠 todo 检查日期data参数
res = QA_fetch_stock_full(date, 'pd')
if res is None:
print("QA Error QA_fetch_stock_day_full_adv parameter date=%s call QA_fetch_stock_full return... | python | def QA_fetch_stock_day_full_adv(date):
'''
'返回全市场某一天的数据'
:param date:
:return: QA_DataStruct_Stock_day类 型数据
'''
# 🛠 todo 检查日期data参数
res = QA_fetch_stock_full(date, 'pd')
if res is None:
print("QA Error QA_fetch_stock_day_full_adv parameter date=%s call QA_fetch_stock_full return... | [
"def",
"QA_fetch_stock_day_full_adv",
"(",
"date",
")",
":",
"# 🛠 todo 检查日期data参数",
"res",
"=",
"QA_fetch_stock_full",
"(",
"date",
",",
"'pd'",
")",
"if",
"res",
"is",
"None",
":",
"print",
"(",
"\"QA Error QA_fetch_stock_day_full_adv parameter date=%s call QA_fetch_sto... | '返回全市场某一天的数据'
:param date:
:return: QA_DataStruct_Stock_day类 型数据 | [
"返回全市场某一天的数据",
":",
"param",
"date",
":",
":",
"return",
":",
"QA_DataStruct_Stock_day类",
"型数据"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L185-L200 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_index_day_adv | def QA_fetch_index_day_adv(
code,
start, end=None,
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.index_day):
'''
:param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg 2... | python | def QA_fetch_index_day_adv(
code,
start, end=None,
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.index_day):
'''
:param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg 2... | [
"def",
"QA_fetch_index_day_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"if_drop_index",
"=",
"True",
",",
"# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉",
"collections",
"=",
"DATABASE",
".",
"index_day",
")",
":",
"'获取指数日线'",
"end",
"=",
"st... | :param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg 2011-05-01
:param if_drop_index: Ture False , dataframe drop index or not
:param collections: mongodb 数据库
:return: | [
":",
"param",
"code",
":",
"code",
":",
"字符串str",
"eg",
"600085",
":",
"param",
"start",
":",
"字符串str",
"开始日期",
"eg",
"2011",
"-",
"01",
"-",
"01",
":",
"param",
"end",
":",
"字符串str",
"结束日期",
"eg",
"2011",
"-",
"05",
"-",
"01",
":",
"param",
"if_... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L203-L235 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_index_min_adv | def QA_fetch_index_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
collections=DATABASE.index_min):
'''
'获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return:
... | python | def QA_fetch_index_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
collections=DATABASE.index_min):
'''
'获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return:
... | [
"def",
"QA_fetch_index_min_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"frequence",
"=",
"'1min'",
",",
"if_drop_index",
"=",
"True",
",",
"collections",
"=",
"DATABASE",
".",
"index_min",
")",
":",
"if",
"frequence",
"in",
"[",
"'1min'"... | '获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return: | [
"获取股票分钟线",
":",
"param",
"code",
":",
":",
"param",
"start",
":",
":",
"param",
"end",
":",
":",
"param",
"frequence",
":",
":",
"param",
"if_drop_index",
":",
":",
"param",
"collections",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L238-L290 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_list_adv | def QA_fetch_stock_list_adv(collections=DATABASE.stock_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
stock_list_items = QA_fetch_stock_list(collections)
if len(stock_list_items) == 0:
print("QA Error QA_fetch_stock_list_adv call item for item in collectio... | python | def QA_fetch_stock_list_adv(collections=DATABASE.stock_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
stock_list_items = QA_fetch_stock_list(collections)
if len(stock_list_items) == 0:
print("QA Error QA_fetch_stock_list_adv call item for item in collectio... | [
"def",
"QA_fetch_stock_list_adv",
"(",
"collections",
"=",
"DATABASE",
".",
"stock_list",
")",
":",
"stock_list_items",
"=",
"QA_fetch_stock_list",
"(",
"collections",
")",
"if",
"len",
"(",
"stock_list_items",
")",
"==",
"0",
":",
"print",
"(",
"\"QA Error QA_fet... | '获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame | [
"获取股票列表",
":",
"param",
"collections",
":",
"mongodb",
"数据库",
":",
"return",
":",
"DataFrame"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L319-L329 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_index_list_adv | def QA_fetch_index_list_adv(collections=DATABASE.index_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
index_list_items = QA_fetch_index_list(collections)
if len(index_list_items) == 0:
print("QA Error QA_fetch_index_list_adv call item for item in collectio... | python | def QA_fetch_index_list_adv(collections=DATABASE.index_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
index_list_items = QA_fetch_index_list(collections)
if len(index_list_items) == 0:
print("QA Error QA_fetch_index_list_adv call item for item in collectio... | [
"def",
"QA_fetch_index_list_adv",
"(",
"collections",
"=",
"DATABASE",
".",
"index_list",
")",
":",
"index_list_items",
"=",
"QA_fetch_index_list",
"(",
"collections",
")",
"if",
"len",
"(",
"index_list_items",
")",
"==",
"0",
":",
"print",
"(",
"\"QA Error QA_fet... | '获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame | [
"获取股票列表",
":",
"param",
"collections",
":",
"mongodb",
"数据库",
":",
"return",
":",
"DataFrame"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L332-L342 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_future_day_adv | def QA_fetch_future_day_adv(
code,
start, end=None,
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.index_day):
'''
:param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg ... | python | def QA_fetch_future_day_adv(
code,
start, end=None,
if_drop_index=True,
# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉
collections=DATABASE.index_day):
'''
:param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg ... | [
"def",
"QA_fetch_future_day_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"if_drop_index",
"=",
"True",
",",
"# 🛠 todo collections 参数没有用到, 且数据库是固定的, 这个变量后期去掉",
"collections",
"=",
"DATABASE",
".",
"index_day",
")",
":",
"'获取期货日线'",
"end",
"=",
"s... | :param code: code: 字符串str eg 600085
:param start: 字符串str 开始日期 eg 2011-01-01
:param end: 字符串str 结束日期 eg 2011-05-01
:param if_drop_index: Ture False , dataframe drop index or not
:param collections: mongodb 数据库
:return: | [
":",
"param",
"code",
":",
"code",
":",
"字符串str",
"eg",
"600085",
":",
"param",
"start",
":",
"字符串str",
"开始日期",
"eg",
"2011",
"-",
"01",
"-",
"01",
":",
"param",
"end",
":",
"字符串str",
"结束日期",
"eg",
"2011",
"-",
"05",
"-",
"01",
":",
"param",
"if_... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L344-L375 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_future_min_adv | def QA_fetch_future_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
collections=DATABASE.future_min):
'''
'获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return... | python | def QA_fetch_future_min_adv(
code,
start, end=None,
frequence='1min',
if_drop_index=True,
collections=DATABASE.future_min):
'''
'获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return... | [
"def",
"QA_fetch_future_min_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"frequence",
"=",
"'1min'",
",",
"if_drop_index",
"=",
"True",
",",
"collections",
"=",
"DATABASE",
".",
"future_min",
")",
":",
"if",
"frequence",
"in",
"[",
"'1min... | '获取股票分钟线'
:param code:
:param start:
:param end:
:param frequence:
:param if_drop_index:
:param collections:
:return: | [
"获取股票分钟线",
":",
"param",
"code",
":",
":",
"param",
"start",
":",
":",
"param",
"end",
":",
":",
"param",
"frequence",
":",
":",
"param",
"if_drop_index",
":",
":",
"param",
"collections",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L378-L430 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_future_list_adv | def QA_fetch_future_list_adv(collections=DATABASE.future_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
future_list_items = QA_fetch_future_list()
if len(future_list_items) == 0:
print("QA Error QA_fetch_future_list_adv call item for item in collections.fi... | python | def QA_fetch_future_list_adv(collections=DATABASE.future_list):
'''
'获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame
'''
future_list_items = QA_fetch_future_list()
if len(future_list_items) == 0:
print("QA Error QA_fetch_future_list_adv call item for item in collections.fi... | [
"def",
"QA_fetch_future_list_adv",
"(",
"collections",
"=",
"DATABASE",
".",
"future_list",
")",
":",
"future_list_items",
"=",
"QA_fetch_future_list",
"(",
")",
"if",
"len",
"(",
"future_list_items",
")",
"==",
"0",
":",
"print",
"(",
"\"QA Error QA_fetch_future_li... | '获取股票列表'
:param collections: mongodb 数据库
:return: DataFrame | [
"获取股票列表",
":",
"param",
"collections",
":",
"mongodb",
"数据库",
":",
"return",
":",
"DataFrame"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L433-L443 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_block_adv | def QA_fetch_stock_block_adv(code=None, blockname=None, collections=DATABASE.stock_block):
'''
返回板块 ❌
:param code:
:param blockname:
:param collections: 默认数据库 stock_block
:return: QA_DataStruct_Stock_block
'''
if code is not None and blockname is None:
# 返回这个股票代码所属的板块
dat... | python | def QA_fetch_stock_block_adv(code=None, blockname=None, collections=DATABASE.stock_block):
'''
返回板块 ❌
:param code:
:param blockname:
:param collections: 默认数据库 stock_block
:return: QA_DataStruct_Stock_block
'''
if code is not None and blockname is None:
# 返回这个股票代码所属的板块
dat... | [
"def",
"QA_fetch_stock_block_adv",
"(",
"code",
"=",
"None",
",",
"blockname",
"=",
"None",
",",
"collections",
"=",
"DATABASE",
".",
"stock_block",
")",
":",
"if",
"code",
"is",
"not",
"None",
"and",
"blockname",
"is",
"None",
":",
"# 返回这个股票代码所属的板块",
"data"... | 返回板块 ❌
:param code:
:param blockname:
:param collections: 默认数据库 stock_block
:return: QA_DataStruct_Stock_block | [
"返回板块",
"❌",
":",
"param",
"code",
":",
":",
"param",
"blockname",
":",
":",
"param",
"collections",
":",
"默认数据库",
"stock_block",
":",
"return",
":",
"QA_DataStruct_Stock_block"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L446-L478 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_realtime_adv | def QA_fetch_stock_realtime_adv(code=None,
num=1,
collections=DATABASE.get_collection('realtime_{}'.format(datetime.date.today()))):
'''
返回当日的上下五档, code可以是股票可以是list, num是每个股票获取的数量
:param code:
:param num:
:param collections: realtime_X... | python | def QA_fetch_stock_realtime_adv(code=None,
num=1,
collections=DATABASE.get_collection('realtime_{}'.format(datetime.date.today()))):
'''
返回当日的上下五档, code可以是股票可以是list, num是每个股票获取的数量
:param code:
:param num:
:param collections: realtime_X... | [
"def",
"QA_fetch_stock_realtime_adv",
"(",
"code",
"=",
"None",
",",
"num",
"=",
"1",
",",
"collections",
"=",
"DATABASE",
".",
"get_collection",
"(",
"'realtime_{}'",
".",
"format",
"(",
"datetime",
".",
"date",
".",
"today",
"(",
")",
")",
")",
")",
":... | 返回当日的上下五档, code可以是股票可以是list, num是每个股票获取的数量
:param code:
:param num:
:param collections: realtime_XXXX-XX-XX 每天实时时间
:return: DataFrame | [
"返回当日的上下五档",
"code可以是股票可以是list",
"num是每个股票获取的数量",
":",
"param",
"code",
":",
":",
"param",
"num",
":",
":",
"param",
"collections",
":",
"realtime_XXXX",
"-",
"XX",
"-",
"XX",
"每天实时时间",
":",
"return",
":",
"DataFrame"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L481-L513 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_financial_report_adv | def QA_fetch_financial_report_adv(code, start, end=None, ltype='EN'):
"""高级财务查询接口
Arguments:
code {[type]} -- [description]
start {[type]} -- [description]
Keyword Arguments:
end {[type]} -- [description] (default: {None})
"""
if end is None:
return QA_DataStruct_Fi... | python | def QA_fetch_financial_report_adv(code, start, end=None, ltype='EN'):
"""高级财务查询接口
Arguments:
code {[type]} -- [description]
start {[type]} -- [description]
Keyword Arguments:
end {[type]} -- [description] (default: {None})
"""
if end is None:
return QA_DataStruct_Fi... | [
"def",
"QA_fetch_financial_report_adv",
"(",
"code",
",",
"start",
",",
"end",
"=",
"None",
",",
"ltype",
"=",
"'EN'",
")",
":",
"if",
"end",
"is",
"None",
":",
"return",
"QA_DataStruct_Financial",
"(",
"QA_fetch_financial_report",
"(",
"code",
",",
"start",
... | 高级财务查询接口
Arguments:
code {[type]} -- [description]
start {[type]} -- [description]
Keyword Arguments:
end {[type]} -- [description] (default: {None}) | [
"高级财务查询接口",
"Arguments",
":",
"code",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"start",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"Keyword",
"Arguments",
":",
"end",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"descrip... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L516-L532 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAQuery_Advance.py | QA_fetch_stock_financial_calendar_adv | def QA_fetch_stock_financial_calendar_adv(code, start="all", end=None, format='pd', collections=DATABASE.report_calendar):
'获取股票日线'
#code= [code] if isinstance(code,str) else code
end = start if end is None else end
start = str(start)[0:10]
end = str(end)[0:10]
# code checking
if start == '... | python | def QA_fetch_stock_financial_calendar_adv(code, start="all", end=None, format='pd', collections=DATABASE.report_calendar):
'获取股票日线'
#code= [code] if isinstance(code,str) else code
end = start if end is None else end
start = str(start)[0:10]
end = str(end)[0:10]
# code checking
if start == '... | [
"def",
"QA_fetch_stock_financial_calendar_adv",
"(",
"code",
",",
"start",
"=",
"\"all\"",
",",
"end",
"=",
"None",
",",
"format",
"=",
"'pd'",
",",
"collections",
"=",
"DATABASE",
".",
"report_calendar",
")",
":",
"#code= [code] if isinstance(code,str) else code",
... | 获取股票日线 | [
"获取股票日线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L572-L591 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QATradeFile.py | QA_fetch_get_tdxtraderecord | def QA_fetch_get_tdxtraderecord(file):
"""
QUANTAXIS 读取历史交易记录 通达信 历史成交-输出-xlsfile--转换csvfile
"""
try:
with open('./20180606.csv', 'r') as f:
l = csv.reader(f)
data = [item for item in l]
res = pd.DataFrame(data[1:], columns=data[0])
return res
except:... | python | def QA_fetch_get_tdxtraderecord(file):
"""
QUANTAXIS 读取历史交易记录 通达信 历史成交-输出-xlsfile--转换csvfile
"""
try:
with open('./20180606.csv', 'r') as f:
l = csv.reader(f)
data = [item for item in l]
res = pd.DataFrame(data[1:], columns=data[0])
return res
except:... | [
"def",
"QA_fetch_get_tdxtraderecord",
"(",
"file",
")",
":",
"try",
":",
"with",
"open",
"(",
"'./20180606.csv'",
",",
"'r'",
")",
"as",
"f",
":",
"l",
"=",
"csv",
".",
"reader",
"(",
"f",
")",
"data",
"=",
"[",
"item",
"for",
"item",
"in",
"l",
"]... | QUANTAXIS 读取历史交易记录 通达信 历史成交-输出-xlsfile--转换csvfile | [
"QUANTAXIS",
"读取历史交易记录",
"通达信",
"历史成交",
"-",
"输出",
"-",
"xlsfile",
"--",
"转换csvfile"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QATradeFile.py#L39-L51 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/talib_indicators.py | AROON | def AROON(DataFrame, N=14):
"""阿隆指标
Arguments:
DataFrame {[type]} -- [description]
Keyword Arguments:
N {int} -- [description] (default: {14})
Returns:
[type] -- [description]
"""
ar_up, ar_down = talib.AROON(DataFrame.high.values, DataFrame.low.values, N)... | python | def AROON(DataFrame, N=14):
"""阿隆指标
Arguments:
DataFrame {[type]} -- [description]
Keyword Arguments:
N {int} -- [description] (default: {14})
Returns:
[type] -- [description]
"""
ar_up, ar_down = talib.AROON(DataFrame.high.values, DataFrame.low.values, N)... | [
"def",
"AROON",
"(",
"DataFrame",
",",
"N",
"=",
"14",
")",
":",
"ar_up",
",",
"ar_down",
"=",
"talib",
".",
"AROON",
"(",
"DataFrame",
".",
"high",
".",
"values",
",",
"DataFrame",
".",
"low",
".",
"values",
",",
"N",
")",
"return",
"pd",
".",
"... | 阿隆指标
Arguments:
DataFrame {[type]} -- [description]
Keyword Arguments:
N {int} -- [description] (default: {14})
Returns:
[type] -- [description] | [
"阿隆指标",
"Arguments",
":",
"DataFrame",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"Keyword",
"Arguments",
":",
"N",
"{",
"int",
"}",
"--",
"[",
"description",
"]",
"(",
"default",
":",
"{",
"14",
"}",
")",
"Returns",
":",
"[",
"type... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/talib_indicators.py#L55-L69 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/market_preset.py | MARKET_PRESET.get_commission_coeff | def get_commission_coeff(self, code):
"""
当前无法区分是百分比还是按手数收费,不过可以拿到以后自行判断
"""
return max(self.get_code(code).get('commission_coeff_peramount'),
self.get_code(code).get('commission_coeff_pervol')) | python | def get_commission_coeff(self, code):
"""
当前无法区分是百分比还是按手数收费,不过可以拿到以后自行判断
"""
return max(self.get_code(code).get('commission_coeff_peramount'),
self.get_code(code).get('commission_coeff_pervol')) | [
"def",
"get_commission_coeff",
"(",
"self",
",",
"code",
")",
":",
"return",
"max",
"(",
"self",
".",
"get_code",
"(",
"code",
")",
".",
"get",
"(",
"'commission_coeff_peramount'",
")",
",",
"self",
".",
"get_code",
"(",
"code",
")",
".",
"get",
"(",
"... | 当前无法区分是百分比还是按手数收费,不过可以拿到以后自行判断 | [
"当前无法区分是百分比还是按手数收费",
"不过可以拿到以后自行判断"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/market_preset.py#L638-L643 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAAnalysis/QAAnalysis_trade.py | QAAnalysis_trade.import_trade | def import_trade(self, trade):
"""
trade是一个可迭代的list/generator
"""
for item in trade:
self.make_deal(item.code, item.datetime, item.amount,
item.towards, item.price.item.order_model, item.amount_model) | python | def import_trade(self, trade):
"""
trade是一个可迭代的list/generator
"""
for item in trade:
self.make_deal(item.code, item.datetime, item.amount,
item.towards, item.price.item.order_model, item.amount_model) | [
"def",
"import_trade",
"(",
"self",
",",
"trade",
")",
":",
"for",
"item",
"in",
"trade",
":",
"self",
".",
"make_deal",
"(",
"item",
".",
"code",
",",
"item",
".",
"datetime",
",",
"item",
".",
"amount",
",",
"item",
".",
"towards",
",",
"item",
"... | trade是一个可迭代的list/generator | [
"trade是一个可迭代的list",
"/",
"generator"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAAnalysis/QAAnalysis_trade.py#L54-L60 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAAnalysis/QAAnalysis_trade.py | QAAnalysis_trade.make_deal | def make_deal(self, code, datetime, amount=100, towards=ORDER_DIRECTION.BUY, price=0, order_model=ORDER_MODEL.MARKET, amount_model=AMOUNT_MODEL.BY_AMOUNT):
"""
这是一个一定会成交,并且立刻结转(及t+0)的交易入口
"""
self.account.receive_deal(self.backtest_broker.receive_order(QA_Event(order=self.account.send_or... | python | def make_deal(self, code, datetime, amount=100, towards=ORDER_DIRECTION.BUY, price=0, order_model=ORDER_MODEL.MARKET, amount_model=AMOUNT_MODEL.BY_AMOUNT):
"""
这是一个一定会成交,并且立刻结转(及t+0)的交易入口
"""
self.account.receive_deal(self.backtest_broker.receive_order(QA_Event(order=self.account.send_or... | [
"def",
"make_deal",
"(",
"self",
",",
"code",
",",
"datetime",
",",
"amount",
"=",
"100",
",",
"towards",
"=",
"ORDER_DIRECTION",
".",
"BUY",
",",
"price",
"=",
"0",
",",
"order_model",
"=",
"ORDER_MODEL",
".",
"MARKET",
",",
"amount_model",
"=",
"AMOUNT... | 这是一个一定会成交,并且立刻结转(及t+0)的交易入口 | [
"这是一个一定会成交",
"并且立刻结转",
"(",
"及t",
"+",
"0",
")",
"的交易入口"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAAnalysis/QAAnalysis_trade.py#L62-L69 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.cancel | def cancel(self):
"""撤单
Arguments:
amount {int} -- 撤单数量
"""
self.cancel_amount = self.amount - self.trade_amount
if self.trade_amount == 0:
# 未交易 直接订单全撤
self._status = ORDER_STATUS.CANCEL_ALL
else:
# 部分交易 剩余订单全撤
... | python | def cancel(self):
"""撤单
Arguments:
amount {int} -- 撤单数量
"""
self.cancel_amount = self.amount - self.trade_amount
if self.trade_amount == 0:
# 未交易 直接订单全撤
self._status = ORDER_STATUS.CANCEL_ALL
else:
# 部分交易 剩余订单全撤
... | [
"def",
"cancel",
"(",
"self",
")",
":",
"self",
".",
"cancel_amount",
"=",
"self",
".",
"amount",
"-",
"self",
".",
"trade_amount",
"if",
"self",
".",
"trade_amount",
"==",
"0",
":",
"# 未交易 直接订单全撤",
"self",
".",
"_status",
"=",
"ORDER_STATUS",
".",
"CAN... | 撤单
Arguments:
amount {int} -- 撤单数量 | [
"撤单"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L246-L259 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.failed | def failed(self, reason=None):
"""失败订单(未成功创建入broker)
Arguments:
reason {str} -- 失败原因
"""
# 订单创建失败(如废单/场外废单/价格高于涨停价/价格低于跌停价/通讯失败)
self._status = ORDER_STATUS.FAILED
self.reason = str(reason) | python | def failed(self, reason=None):
"""失败订单(未成功创建入broker)
Arguments:
reason {str} -- 失败原因
"""
# 订单创建失败(如废单/场外废单/价格高于涨停价/价格低于跌停价/通讯失败)
self._status = ORDER_STATUS.FAILED
self.reason = str(reason) | [
"def",
"failed",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"# 订单创建失败(如废单/场外废单/价格高于涨停价/价格低于跌停价/通讯失败)",
"self",
".",
"_status",
"=",
"ORDER_STATUS",
".",
"FAILED",
"self",
".",
"reason",
"=",
"str",
"(",
"reason",
")"
] | 失败订单(未成功创建入broker)
Arguments:
reason {str} -- 失败原因 | [
"失败订单",
"(",
"未成功创建入broker",
")"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L261-L269 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.trade | def trade(self, trade_id, trade_price, trade_amount, trade_time):
"""trade 状态
Arguments:
amount {[type]} -- [description]
"""
if self.status in [ORDER_STATUS.SUCCESS_PART, ORDER_STATUS.QUEUED]:
trade_amount = int(trade_amount)
trade_id = str(trade_id)... | python | def trade(self, trade_id, trade_price, trade_amount, trade_time):
"""trade 状态
Arguments:
amount {[type]} -- [description]
"""
if self.status in [ORDER_STATUS.SUCCESS_PART, ORDER_STATUS.QUEUED]:
trade_amount = int(trade_amount)
trade_id = str(trade_id)... | [
"def",
"trade",
"(",
"self",
",",
"trade_id",
",",
"trade_price",
",",
"trade_amount",
",",
"trade_time",
")",
":",
"if",
"self",
".",
"status",
"in",
"[",
"ORDER_STATUS",
".",
"SUCCESS_PART",
",",
"ORDER_STATUS",
".",
"QUEUED",
"]",
":",
"trade_amount",
"... | trade 状态
Arguments:
amount {[type]} -- [description] | [
"trade",
"状态"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L271-L314 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.to_otgdict | def to_otgdict(self):
"""{
"aid": "insert_order", # //必填, 下单请求
# //必填, 需要与登录用户名一致, 或为登录用户的子账户(例如登录用户为user1, 则报单 user_id 应当为 user1 或 user1.some_unit)
"user_id": account_cookie,
# //必填, 委托单号, 需确保在一个账号中不重复, 限长512字节
"or... | python | def to_otgdict(self):
"""{
"aid": "insert_order", # //必填, 下单请求
# //必填, 需要与登录用户名一致, 或为登录用户的子账户(例如登录用户为user1, 则报单 user_id 应当为 user1 或 user1.some_unit)
"user_id": account_cookie,
# //必填, 委托单号, 需确保在一个账号中不重复, 限长512字节
"or... | [
"def",
"to_otgdict",
"(",
"self",
")",
":",
"return",
"{",
"\"aid\"",
":",
"\"insert_order\"",
",",
"# //必填, 下单请求",
"# //必填, 需要与登录用户名一致, 或为登录用户的子账户(例如登录用户为user1, 则报单 user_id 应当为 user1 或 user1.some_unit)",
"\"user_id\"",
":",
"self",
".",
"account_cookie",
",",
"# //必填, 委托单号, ... | {
"aid": "insert_order", # //必填, 下单请求
# //必填, 需要与登录用户名一致, 或为登录用户的子账户(例如登录用户为user1, 则报单 user_id 应当为 user1 或 user1.some_unit)
"user_id": account_cookie,
# //必填, 委托单号, 需确保在一个账号中不重复, 限长512字节
"order_id": order_id if order_id els... | [
"{",
"aid",
":",
"insert_order",
"#",
"//",
"必填",
"下单请求",
"#",
"//",
"必填",
"需要与登录用户名一致",
"或为登录用户的子账户",
"(",
"例如登录用户为user1",
"则报单",
"user_id",
"应当为",
"user1",
"或",
"user1",
".",
"some_unit",
")",
"user_id",
":",
"account_cookie",
"#",
"//",
"必填",
"委托单号",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L365-L400 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.from_otgformat | def from_otgformat(self, otgOrder):
"""[summary]
Arguments:
otgOrder {[type]} -- [description]
{'seqno': 6,
'user_id': '106184',
'order_id': 'WDRB_QA01_FtNlyBem',
'exchange_id': 'SHFE',
'instrument_id': 'rb1905',
'direction': 'SELL',
... | python | def from_otgformat(self, otgOrder):
"""[summary]
Arguments:
otgOrder {[type]} -- [description]
{'seqno': 6,
'user_id': '106184',
'order_id': 'WDRB_QA01_FtNlyBem',
'exchange_id': 'SHFE',
'instrument_id': 'rb1905',
'direction': 'SELL',
... | [
"def",
"from_otgformat",
"(",
"self",
",",
"otgOrder",
")",
":",
"self",
".",
"order_id",
"=",
"otgOrder",
".",
"get",
"(",
"'order_id'",
")",
"self",
".",
"account_cookie",
"=",
"otgOrder",
".",
"get",
"(",
"'user_id'",
")",
"self",
".",
"exchange_id",
... | [summary]
Arguments:
otgOrder {[type]} -- [description]
{'seqno': 6,
'user_id': '106184',
'order_id': 'WDRB_QA01_FtNlyBem',
'exchange_id': 'SHFE',
'instrument_id': 'rb1905',
'direction': 'SELL',
'offset': 'OPEN',
'volume_orign': 50, ... | [
"[",
"summary",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L419-L476 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_Order.from_dict | def from_dict(self, order_dict):
'''
从字段类型的字段 填充 对象的字段
:param order_dict: dict 类型
:return: self QA_Order
'''
try:
# QA_util_log_info('QA_ORDER CHANGE: from {} change to {}'.format(
# self.order_id, order['order_id']))
self.price = ... | python | def from_dict(self, order_dict):
'''
从字段类型的字段 填充 对象的字段
:param order_dict: dict 类型
:return: self QA_Order
'''
try:
# QA_util_log_info('QA_ORDER CHANGE: from {} change to {}'.format(
# self.order_id, order['order_id']))
self.price = ... | [
"def",
"from_dict",
"(",
"self",
",",
"order_dict",
")",
":",
"try",
":",
"# QA_util_log_info('QA_ORDER CHANGE: from {} change to {}'.format(",
"# self.order_id, order['order_id']))",
"self",
".",
"price",
"=",
"order_dict",
"[",
"'price'",
"]",
"self",
".",
"date",
... | 从字段类型的字段 填充 对象的字段
:param order_dict: dict 类型
:return: self QA_Order | [
"从字段类型的字段",
"填充",
"对象的字段",
":",
"param",
"order_dict",
":",
"dict",
"类型",
":",
"return",
":",
"self",
"QA_Order"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L478-L520 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_OrderQueue.insert_order | def insert_order(self, order):
'''
:param order: QA_Order类型
:return:
'''
#print(" *>> QAOrder!insert_order {}".format(order))
# QUEUED = 300 # queued 用于表示在order_queue中 实际表达的意思是订单存活 待成交
#order.status = ORDER_STATUS.QUEUED
# 🛠 todo 是为了速度快把order对象转换成 d... | python | def insert_order(self, order):
'''
:param order: QA_Order类型
:return:
'''
#print(" *>> QAOrder!insert_order {}".format(order))
# QUEUED = 300 # queued 用于表示在order_queue中 实际表达的意思是订单存活 待成交
#order.status = ORDER_STATUS.QUEUED
# 🛠 todo 是为了速度快把order对象转换成 d... | [
"def",
"insert_order",
"(",
"self",
",",
"order",
")",
":",
"#print(\" *>> QAOrder!insert_order {}\".format(order))",
"# QUEUED = 300 # queued 用于表示在order_queue中 实际表达的意思是订单存活 待成交",
"#order.status = ORDER_STATUS.QUEUED",
"# 🛠 todo 是为了速度快把order对象转换成 df 对象的吗?",
"#self.queue_df = self.queu... | :param order: QA_Order类型
:return: | [
":",
"param",
"order",
":",
"QA_Order类型",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L557-L572 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QAOrder.py | QA_OrderQueue.pending | def pending(self):
'''
600 废单 未委托成功
200 委托成功,完全交易
203 委托成功,未完全成功
300 委托队列 待成交
400 已撤单
500 服务器撤单/每日结算
订单生成(100) -- 废单(600)
订单生成(100) -- 进入待成交队列(300) -- 完全成交(200) -- 每日结算(500)-- 死亡
订单生成(100) -- 进入待成交队列(300) -- 部分成交(203) -- 未成交(300) -- 每日结算(... | python | def pending(self):
'''
600 废单 未委托成功
200 委托成功,完全交易
203 委托成功,未完全成功
300 委托队列 待成交
400 已撤单
500 服务器撤单/每日结算
订单生成(100) -- 废单(600)
订单生成(100) -- 进入待成交队列(300) -- 完全成交(200) -- 每日结算(500)-- 死亡
订单生成(100) -- 进入待成交队列(300) -- 部分成交(203) -- 未成交(300) -- 每日结算(... | [
"def",
"pending",
"(",
"self",
")",
":",
"try",
":",
"return",
"[",
"item",
"for",
"item",
"in",
"self",
".",
"order_list",
".",
"values",
"(",
")",
"if",
"item",
".",
"status",
"in",
"[",
"ORDER_STATUS",
".",
"QUEUED",
",",
"ORDER_STATUS",
".",
"NEX... | 600 废单 未委托成功
200 委托成功,完全交易
203 委托成功,未完全成功
300 委托队列 待成交
400 已撤单
500 服务器撤单/每日结算
订单生成(100) -- 废单(600)
订单生成(100) -- 进入待成交队列(300) -- 完全成交(200) -- 每日结算(500)-- 死亡
订单生成(100) -- 进入待成交队列(300) -- 部分成交(203) -- 未成交(300) -- 每日结算(500) -- 死亡
订单生成(100) -- 进入待成交队列... | [
"600",
"废单",
"未委托成功",
"200",
"委托成功",
"完全交易",
"203",
"委托成功",
"未完全成功",
"300",
"委托队列",
"待成交",
"400",
"已撤单",
"500",
"服务器撤单",
"/",
"每日结算"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAOrder.py#L593-L619 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/data_fq.py | _QA_data_stock_to_fq | def _QA_data_stock_to_fq(bfq_data, xdxr_data, fqtype):
'使用数据库数据进行复权'
info = xdxr_data.query('category==1')
bfq_data = bfq_data.assign(if_trade=1)
if len(info) > 0:
data = pd.concat(
[
bfq_data,
info.loc[bfq_data.index[0]:bfq_data.index[-1],
... | python | def _QA_data_stock_to_fq(bfq_data, xdxr_data, fqtype):
'使用数据库数据进行复权'
info = xdxr_data.query('category==1')
bfq_data = bfq_data.assign(if_trade=1)
if len(info) > 0:
data = pd.concat(
[
bfq_data,
info.loc[bfq_data.index[0]:bfq_data.index[-1],
... | [
"def",
"_QA_data_stock_to_fq",
"(",
"bfq_data",
",",
"xdxr_data",
",",
"fqtype",
")",
":",
"info",
"=",
"xdxr_data",
".",
"query",
"(",
"'category==1'",
")",
"bfq_data",
"=",
"bfq_data",
".",
"assign",
"(",
"if_trade",
"=",
"1",
")",
"if",
"len",
"(",
"i... | 使用数据库数据进行复权 | [
"使用数据库数据进行复权"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/data_fq.py#L102-L176 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/data_fq.py | QA_data_stock_to_fq | def QA_data_stock_to_fq(__data, type_='01'):
def __QA_fetch_stock_xdxr(
code,
format_='pd',
collections=DATABASE.stock_xdxr
):
'获取股票除权信息/数据库'
try:
data = pd.DataFrame(
[item for item in collections.find({'code': code})]
... | python | def QA_data_stock_to_fq(__data, type_='01'):
def __QA_fetch_stock_xdxr(
code,
format_='pd',
collections=DATABASE.stock_xdxr
):
'获取股票除权信息/数据库'
try:
data = pd.DataFrame(
[item for item in collections.find({'code': code})]
... | [
"def",
"QA_data_stock_to_fq",
"(",
"__data",
",",
"type_",
"=",
"'01'",
")",
":",
"def",
"__QA_fetch_stock_xdxr",
"(",
"code",
",",
"format_",
"=",
"'pd'",
",",
"collections",
"=",
"DATABASE",
".",
"stock_xdxr",
")",
":",
"'获取股票除权信息/数据库'",
"try",
":",
"data"... | 股票 日线/分钟线 动态复权接口 | [
"股票",
"日线",
"/",
"分钟线",
"动态复权接口"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/data_fq.py#L179-L228 | train |
gunthercox/ChatterBot | chatterbot/chatterbot.py | ChatBot.get_response | def get_response(self, statement=None, **kwargs):
"""
Return the bot's response based on the input.
:param statement: An statement object or string.
:returns: A response to the input.
:rtype: Statement
:param additional_response_selection_parameters: Parameters to pass ... | python | def get_response(self, statement=None, **kwargs):
"""
Return the bot's response based on the input.
:param statement: An statement object or string.
:returns: A response to the input.
:rtype: Statement
:param additional_response_selection_parameters: Parameters to pass ... | [
"def",
"get_response",
"(",
"self",
",",
"statement",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"Statement",
"=",
"self",
".",
"storage",
".",
"get_object",
"(",
"'statement'",
")",
"additional_response_selection_parameters",
"=",
"kwargs",
".",
"pop",
... | Return the bot's response based on the input.
:param statement: An statement object or string.
:returns: A response to the input.
:rtype: Statement
:param additional_response_selection_parameters: Parameters to pass to the
chat bot's logic adapters to control response selec... | [
"Return",
"the",
"bot",
"s",
"response",
"based",
"on",
"the",
"input",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/chatterbot.py#L57-L133 | train |
gunthercox/ChatterBot | chatterbot/chatterbot.py | ChatBot.generate_response | def generate_response(self, input_statement, additional_response_selection_parameters=None):
"""
Return a response based on a given input statement.
:param input_statement: The input statement to be processed.
"""
Statement = self.storage.get_object('statement')
results... | python | def generate_response(self, input_statement, additional_response_selection_parameters=None):
"""
Return a response based on a given input statement.
:param input_statement: The input statement to be processed.
"""
Statement = self.storage.get_object('statement')
results... | [
"def",
"generate_response",
"(",
"self",
",",
"input_statement",
",",
"additional_response_selection_parameters",
"=",
"None",
")",
":",
"Statement",
"=",
"self",
".",
"storage",
".",
"get_object",
"(",
"'statement'",
")",
"results",
"=",
"[",
"]",
"result",
"="... | Return a response based on a given input statement.
:param input_statement: The input statement to be processed. | [
"Return",
"a",
"response",
"based",
"on",
"a",
"given",
"input",
"statement",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/chatterbot.py#L135-L206 | train |
gunthercox/ChatterBot | chatterbot/chatterbot.py | ChatBot.learn_response | def learn_response(self, statement, previous_statement=None):
"""
Learn that the statement provided is a valid response.
"""
if not previous_statement:
previous_statement = statement.in_response_to
if not previous_statement:
previous_statement = self.get_... | python | def learn_response(self, statement, previous_statement=None):
"""
Learn that the statement provided is a valid response.
"""
if not previous_statement:
previous_statement = statement.in_response_to
if not previous_statement:
previous_statement = self.get_... | [
"def",
"learn_response",
"(",
"self",
",",
"statement",
",",
"previous_statement",
"=",
"None",
")",
":",
"if",
"not",
"previous_statement",
":",
"previous_statement",
"=",
"statement",
".",
"in_response_to",
"if",
"not",
"previous_statement",
":",
"previous_stateme... | Learn that the statement provided is a valid response. | [
"Learn",
"that",
"the",
"statement",
"provided",
"is",
"a",
"valid",
"response",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/chatterbot.py#L208-L233 | train |
gunthercox/ChatterBot | chatterbot/conversation.py | StatementMixin.serialize | def serialize(self):
"""
:returns: A dictionary representation of the statement object.
:rtype: dict
"""
data = {}
for field_name in self.get_statement_field_names():
format_method = getattr(self, 'get_{}'.format(
field_name
), Non... | python | def serialize(self):
"""
:returns: A dictionary representation of the statement object.
:rtype: dict
"""
data = {}
for field_name in self.get_statement_field_names():
format_method = getattr(self, 'get_{}'.format(
field_name
), Non... | [
"def",
"serialize",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"for",
"field_name",
"in",
"self",
".",
"get_statement_field_names",
"(",
")",
":",
"format_method",
"=",
"getattr",
"(",
"self",
",",
"'get_{}'",
".",
"format",
"(",
"field_name",
")",
",... | :returns: A dictionary representation of the statement object.
:rtype: dict | [
":",
"returns",
":",
"A",
"dictionary",
"representation",
"of",
"the",
"statement",
"object",
".",
":",
"rtype",
":",
"dict"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/conversation.py#L44-L61 | train |
gunthercox/ChatterBot | chatterbot/utils.py | import_module | def import_module(dotted_path):
"""
Imports the specified module based on the
dot notated import path for the module.
"""
import importlib
module_parts = dotted_path.split('.')
module_path = '.'.join(module_parts[:-1])
module = importlib.import_module(module_path)
return getattr(mo... | python | def import_module(dotted_path):
"""
Imports the specified module based on the
dot notated import path for the module.
"""
import importlib
module_parts = dotted_path.split('.')
module_path = '.'.join(module_parts[:-1])
module = importlib.import_module(module_path)
return getattr(mo... | [
"def",
"import_module",
"(",
"dotted_path",
")",
":",
"import",
"importlib",
"module_parts",
"=",
"dotted_path",
".",
"split",
"(",
"'.'",
")",
"module_path",
"=",
"'.'",
".",
"join",
"(",
"module_parts",
"[",
":",
"-",
"1",
"]",
")",
"module",
"=",
"imp... | Imports the specified module based on the
dot notated import path for the module. | [
"Imports",
"the",
"specified",
"module",
"based",
"on",
"the",
"dot",
"notated",
"import",
"path",
"for",
"the",
"module",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/utils.py#L6-L17 | train |
gunthercox/ChatterBot | chatterbot/utils.py | initialize_class | def initialize_class(data, *args, **kwargs):
"""
:param data: A string or dictionary containing a import_path attribute.
"""
if isinstance(data, dict):
import_path = data.get('import_path')
data.update(kwargs)
Class = import_module(import_path)
return Class(*args, **data... | python | def initialize_class(data, *args, **kwargs):
"""
:param data: A string or dictionary containing a import_path attribute.
"""
if isinstance(data, dict):
import_path = data.get('import_path')
data.update(kwargs)
Class = import_module(import_path)
return Class(*args, **data... | [
"def",
"initialize_class",
"(",
"data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"import_path",
"=",
"data",
".",
"get",
"(",
"'import_path'",
")",
"data",
".",
"update",
"(",
"kwarg... | :param data: A string or dictionary containing a import_path attribute. | [
":",
"param",
"data",
":",
"A",
"string",
"or",
"dictionary",
"containing",
"a",
"import_path",
"attribute",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/utils.py#L20-L33 | train |
gunthercox/ChatterBot | chatterbot/utils.py | validate_adapter_class | def validate_adapter_class(validate_class, adapter_class):
"""
Raises an exception if validate_class is not a
subclass of adapter_class.
:param validate_class: The class to be validated.
:type validate_class: class
:param adapter_class: The class type to check against.
:type adapter_class:... | python | def validate_adapter_class(validate_class, adapter_class):
"""
Raises an exception if validate_class is not a
subclass of adapter_class.
:param validate_class: The class to be validated.
:type validate_class: class
:param adapter_class: The class type to check against.
:type adapter_class:... | [
"def",
"validate_adapter_class",
"(",
"validate_class",
",",
"adapter_class",
")",
":",
"from",
"chatterbot",
".",
"adapters",
"import",
"Adapter",
"# If a dictionary was passed in, check if it has an import_path attribute",
"if",
"isinstance",
"(",
"validate_class",
",",
"di... | Raises an exception if validate_class is not a
subclass of adapter_class.
:param validate_class: The class to be validated.
:type validate_class: class
:param adapter_class: The class type to check against.
:type adapter_class: class
:raises: Adapter.InvalidAdapterTypeException | [
"Raises",
"an",
"exception",
"if",
"validate_class",
"is",
"not",
"a",
"subclass",
"of",
"adapter_class",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/utils.py#L36-L70 | train |
gunthercox/ChatterBot | chatterbot/utils.py | get_response_time | def get_response_time(chatbot, statement='Hello'):
"""
Returns the amount of time taken for a given
chat bot to return a response.
:param chatbot: A chat bot instance.
:type chatbot: ChatBot
:returns: The response time in seconds.
:rtype: float
"""
import time
start_time = tim... | python | def get_response_time(chatbot, statement='Hello'):
"""
Returns the amount of time taken for a given
chat bot to return a response.
:param chatbot: A chat bot instance.
:type chatbot: ChatBot
:returns: The response time in seconds.
:rtype: float
"""
import time
start_time = tim... | [
"def",
"get_response_time",
"(",
"chatbot",
",",
"statement",
"=",
"'Hello'",
")",
":",
"import",
"time",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"chatbot",
".",
"get_response",
"(",
"statement",
")",
"return",
"time",
".",
"time",
"(",
")",
"-... | Returns the amount of time taken for a given
chat bot to return a response.
:param chatbot: A chat bot instance.
:type chatbot: ChatBot
:returns: The response time in seconds.
:rtype: float | [
"Returns",
"the",
"amount",
"of",
"time",
"taken",
"for",
"a",
"given",
"chat",
"bot",
"to",
"return",
"a",
"response",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/utils.py#L73-L90 | train |
gunthercox/ChatterBot | chatterbot/utils.py | print_progress_bar | def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20):
"""
Print progress bar
:param description: Training description
:type description: str
:param iteration_counter: Incremental counter
:type iteration_counter: int
:param total_items: total number it... | python | def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20):
"""
Print progress bar
:param description: Training description
:type description: str
:param iteration_counter: Incremental counter
:type iteration_counter: int
:param total_items: total number it... | [
"def",
"print_progress_bar",
"(",
"description",
",",
"iteration_counter",
",",
"total_items",
",",
"progress_bar_length",
"=",
"20",
")",
":",
"import",
"sys",
"percent",
"=",
"float",
"(",
"iteration_counter",
")",
"/",
"total_items",
"hashes",
"=",
"'#'",
"*"... | Print progress bar
:param description: Training description
:type description: str
:param iteration_counter: Incremental counter
:type iteration_counter: int
:param total_items: total number items
:type total_items: int
:param progress_bar_length: Progress bar length
:type progress_ba... | [
"Print",
"progress",
"bar",
":",
"param",
"description",
":",
"Training",
"description",
":",
"type",
"description",
":",
"str"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/utils.py#L93-L119 | train |
gunthercox/ChatterBot | chatterbot/logic/unit_conversion.py | UnitConversion.get_unit | def get_unit(self, ureg, unit_variations):
"""
Get the first match unit metric object supported by pint library
given a variation of unit metric names (Ex:['HOUR', 'hour']).
:param ureg: unit registry which units are defined and handled
:type ureg: pint.registry.UnitRegistry obj... | python | def get_unit(self, ureg, unit_variations):
"""
Get the first match unit metric object supported by pint library
given a variation of unit metric names (Ex:['HOUR', 'hour']).
:param ureg: unit registry which units are defined and handled
:type ureg: pint.registry.UnitRegistry obj... | [
"def",
"get_unit",
"(",
"self",
",",
"ureg",
",",
"unit_variations",
")",
":",
"for",
"unit",
"in",
"unit_variations",
":",
"try",
":",
"return",
"getattr",
"(",
"ureg",
",",
"unit",
")",
"except",
"Exception",
":",
"continue",
"return",
"None"
] | Get the first match unit metric object supported by pint library
given a variation of unit metric names (Ex:['HOUR', 'hour']).
:param ureg: unit registry which units are defined and handled
:type ureg: pint.registry.UnitRegistry object
:param unit_variations: A list of strings with nam... | [
"Get",
"the",
"first",
"match",
"unit",
"metric",
"object",
"supported",
"by",
"pint",
"library",
"given",
"a",
"variation",
"of",
"unit",
"metric",
"names",
"(",
"Ex",
":",
"[",
"HOUR",
"hour",
"]",
")",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/unit_conversion.py#L67-L83 | train |
gunthercox/ChatterBot | chatterbot/logic/unit_conversion.py | UnitConversion.get_valid_units | def get_valid_units(self, ureg, from_unit, target_unit):
"""
Returns the firt match `pint.unit.Unit` object for from_unit and
target_unit strings from a possible variation of metric unit names
supported by pint library.
:param ureg: unit registry which units are defined and hand... | python | def get_valid_units(self, ureg, from_unit, target_unit):
"""
Returns the firt match `pint.unit.Unit` object for from_unit and
target_unit strings from a possible variation of metric unit names
supported by pint library.
:param ureg: unit registry which units are defined and hand... | [
"def",
"get_valid_units",
"(",
"self",
",",
"ureg",
",",
"from_unit",
",",
"target_unit",
")",
":",
"from_unit_variations",
"=",
"[",
"from_unit",
".",
"lower",
"(",
")",
",",
"from_unit",
".",
"upper",
"(",
")",
"]",
"target_unit_variations",
"=",
"[",
"t... | Returns the firt match `pint.unit.Unit` object for from_unit and
target_unit strings from a possible variation of metric unit names
supported by pint library.
:param ureg: unit registry which units are defined and handled
:type ureg: `pint.registry.UnitRegistry`
:param from_uni... | [
"Returns",
"the",
"firt",
"match",
"pint",
".",
"unit",
".",
"Unit",
"object",
"for",
"from_unit",
"and",
"target_unit",
"strings",
"from",
"a",
"possible",
"variation",
"of",
"metric",
"unit",
"names",
"supported",
"by",
"pint",
"library",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/unit_conversion.py#L85-L104 | train |
gunthercox/ChatterBot | chatterbot/logic/unit_conversion.py | UnitConversion.handle_matches | def handle_matches(self, match):
"""
Returns a response statement from a matched input statement.
:param match: It is a valid matched pattern from the input statement
:type: `_sre.SRE_Match`
"""
response = Statement(text='')
from_parsed = match.group("from")
... | python | def handle_matches(self, match):
"""
Returns a response statement from a matched input statement.
:param match: It is a valid matched pattern from the input statement
:type: `_sre.SRE_Match`
"""
response = Statement(text='')
from_parsed = match.group("from")
... | [
"def",
"handle_matches",
"(",
"self",
",",
"match",
")",
":",
"response",
"=",
"Statement",
"(",
"text",
"=",
"''",
")",
"from_parsed",
"=",
"match",
".",
"group",
"(",
"\"from\"",
")",
"target_parsed",
"=",
"match",
".",
"group",
"(",
"\"target\"",
")",... | Returns a response statement from a matched input statement.
:param match: It is a valid matched pattern from the input statement
:type: `_sre.SRE_Match` | [
"Returns",
"a",
"response",
"statement",
"from",
"a",
"matched",
"input",
"statement",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/unit_conversion.py#L106-L135 | train |
gunthercox/ChatterBot | chatterbot/logic/logic_adapter.py | LogicAdapter.get_default_response | def get_default_response(self, input_statement):
"""
This method is called when a logic adapter is unable to generate any
other meaningful response.
"""
from random import choice
if self.default_responses:
response = choice(self.default_responses)
els... | python | def get_default_response(self, input_statement):
"""
This method is called when a logic adapter is unable to generate any
other meaningful response.
"""
from random import choice
if self.default_responses:
response = choice(self.default_responses)
els... | [
"def",
"get_default_response",
"(",
"self",
",",
"input_statement",
")",
":",
"from",
"random",
"import",
"choice",
"if",
"self",
".",
"default_responses",
":",
"response",
"=",
"choice",
"(",
"self",
".",
"default_responses",
")",
"else",
":",
"try",
":",
"... | This method is called when a logic adapter is unable to generate any
other meaningful response. | [
"This",
"method",
"is",
"called",
"when",
"a",
"logic",
"adapter",
"is",
"unable",
"to",
"generate",
"any",
"other",
"meaningful",
"response",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/logic_adapter.py#L103-L125 | train |
gunthercox/ChatterBot | chatterbot/logic/time_adapter.py | TimeLogicAdapter.time_question_features | def time_question_features(self, text):
"""
Provide an analysis of significant features in the string.
"""
features = {}
# A list of all words from the known sentences
all_words = " ".join(self.positive + self.negative).split()
# A list of the first word in each... | python | def time_question_features(self, text):
"""
Provide an analysis of significant features in the string.
"""
features = {}
# A list of all words from the known sentences
all_words = " ".join(self.positive + self.negative).split()
# A list of the first word in each... | [
"def",
"time_question_features",
"(",
"self",
",",
"text",
")",
":",
"features",
"=",
"{",
"}",
"# A list of all words from the known sentences",
"all_words",
"=",
"\" \"",
".",
"join",
"(",
"self",
".",
"positive",
"+",
"self",
".",
"negative",
")",
".",
"spl... | Provide an analysis of significant features in the string. | [
"Provide",
"an",
"analysis",
"of",
"significant",
"features",
"in",
"the",
"string",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/time_adapter.py#L56-L82 | train |
gunthercox/ChatterBot | chatterbot/logic/mathematical_evaluation.py | MathematicalEvaluation.can_process | def can_process(self, statement):
"""
Determines whether it is appropriate for this
adapter to respond to the user input.
"""
response = self.process(statement)
self.cache[statement.text] = response
return response.confidence == 1 | python | def can_process(self, statement):
"""
Determines whether it is appropriate for this
adapter to respond to the user input.
"""
response = self.process(statement)
self.cache[statement.text] = response
return response.confidence == 1 | [
"def",
"can_process",
"(",
"self",
",",
"statement",
")",
":",
"response",
"=",
"self",
".",
"process",
"(",
"statement",
")",
"self",
".",
"cache",
"[",
"statement",
".",
"text",
"]",
"=",
"response",
"return",
"response",
".",
"confidence",
"==",
"1"
] | Determines whether it is appropriate for this
adapter to respond to the user input. | [
"Determines",
"whether",
"it",
"is",
"appropriate",
"for",
"this",
"adapter",
"to",
"respond",
"to",
"the",
"user",
"input",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/mathematical_evaluation.py#L28-L35 | train |
gunthercox/ChatterBot | chatterbot/logic/mathematical_evaluation.py | MathematicalEvaluation.process | def process(self, statement, additional_response_selection_parameters=None):
"""
Takes a statement string.
Returns the equation from the statement with the mathematical terms solved.
"""
from mathparse import mathparse
input_text = statement.text
# Use the resul... | python | def process(self, statement, additional_response_selection_parameters=None):
"""
Takes a statement string.
Returns the equation from the statement with the mathematical terms solved.
"""
from mathparse import mathparse
input_text = statement.text
# Use the resul... | [
"def",
"process",
"(",
"self",
",",
"statement",
",",
"additional_response_selection_parameters",
"=",
"None",
")",
":",
"from",
"mathparse",
"import",
"mathparse",
"input_text",
"=",
"statement",
".",
"text",
"# Use the result cached by the process method if it exists",
... | Takes a statement string.
Returns the equation from the statement with the mathematical terms solved. | [
"Takes",
"a",
"statement",
"string",
".",
"Returns",
"the",
"equation",
"from",
"the",
"statement",
"with",
"the",
"mathematical",
"terms",
"solved",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/logic/mathematical_evaluation.py#L37-L67 | train |
gunthercox/ChatterBot | chatterbot/filters.py | get_recent_repeated_responses | def get_recent_repeated_responses(chatbot, conversation, sample=10, threshold=3, quantity=3):
"""
A filter that eliminates possibly repetitive responses to prevent
a chat bot from repeating statements that it has recently said.
"""
from collections import Counter
# Get the most recent statement... | python | def get_recent_repeated_responses(chatbot, conversation, sample=10, threshold=3, quantity=3):
"""
A filter that eliminates possibly repetitive responses to prevent
a chat bot from repeating statements that it has recently said.
"""
from collections import Counter
# Get the most recent statement... | [
"def",
"get_recent_repeated_responses",
"(",
"chatbot",
",",
"conversation",
",",
"sample",
"=",
"10",
",",
"threshold",
"=",
"3",
",",
"quantity",
"=",
"3",
")",
":",
"from",
"collections",
"import",
"Counter",
"# Get the most recent statements from the conversation"... | A filter that eliminates possibly repetitive responses to prevent
a chat bot from repeating statements that it has recently said. | [
"A",
"filter",
"that",
"eliminates",
"possibly",
"repetitive",
"responses",
"to",
"prevent",
"a",
"chat",
"bot",
"from",
"repeating",
"statements",
"that",
"it",
"has",
"recently",
"said",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/filters.py#L1-L26 | train |
gunthercox/ChatterBot | chatterbot/response_selection.py | get_most_frequent_response | def get_most_frequent_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: li... | python | def get_most_frequent_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: li... | [
"def",
"get_most_frequent_response",
"(",
"input_statement",
",",
"response_list",
",",
"storage",
"=",
"None",
")",
":",
"matching_response",
"=",
"None",
"occurrence_count",
"=",
"-",
"1",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logg... | :param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
:param storage: An instance of a storage adapter to allow the response selection
... | [
":",
"param",
"input_statement",
":",
"A",
"statement",
"that",
"closely",
"matches",
"an",
"input",
"to",
"the",
"chat",
"bot",
".",
":",
"type",
"input_statement",
":",
"Statement"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/response_selection.py#L8-L41 | train |
gunthercox/ChatterBot | chatterbot/response_selection.py | get_first_response | def get_first_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
... | python | def get_first_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
... | [
"def",
"get_first_response",
"(",
"input_statement",
",",
"response_list",
",",
"storage",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"info",
"(",
"'Selecting first response from list of {} options.'",
"."... | :param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
:param storage: An instance of a storage adapter to allow the response selection
... | [
":",
"param",
"input_statement",
":",
"A",
"statement",
"that",
"closely",
"matches",
"an",
"input",
"to",
"the",
"chat",
"bot",
".",
":",
"type",
"input_statement",
":",
"Statement"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/response_selection.py#L44-L63 | train |
gunthercox/ChatterBot | chatterbot/response_selection.py | get_random_response | def get_random_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
... | python | def get_random_response(input_statement, response_list, storage=None):
"""
:param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
... | [
"def",
"get_random_response",
"(",
"input_statement",
",",
"response_list",
",",
"storage",
"=",
"None",
")",
":",
"from",
"random",
"import",
"choice",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"info",
"(",
"'Selecting a... | :param input_statement: A statement, that closely matches an input to the chat bot.
:type input_statement: Statement
:param response_list: A list of statement options to choose a response from.
:type response_list: list
:param storage: An instance of a storage adapter to allow the response selection
... | [
":",
"param",
"input_statement",
":",
"A",
"statement",
"that",
"closely",
"matches",
"an",
"input",
"to",
"the",
"chat",
"bot",
".",
":",
"type",
"input_statement",
":",
"Statement"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/response_selection.py#L66-L86 | train |
gunthercox/ChatterBot | chatterbot/comparisons.py | LevenshteinDistance.compare | def compare(self, statement_a, statement_b):
"""
Compare the two input statements.
:return: The percent of similarity between the text of the statements.
:rtype: float
"""
# Return 0 if either statement has a falsy text value
if not statement_a.text or not state... | python | def compare(self, statement_a, statement_b):
"""
Compare the two input statements.
:return: The percent of similarity between the text of the statements.
:rtype: float
"""
# Return 0 if either statement has a falsy text value
if not statement_a.text or not state... | [
"def",
"compare",
"(",
"self",
",",
"statement_a",
",",
"statement_b",
")",
":",
"# Return 0 if either statement has a falsy text value",
"if",
"not",
"statement_a",
".",
"text",
"or",
"not",
"statement_b",
".",
"text",
":",
"return",
"0",
"# Get the lowercase version... | Compare the two input statements.
:return: The percent of similarity between the text of the statements.
:rtype: float | [
"Compare",
"the",
"two",
"input",
"statements",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/comparisons.py#L32-L57 | train |
gunthercox/ChatterBot | chatterbot/comparisons.py | SpacySimilarity.compare | def compare(self, statement_a, statement_b):
"""
Compare the two input statements.
:return: The percent of similarity between the closest synset distance.
:rtype: float
"""
document_a = self.nlp(statement_a.text)
document_b = self.nlp(statement_b.text)
r... | python | def compare(self, statement_a, statement_b):
"""
Compare the two input statements.
:return: The percent of similarity between the closest synset distance.
:rtype: float
"""
document_a = self.nlp(statement_a.text)
document_b = self.nlp(statement_b.text)
r... | [
"def",
"compare",
"(",
"self",
",",
"statement_a",
",",
"statement_b",
")",
":",
"document_a",
"=",
"self",
".",
"nlp",
"(",
"statement_a",
".",
"text",
")",
"document_b",
"=",
"self",
".",
"nlp",
"(",
"statement_b",
".",
"text",
")",
"return",
"document... | Compare the two input statements.
:return: The percent of similarity between the closest synset distance.
:rtype: float | [
"Compare",
"the",
"two",
"input",
"statements",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/comparisons.py#L70-L80 | train |
gunthercox/ChatterBot | chatterbot/comparisons.py | JaccardSimilarity.compare | def compare(self, statement_a, statement_b):
"""
Return the calculated similarity of two
statements based on the Jaccard index.
"""
# Make both strings lowercase
document_a = self.nlp(statement_a.text.lower())
document_b = self.nlp(statement_b.text.lower())
... | python | def compare(self, statement_a, statement_b):
"""
Return the calculated similarity of two
statements based on the Jaccard index.
"""
# Make both strings lowercase
document_a = self.nlp(statement_a.text.lower())
document_b = self.nlp(statement_b.text.lower())
... | [
"def",
"compare",
"(",
"self",
",",
"statement_a",
",",
"statement_b",
")",
":",
"# Make both strings lowercase",
"document_a",
"=",
"self",
".",
"nlp",
"(",
"statement_a",
".",
"text",
".",
"lower",
"(",
")",
")",
"document_b",
"=",
"self",
".",
"nlp",
"(... | Return the calculated similarity of two
statements based on the Jaccard index. | [
"Return",
"the",
"calculated",
"similarity",
"of",
"two",
"statements",
"based",
"on",
"the",
"Jaccard",
"index",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/comparisons.py#L114-L135 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.get_statement_model | def get_statement_model(self):
"""
Return the class for the statement model.
"""
from chatterbot.conversation import Statement
# Create a storage-aware statement
statement = Statement
statement.storage = self
return statement | python | def get_statement_model(self):
"""
Return the class for the statement model.
"""
from chatterbot.conversation import Statement
# Create a storage-aware statement
statement = Statement
statement.storage = self
return statement | [
"def",
"get_statement_model",
"(",
"self",
")",
":",
"from",
"chatterbot",
".",
"conversation",
"import",
"Statement",
"# Create a storage-aware statement",
"statement",
"=",
"Statement",
"statement",
".",
"storage",
"=",
"self",
"return",
"statement"
] | Return the class for the statement model. | [
"Return",
"the",
"class",
"for",
"the",
"statement",
"model",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L44-L54 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.mongo_to_object | def mongo_to_object(self, statement_data):
"""
Return Statement object when given data
returned from Mongo DB.
"""
Statement = self.get_model('statement')
statement_data['id'] = statement_data['_id']
return Statement(**statement_data) | python | def mongo_to_object(self, statement_data):
"""
Return Statement object when given data
returned from Mongo DB.
"""
Statement = self.get_model('statement')
statement_data['id'] = statement_data['_id']
return Statement(**statement_data) | [
"def",
"mongo_to_object",
"(",
"self",
",",
"statement_data",
")",
":",
"Statement",
"=",
"self",
".",
"get_model",
"(",
"'statement'",
")",
"statement_data",
"[",
"'id'",
"]",
"=",
"statement_data",
"[",
"'_id'",
"]",
"return",
"Statement",
"(",
"*",
"*",
... | Return Statement object when given data
returned from Mongo DB. | [
"Return",
"Statement",
"object",
"when",
"given",
"data",
"returned",
"from",
"Mongo",
"DB",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L59-L68 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.filter | def filter(self, **kwargs):
"""
Returns a list of statements in the database
that match the parameters specified.
"""
import pymongo
page_size = kwargs.pop('page_size', 1000)
order_by = kwargs.pop('order_by', None)
tags = kwargs.pop('tags', [])
ex... | python | def filter(self, **kwargs):
"""
Returns a list of statements in the database
that match the parameters specified.
"""
import pymongo
page_size = kwargs.pop('page_size', 1000)
order_by = kwargs.pop('order_by', None)
tags = kwargs.pop('tags', [])
ex... | [
"def",
"filter",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"pymongo",
"page_size",
"=",
"kwargs",
".",
"pop",
"(",
"'page_size'",
",",
"1000",
")",
"order_by",
"=",
"kwargs",
".",
"pop",
"(",
"'order_by'",
",",
"None",
")",
"tags",
"=... | Returns a list of statements in the database
that match the parameters specified. | [
"Returns",
"a",
"list",
"of",
"statements",
"in",
"the",
"database",
"that",
"match",
"the",
"parameters",
"specified",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L70-L149 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.create | def create(self, **kwargs):
"""
Creates a new statement matching the keyword arguments specified.
Returns the created statement.
"""
Statement = self.get_model('statement')
if 'tags' in kwargs:
kwargs['tags'] = list(set(kwargs['tags']))
if 'search_te... | python | def create(self, **kwargs):
"""
Creates a new statement matching the keyword arguments specified.
Returns the created statement.
"""
Statement = self.get_model('statement')
if 'tags' in kwargs:
kwargs['tags'] = list(set(kwargs['tags']))
if 'search_te... | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"Statement",
"=",
"self",
".",
"get_model",
"(",
"'statement'",
")",
"if",
"'tags'",
"in",
"kwargs",
":",
"kwargs",
"[",
"'tags'",
"]",
"=",
"list",
"(",
"set",
"(",
"kwargs",
"[",
"'... | Creates a new statement matching the keyword arguments specified.
Returns the created statement. | [
"Creates",
"a",
"new",
"statement",
"matching",
"the",
"keyword",
"arguments",
"specified",
".",
"Returns",
"the",
"created",
"statement",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L151-L172 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.create_many | def create_many(self, statements):
"""
Creates multiple statement entries.
"""
create_statements = []
for statement in statements:
statement_data = statement.serialize()
tag_data = list(set(statement_data.pop('tags', [])))
statement_data['tags... | python | def create_many(self, statements):
"""
Creates multiple statement entries.
"""
create_statements = []
for statement in statements:
statement_data = statement.serialize()
tag_data = list(set(statement_data.pop('tags', [])))
statement_data['tags... | [
"def",
"create_many",
"(",
"self",
",",
"statements",
")",
":",
"create_statements",
"=",
"[",
"]",
"for",
"statement",
"in",
"statements",
":",
"statement_data",
"=",
"statement",
".",
"serialize",
"(",
")",
"tag_data",
"=",
"list",
"(",
"set",
"(",
"stat... | Creates multiple statement entries. | [
"Creates",
"multiple",
"statement",
"entries",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L174-L193 | train |
gunthercox/ChatterBot | chatterbot/storage/mongodb.py | MongoDatabaseAdapter.get_random | def get_random(self):
"""
Returns a random statement from the database
"""
from random import randint
count = self.count()
if count < 1:
raise self.EmptyDatabaseException()
random_integer = randint(0, count - 1)
statements = self.statements... | python | def get_random(self):
"""
Returns a random statement from the database
"""
from random import randint
count = self.count()
if count < 1:
raise self.EmptyDatabaseException()
random_integer = randint(0, count - 1)
statements = self.statements... | [
"def",
"get_random",
"(",
"self",
")",
":",
"from",
"random",
"import",
"randint",
"count",
"=",
"self",
".",
"count",
"(",
")",
"if",
"count",
"<",
"1",
":",
"raise",
"self",
".",
"EmptyDatabaseException",
"(",
")",
"random_integer",
"=",
"randint",
"("... | Returns a random statement from the database | [
"Returns",
"a",
"random",
"statement",
"from",
"the",
"database"
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/mongodb.py#L235-L250 | train |
gunthercox/ChatterBot | chatterbot/ext/sqlalchemy_app/models.py | Statement.add_tags | def add_tags(self, *tags):
"""
Add a list of strings to the statement as tags.
"""
self.tags.extend([
Tag(name=tag) for tag in tags
]) | python | def add_tags(self, *tags):
"""
Add a list of strings to the statement as tags.
"""
self.tags.extend([
Tag(name=tag) for tag in tags
]) | [
"def",
"add_tags",
"(",
"self",
",",
"*",
"tags",
")",
":",
"self",
".",
"tags",
".",
"extend",
"(",
"[",
"Tag",
"(",
"name",
"=",
"tag",
")",
"for",
"tag",
"in",
"tags",
"]",
")"
] | Add a list of strings to the statement as tags. | [
"Add",
"a",
"list",
"of",
"strings",
"to",
"the",
"statement",
"as",
"tags",
"."
] | 1a03dcb45cba7bdc24d3db5e750582e0cb1518e2 | https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/ext/sqlalchemy_app/models.py#L108-L114 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.