repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.market_value | def market_value(self):
"""每日每个股票持仓市值表
Returns:
pd.DataFrame -- 市值表
"""
if self.account.daily_hold is not None:
if self.if_fq:
return (
self.market_data.to_qfq().pivot('close').fillna(
method='ffill'
... | python | def market_value(self):
"""每日每个股票持仓市值表
Returns:
pd.DataFrame -- 市值表
"""
if self.account.daily_hold is not None:
if self.if_fq:
return (
self.market_data.to_qfq().pivot('close').fillna(
method='ffill'
... | [
"def",
"market_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"account",
".",
"daily_hold",
"is",
"not",
"None",
":",
"if",
"self",
".",
"if_fq",
":",
"return",
"(",
"self",
".",
"market_data",
".",
"to_qfq",
"(",
")",
".",
"pivot",
"(",
"'close'"... | 每日每个股票持仓市值表
Returns:
pd.DataFrame -- 市值表 | [
"每日每个股票持仓市值表"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L212-L232 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.max_dropback | def max_dropback(self):
"""最大回撤
"""
return round(
float(
max(
[
(self.assets.iloc[idx] - self.assets.iloc[idx::].min())
/ self.assets.iloc[idx]
for idx in range(len(self.assets... | python | def max_dropback(self):
"""最大回撤
"""
return round(
float(
max(
[
(self.assets.iloc[idx] - self.assets.iloc[idx::].min())
/ self.assets.iloc[idx]
for idx in range(len(self.assets... | [
"def",
"max_dropback",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"max",
"(",
"[",
"(",
"self",
".",
"assets",
".",
"iloc",
"[",
"idx",
"]",
"-",
"self",
".",
"assets",
".",
"iloc",
"[",
"idx",
":",
":",
"]",
".",
"min",
"(",
... | 最大回撤 | [
"最大回撤"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L252-L266 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.total_commission | def total_commission(self):
"""总手续费
"""
return float(
-abs(round(self.account.history_table.commission.sum(),
2))
) | python | def total_commission(self):
"""总手续费
"""
return float(
-abs(round(self.account.history_table.commission.sum(),
2))
) | [
"def",
"total_commission",
"(",
"self",
")",
":",
"return",
"float",
"(",
"-",
"abs",
"(",
"round",
"(",
"self",
".",
"account",
".",
"history_table",
".",
"commission",
".",
"sum",
"(",
")",
",",
"2",
")",
")",
")"
] | 总手续费 | [
"总手续费"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L269-L275 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.total_tax | def total_tax(self):
"""总印花税
"""
return float(-abs(round(self.account.history_table.tax.sum(), 2))) | python | def total_tax(self):
"""总印花税
"""
return float(-abs(round(self.account.history_table.tax.sum(), 2))) | [
"def",
"total_tax",
"(",
"self",
")",
":",
"return",
"float",
"(",
"-",
"abs",
"(",
"round",
"(",
"self",
".",
"account",
".",
"history_table",
".",
"tax",
".",
"sum",
"(",
")",
",",
"2",
")",
")",
")"
] | 总印花税 | [
"总印花税"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L278-L283 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.profit_construct | def profit_construct(self):
"""利润构成
Returns:
dict -- 利润构成表
"""
return {
'total_buyandsell':
round(
self.profit_money - self.total_commission - self.total_tax,
2
),
'total_tax':
self.... | python | def profit_construct(self):
"""利润构成
Returns:
dict -- 利润构成表
"""
return {
'total_buyandsell':
round(
self.profit_money - self.total_commission - self.total_tax,
2
),
'total_tax':
self.... | [
"def",
"profit_construct",
"(",
"self",
")",
":",
"return",
"{",
"'total_buyandsell'",
":",
"round",
"(",
"self",
".",
"profit_money",
"-",
"self",
".",
"total_commission",
"-",
"self",
".",
"total_tax",
",",
"2",
")",
",",
"'total_tax'",
":",
"self",
".",... | 利润构成
Returns:
dict -- 利润构成表 | [
"利润构成"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L286-L305 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.profit_money | def profit_money(self):
"""盈利额
Returns:
[type] -- [description]
"""
return float(round(self.assets.iloc[-1] - self.assets.iloc[0], 2)) | python | def profit_money(self):
"""盈利额
Returns:
[type] -- [description]
"""
return float(round(self.assets.iloc[-1] - self.assets.iloc[0], 2)) | [
"def",
"profit_money",
"(",
"self",
")",
":",
"return",
"float",
"(",
"round",
"(",
"self",
".",
"assets",
".",
"iloc",
"[",
"-",
"1",
"]",
"-",
"self",
".",
"assets",
".",
"iloc",
"[",
"0",
"]",
",",
"2",
")",
")"
] | 盈利额
Returns:
[type] -- [description] | [
"盈利额"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L308-L315 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.annualize_return | def annualize_return(self):
"""年化收益
Returns:
[type] -- [description]
"""
return round(
float(self.calc_annualize_return(self.assets,
self.time_gap)),
2
) | python | def annualize_return(self):
"""年化收益
Returns:
[type] -- [description]
"""
return round(
float(self.calc_annualize_return(self.assets,
self.time_gap)),
2
) | [
"def",
"annualize_return",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"self",
".",
"calc_annualize_return",
"(",
"self",
".",
"assets",
",",
"self",
".",
"time_gap",
")",
")",
",",
"2",
")"
] | 年化收益
Returns:
[type] -- [description] | [
"年化收益"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L334-L345 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.benchmark_data | def benchmark_data(self):
"""
基准组合的行情数据(一般是组合,可以调整)
"""
return self.fetch[self.benchmark_type](
self.benchmark_code,
self.account.start_date,
self.account.end_date
) | python | def benchmark_data(self):
"""
基准组合的行情数据(一般是组合,可以调整)
"""
return self.fetch[self.benchmark_type](
self.benchmark_code,
self.account.start_date,
self.account.end_date
) | [
"def",
"benchmark_data",
"(",
"self",
")",
":",
"return",
"self",
".",
"fetch",
"[",
"self",
".",
"benchmark_type",
"]",
"(",
"self",
".",
"benchmark_code",
",",
"self",
".",
"account",
".",
"start_date",
",",
"self",
".",
"account",
".",
"end_date",
")"... | 基准组合的行情数据(一般是组合,可以调整) | [
"基准组合的行情数据",
"(",
"一般是组合",
"可以调整",
")"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L396-L404 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.benchmark_assets | def benchmark_assets(self):
"""
基准组合的账户资产队列
"""
return (
self.benchmark_data.close /
float(self.benchmark_data.close.iloc[0])
* float(self.assets[0])
) | python | def benchmark_assets(self):
"""
基准组合的账户资产队列
"""
return (
self.benchmark_data.close /
float(self.benchmark_data.close.iloc[0])
* float(self.assets[0])
) | [
"def",
"benchmark_assets",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"benchmark_data",
".",
"close",
"/",
"float",
"(",
"self",
".",
"benchmark_data",
".",
"close",
".",
"iloc",
"[",
"0",
"]",
")",
"*",
"float",
"(",
"self",
".",
"assets",
"... | 基准组合的账户资产队列 | [
"基准组合的账户资产队列"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L407-L415 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.benchmark_annualize_return | def benchmark_annualize_return(self):
"""基准组合的年化收益
Returns:
[type] -- [description]
"""
return round(
float(
self.calc_annualize_return(
self.benchmark_assets,
self.time_gap
)
),... | python | def benchmark_annualize_return(self):
"""基准组合的年化收益
Returns:
[type] -- [description]
"""
return round(
float(
self.calc_annualize_return(
self.benchmark_assets,
self.time_gap
)
),... | [
"def",
"benchmark_annualize_return",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"self",
".",
"calc_annualize_return",
"(",
"self",
".",
"benchmark_assets",
",",
"self",
".",
"time_gap",
")",
")",
",",
"2",
")"
] | 基准组合的年化收益
Returns:
[type] -- [description] | [
"基准组合的年化收益"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L425-L440 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.beta | def beta(self):
"""
beta比率 组合的系统性风险
"""
try:
res = round(
float(
self.calc_beta(
self.profit_pct.dropna(),
self.benchmark_profitpct.dropna()
)
),
... | python | def beta(self):
"""
beta比率 组合的系统性风险
"""
try:
res = round(
float(
self.calc_beta(
self.profit_pct.dropna(),
self.benchmark_profitpct.dropna()
)
),
... | [
"def",
"beta",
"(",
"self",
")",
":",
"try",
":",
"res",
"=",
"round",
"(",
"float",
"(",
"self",
".",
"calc_beta",
"(",
"self",
".",
"profit_pct",
".",
"dropna",
"(",
")",
",",
"self",
".",
"benchmark_profitpct",
".",
"dropna",
"(",
")",
")",
")",... | beta比率 组合的系统性风险 | [
"beta比率",
"组合的系统性风险"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L450-L468 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.alpha | def alpha(self):
"""
alpha比率 与市场基准收益无关的超额收益率
"""
return round(
float(
self.calc_alpha(
self.annualize_return,
self.benchmark_annualize_return,
self.beta,
0.05
)
... | python | def alpha(self):
"""
alpha比率 与市场基准收益无关的超额收益率
"""
return round(
float(
self.calc_alpha(
self.annualize_return,
self.benchmark_annualize_return,
self.beta,
0.05
)
... | [
"def",
"alpha",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"self",
".",
"calc_alpha",
"(",
"self",
".",
"annualize_return",
",",
"self",
".",
"benchmark_annualize_return",
",",
"self",
".",
"beta",
",",
"0.05",
")",
")",
",",
"2",
")"... | alpha比率 与市场基准收益无关的超额收益率 | [
"alpha比率",
"与市场基准收益无关的超额收益率"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L471-L485 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.sharpe | def sharpe(self):
"""
夏普比率
"""
return round(
float(
self.calc_sharpe(self.annualize_return,
self.volatility,
0.05)
),
2
) | python | def sharpe(self):
"""
夏普比率
"""
return round(
float(
self.calc_sharpe(self.annualize_return,
self.volatility,
0.05)
),
2
) | [
"def",
"sharpe",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"self",
".",
"calc_sharpe",
"(",
"self",
".",
"annualize_return",
",",
"self",
".",
"volatility",
",",
"0.05",
")",
")",
",",
"2",
")"
] | 夏普比率 | [
"夏普比率"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L488-L500 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.plot_assets_curve | def plot_assets_curve(self, length=14, height=12):
"""
资金曲线叠加图
@Roy T.Burns 2018/05/29 修改百分比显示错误
"""
plt.style.use('ggplot')
plt.figure(figsize=(length, height))
plt.subplot(211)
plt.title('BASIC INFO', fontsize=12)
plt.axis([0, length, 0, 0.6])
... | python | def plot_assets_curve(self, length=14, height=12):
"""
资金曲线叠加图
@Roy T.Burns 2018/05/29 修改百分比显示错误
"""
plt.style.use('ggplot')
plt.figure(figsize=(length, height))
plt.subplot(211)
plt.title('BASIC INFO', fontsize=12)
plt.axis([0, length, 0, 0.6])
... | [
"def",
"plot_assets_curve",
"(",
"self",
",",
"length",
"=",
"14",
",",
"height",
"=",
"12",
")",
":",
"plt",
".",
"style",
".",
"use",
"(",
"'ggplot'",
")",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"length",
",",
"height",
")",
")",
"plt",
... | 资金曲线叠加图
@Roy T.Burns 2018/05/29 修改百分比显示错误 | [
"资金曲线叠加图"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L643-L733 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Risk.plot_signal | def plot_signal(self, start=None, end=None):
"""
使用热力图画出买卖信号
"""
start = self.account.start_date if start is None else start
end = self.account.end_date if end is None else end
_, ax = plt.subplots(figsize=(20, 18))
sns.heatmap(
self.account.trade.rese... | python | def plot_signal(self, start=None, end=None):
"""
使用热力图画出买卖信号
"""
start = self.account.start_date if start is None else start
end = self.account.end_date if end is None else end
_, ax = plt.subplots(figsize=(20, 18))
sns.heatmap(
self.account.trade.rese... | [
"def",
"plot_signal",
"(",
"self",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"start",
"=",
"self",
".",
"account",
".",
"start_date",
"if",
"start",
"is",
"None",
"else",
"start",
"end",
"=",
"self",
".",
"account",
".",
"end_date... | 使用热力图画出买卖信号 | [
"使用热力图画出买卖信号"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L775-L796 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Performance.pnl_lifo | def pnl_lifo(self):
"""
使用后进先出法配对成交记录
"""
X = dict(
zip(
self.target.code,
[LifoQueue() for i in range(len(self.target.code))]
)
)
pair_table = []
for _, data in self.target.history_table_min.iterrows():
... | python | def pnl_lifo(self):
"""
使用后进先出法配对成交记录
"""
X = dict(
zip(
self.target.code,
[LifoQueue() for i in range(len(self.target.code))]
)
)
pair_table = []
for _, data in self.target.history_table_min.iterrows():
... | [
"def",
"pnl_lifo",
"(",
"self",
")",
":",
"X",
"=",
"dict",
"(",
"zip",
"(",
"self",
".",
"target",
".",
"code",
",",
"[",
"LifoQueue",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"target",
".",
"code",
")",
")",
"]",
"... | 使用后进先出法配对成交记录 | [
"使用后进先出法配对成交记录"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L1015-L1155 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Performance.plot_pnlratio | def plot_pnlratio(self):
"""
画出pnl比率散点图
"""
plt.scatter(x=self.pnl.sell_date.apply(str), y=self.pnl.pnl_ratio)
plt.gcf().autofmt_xdate()
return plt | python | def plot_pnlratio(self):
"""
画出pnl比率散点图
"""
plt.scatter(x=self.pnl.sell_date.apply(str), y=self.pnl.pnl_ratio)
plt.gcf().autofmt_xdate()
return plt | [
"def",
"plot_pnlratio",
"(",
"self",
")",
":",
"plt",
".",
"scatter",
"(",
"x",
"=",
"self",
".",
"pnl",
".",
"sell_date",
".",
"apply",
"(",
"str",
")",
",",
"y",
"=",
"self",
".",
"pnl",
".",
"pnl_ratio",
")",
"plt",
".",
"gcf",
"(",
")",
"."... | 画出pnl比率散点图 | [
"画出pnl比率散点图"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L1313-L1320 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Performance.plot_pnlmoney | def plot_pnlmoney(self):
"""
画出pnl盈亏额散点图
"""
plt.scatter(x=self.pnl.sell_date.apply(str), y=self.pnl.pnl_money)
plt.gcf().autofmt_xdate()
return plt | python | def plot_pnlmoney(self):
"""
画出pnl盈亏额散点图
"""
plt.scatter(x=self.pnl.sell_date.apply(str), y=self.pnl.pnl_money)
plt.gcf().autofmt_xdate()
return plt | [
"def",
"plot_pnlmoney",
"(",
"self",
")",
":",
"plt",
".",
"scatter",
"(",
"x",
"=",
"self",
".",
"pnl",
".",
"sell_date",
".",
"apply",
"(",
"str",
")",
",",
"y",
"=",
"self",
".",
"pnl",
".",
"pnl_money",
")",
"plt",
".",
"gcf",
"(",
")",
"."... | 画出pnl盈亏额散点图 | [
"画出pnl盈亏额散点图"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L1322-L1328 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAARP/QARisk.py | QA_Performance.win_rate | def win_rate(self):
"""胜率
胜率
盈利次数/总次数
"""
data = self.pnl
try:
return round(len(data.query('pnl_money>0')) / len(data), 2)
except ZeroDivisionError:
return 0 | python | def win_rate(self):
"""胜率
胜率
盈利次数/总次数
"""
data = self.pnl
try:
return round(len(data.query('pnl_money>0')) / len(data), 2)
except ZeroDivisionError:
return 0 | [
"def",
"win_rate",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"pnl",
"try",
":",
"return",
"round",
"(",
"len",
"(",
"data",
".",
"query",
"(",
"'pnl_money>0'",
")",
")",
"/",
"len",
"(",
"data",
")",
",",
"2",
")",
"except",
"ZeroDivisionErr... | 胜率
胜率
盈利次数/总次数 | [
"胜率"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L1346-L1356 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASetting/crontab.py | CronTabItem.next_time | def next_time(self, asc=False):
"""Get the local time of the next schedule time this job will run.
:param bool asc: Format the result with ``time.asctime()``
:returns: The epoch time or string representation of the epoch time that
the job should be run next
"""
_time ... | python | def next_time(self, asc=False):
"""Get the local time of the next schedule time this job will run.
:param bool asc: Format the result with ``time.asctime()``
:returns: The epoch time or string representation of the epoch time that
the job should be run next
"""
_time ... | [
"def",
"next_time",
"(",
"self",
",",
"asc",
"=",
"False",
")",
":",
"_time",
"=",
"time",
".",
"localtime",
"(",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"next",
"(",
")",
")",
"if",
"asc",
":",
"return",
"time",
".",
"asctime",
"(",
"... | Get the local time of the next schedule time this job will run.
:param bool asc: Format the result with ``time.asctime()``
:returns: The epoch time or string representation of the epoch time that
the job should be run next | [
"Get",
"the",
"local",
"time",
"of",
"the",
"next",
"schedule",
"time",
"this",
"job",
"will",
"run",
".",
":",
"param",
"bool",
"asc",
":",
"Format",
"the",
"result",
"with",
"time",
".",
"asctime",
"()",
":",
"returns",
":",
"The",
"epoch",
"time",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASetting/crontab.py#L51-L62 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/__init__.py | QA_fetch_get_future_transaction_realtime | def QA_fetch_get_future_transaction_realtime(package, code):
"""
期货实时tick
"""
Engine = use(package)
if package in ['tdx', 'pytdx']:
return Engine.QA_fetch_get_future_transaction_realtime(code)
else:
return 'Unsupport packages' | python | def QA_fetch_get_future_transaction_realtime(package, code):
"""
期货实时tick
"""
Engine = use(package)
if package in ['tdx', 'pytdx']:
return Engine.QA_fetch_get_future_transaction_realtime(code)
else:
return 'Unsupport packages' | [
"def",
"QA_fetch_get_future_transaction_realtime",
"(",
"package",
",",
"code",
")",
":",
"Engine",
"=",
"use",
"(",
"package",
")",
"if",
"package",
"in",
"[",
"'tdx'",
",",
"'pytdx'",
"]",
":",
"return",
"Engine",
".",
"QA_fetch_get_future_transaction_realtime",... | 期货实时tick | [
"期货实时tick"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/__init__.py#L272-L280 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_MA | def QA_indicator_MA(DataFrame,*args,**kwargs):
"""MA
Arguments:
DataFrame {[type]} -- [description]
Returns:
[type] -- [description]
"""
CLOSE = DataFrame['close']
return pd.DataFrame({'MA{}'.format(N): MA(CLOSE, N) for N in list(args)}) | python | def QA_indicator_MA(DataFrame,*args,**kwargs):
"""MA
Arguments:
DataFrame {[type]} -- [description]
Returns:
[type] -- [description]
"""
CLOSE = DataFrame['close']
return pd.DataFrame({'MA{}'.format(N): MA(CLOSE, N) for N in list(args)}) | [
"def",
"QA_indicator_MA",
"(",
"DataFrame",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"return",
"pd",
".",
"DataFrame",
"(",
"{",
"'MA{}'",
".",
"format",
"(",
"N",
")",
":",
"MA",
"(",
"CL... | MA
Arguments:
DataFrame {[type]} -- [description]
Returns:
[type] -- [description] | [
"MA",
"Arguments",
":",
"DataFrame",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"Returns",
":",
"[",
"type",
"]",
"--",
"[",
"description",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L58-L69 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_MACD | def QA_indicator_MACD(DataFrame, short=12, long=26, mid=9):
"""
MACD CALC
"""
CLOSE = DataFrame['close']
DIF = EMA(CLOSE, short)-EMA(CLOSE, long)
DEA = EMA(DIF, mid)
MACD = (DIF-DEA)*2
return pd.DataFrame({'DIF': DIF, 'DEA': DEA, 'MACD': MACD}) | python | def QA_indicator_MACD(DataFrame, short=12, long=26, mid=9):
"""
MACD CALC
"""
CLOSE = DataFrame['close']
DIF = EMA(CLOSE, short)-EMA(CLOSE, long)
DEA = EMA(DIF, mid)
MACD = (DIF-DEA)*2
return pd.DataFrame({'DIF': DIF, 'DEA': DEA, 'MACD': MACD}) | [
"def",
"QA_indicator_MACD",
"(",
"DataFrame",
",",
"short",
"=",
"12",
",",
"long",
"=",
"26",
",",
"mid",
"=",
"9",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"DIF",
"=",
"EMA",
"(",
"CLOSE",
",",
"short",
")",
"-",
"EMA",
"(",
"C... | MACD CALC | [
"MACD",
"CALC"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L82-L92 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_DMI | def QA_indicator_DMI(DataFrame, M1=14, M2=6):
"""
趋向指标 DMI
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
OPEN = DataFrame.open
TR = SUM(MAX(MAX(HIGH-LOW, ABS(HIGH-REF(CLOSE, 1))),
ABS(LOW-REF(CLOSE, 1))), M1)
HD = HIGH-REF(HIGH, 1)
LD = R... | python | def QA_indicator_DMI(DataFrame, M1=14, M2=6):
"""
趋向指标 DMI
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
OPEN = DataFrame.open
TR = SUM(MAX(MAX(HIGH-LOW, ABS(HIGH-REF(CLOSE, 1))),
ABS(LOW-REF(CLOSE, 1))), M1)
HD = HIGH-REF(HIGH, 1)
LD = R... | [
"def",
"QA_indicator_DMI",
"(",
"DataFrame",
",",
"M1",
"=",
"14",
",",
"M2",
"=",
"6",
")",
":",
"HIGH",
"=",
"DataFrame",
".",
"high",
"LOW",
"=",
"DataFrame",
".",
"low",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"OPEN",
"=",
"DataFrame",
".",
"ope... | 趋向指标 DMI | [
"趋向指标",
"DMI"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L95-L118 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_PBX | def QA_indicator_PBX(DataFrame, N1=3, N2=5, N3=8, N4=13, N5=18, N6=24):
'瀑布线'
C = DataFrame['close']
PBX1 = (EMA(C, N1) + EMA(C, 2 * N1) + EMA(C, 4 * N1)) / 3
PBX2 = (EMA(C, N2) + EMA(C, 2 * N2) + EMA(C, 4 * N2)) / 3
PBX3 = (EMA(C, N3) + EMA(C, 2 * N3) + EMA(C, 4 * N3)) / 3
PBX4 = (EMA(C, N4) + ... | python | def QA_indicator_PBX(DataFrame, N1=3, N2=5, N3=8, N4=13, N5=18, N6=24):
'瀑布线'
C = DataFrame['close']
PBX1 = (EMA(C, N1) + EMA(C, 2 * N1) + EMA(C, 4 * N1)) / 3
PBX2 = (EMA(C, N2) + EMA(C, 2 * N2) + EMA(C, 4 * N2)) / 3
PBX3 = (EMA(C, N3) + EMA(C, 2 * N3) + EMA(C, 4 * N3)) / 3
PBX4 = (EMA(C, N4) + ... | [
"def",
"QA_indicator_PBX",
"(",
"DataFrame",
",",
"N1",
"=",
"3",
",",
"N2",
"=",
"5",
",",
"N3",
"=",
"8",
",",
"N4",
"=",
"13",
",",
"N5",
"=",
"18",
",",
"N6",
"=",
"24",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"PBX1",
"=",
... | 瀑布线 | [
"瀑布线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L121-L133 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_DMA | def QA_indicator_DMA(DataFrame, M1=10, M2=50, M3=10):
"""
平均线差 DMA
"""
CLOSE = DataFrame.close
DDD = MA(CLOSE, M1) - MA(CLOSE, M2)
AMA = MA(DDD, M3)
return pd.DataFrame({
'DDD': DDD, 'AMA': AMA
}) | python | def QA_indicator_DMA(DataFrame, M1=10, M2=50, M3=10):
"""
平均线差 DMA
"""
CLOSE = DataFrame.close
DDD = MA(CLOSE, M1) - MA(CLOSE, M2)
AMA = MA(DDD, M3)
return pd.DataFrame({
'DDD': DDD, 'AMA': AMA
}) | [
"def",
"QA_indicator_DMA",
"(",
"DataFrame",
",",
"M1",
"=",
"10",
",",
"M2",
"=",
"50",
",",
"M3",
"=",
"10",
")",
":",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"DDD",
"=",
"MA",
"(",
"CLOSE",
",",
"M1",
")",
"-",
"MA",
"(",
"CLOSE",
",",
"M2"... | 平均线差 DMA | [
"平均线差",
"DMA"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L136-L145 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_MTM | def QA_indicator_MTM(DataFrame, N=12, M=6):
'动量线'
C = DataFrame.close
mtm = C - REF(C, N)
MTMMA = MA(mtm, M)
DICT = {'MTM': mtm, 'MTMMA': MTMMA}
return pd.DataFrame(DICT) | python | def QA_indicator_MTM(DataFrame, N=12, M=6):
'动量线'
C = DataFrame.close
mtm = C - REF(C, N)
MTMMA = MA(mtm, M)
DICT = {'MTM': mtm, 'MTMMA': MTMMA}
return pd.DataFrame(DICT) | [
"def",
"QA_indicator_MTM",
"(",
"DataFrame",
",",
"N",
"=",
"12",
",",
"M",
"=",
"6",
")",
":",
"C",
"=",
"DataFrame",
".",
"close",
"mtm",
"=",
"C",
"-",
"REF",
"(",
"C",
",",
"N",
")",
"MTMMA",
"=",
"MA",
"(",
"mtm",
",",
"M",
")",
"DICT",
... | 动量线 | [
"动量线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L148-L155 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_EXPMA | def QA_indicator_EXPMA(DataFrame, P1=5, P2=10, P3=20, P4=60):
""" 指数平均线 EXPMA"""
CLOSE = DataFrame.close
MA1 = EMA(CLOSE, P1)
MA2 = EMA(CLOSE, P2)
MA3 = EMA(CLOSE, P3)
MA4 = EMA(CLOSE, P4)
return pd.DataFrame({
'MA1': MA1, 'MA2': MA2, 'MA3': MA3, 'MA4': MA4
}) | python | def QA_indicator_EXPMA(DataFrame, P1=5, P2=10, P3=20, P4=60):
""" 指数平均线 EXPMA"""
CLOSE = DataFrame.close
MA1 = EMA(CLOSE, P1)
MA2 = EMA(CLOSE, P2)
MA3 = EMA(CLOSE, P3)
MA4 = EMA(CLOSE, P4)
return pd.DataFrame({
'MA1': MA1, 'MA2': MA2, 'MA3': MA3, 'MA4': MA4
}) | [
"def",
"QA_indicator_EXPMA",
"(",
"DataFrame",
",",
"P1",
"=",
"5",
",",
"P2",
"=",
"10",
",",
"P3",
"=",
"20",
",",
"P4",
"=",
"60",
")",
":",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"MA1",
"=",
"EMA",
"(",
"CLOSE",
",",
"P1",
")",
"MA2",
"="... | 指数平均线 EXPMA | [
"指数平均线",
"EXPMA"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L158-L167 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_CHO | def QA_indicator_CHO(DataFrame, N1=10, N2=20, M=6):
"""
佳庆指标 CHO
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
VOL = DataFrame.volume
MID = SUM(VOL*(2*CLOSE-HIGH-LOW)/(HIGH+LOW), 0)
CHO = MA(MID, N1)-MA(MID, N2)
MACHO = MA(CHO, M)
return pd.DataFrame({... | python | def QA_indicator_CHO(DataFrame, N1=10, N2=20, M=6):
"""
佳庆指标 CHO
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
VOL = DataFrame.volume
MID = SUM(VOL*(2*CLOSE-HIGH-LOW)/(HIGH+LOW), 0)
CHO = MA(MID, N1)-MA(MID, N2)
MACHO = MA(CHO, M)
return pd.DataFrame({... | [
"def",
"QA_indicator_CHO",
"(",
"DataFrame",
",",
"N1",
"=",
"10",
",",
"N2",
"=",
"20",
",",
"M",
"=",
"6",
")",
":",
"HIGH",
"=",
"DataFrame",
".",
"high",
"LOW",
"=",
"DataFrame",
".",
"low",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"VOL",
"=",
... | 佳庆指标 CHO | [
"佳庆指标",
"CHO"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L170-L183 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_BIAS | def QA_indicator_BIAS(DataFrame, N1, N2, N3):
'乖离率'
CLOSE = DataFrame['close']
BIAS1 = (CLOSE - MA(CLOSE, N1)) / MA(CLOSE, N1) * 100
BIAS2 = (CLOSE - MA(CLOSE, N2)) / MA(CLOSE, N2) * 100
BIAS3 = (CLOSE - MA(CLOSE, N3)) / MA(CLOSE, N3) * 100
DICT = {'BIAS1': BIAS1, 'BIAS2': BIAS2, 'BIAS3': BIAS3}... | python | def QA_indicator_BIAS(DataFrame, N1, N2, N3):
'乖离率'
CLOSE = DataFrame['close']
BIAS1 = (CLOSE - MA(CLOSE, N1)) / MA(CLOSE, N1) * 100
BIAS2 = (CLOSE - MA(CLOSE, N2)) / MA(CLOSE, N2) * 100
BIAS3 = (CLOSE - MA(CLOSE, N3)) / MA(CLOSE, N3) * 100
DICT = {'BIAS1': BIAS1, 'BIAS2': BIAS2, 'BIAS3': BIAS3}... | [
"def",
"QA_indicator_BIAS",
"(",
"DataFrame",
",",
"N1",
",",
"N2",
",",
"N3",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"BIAS1",
"=",
"(",
"CLOSE",
"-",
"MA",
"(",
"CLOSE",
",",
"N1",
")",
")",
"/",
"MA",
"(",
"CLOSE",
",",
"N1",... | 乖离率 | [
"乖离率"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L216-L224 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_ROC | def QA_indicator_ROC(DataFrame, N=12, M=6):
'变动率指标'
C = DataFrame['close']
roc = 100 * (C - REF(C, N)) / REF(C, N)
ROCMA = MA(roc, M)
DICT = {'ROC': roc, 'ROCMA': ROCMA}
return pd.DataFrame(DICT) | python | def QA_indicator_ROC(DataFrame, N=12, M=6):
'变动率指标'
C = DataFrame['close']
roc = 100 * (C - REF(C, N)) / REF(C, N)
ROCMA = MA(roc, M)
DICT = {'ROC': roc, 'ROCMA': ROCMA}
return pd.DataFrame(DICT) | [
"def",
"QA_indicator_ROC",
"(",
"DataFrame",
",",
"N",
"=",
"12",
",",
"M",
"=",
"6",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"roc",
"=",
"100",
"*",
"(",
"C",
"-",
"REF",
"(",
"C",
",",
"N",
")",
")",
"/",
"REF",
"(",
"C",
",... | 变动率指标 | [
"变动率指标"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L227-L234 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_CCI | def QA_indicator_CCI(DataFrame, N=14):
"""
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
"""
typ = (DataFrame['high'] + DataFrame['low'] + DataFrame['close']) / 3
cci = ((typ - MA(typ, N)) / (0.015 * AVEDEV(typ, N)))
a = 100
b = -100
return pd.DataFrame({
... | python | def QA_indicator_CCI(DataFrame, N=14):
"""
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
"""
typ = (DataFrame['high'] + DataFrame['low'] + DataFrame['close']) / 3
cci = ((typ - MA(typ, N)) / (0.015 * AVEDEV(typ, N)))
a = 100
b = -100
return pd.DataFrame({
... | [
"def",
"QA_indicator_CCI",
"(",
"DataFrame",
",",
"N",
"=",
"14",
")",
":",
"typ",
"=",
"(",
"DataFrame",
"[",
"'high'",
"]",
"+",
"DataFrame",
"[",
"'low'",
"]",
"+",
"DataFrame",
"[",
"'close'",
"]",
")",
"/",
"3",
"cci",
"=",
"(",
"(",
"typ",
... | TYP:=(HIGH+LOW+CLOSE)/3;
CCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)); | [
"TYP",
":",
"=",
"(",
"HIGH",
"+",
"LOW",
"+",
"CLOSE",
")",
"/",
"3",
";",
"CCI",
":",
"(",
"TYP",
"-",
"MA",
"(",
"TYP",
"N",
"))",
"/",
"(",
"0",
".",
"015",
"*",
"AVEDEV",
"(",
"TYP",
"N",
"))",
";"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L237-L249 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_WR | def QA_indicator_WR(DataFrame, N, N1):
'威廉指标'
HIGH = DataFrame['high']
LOW = DataFrame['low']
CLOSE = DataFrame['close']
WR1 = 100 * (HHV(HIGH, N) - CLOSE) / (HHV(HIGH, N) - LLV(LOW, N))
WR2 = 100 * (HHV(HIGH, N1) - CLOSE) / (HHV(HIGH, N1) - LLV(LOW, N1))
DICT = {'WR1': WR1, 'WR2': WR2}
... | python | def QA_indicator_WR(DataFrame, N, N1):
'威廉指标'
HIGH = DataFrame['high']
LOW = DataFrame['low']
CLOSE = DataFrame['close']
WR1 = 100 * (HHV(HIGH, N) - CLOSE) / (HHV(HIGH, N) - LLV(LOW, N))
WR2 = 100 * (HHV(HIGH, N1) - CLOSE) / (HHV(HIGH, N1) - LLV(LOW, N1))
DICT = {'WR1': WR1, 'WR2': WR2}
... | [
"def",
"QA_indicator_WR",
"(",
"DataFrame",
",",
"N",
",",
"N1",
")",
":",
"HIGH",
"=",
"DataFrame",
"[",
"'high'",
"]",
"LOW",
"=",
"DataFrame",
"[",
"'low'",
"]",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"WR1",
"=",
"100",
"*",
"(",
"HHV",
... | 威廉指标 | [
"威廉指标"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L252-L261 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_OSC | def QA_indicator_OSC(DataFrame, N=20, M=6):
"""变动速率线
震荡量指标OSC,也叫变动速率线。属于超买超卖类指标,是从移动平均线原理派生出来的一种分析指标。
它反应当日收盘价与一段时间内平均收盘价的差离值,从而测出股价的震荡幅度。
按照移动平均线原理,根据OSC的值可推断价格的趋势,如果远离平均线,就很可能向平均线回归。
"""
C = DataFrame['close']
OS = (C - MA(C, N)) * 100
MAOSC = EMA(OS, M)
DICT = {'OSC': OS, 'MAOS... | python | def QA_indicator_OSC(DataFrame, N=20, M=6):
"""变动速率线
震荡量指标OSC,也叫变动速率线。属于超买超卖类指标,是从移动平均线原理派生出来的一种分析指标。
它反应当日收盘价与一段时间内平均收盘价的差离值,从而测出股价的震荡幅度。
按照移动平均线原理,根据OSC的值可推断价格的趋势,如果远离平均线,就很可能向平均线回归。
"""
C = DataFrame['close']
OS = (C - MA(C, N)) * 100
MAOSC = EMA(OS, M)
DICT = {'OSC': OS, 'MAOS... | [
"def",
"QA_indicator_OSC",
"(",
"DataFrame",
",",
"N",
"=",
"20",
",",
"M",
"=",
"6",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"OS",
"=",
"(",
"C",
"-",
"MA",
"(",
"C",
",",
"N",
")",
")",
"*",
"100",
"MAOSC",
"=",
"EMA",
"(",
... | 变动速率线
震荡量指标OSC,也叫变动速率线。属于超买超卖类指标,是从移动平均线原理派生出来的一种分析指标。
它反应当日收盘价与一段时间内平均收盘价的差离值,从而测出股价的震荡幅度。
按照移动平均线原理,根据OSC的值可推断价格的趋势,如果远离平均线,就很可能向平均线回归。 | [
"变动速率线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L264-L278 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_RSI | def QA_indicator_RSI(DataFrame, N1=12, N2=26, N3=9):
'相对强弱指标RSI1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;'
CLOSE = DataFrame['close']
LC = REF(CLOSE, 1)
RSI1 = SMA(MAX(CLOSE - LC, 0), N1) / SMA(ABS(CLOSE - LC), N1) * 100
RSI2 = SMA(MAX(CLOSE - LC, 0), N2) / SMA(ABS(CLOSE - LC), N2) * 1... | python | def QA_indicator_RSI(DataFrame, N1=12, N2=26, N3=9):
'相对强弱指标RSI1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;'
CLOSE = DataFrame['close']
LC = REF(CLOSE, 1)
RSI1 = SMA(MAX(CLOSE - LC, 0), N1) / SMA(ABS(CLOSE - LC), N1) * 100
RSI2 = SMA(MAX(CLOSE - LC, 0), N2) / SMA(ABS(CLOSE - LC), N2) * 1... | [
"def",
"QA_indicator_RSI",
"(",
"DataFrame",
",",
"N1",
"=",
"12",
",",
"N2",
"=",
"26",
",",
"N3",
"=",
"9",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"LC",
"=",
"REF",
"(",
"CLOSE",
",",
"1",
")",
"RSI1",
"=",
"SMA",
"(",
"MAX... | 相对强弱指标RSI1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100; | [
"相对强弱指标RSI1",
":",
"SMA",
"(",
"MAX",
"(",
"CLOSE",
"-",
"LC",
"0",
")",
"N1",
"1",
")",
"/",
"SMA",
"(",
"ABS",
"(",
"CLOSE",
"-",
"LC",
")",
"N1",
"1",
")",
"*",
"100",
";"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L281-L290 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_ADTM | def QA_indicator_ADTM(DataFrame, N=23, M=8):
'动态买卖气指标'
HIGH = DataFrame.high
LOW = DataFrame.low
OPEN = DataFrame.open
DTM = IF(OPEN > REF(OPEN, 1), MAX((HIGH - OPEN), (OPEN - REF(OPEN, 1))), 0)
DBM = IF(OPEN < REF(OPEN, 1), MAX((OPEN - LOW), (OPEN - REF(OPEN, 1))), 0)
STM = SUM(DTM, N)
... | python | def QA_indicator_ADTM(DataFrame, N=23, M=8):
'动态买卖气指标'
HIGH = DataFrame.high
LOW = DataFrame.low
OPEN = DataFrame.open
DTM = IF(OPEN > REF(OPEN, 1), MAX((HIGH - OPEN), (OPEN - REF(OPEN, 1))), 0)
DBM = IF(OPEN < REF(OPEN, 1), MAX((OPEN - LOW), (OPEN - REF(OPEN, 1))), 0)
STM = SUM(DTM, N)
... | [
"def",
"QA_indicator_ADTM",
"(",
"DataFrame",
",",
"N",
"=",
"23",
",",
"M",
"=",
"8",
")",
":",
"HIGH",
"=",
"DataFrame",
".",
"high",
"LOW",
"=",
"DataFrame",
".",
"low",
"OPEN",
"=",
"DataFrame",
".",
"open",
"DTM",
"=",
"IF",
"(",
"OPEN",
">",
... | 动态买卖气指标 | [
"动态买卖气指标"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L293-L307 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_ASI | def QA_indicator_ASI(DataFrame, M1=26, M2=10):
"""
LC=REF(CLOSE,1);
AA=ABS(HIGH-LC);
BB=ABS(LOW-LC);
CC=ABS(HIGH-REF(LOW,1));
DD=ABS(LC-REF(OPEN,1));
R=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4));
X=(CLOSE-LC+(CLOSE-OPEN)/2+LC-REF(OPEN,1));
SI=16*X/R*MAX... | python | def QA_indicator_ASI(DataFrame, M1=26, M2=10):
"""
LC=REF(CLOSE,1);
AA=ABS(HIGH-LC);
BB=ABS(LOW-LC);
CC=ABS(HIGH-REF(LOW,1));
DD=ABS(LC-REF(OPEN,1));
R=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4));
X=(CLOSE-LC+(CLOSE-OPEN)/2+LC-REF(OPEN,1));
SI=16*X/R*MAX... | [
"def",
"QA_indicator_ASI",
"(",
"DataFrame",
",",
"M1",
"=",
"26",
",",
"M2",
"=",
"10",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"HIGH",
"=",
"DataFrame",
"[",
"'high'",
"]",
"LOW",
"=",
"DataFrame",
"[",
"'low'",
"]",
"OPEN",
"=",
... | LC=REF(CLOSE,1);
AA=ABS(HIGH-LC);
BB=ABS(LOW-LC);
CC=ABS(HIGH-REF(LOW,1));
DD=ABS(LC-REF(OPEN,1));
R=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4));
X=(CLOSE-LC+(CLOSE-OPEN)/2+LC-REF(OPEN,1));
SI=16*X/R*MAX(AA,BB);
ASI:SUM(SI,M1);
ASIT:MA(ASI,M2); | [
"LC",
"=",
"REF",
"(",
"CLOSE",
"1",
")",
";",
"AA",
"=",
"ABS",
"(",
"HIGH",
"-",
"LC",
")",
";",
"BB",
"=",
"ABS",
"(",
"LOW",
"-",
"LC",
")",
";",
"CC",
"=",
"ABS",
"(",
"HIGH",
"-",
"REF",
"(",
"LOW",
"1",
"))",
";",
"DD",
"=",
"ABS... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L388-L419 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_OBV | def QA_indicator_OBV(DataFrame):
"""能量潮"""
VOL = DataFrame.volume
CLOSE = DataFrame.close
return pd.DataFrame({
'OBV': np.cumsum(IF(CLOSE > REF(CLOSE, 1), VOL, IF(CLOSE < REF(CLOSE, 1), -VOL, 0)))/10000
}) | python | def QA_indicator_OBV(DataFrame):
"""能量潮"""
VOL = DataFrame.volume
CLOSE = DataFrame.close
return pd.DataFrame({
'OBV': np.cumsum(IF(CLOSE > REF(CLOSE, 1), VOL, IF(CLOSE < REF(CLOSE, 1), -VOL, 0)))/10000
}) | [
"def",
"QA_indicator_OBV",
"(",
"DataFrame",
")",
":",
"VOL",
"=",
"DataFrame",
".",
"volume",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"return",
"pd",
".",
"DataFrame",
"(",
"{",
"'OBV'",
":",
"np",
".",
"cumsum",
"(",
"IF",
"(",
"CLOSE",
">",
"REF",
... | 能量潮 | [
"能量潮"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L429-L435 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_BOLL | def QA_indicator_BOLL(DataFrame, N=20, P=2):
'布林线'
C = DataFrame['close']
boll = MA(C, N)
UB = boll + P * STD(C, N)
LB = boll - P * STD(C, N)
DICT = {'BOLL': boll, 'UB': UB, 'LB': LB}
return pd.DataFrame(DICT) | python | def QA_indicator_BOLL(DataFrame, N=20, P=2):
'布林线'
C = DataFrame['close']
boll = MA(C, N)
UB = boll + P * STD(C, N)
LB = boll - P * STD(C, N)
DICT = {'BOLL': boll, 'UB': UB, 'LB': LB}
return pd.DataFrame(DICT) | [
"def",
"QA_indicator_BOLL",
"(",
"DataFrame",
",",
"N",
"=",
"20",
",",
"P",
"=",
"2",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"boll",
"=",
"MA",
"(",
"C",
",",
"N",
")",
"UB",
"=",
"boll",
"+",
"P",
"*",
"STD",
"(",
"C",
",",
... | 布林线 | [
"布林线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L456-L464 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_MIKE | def QA_indicator_MIKE(DataFrame, N=12):
"""
MIKE指标
指标说明
MIKE是另外一种形式的路径指标。
买卖原则
1 WEAK-S,MEDIUM-S,STRONG-S三条线代表初级、中级、强力支撑。
2 WEAK-R,MEDIUM-R,STRONG-R三条线代表初级、中级、强力压力。
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
TYP = (HIGH+LOW+CLOSE)/3
LL = ... | python | def QA_indicator_MIKE(DataFrame, N=12):
"""
MIKE指标
指标说明
MIKE是另外一种形式的路径指标。
买卖原则
1 WEAK-S,MEDIUM-S,STRONG-S三条线代表初级、中级、强力支撑。
2 WEAK-R,MEDIUM-R,STRONG-R三条线代表初级、中级、强力压力。
"""
HIGH = DataFrame.high
LOW = DataFrame.low
CLOSE = DataFrame.close
TYP = (HIGH+LOW+CLOSE)/3
LL = ... | [
"def",
"QA_indicator_MIKE",
"(",
"DataFrame",
",",
"N",
"=",
"12",
")",
":",
"HIGH",
"=",
"DataFrame",
".",
"high",
"LOW",
"=",
"DataFrame",
".",
"low",
"CLOSE",
"=",
"DataFrame",
".",
"close",
"TYP",
"=",
"(",
"HIGH",
"+",
"LOW",
"+",
"CLOSE",
")",
... | MIKE指标
指标说明
MIKE是另外一种形式的路径指标。
买卖原则
1 WEAK-S,MEDIUM-S,STRONG-S三条线代表初级、中级、强力支撑。
2 WEAK-R,MEDIUM-R,STRONG-R三条线代表初级、中级、强力压力。 | [
"MIKE指标",
"指标说明",
"MIKE是另外一种形式的路径指标。",
"买卖原则",
"1",
"WEAK",
"-",
"S,MEDIUM",
"-",
"S,STRONG",
"-",
"S三条线代表初级、中级、强力支撑。",
"2",
"WEAK",
"-",
"R,MEDIUM",
"-",
"R,STRONG",
"-",
"R三条线代表初级、中级、强力压力。"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L467-L493 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_BBI | def QA_indicator_BBI(DataFrame, N1=3, N2=6, N3=12, N4=24):
'多空指标'
C = DataFrame['close']
bbi = (MA(C, N1) + MA(C, N2) + MA(C, N3) + MA(C, N4)) / 4
DICT = {'BBI': bbi}
return pd.DataFrame(DICT) | python | def QA_indicator_BBI(DataFrame, N1=3, N2=6, N3=12, N4=24):
'多空指标'
C = DataFrame['close']
bbi = (MA(C, N1) + MA(C, N2) + MA(C, N3) + MA(C, N4)) / 4
DICT = {'BBI': bbi}
return pd.DataFrame(DICT) | [
"def",
"QA_indicator_BBI",
"(",
"DataFrame",
",",
"N1",
"=",
"3",
",",
"N2",
"=",
"6",
",",
"N3",
"=",
"12",
",",
"N4",
"=",
"24",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"bbi",
"=",
"(",
"MA",
"(",
"C",
",",
"N1",
")",
"+",
"... | 多空指标 | [
"多空指标"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L496-L502 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_MFI | def QA_indicator_MFI(DataFrame, N=14):
"""
资金指标
TYP := (HIGH + LOW + CLOSE)/3;
V1:=SUM(IF(TYP>REF(TYP,1),TYP*VOL,0),N)/SUM(IF(TYP<REF(TYP,1),TYP*VOL,0),N);
MFI:100-(100/(1+V1));
赋值: (最高价 + 最低价 + 收盘价)/3
V1赋值:如果TYP>1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和/如果TYP<1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和
输出资金流... | python | def QA_indicator_MFI(DataFrame, N=14):
"""
资金指标
TYP := (HIGH + LOW + CLOSE)/3;
V1:=SUM(IF(TYP>REF(TYP,1),TYP*VOL,0),N)/SUM(IF(TYP<REF(TYP,1),TYP*VOL,0),N);
MFI:100-(100/(1+V1));
赋值: (最高价 + 最低价 + 收盘价)/3
V1赋值:如果TYP>1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和/如果TYP<1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和
输出资金流... | [
"def",
"QA_indicator_MFI",
"(",
"DataFrame",
",",
"N",
"=",
"14",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"H",
"=",
"DataFrame",
"[",
"'high'",
"]",
"L",
"=",
"DataFrame",
"[",
"'low'",
"]",
"VOL",
"=",
"DataFrame",
"[",
"'volume'",
"]"... | 资金指标
TYP := (HIGH + LOW + CLOSE)/3;
V1:=SUM(IF(TYP>REF(TYP,1),TYP*VOL,0),N)/SUM(IF(TYP<REF(TYP,1),TYP*VOL,0),N);
MFI:100-(100/(1+V1));
赋值: (最高价 + 最低价 + 收盘价)/3
V1赋值:如果TYP>1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和/如果TYP<1日前的TYP,返回TYP*成交量(手),否则返回0的N日累和
输出资金流量指标:100-(100/(1+V1)) | [
"资金指标",
"TYP",
":",
"=",
"(",
"HIGH",
"+",
"LOW",
"+",
"CLOSE",
")",
"/",
"3",
";",
"V1",
":",
"=",
"SUM",
"(",
"IF",
"(",
"TYP",
">",
"REF",
"(",
"TYP",
"1",
")",
"TYP",
"*",
"VOL",
"0",
")",
"N",
")",
"/",
"SUM",
"(",
"IF",
"(",
"TYP<... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L505-L525 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_ATR | def QA_indicator_ATR(DataFrame, N=14):
"""
输出TR:(最高价-最低价)和昨收-最高价的绝对值的较大值和昨收-最低价的绝对值的较大值
输出真实波幅:TR的N日简单移动平均
算法:今日振幅、今日最高与昨收差价、今日最低与昨收差价中的最大值,为真实波幅,求真实波幅的N日移动平均
参数:N 天数,一般取14
"""
C = DataFrame['close']
H = DataFrame['high']
L = DataFrame['low']
TR = MAX(MAX((H - L), ABS(REF(C, 1)... | python | def QA_indicator_ATR(DataFrame, N=14):
"""
输出TR:(最高价-最低价)和昨收-最高价的绝对值的较大值和昨收-最低价的绝对值的较大值
输出真实波幅:TR的N日简单移动平均
算法:今日振幅、今日最高与昨收差价、今日最低与昨收差价中的最大值,为真实波幅,求真实波幅的N日移动平均
参数:N 天数,一般取14
"""
C = DataFrame['close']
H = DataFrame['high']
L = DataFrame['low']
TR = MAX(MAX((H - L), ABS(REF(C, 1)... | [
"def",
"QA_indicator_ATR",
"(",
"DataFrame",
",",
"N",
"=",
"14",
")",
":",
"C",
"=",
"DataFrame",
"[",
"'close'",
"]",
"H",
"=",
"DataFrame",
"[",
"'high'",
"]",
"L",
"=",
"DataFrame",
"[",
"'low'",
"]",
"TR",
"=",
"MAX",
"(",
"MAX",
"(",
"(",
"... | 输出TR:(最高价-最低价)和昨收-最高价的绝对值的较大值和昨收-最低价的绝对值的较大值
输出真实波幅:TR的N日简单移动平均
算法:今日振幅、今日最高与昨收差价、今日最低与昨收差价中的最大值,为真实波幅,求真实波幅的N日移动平均
参数:N 天数,一般取14 | [
"输出TR",
":",
"(",
"最高价",
"-",
"最低价",
")",
"和昨收",
"-",
"最高价的绝对值的较大值和昨收",
"-",
"最低价的绝对值的较大值",
"输出真实波幅",
":",
"TR的N日简单移动平均",
"算法:今日振幅、今日最高与昨收差价、今日最低与昨收差价中的最大值,为真实波幅,求真实波幅的N日移动平均"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L528-L542 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_SKDJ | def QA_indicator_SKDJ(DataFrame, N=9, M=3):
"""
1.指标>80 时,回档机率大;指标<20 时,反弹机率大;
2.K在20左右向上交叉D时,视为买进信号参考;
3.K在80左右向下交叉D时,视为卖出信号参考;
4.SKDJ波动于50左右的任何讯号,其作用不大。
"""
CLOSE = DataFrame['close']
LOWV = LLV(DataFrame['low'], N)
HIGHV = HHV(DataFrame['high'], N)
RSV = EMA((CLOSE - LOWV) /... | python | def QA_indicator_SKDJ(DataFrame, N=9, M=3):
"""
1.指标>80 时,回档机率大;指标<20 时,反弹机率大;
2.K在20左右向上交叉D时,视为买进信号参考;
3.K在80左右向下交叉D时,视为卖出信号参考;
4.SKDJ波动于50左右的任何讯号,其作用不大。
"""
CLOSE = DataFrame['close']
LOWV = LLV(DataFrame['low'], N)
HIGHV = HHV(DataFrame['high'], N)
RSV = EMA((CLOSE - LOWV) /... | [
"def",
"QA_indicator_SKDJ",
"(",
"DataFrame",
",",
"N",
"=",
"9",
",",
"M",
"=",
"3",
")",
":",
"CLOSE",
"=",
"DataFrame",
"[",
"'close'",
"]",
"LOWV",
"=",
"LLV",
"(",
"DataFrame",
"[",
"'low'",
"]",
",",
"N",
")",
"HIGHV",
"=",
"HHV",
"(",
"Dat... | 1.指标>80 时,回档机率大;指标<20 时,反弹机率大;
2.K在20左右向上交叉D时,视为买进信号参考;
3.K在80左右向下交叉D时,视为卖出信号参考;
4.SKDJ波动于50左右的任何讯号,其作用不大。 | [
"1",
".",
"指标",
">",
"80",
"时,回档机率大;指标<20",
"时,反弹机率大;",
"2",
".",
"K在20左右向上交叉D时,视为买进信号参考;",
"3",
".",
"K在80左右向下交叉D时,视为卖出信号参考;",
"4",
".",
"SKDJ波动于50左右的任何讯号,其作用不大。"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L545-L561 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_DDI | def QA_indicator_DDI(DataFrame, N=13, N1=26, M=1, M1=5):
"""
'方向标准离差指数'
分析DDI柱状线,由红变绿(正变负),卖出信号参考;由绿变红,买入信号参考。
"""
H = DataFrame['high']
L = DataFrame['low']
DMZ = IF((H + L) > (REF(H, 1) + REF(L, 1)),
MAX(ABS(H - REF(H, 1)), ABS(L - REF(L, 1))), 0)
DMF = IF((H + L) < (REF... | python | def QA_indicator_DDI(DataFrame, N=13, N1=26, M=1, M1=5):
"""
'方向标准离差指数'
分析DDI柱状线,由红变绿(正变负),卖出信号参考;由绿变红,买入信号参考。
"""
H = DataFrame['high']
L = DataFrame['low']
DMZ = IF((H + L) > (REF(H, 1) + REF(L, 1)),
MAX(ABS(H - REF(H, 1)), ABS(L - REF(L, 1))), 0)
DMF = IF((H + L) < (REF... | [
"def",
"QA_indicator_DDI",
"(",
"DataFrame",
",",
"N",
"=",
"13",
",",
"N1",
"=",
"26",
",",
"M",
"=",
"1",
",",
"M1",
"=",
"5",
")",
":",
"H",
"=",
"DataFrame",
"[",
"'high'",
"]",
"L",
"=",
"DataFrame",
"[",
"'low'",
"]",
"DMZ",
"=",
"IF",
... | '方向标准离差指数'
分析DDI柱状线,由红变绿(正变负),卖出信号参考;由绿变红,买入信号参考。 | [
"方向标准离差指数",
"分析DDI柱状线,由红变绿",
"(",
"正变负",
")",
",卖出信号参考;由绿变红,买入信号参考。"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L564-L583 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/indicators.py | QA_indicator_shadow | def QA_indicator_shadow(DataFrame):
"""
上下影线指标
"""
return {
'LOW': lower_shadow(DataFrame), 'UP': upper_shadow(DataFrame),
'BODY': body(DataFrame), 'BODY_ABS': body_abs(DataFrame), 'PRICE_PCG': price_pcg(DataFrame)
} | python | def QA_indicator_shadow(DataFrame):
"""
上下影线指标
"""
return {
'LOW': lower_shadow(DataFrame), 'UP': upper_shadow(DataFrame),
'BODY': body(DataFrame), 'BODY_ABS': body_abs(DataFrame), 'PRICE_PCG': price_pcg(DataFrame)
} | [
"def",
"QA_indicator_shadow",
"(",
"DataFrame",
")",
":",
"return",
"{",
"'LOW'",
":",
"lower_shadow",
"(",
"DataFrame",
")",
",",
"'UP'",
":",
"upper_shadow",
"(",
"DataFrame",
")",
",",
"'BODY'",
":",
"body",
"(",
"DataFrame",
")",
",",
"'BODY_ABS'",
":"... | 上下影线指标 | [
"上下影线指标"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L586-L593 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.run | def run(self, series, exponent=None):
'''
:type series: List
:type exponent: int
:rtype: float
'''
try:
return self.calculateHurst(series, exponent)
except Exception as e:
print(" Error: %s" % e) | python | def run(self, series, exponent=None):
'''
:type series: List
:type exponent: int
:rtype: float
'''
try:
return self.calculateHurst(series, exponent)
except Exception as e:
print(" Error: %s" % e) | [
"def",
"run",
"(",
"self",
",",
"series",
",",
"exponent",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"calculateHurst",
"(",
"series",
",",
"exponent",
")",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"\" Error: %s\"",
"%",
"e... | :type series: List
:type exponent: int
:rtype: float | [
":",
"type",
"series",
":",
"List",
":",
"type",
"exponent",
":",
"int",
":",
"rtype",
":",
"float"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L15-L24 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.bestExponent | def bestExponent(self, seriesLenght):
'''
:type seriesLenght: int
:rtype: int
'''
i = 0
cont = True
while(cont):
if(int(seriesLenght/int(math.pow(2, i))) <= 1):
cont = False
else:
i += 1
return int(i-... | python | def bestExponent(self, seriesLenght):
'''
:type seriesLenght: int
:rtype: int
'''
i = 0
cont = True
while(cont):
if(int(seriesLenght/int(math.pow(2, i))) <= 1):
cont = False
else:
i += 1
return int(i-... | [
"def",
"bestExponent",
"(",
"self",
",",
"seriesLenght",
")",
":",
"i",
"=",
"0",
"cont",
"=",
"True",
"while",
"(",
"cont",
")",
":",
"if",
"(",
"int",
"(",
"seriesLenght",
"/",
"int",
"(",
"math",
".",
"pow",
"(",
"2",
",",
"i",
")",
")",
")"... | :type seriesLenght: int
:rtype: int | [
":",
"type",
"seriesLenght",
":",
"int",
":",
"rtype",
":",
"int"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L26-L38 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.mean | def mean(self, series, start, limit):
'''
:type start: int
:type limit: int
:rtype: float
'''
return float(np.mean(series[start:limit])) | python | def mean(self, series, start, limit):
'''
:type start: int
:type limit: int
:rtype: float
'''
return float(np.mean(series[start:limit])) | [
"def",
"mean",
"(",
"self",
",",
"series",
",",
"start",
",",
"limit",
")",
":",
"return",
"float",
"(",
"np",
".",
"mean",
"(",
"series",
"[",
"start",
":",
"limit",
"]",
")",
")"
] | :type start: int
:type limit: int
:rtype: float | [
":",
"type",
"start",
":",
"int",
":",
"type",
"limit",
":",
"int",
":",
"rtype",
":",
"float"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L40-L46 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.deviation | def deviation(self, series, start, limit, mean):
'''
:type start: int
:type limit: int
:type mean: int
:rtype: list()
'''
d = []
for x in range(start, limit):
d.append(float(series[x] - mean))
return d | python | def deviation(self, series, start, limit, mean):
'''
:type start: int
:type limit: int
:type mean: int
:rtype: list()
'''
d = []
for x in range(start, limit):
d.append(float(series[x] - mean))
return d | [
"def",
"deviation",
"(",
"self",
",",
"series",
",",
"start",
",",
"limit",
",",
"mean",
")",
":",
"d",
"=",
"[",
"]",
"for",
"x",
"in",
"range",
"(",
"start",
",",
"limit",
")",
":",
"d",
".",
"append",
"(",
"float",
"(",
"series",
"[",
"x",
... | :type start: int
:type limit: int
:type mean: int
:rtype: list() | [
":",
"type",
"start",
":",
"int",
":",
"type",
"limit",
":",
"int",
":",
"type",
"mean",
":",
"int",
":",
"rtype",
":",
"list",
"()"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L55-L65 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.standartDeviation | def standartDeviation(self, series, start, limit):
'''
:type start: int
:type limit: int
:rtype: float
'''
return float(np.std(series[start:limit])) | python | def standartDeviation(self, series, start, limit):
'''
:type start: int
:type limit: int
:rtype: float
'''
return float(np.std(series[start:limit])) | [
"def",
"standartDeviation",
"(",
"self",
",",
"series",
",",
"start",
",",
"limit",
")",
":",
"return",
"float",
"(",
"np",
".",
"std",
"(",
"series",
"[",
"start",
":",
"limit",
"]",
")",
")"
] | :type start: int
:type limit: int
:rtype: float | [
":",
"type",
"start",
":",
"int",
":",
"type",
"limit",
":",
"int",
":",
"rtype",
":",
"float"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L67-L73 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAIndicator/hurst.py | RSanalysis.calculateHurst | def calculateHurst(self, series, exponent=None):
'''
:type series: List
:type exponent: int
:rtype: float
'''
rescaledRange = list()
sizeRange = list()
rescaledRangeMean = list()
if(exponent is None):
exponent = self.bestExponent(len(s... | python | def calculateHurst(self, series, exponent=None):
'''
:type series: List
:type exponent: int
:rtype: float
'''
rescaledRange = list()
sizeRange = list()
rescaledRangeMean = list()
if(exponent is None):
exponent = self.bestExponent(len(s... | [
"def",
"calculateHurst",
"(",
"self",
",",
"series",
",",
"exponent",
"=",
"None",
")",
":",
"rescaledRange",
"=",
"list",
"(",
")",
"sizeRange",
"=",
"list",
"(",
")",
"rescaledRangeMean",
"=",
"list",
"(",
")",
"if",
"(",
"exponent",
"is",
"None",
")... | :type series: List
:type exponent: int
:rtype: float | [
":",
"type",
"series",
":",
"List",
":",
"type",
"exponent",
":",
"int",
":",
"rtype",
":",
"float"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/hurst.py#L75-L146 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QAMail.py | QA_util_send_mail | def QA_util_send_mail(msg, title, from_user, from_password, to_addr, smtp):
"""邮件发送
Arguments:
msg {[type]} -- [description]
title {[type]} -- [description]
from_user {[type]} -- [description]
from_password {[type]} -- [description]
to_addr {[type]} -- [description]
... | python | def QA_util_send_mail(msg, title, from_user, from_password, to_addr, smtp):
"""邮件发送
Arguments:
msg {[type]} -- [description]
title {[type]} -- [description]
from_user {[type]} -- [description]
from_password {[type]} -- [description]
to_addr {[type]} -- [description]
... | [
"def",
"QA_util_send_mail",
"(",
"msg",
",",
"title",
",",
"from_user",
",",
"from_password",
",",
"to_addr",
",",
"smtp",
")",
":",
"msg",
"=",
"MIMEText",
"(",
"msg",
",",
"'plain'",
",",
"'utf-8'",
")",
"msg",
"[",
"'Subject'",
"]",
"=",
"Header",
"... | 邮件发送
Arguments:
msg {[type]} -- [description]
title {[type]} -- [description]
from_user {[type]} -- [description]
from_password {[type]} -- [description]
to_addr {[type]} -- [description]
smtp {[type]} -- [description] | [
"邮件发送",
"Arguments",
":",
"msg",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"title",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"from_user",
"{",
"[",
"type",
"]",
"}",
"--",
"[",
"description",
"]",
"from_password",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QAMail.py#L32-L50 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAFetch/QAEastMoney.py | QA_fetch_get_stock_analysis | def QA_fetch_get_stock_analysis(code):
"""
'zyfw', 主营范围 'jyps'#经营评述 'zygcfx' 主营构成分析
date 主营构成 主营收入(元) 收入比例cbbl 主营成本(元) 成本比例 主营利润(元) 利润比例 毛利率(%)
行业 /产品/ 区域 hq cp qy
"""
market = 'sh' if _select_market_code(code) == 1 else 'sz'
null = 'none'
data = eval(requests.get(BusinessAnalysis_url.f... | python | def QA_fetch_get_stock_analysis(code):
"""
'zyfw', 主营范围 'jyps'#经营评述 'zygcfx' 主营构成分析
date 主营构成 主营收入(元) 收入比例cbbl 主营成本(元) 成本比例 主营利润(元) 利润比例 毛利率(%)
行业 /产品/ 区域 hq cp qy
"""
market = 'sh' if _select_market_code(code) == 1 else 'sz'
null = 'none'
data = eval(requests.get(BusinessAnalysis_url.f... | [
"def",
"QA_fetch_get_stock_analysis",
"(",
"code",
")",
":",
"market",
"=",
"'sh'",
"if",
"_select_market_code",
"(",
"code",
")",
"==",
"1",
"else",
"'sz'",
"null",
"=",
"'none'",
"data",
"=",
"eval",
"(",
"requests",
".",
"get",
"(",
"BusinessAnalysis_url"... | 'zyfw', 主营范围 'jyps'#经营评述 'zygcfx' 主营构成分析
date 主营构成 主营收入(元) 收入比例cbbl 主营成本(元) 成本比例 主营利润(元) 利润比例 毛利率(%)
行业 /产品/ 区域 hq cp qy | [
"zyfw",
"主营范围",
"jyps",
"#经营评述",
"zygcfx",
"主营构成分析"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAEastMoney.py#L35-L66 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QATTSBroker.py | QA_TTSBroker.send_order | def send_order(self, code, price, amount, towards, order_model, market=None):
"""下单
Arguments:
code {[type]} -- [description]
price {[type]} -- [description]
amount {[type]} -- [description]
towards {[type]} -- [description]
order_model {[typ... | python | def send_order(self, code, price, amount, towards, order_model, market=None):
"""下单
Arguments:
code {[type]} -- [description]
price {[type]} -- [description]
amount {[type]} -- [description]
towards {[type]} -- [description]
order_model {[typ... | [
"def",
"send_order",
"(",
"self",
",",
"code",
",",
"price",
",",
"amount",
",",
"towards",
",",
"order_model",
",",
"market",
"=",
"None",
")",
":",
"towards",
"=",
"0",
"if",
"towards",
"==",
"ORDER_DIRECTION",
".",
"BUY",
"else",
"1",
"if",
"order_m... | 下单
Arguments:
code {[type]} -- [description]
price {[type]} -- [description]
amount {[type]} -- [description]
towards {[type]} -- [description]
order_model {[type]} -- [description]
market:市场,SZ 深交所,SH 上交所
Returns:
[ty... | [
"下单"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QATTSBroker.py#L255-L292 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADateTools.py | QA_util_getBetweenMonth | def QA_util_getBetweenMonth(from_date, to_date):
"""
#返回所有月份,以及每月的起始日期、结束日期,字典格式
"""
date_list = {}
begin_date = datetime.datetime.strptime(from_date, "%Y-%m-%d")
end_date = datetime.datetime.strptime(to_date, "%Y-%m-%d")
while begin_date <= end_date:
date_str = begin_date.strftime("... | python | def QA_util_getBetweenMonth(from_date, to_date):
"""
#返回所有月份,以及每月的起始日期、结束日期,字典格式
"""
date_list = {}
begin_date = datetime.datetime.strptime(from_date, "%Y-%m-%d")
end_date = datetime.datetime.strptime(to_date, "%Y-%m-%d")
while begin_date <= end_date:
date_str = begin_date.strftime("... | [
"def",
"QA_util_getBetweenMonth",
"(",
"from_date",
",",
"to_date",
")",
":",
"date_list",
"=",
"{",
"}",
"begin_date",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"from_date",
",",
"\"%Y-%m-%d\"",
")",
"end_date",
"=",
"datetime",
".",
"datetime",... | #返回所有月份,以及每月的起始日期、结束日期,字典格式 | [
"#返回所有月份,以及每月的起始日期、结束日期,字典格式"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADateTools.py#L6-L19 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADateTools.py | QA_util_add_months | def QA_util_add_months(dt, months):
"""
#返回dt隔months个月后的日期,months相当于步长
"""
dt = datetime.datetime.strptime(
dt, "%Y-%m-%d") + relativedelta(months=months)
return(dt) | python | def QA_util_add_months(dt, months):
"""
#返回dt隔months个月后的日期,months相当于步长
"""
dt = datetime.datetime.strptime(
dt, "%Y-%m-%d") + relativedelta(months=months)
return(dt) | [
"def",
"QA_util_add_months",
"(",
"dt",
",",
"months",
")",
":",
"dt",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"dt",
",",
"\"%Y-%m-%d\"",
")",
"+",
"relativedelta",
"(",
"months",
"=",
"months",
")",
"return",
"(",
"dt",
")"
] | #返回dt隔months个月后的日期,months相当于步长 | [
"#返回dt隔months个月后的日期,months相当于步长"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADateTools.py#L22-L28 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADateTools.py | QA_util_get_1st_of_next_month | def QA_util_get_1st_of_next_month(dt):
"""
获取下个月第一天的日期
:return: 返回日期
"""
year = dt.year
month = dt.month
if month == 12:
month = 1
year += 1
else:
month += 1
res = datetime.datetime(year, month, 1)
return res | python | def QA_util_get_1st_of_next_month(dt):
"""
获取下个月第一天的日期
:return: 返回日期
"""
year = dt.year
month = dt.month
if month == 12:
month = 1
year += 1
else:
month += 1
res = datetime.datetime(year, month, 1)
return res | [
"def",
"QA_util_get_1st_of_next_month",
"(",
"dt",
")",
":",
"year",
"=",
"dt",
".",
"year",
"month",
"=",
"dt",
".",
"month",
"if",
"month",
"==",
"12",
":",
"month",
"=",
"1",
"year",
"+=",
"1",
"else",
":",
"month",
"+=",
"1",
"res",
"=",
"datet... | 获取下个月第一天的日期
:return: 返回日期 | [
"获取下个月第一天的日期",
":",
"return",
":",
"返回日期"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADateTools.py#L31-L44 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADateTools.py | QA_util_getBetweenQuarter | def QA_util_getBetweenQuarter(begin_date, end_date):
"""
#加上每季度的起始日期、结束日期
"""
quarter_list = {}
month_list = QA_util_getBetweenMonth(begin_date, end_date)
for value in month_list:
tempvalue = value.split("-")
year = tempvalue[0]
if tempvalue[1] in ['01', '02', '03']:
... | python | def QA_util_getBetweenQuarter(begin_date, end_date):
"""
#加上每季度的起始日期、结束日期
"""
quarter_list = {}
month_list = QA_util_getBetweenMonth(begin_date, end_date)
for value in month_list:
tempvalue = value.split("-")
year = tempvalue[0]
if tempvalue[1] in ['01', '02', '03']:
... | [
"def",
"QA_util_getBetweenQuarter",
"(",
"begin_date",
",",
"end_date",
")",
":",
"quarter_list",
"=",
"{",
"}",
"month_list",
"=",
"QA_util_getBetweenMonth",
"(",
"begin_date",
",",
"end_date",
")",
"for",
"value",
"in",
"month_list",
":",
"tempvalue",
"=",
"va... | #加上每季度的起始日期、结束日期 | [
"#加上每季度的起始日期、结束日期"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADateTools.py#L47-L64 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_account.py | save_account | def save_account(message, collection=DATABASE.account):
"""save account
Arguments:
message {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
"""
try:
collection.create_index(
[("account_cookie", ASCENDING), (... | python | def save_account(message, collection=DATABASE.account):
"""save account
Arguments:
message {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE})
"""
try:
collection.create_index(
[("account_cookie", ASCENDING), (... | [
"def",
"save_account",
"(",
"message",
",",
"collection",
"=",
"DATABASE",
".",
"account",
")",
":",
"try",
":",
"collection",
".",
"create_index",
"(",
"[",
"(",
"\"account_cookie\"",
",",
"ASCENDING",
")",
",",
"(",
"\"user_cookie\"",
",",
"ASCENDING",
")"... | save account
Arguments:
message {[type]} -- [description]
Keyword Arguments:
collection {[type]} -- [description] (default: {DATABASE}) | [
"save",
"account"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_account.py#L32-L51 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_financialfiles.py | QA_SU_save_financial_files | def QA_SU_save_financial_files():
"""本地存储financialdata
"""
download_financialzip()
coll = DATABASE.financial
coll.create_index(
[("code", ASCENDING), ("report_date", ASCENDING)], unique=True)
for item in os.listdir(download_path):
if item[0:4] != 'gpcw':
print(
... | python | def QA_SU_save_financial_files():
"""本地存储financialdata
"""
download_financialzip()
coll = DATABASE.financial
coll.create_index(
[("code", ASCENDING), ("report_date", ASCENDING)], unique=True)
for item in os.listdir(download_path):
if item[0:4] != 'gpcw':
print(
... | [
"def",
"QA_SU_save_financial_files",
"(",
")",
":",
"download_financialzip",
"(",
")",
"coll",
"=",
"DATABASE",
".",
"financial",
"coll",
".",
"create_index",
"(",
"[",
"(",
"\"code\"",
",",
"ASCENDING",
")",
",",
"(",
"\"report_date\"",
",",
"ASCENDING",
")",... | 本地存储financialdata | [
"本地存储financialdata"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_financialfiles.py#L39-L71 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QALogs.py | QA_util_log_info | def QA_util_log_info(
logs,
ui_log=None,
ui_progress=None,
ui_progress_int_value=None,
):
"""
QUANTAXIS Log Module
@yutiansut
QA_util_log_x is under [QAStandard#0.0.2@602-x] Protocol
"""
logging.warning(logs)
# 给GUI使用,更新当前任务到日志和进度
if ui_log is not None:
... | python | def QA_util_log_info(
logs,
ui_log=None,
ui_progress=None,
ui_progress_int_value=None,
):
"""
QUANTAXIS Log Module
@yutiansut
QA_util_log_x is under [QAStandard#0.0.2@602-x] Protocol
"""
logging.warning(logs)
# 给GUI使用,更新当前任务到日志和进度
if ui_log is not None:
... | [
"def",
"QA_util_log_info",
"(",
"logs",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
",",
"ui_progress_int_value",
"=",
"None",
",",
")",
":",
"logging",
".",
"warning",
"(",
"logs",
")",
"# 给GUI使用,更新当前任务到日志和进度",
"if",
"ui_log",
"is",
"not",
... | QUANTAXIS Log Module
@yutiansut
QA_util_log_x is under [QAStandard#0.0.2@602-x] Protocol | [
"QUANTAXIS",
"Log",
"Module",
"@yutiansut"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QALogs.py#L86-L109 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx_file.py | QA_save_tdx_to_mongo | def QA_save_tdx_to_mongo(file_dir, client=DATABASE):
"""save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE})
"""
reader = TdxMinBarReader()
__coll = client.stock_min_five
for... | python | def QA_save_tdx_to_mongo(file_dir, client=DATABASE):
"""save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE})
"""
reader = TdxMinBarReader()
__coll = client.stock_min_five
for... | [
"def",
"QA_save_tdx_to_mongo",
"(",
"file_dir",
",",
"client",
"=",
"DATABASE",
")",
":",
"reader",
"=",
"TdxMinBarReader",
"(",
")",
"__coll",
"=",
"client",
".",
"stock_min_five",
"for",
"a",
",",
"v",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"file_... | save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE}) | [
"save",
"file",
"Arguments",
":",
"file_dir",
"{",
"str",
":",
"direction",
"}",
"--",
"文件的地址",
"Keyword",
"Arguments",
":",
"client",
"{",
"Mongodb",
":",
"Connection",
"}",
"--",
"Mongo",
"Connection",
"(",
"default",
":",
"{",
"DATABASE",
"}",
")"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx_file.py#L35-L68 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QASetting.py | exclude_from_stock_ip_list | def exclude_from_stock_ip_list(exclude_ip_list):
""" 从stock_ip_list删除列表exclude_ip_list中的ip
从stock_ip_list删除列表future_ip_list中的ip
:param exclude_ip_list: 需要删除的ip_list
:return: None
"""
for exc in exclude_ip_list:
if exc in stock_ip_list:
stock_ip_list.remove(exc)
# 扩展市场
... | python | def exclude_from_stock_ip_list(exclude_ip_list):
""" 从stock_ip_list删除列表exclude_ip_list中的ip
从stock_ip_list删除列表future_ip_list中的ip
:param exclude_ip_list: 需要删除的ip_list
:return: None
"""
for exc in exclude_ip_list:
if exc in stock_ip_list:
stock_ip_list.remove(exc)
# 扩展市场
... | [
"def",
"exclude_from_stock_ip_list",
"(",
"exclude_ip_list",
")",
":",
"for",
"exc",
"in",
"exclude_ip_list",
":",
"if",
"exc",
"in",
"stock_ip_list",
":",
"stock_ip_list",
".",
"remove",
"(",
"exc",
")",
"# 扩展市场",
"for",
"exc",
"in",
"exclude_ip_list",
":",
"... | 从stock_ip_list删除列表exclude_ip_list中的ip
从stock_ip_list删除列表future_ip_list中的ip
:param exclude_ip_list: 需要删除的ip_list
:return: None | [
"从stock_ip_list删除列表exclude_ip_list中的ip",
"从stock_ip_list删除列表future_ip_list中的ip"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QASetting.py#L209-L223 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QASetting.py | QA_Setting.get_config | def get_config(
self,
section='MONGODB',
option='uri',
default_value=DEFAULT_DB_URI
):
"""[summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
... | python | def get_config(
self,
section='MONGODB',
option='uri',
default_value=DEFAULT_DB_URI
):
"""[summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
... | [
"def",
"get_config",
"(",
"self",
",",
"section",
"=",
"'MONGODB'",
",",
"option",
"=",
"'uri'",
",",
"default_value",
"=",
"DEFAULT_DB_URI",
")",
":",
"res",
"=",
"self",
".",
"client",
".",
"quantaxis",
".",
"usersetting",
".",
"find_one",
"(",
"{",
"'... | [summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
default_value {[type]} -- [description] (default: {DEFAULT_DB_URI})
Returns:
[type] -- [description] | [
"[",
"summary",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QASetting.py#L78-L101 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QASetting.py | QA_Setting.set_config | def set_config(
self,
section='MONGODB',
option='uri',
default_value=DEFAULT_DB_URI
):
"""[summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
... | python | def set_config(
self,
section='MONGODB',
option='uri',
default_value=DEFAULT_DB_URI
):
"""[summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
... | [
"def",
"set_config",
"(",
"self",
",",
"section",
"=",
"'MONGODB'",
",",
"option",
"=",
"'uri'",
",",
"default_value",
"=",
"DEFAULT_DB_URI",
")",
":",
"t",
"=",
"{",
"'section'",
":",
"section",
",",
"option",
":",
"default_value",
"}",
"self",
".",
"cl... | [summary]
Keyword Arguments:
section {str} -- [description] (default: {'MONGODB'})
option {str} -- [description] (default: {'uri'})
default_value {[type]} -- [description] (default: {DEFAULT_DB_URI})
Returns:
[type] -- [description] | [
"[",
"summary",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QASetting.py#L103-L121 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QASetting.py | QA_Setting.get_or_set_section | def get_or_set_section(
self,
config,
section,
option,
DEFAULT_VALUE,
method='get'
):
"""[summary]
Arguments:
config {[type]} -- [description]
section {[type]} -- [description]
option {[type]... | python | def get_or_set_section(
self,
config,
section,
option,
DEFAULT_VALUE,
method='get'
):
"""[summary]
Arguments:
config {[type]} -- [description]
section {[type]} -- [description]
option {[type]... | [
"def",
"get_or_set_section",
"(",
"self",
",",
"config",
",",
"section",
",",
"option",
",",
"DEFAULT_VALUE",
",",
"method",
"=",
"'get'",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"DEFAULT_VALUE",
",",
"str",
")",
":",
"val",
"=",
"DEFAULT_VALUE",
... | [summary]
Arguments:
config {[type]} -- [description]
section {[type]} -- [description]
option {[type]} -- [description]
DEFAULT_VALUE {[type]} -- [description]
Keyword Arguments:
method {str} -- [description] (default: {'get'})
Retu... | [
"[",
"summary",
"]"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QASetting.py#L147-L183 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_date_str2int | def QA_util_date_str2int(date):
"""
日期字符串 '2011-09-11' 变换成 整数 20110911
日期字符串 '2018-12-01' 变换成 整数 20181201
:param date: str日期字符串
:return: 类型int
"""
# return int(str(date)[0:4] + str(date)[5:7] + str(date)[8:10])
if isinstance(date, str):
return int(str().join(date.split('-')))
... | python | def QA_util_date_str2int(date):
"""
日期字符串 '2011-09-11' 变换成 整数 20110911
日期字符串 '2018-12-01' 变换成 整数 20181201
:param date: str日期字符串
:return: 类型int
"""
# return int(str(date)[0:4] + str(date)[5:7] + str(date)[8:10])
if isinstance(date, str):
return int(str().join(date.split('-')))
... | [
"def",
"QA_util_date_str2int",
"(",
"date",
")",
":",
"# return int(str(date)[0:4] + str(date)[5:7] + str(date)[8:10])",
"if",
"isinstance",
"(",
"date",
",",
"str",
")",
":",
"return",
"int",
"(",
"str",
"(",
")",
".",
"join",
"(",
"date",
".",
"split",
"(",
... | 日期字符串 '2011-09-11' 变换成 整数 20110911
日期字符串 '2018-12-01' 变换成 整数 20181201
:param date: str日期字符串
:return: 类型int | [
"日期字符串",
"2011",
"-",
"09",
"-",
"11",
"变换成",
"整数",
"20110911",
"日期字符串",
"2018",
"-",
"12",
"-",
"01",
"变换成",
"整数",
"20181201",
":",
"param",
"date",
":",
"str日期字符串",
":",
"return",
":",
"类型int"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L60-L71 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_date_int2str | def QA_util_date_int2str(int_date):
"""
类型datetime.datatime
:param date: int 8位整数
:return: 类型str
"""
date = str(int_date)
if len(date) == 8:
return str(date[0:4] + '-' + date[4:6] + '-' + date[6:8])
elif len(date) == 10:
return date | python | def QA_util_date_int2str(int_date):
"""
类型datetime.datatime
:param date: int 8位整数
:return: 类型str
"""
date = str(int_date)
if len(date) == 8:
return str(date[0:4] + '-' + date[4:6] + '-' + date[6:8])
elif len(date) == 10:
return date | [
"def",
"QA_util_date_int2str",
"(",
"int_date",
")",
":",
"date",
"=",
"str",
"(",
"int_date",
")",
"if",
"len",
"(",
"date",
")",
"==",
"8",
":",
"return",
"str",
"(",
"date",
"[",
"0",
":",
"4",
"]",
"+",
"'-'",
"+",
"date",
"[",
"4",
":",
"6... | 类型datetime.datatime
:param date: int 8位整数
:return: 类型str | [
"类型datetime",
".",
"datatime",
":",
"param",
"date",
":",
"int",
"8位整数",
":",
"return",
":",
"类型str"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L74-L84 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_to_datetime | def QA_util_to_datetime(time):
"""
字符串 '2018-01-01' 转变成 datatime 类型
:param time: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型datetime.datatime
"""
if len(str(time)) == 10:
_time = '{} 00:00:00'.format(time)
elif len(str(time)) == 19:
_time = str(time)
else:
QA_ut... | python | def QA_util_to_datetime(time):
"""
字符串 '2018-01-01' 转变成 datatime 类型
:param time: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型datetime.datatime
"""
if len(str(time)) == 10:
_time = '{} 00:00:00'.format(time)
elif len(str(time)) == 19:
_time = str(time)
else:
QA_ut... | [
"def",
"QA_util_to_datetime",
"(",
"time",
")",
":",
"if",
"len",
"(",
"str",
"(",
"time",
")",
")",
"==",
"10",
":",
"_time",
"=",
"'{} 00:00:00'",
".",
"format",
"(",
"time",
")",
"elif",
"len",
"(",
"str",
"(",
"time",
")",
")",
"==",
"19",
":... | 字符串 '2018-01-01' 转变成 datatime 类型
:param time: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型datetime.datatime | [
"字符串",
"2018",
"-",
"01",
"-",
"01",
"转变成",
"datatime",
"类型",
":",
"param",
"time",
":",
"字符串str",
"--",
"格式必须是",
"2018",
"-",
"01",
"-",
"01",
",长度10",
":",
"return",
":",
"类型datetime",
".",
"datatime"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L87-L99 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_datetime_to_strdate | def QA_util_datetime_to_strdate(dt):
"""
:param dt: pythone datetime.datetime
:return: 1999-02-01 string type
"""
strdate = "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
return strdate | python | def QA_util_datetime_to_strdate(dt):
"""
:param dt: pythone datetime.datetime
:return: 1999-02-01 string type
"""
strdate = "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
return strdate | [
"def",
"QA_util_datetime_to_strdate",
"(",
"dt",
")",
":",
"strdate",
"=",
"\"%04d-%02d-%02d\"",
"%",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
")",
"return",
"strdate"
] | :param dt: pythone datetime.datetime
:return: 1999-02-01 string type | [
":",
"param",
"dt",
":",
"pythone",
"datetime",
".",
"datetime",
":",
"return",
":",
"1999",
"-",
"02",
"-",
"01",
"string",
"type"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L102-L108 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_datetime_to_strdatetime | def QA_util_datetime_to_strdatetime(dt):
"""
:param dt: pythone datetime.datetime
:return: 1999-02-01 09:30:91 string type
"""
strdatetime = "%04d-%02d-%02d %02d:%02d:%02d" % (
dt.year,
dt.month,
dt.day,
dt.hour,
dt.minute,
dt.second
)
return... | python | def QA_util_datetime_to_strdatetime(dt):
"""
:param dt: pythone datetime.datetime
:return: 1999-02-01 09:30:91 string type
"""
strdatetime = "%04d-%02d-%02d %02d:%02d:%02d" % (
dt.year,
dt.month,
dt.day,
dt.hour,
dt.minute,
dt.second
)
return... | [
"def",
"QA_util_datetime_to_strdatetime",
"(",
"dt",
")",
":",
"strdatetime",
"=",
"\"%04d-%02d-%02d %02d:%02d:%02d\"",
"%",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
",",
"dt",
".",
"hour",
",",
"dt",
".",
"minute",
",",
"d... | :param dt: pythone datetime.datetime
:return: 1999-02-01 09:30:91 string type | [
":",
"param",
"dt",
":",
"pythone",
"datetime",
".",
"datetime",
":",
"return",
":",
"1999",
"-",
"02",
"-",
"01",
"09",
":",
"30",
":",
"91",
"string",
"type"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L111-L124 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_date_stamp | def QA_util_date_stamp(date):
"""
字符串 '2018-01-01' 转变成 float 类型时间 类似 time.time() 返回的类型
:param date: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型float
"""
datestr = str(date)[0:10]
date = time.mktime(time.strptime(datestr, '%Y-%m-%d'))
return date | python | def QA_util_date_stamp(date):
"""
字符串 '2018-01-01' 转变成 float 类型时间 类似 time.time() 返回的类型
:param date: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型float
"""
datestr = str(date)[0:10]
date = time.mktime(time.strptime(datestr, '%Y-%m-%d'))
return date | [
"def",
"QA_util_date_stamp",
"(",
"date",
")",
":",
"datestr",
"=",
"str",
"(",
"date",
")",
"[",
"0",
":",
"10",
"]",
"date",
"=",
"time",
".",
"mktime",
"(",
"time",
".",
"strptime",
"(",
"datestr",
",",
"'%Y-%m-%d'",
")",
")",
"return",
"date"
] | 字符串 '2018-01-01' 转变成 float 类型时间 类似 time.time() 返回的类型
:param date: 字符串str -- 格式必须是 2018-01-01 ,长度10
:return: 类型float | [
"字符串",
"2018",
"-",
"01",
"-",
"01",
"转变成",
"float",
"类型时间",
"类似",
"time",
".",
"time",
"()",
"返回的类型",
":",
"param",
"date",
":",
"字符串str",
"--",
"格式必须是",
"2018",
"-",
"01",
"-",
"01",
",长度10",
":",
"return",
":",
"类型float"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L127-L135 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_time_stamp | def QA_util_time_stamp(time_):
"""
字符串 '2018-01-01 00:00:00' 转变成 float 类型时间 类似 time.time() 返回的类型
:param time_: 字符串str -- 数据格式 最好是%Y-%m-%d %H:%M:%S 中间要有空格
:return: 类型float
"""
if len(str(time_)) == 10:
# yyyy-mm-dd格式
return time.mktime(time.strptime(time_, '%Y-%m-%d'))
elif l... | python | def QA_util_time_stamp(time_):
"""
字符串 '2018-01-01 00:00:00' 转变成 float 类型时间 类似 time.time() 返回的类型
:param time_: 字符串str -- 数据格式 最好是%Y-%m-%d %H:%M:%S 中间要有空格
:return: 类型float
"""
if len(str(time_)) == 10:
# yyyy-mm-dd格式
return time.mktime(time.strptime(time_, '%Y-%m-%d'))
elif l... | [
"def",
"QA_util_time_stamp",
"(",
"time_",
")",
":",
"if",
"len",
"(",
"str",
"(",
"time_",
")",
")",
"==",
"10",
":",
"# yyyy-mm-dd格式",
"return",
"time",
".",
"mktime",
"(",
"time",
".",
"strptime",
"(",
"time_",
",",
"'%Y-%m-%d'",
")",
")",
"elif",
... | 字符串 '2018-01-01 00:00:00' 转变成 float 类型时间 类似 time.time() 返回的类型
:param time_: 字符串str -- 数据格式 最好是%Y-%m-%d %H:%M:%S 中间要有空格
:return: 类型float | [
"字符串",
"2018",
"-",
"01",
"-",
"01",
"00",
":",
"00",
":",
"00",
"转变成",
"float",
"类型时间",
"类似",
"time",
".",
"time",
"()",
"返回的类型",
":",
"param",
"time_",
":",
"字符串str",
"--",
"数据格式",
"最好是%Y",
"-",
"%m",
"-",
"%d",
"%H",
":",
"%M",
":",
"%S",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L138-L152 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_stamp2datetime | def QA_util_stamp2datetime(timestamp):
"""
datestamp转datetime
pandas转出来的timestamp是13位整数 要/1000
It’s common for this to be restricted to years from 1970 through 2038.
从1970年开始的纳秒到当前的计数 转变成 float 类型时间 类似 time.time() 返回的类型
:param timestamp: long类型
:return: 类型float
"""
try:
retur... | python | def QA_util_stamp2datetime(timestamp):
"""
datestamp转datetime
pandas转出来的timestamp是13位整数 要/1000
It’s common for this to be restricted to years from 1970 through 2038.
从1970年开始的纳秒到当前的计数 转变成 float 类型时间 类似 time.time() 返回的类型
:param timestamp: long类型
:return: 类型float
"""
try:
retur... | [
"def",
"QA_util_stamp2datetime",
"(",
"timestamp",
")",
":",
"try",
":",
"return",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"timestamp",
")",
"except",
"Exception",
"as",
"e",
":",
"# it won't work ??",
"try",
":",
"return",
"datetime",
".",
"da... | datestamp转datetime
pandas转出来的timestamp是13位整数 要/1000
It’s common for this to be restricted to years from 1970 through 2038.
从1970年开始的纳秒到当前的计数 转变成 float 类型时间 类似 time.time() 返回的类型
:param timestamp: long类型
:return: 类型float | [
"datestamp转datetime",
"pandas转出来的timestamp是13位整数",
"要",
"/",
"1000",
"It’s",
"common",
"for",
"this",
"to",
"be",
"restricted",
"to",
"years",
"from",
"1970",
"through",
"2038",
".",
"从1970年开始的纳秒到当前的计数",
"转变成",
"float",
"类型时间",
"类似",
"time",
".",
"time",
"()",
... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L173-L192 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_realtime | def QA_util_realtime(strtime, client):
"""
查询数据库中的数据
:param strtime: strtime str字符串 -- 1999-12-11 这种格式
:param client: client pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Dictionary -- {'time_real': 时间,'id': id}
"""... | python | def QA_util_realtime(strtime, client):
"""
查询数据库中的数据
:param strtime: strtime str字符串 -- 1999-12-11 这种格式
:param client: client pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Dictionary -- {'time_real': 时间,'id': id}
"""... | [
"def",
"QA_util_realtime",
"(",
"strtime",
",",
"client",
")",
":",
"time_stamp",
"=",
"QA_util_date_stamp",
"(",
"strtime",
")",
"coll",
"=",
"client",
".",
"quantaxis",
".",
"trade_date",
"temp_str",
"=",
"coll",
".",
"find_one",
"(",
"{",
"'date_stamp'",
... | 查询数据库中的数据
:param strtime: strtime str字符串 -- 1999-12-11 这种格式
:param client: client pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Dictionary -- {'time_real': 时间,'id': id} | [
"查询数据库中的数据",
":",
"param",
"strtime",
":",
"strtime",
"str字符串",
"--",
"1999",
"-",
"12",
"-",
"11",
"这种格式",
":",
"param",
"client",
":",
"client",
"pymongo",
".",
"MongoClient类型",
"--",
"mongodb",
"数据库",
"从",
"QA_util_sql_mongo_setting",
"中",
"QA_util_sql_mong... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L219-L231 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_id2date | def QA_util_id2date(idx, client):
"""
从数据库中查询 通达信时间
:param idx: 字符串 -- 数据库index
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Str -- 通达信数据库时间
"""
coll = client.quantaxis.trade_date
temp_str = coll.find_o... | python | def QA_util_id2date(idx, client):
"""
从数据库中查询 通达信时间
:param idx: 字符串 -- 数据库index
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Str -- 通达信数据库时间
"""
coll = client.quantaxis.trade_date
temp_str = coll.find_o... | [
"def",
"QA_util_id2date",
"(",
"idx",
",",
"client",
")",
":",
"coll",
"=",
"client",
".",
"quantaxis",
".",
"trade_date",
"temp_str",
"=",
"coll",
".",
"find_one",
"(",
"{",
"'num'",
":",
"idx",
"}",
")",
"return",
"temp_str",
"[",
"'date'",
"]"
] | 从数据库中查询 通达信时间
:param idx: 字符串 -- 数据库index
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Str -- 通达信数据库时间 | [
"从数据库中查询",
"通达信时间",
":",
"param",
"idx",
":",
"字符串",
"--",
"数据库index",
":",
"param",
"client",
":",
"pymongo",
".",
"MongoClient类型",
"--",
"mongodb",
"数据库",
"从",
"QA_util_sql_mongo_setting",
"中",
"QA_util_sql_mongo_setting",
"获取",
":",
"return",
":",
"Str",
"-... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L234-L243 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_is_trade | def QA_util_is_trade(date, code, client):
"""
判断是否是交易日
从数据库中查询
:param date: str类型 -- 1999-12-11 这种格式 10位字符串
:param code: str类型 -- 股票代码 例如 603658 , 6位字符串
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Boolean -- 是... | python | def QA_util_is_trade(date, code, client):
"""
判断是否是交易日
从数据库中查询
:param date: str类型 -- 1999-12-11 这种格式 10位字符串
:param code: str类型 -- 股票代码 例如 603658 , 6位字符串
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Boolean -- 是... | [
"def",
"QA_util_is_trade",
"(",
"date",
",",
"code",
",",
"client",
")",
":",
"coll",
"=",
"client",
".",
"quantaxis",
".",
"stock_day",
"date",
"=",
"str",
"(",
"date",
")",
"[",
"0",
":",
"10",
"]",
"is_trade",
"=",
"coll",
".",
"find_one",
"(",
... | 判断是否是交易日
从数据库中查询
:param date: str类型 -- 1999-12-11 这种格式 10位字符串
:param code: str类型 -- 股票代码 例如 603658 , 6位字符串
:param client: pymongo.MongoClient类型 -- mongodb 数据库 从 QA_util_sql_mongo_setting 中 QA_util_sql_mongo_setting 获取
:return: Boolean -- 是否是交易时间 | [
"判断是否是交易日",
"从数据库中查询",
":",
"param",
"date",
":",
"str类型",
"--",
"1999",
"-",
"12",
"-",
"11",
"这种格式",
"10位字符串",
":",
"param",
"code",
":",
"str类型",
"--",
"股票代码",
"例如",
"603658",
",",
"6位字符串",
":",
"param",
"client",
":",
"pymongo",
".",
"MongoClient类型... | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L246-L262 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_select_hours | def QA_util_select_hours(time=None, gt=None, lt=None, gte=None, lte=None):
'quantaxis的时间选择函数,约定时间的范围,比如早上9点到11点'
if time is None:
__realtime = datetime.datetime.now()
else:
__realtime = time
fun_list = []
if gt != None:
fun_list.append('>')
if lt != None:
fun_lis... | python | def QA_util_select_hours(time=None, gt=None, lt=None, gte=None, lte=None):
'quantaxis的时间选择函数,约定时间的范围,比如早上9点到11点'
if time is None:
__realtime = datetime.datetime.now()
else:
__realtime = time
fun_list = []
if gt != None:
fun_list.append('>')
if lt != None:
fun_lis... | [
"def",
"QA_util_select_hours",
"(",
"time",
"=",
"None",
",",
"gt",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"gte",
"=",
"None",
",",
"lte",
"=",
"None",
")",
":",
"if",
"time",
"is",
"None",
":",
"__realtime",
"=",
"datetime",
".",
"datetime",
".... | quantaxis的时间选择函数,约定时间的范围,比如早上9点到11点 | [
"quantaxis的时间选择函数",
"约定时间的范围",
"比如早上9点到11点"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L284-L331 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAUtil/QADate.py | QA_util_calc_time | def QA_util_calc_time(func, *args, **kwargs):
"""
'耗时长度的装饰器'
:param func:
:param args:
:param kwargs:
:return:
"""
_time = datetime.datetime.now()
func(*args, **kwargs)
print(datetime.datetime.now() - _time) | python | def QA_util_calc_time(func, *args, **kwargs):
"""
'耗时长度的装饰器'
:param func:
:param args:
:param kwargs:
:return:
"""
_time = datetime.datetime.now()
func(*args, **kwargs)
print(datetime.datetime.now() - _time) | [
"def",
"QA_util_calc_time",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"print",
"(",
"datetime",
".",
... | '耗时长度的装饰器'
:param func:
:param args:
:param kwargs:
:return: | [
"耗时长度的装饰器",
":",
"param",
"func",
":",
":",
"param",
"args",
":",
":",
"param",
"kwargs",
":",
":",
"return",
":"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADate.py#L407-L417 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/QADataStruct.py | QA_DataStruct_Stock_day.high_limit | def high_limit(self):
'涨停价'
return self.groupby(level=1).close.apply(lambda x: round((x.shift(1) + 0.0002)*1.1, 2)).sort_index() | python | def high_limit(self):
'涨停价'
return self.groupby(level=1).close.apply(lambda x: round((x.shift(1) + 0.0002)*1.1, 2)).sort_index() | [
"def",
"high_limit",
"(",
"self",
")",
":",
"return",
"self",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"close",
".",
"apply",
"(",
"lambda",
"x",
":",
"round",
"(",
"(",
"x",
".",
"shift",
"(",
"1",
")",
"+",
"0.0002",
")",
"*",
"1.1",... | 涨停价 | [
"涨停价"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/QADataStruct.py#L121-L123 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/QADataStruct.py | QA_DataStruct_Stock_day.next_day_low_limit | def next_day_low_limit(self):
"明日跌停价"
return self.groupby(level=1).close.apply(lambda x: round((x + 0.0002)*0.9, 2)).sort_index() | python | def next_day_low_limit(self):
"明日跌停价"
return self.groupby(level=1).close.apply(lambda x: round((x + 0.0002)*0.9, 2)).sort_index() | [
"def",
"next_day_low_limit",
"(",
"self",
")",
":",
"return",
"self",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"close",
".",
"apply",
"(",
"lambda",
"x",
":",
"round",
"(",
"(",
"x",
"+",
"0.0002",
")",
"*",
"0.9",
",",
"2",
")",
")",
... | 明日跌停价 | [
"明日跌停价"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/QADataStruct.py#L133-L135 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/QADataStruct.py | QA_DataStruct_Stock_transaction.get_medium_order | def get_medium_order(self, lower=200000, higher=1000000):
"""return medium
Keyword Arguments:
lower {[type]} -- [description] (default: {200000})
higher {[type]} -- [description] (default: {1000000})
Returns:
[type] -- [description]
"""
retu... | python | def get_medium_order(self, lower=200000, higher=1000000):
"""return medium
Keyword Arguments:
lower {[type]} -- [description] (default: {200000})
higher {[type]} -- [description] (default: {1000000})
Returns:
[type] -- [description]
"""
retu... | [
"def",
"get_medium_order",
"(",
"self",
",",
"lower",
"=",
"200000",
",",
"higher",
"=",
"1000000",
")",
":",
"return",
"self",
".",
"data",
".",
"query",
"(",
"'amount>={}'",
".",
"format",
"(",
"lower",
")",
")",
".",
"query",
"(",
"'amount<={}'",
".... | return medium
Keyword Arguments:
lower {[type]} -- [description] (default: {200000})
higher {[type]} -- [description] (default: {1000000})
Returns:
[type] -- [description] | [
"return",
"medium"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/QADataStruct.py#L767-L778 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAAnalysis/QAAnalysis_dataframe.py | shadow_calc | def shadow_calc(data):
"""计算上下影线
Arguments:
data {DataStruct.slice} -- 输入的是一个行情切片
Returns:
up_shadow {float} -- 上影线
down_shdow {float} -- 下影线
entity {float} -- 实体部分
date {str} -- 时间
code {str} -- 代码
"""
up_shadow = abs(data.high - (max(data.open, da... | python | def shadow_calc(data):
"""计算上下影线
Arguments:
data {DataStruct.slice} -- 输入的是一个行情切片
Returns:
up_shadow {float} -- 上影线
down_shdow {float} -- 下影线
entity {float} -- 实体部分
date {str} -- 时间
code {str} -- 代码
"""
up_shadow = abs(data.high - (max(data.open, da... | [
"def",
"shadow_calc",
"(",
"data",
")",
":",
"up_shadow",
"=",
"abs",
"(",
"data",
".",
"high",
"-",
"(",
"max",
"(",
"data",
".",
"open",
",",
"data",
".",
"close",
")",
")",
")",
"down_shadow",
"=",
"abs",
"(",
"data",
".",
"low",
"-",
"(",
"... | 计算上下影线
Arguments:
data {DataStruct.slice} -- 输入的是一个行情切片
Returns:
up_shadow {float} -- 上影线
down_shdow {float} -- 下影线
entity {float} -- 实体部分
date {str} -- 时间
code {str} -- 代码 | [
"计算上下影线"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAAnalysis/QAAnalysis_dataframe.py#L202-L225 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAMarket/QASimulatedBroker.py | QA_SimulatedBroker.query_data | def query_data(self, code, start, end, frequence, market_type=None):
"""
标准格式是numpy
"""
try:
return self.fetcher[(market_type, frequence)](
code, start, end, frequence=frequence)
except:
pass | python | def query_data(self, code, start, end, frequence, market_type=None):
"""
标准格式是numpy
"""
try:
return self.fetcher[(market_type, frequence)](
code, start, end, frequence=frequence)
except:
pass | [
"def",
"query_data",
"(",
"self",
",",
"code",
",",
"start",
",",
"end",
",",
"frequence",
",",
"market_type",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"fetcher",
"[",
"(",
"market_type",
",",
"frequence",
")",
"]",
"(",
"code",
",",... | 标准格式是numpy | [
"标准格式是numpy"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QASimulatedBroker.py#L76-L84 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_gm.py | QA_SU_save_stock_min | def QA_SU_save_stock_min(client=DATABASE, ui_log=None, ui_progress=None):
"""
掘金实现方式
save current day's stock_min data
"""
# 导入掘金模块且进行登录
try:
from gm.api import set_token
from gm.api import history
# 请自行将掘金量化的 TOKEN 替换掉 GMTOKEN
set_token("9c5601171e97994686b47b5cb... | python | def QA_SU_save_stock_min(client=DATABASE, ui_log=None, ui_progress=None):
"""
掘金实现方式
save current day's stock_min data
"""
# 导入掘金模块且进行登录
try:
from gm.api import set_token
from gm.api import history
# 请自行将掘金量化的 TOKEN 替换掉 GMTOKEN
set_token("9c5601171e97994686b47b5cb... | [
"def",
"QA_SU_save_stock_min",
"(",
"client",
"=",
"DATABASE",
",",
"ui_log",
"=",
"None",
",",
"ui_progress",
"=",
"None",
")",
":",
"# 导入掘金模块且进行登录",
"try",
":",
"from",
"gm",
".",
"api",
"import",
"set_token",
"from",
"gm",
".",
"api",
"import",
"history... | 掘金实现方式
save current day's stock_min data | [
"掘金实现方式",
"save",
"current",
"day",
"s",
"stock_min",
"data"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_gm.py#L36-L206 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.datetime | def datetime(self):
'分钟线结构返回datetime 日线结构返回date'
index = self.data.index.remove_unused_levels()
return pd.to_datetime(index.levels[0]) | python | def datetime(self):
'分钟线结构返回datetime 日线结构返回date'
index = self.data.index.remove_unused_levels()
return pd.to_datetime(index.levels[0]) | [
"def",
"datetime",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"data",
".",
"index",
".",
"remove_unused_levels",
"(",
")",
"return",
"pd",
".",
"to_datetime",
"(",
"index",
".",
"levels",
"[",
"0",
"]",
")"
] | 分钟线结构返回datetime 日线结构返回date | [
"分钟线结构返回datetime",
"日线结构返回date"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L391-L394 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.price_diff | def price_diff(self):
'返回DataStruct.price的一阶差分'
res = self.price.groupby(level=1).apply(lambda x: x.diff(1))
res.name = 'price_diff'
return res | python | def price_diff(self):
'返回DataStruct.price的一阶差分'
res = self.price.groupby(level=1).apply(lambda x: x.diff(1))
res.name = 'price_diff'
return res | [
"def",
"price_diff",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"price",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"x",
".",
"diff",
"(",
"1",
")",
")",
"res",
".",
"name",
"=",
"'price_diff'",
"re... | 返回DataStruct.price的一阶差分 | [
"返回DataStruct",
".",
"price的一阶差分"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L447-L451 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.pvariance | def pvariance(self):
'返回DataStruct.price的方差 variance'
res = self.price.groupby(level=1
).apply(lambda x: statistics.pvariance(x))
res.name = 'pvariance'
return res | python | def pvariance(self):
'返回DataStruct.price的方差 variance'
res = self.price.groupby(level=1
).apply(lambda x: statistics.pvariance(x))
res.name = 'pvariance'
return res | [
"def",
"pvariance",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"price",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"statistics",
".",
"pvariance",
"(",
"x",
")",
")",
"res",
".",
"name",
"=",
"'pvaria... | 返回DataStruct.price的方差 variance | [
"返回DataStruct",
".",
"price的方差",
"variance"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L457-L462 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.bar_pct_change | def bar_pct_change(self):
'返回bar的涨跌幅'
res = (self.close - self.open) / self.open
res.name = 'bar_pct_change'
return res | python | def bar_pct_change(self):
'返回bar的涨跌幅'
res = (self.close - self.open) / self.open
res.name = 'bar_pct_change'
return res | [
"def",
"bar_pct_change",
"(",
"self",
")",
":",
"res",
"=",
"(",
"self",
".",
"close",
"-",
"self",
".",
"open",
")",
"/",
"self",
".",
"open",
"res",
".",
"name",
"=",
"'bar_pct_change'",
"return",
"res"
] | 返回bar的涨跌幅 | [
"返回bar的涨跌幅"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L478-L482 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.bar_amplitude | def bar_amplitude(self):
"返回bar振幅"
res = (self.high - self.low) / self.low
res.name = 'bar_amplitude'
return res | python | def bar_amplitude(self):
"返回bar振幅"
res = (self.high - self.low) / self.low
res.name = 'bar_amplitude'
return res | [
"def",
"bar_amplitude",
"(",
"self",
")",
":",
"res",
"=",
"(",
"self",
".",
"high",
"-",
"self",
".",
"low",
")",
"/",
"self",
".",
"low",
"res",
".",
"name",
"=",
"'bar_amplitude'",
"return",
"res"
] | 返回bar振幅 | [
"返回bar振幅"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L486-L490 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.mean_harmonic | def mean_harmonic(self):
'返回DataStruct.price的调和平均数'
res = self.price.groupby(level=1
).apply(lambda x: statistics.harmonic_mean(x))
res.name = 'mean_harmonic'
return res | python | def mean_harmonic(self):
'返回DataStruct.price的调和平均数'
res = self.price.groupby(level=1
).apply(lambda x: statistics.harmonic_mean(x))
res.name = 'mean_harmonic'
return res | [
"def",
"mean_harmonic",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"price",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"statistics",
".",
"harmonic_mean",
"(",
"x",
")",
")",
"res",
".",
"name",
"=",
... | 返回DataStruct.price的调和平均数 | [
"返回DataStruct",
".",
"price的调和平均数"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L513-L518 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.amplitude | def amplitude(self):
'返回DataStruct.price的百分比变化'
res = self.price.groupby(
level=1
).apply(lambda x: (x.max() - x.min()) / x.min())
res.name = 'amplitude'
return res | python | def amplitude(self):
'返回DataStruct.price的百分比变化'
res = self.price.groupby(
level=1
).apply(lambda x: (x.max() - x.min()) / x.min())
res.name = 'amplitude'
return res | [
"def",
"amplitude",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"price",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"(",
"x",
".",
"max",
"(",
")",
"-",
"x",
".",
"min",
"(",
")",
")",
"/",
"x",
... | 返回DataStruct.price的百分比变化 | [
"返回DataStruct",
".",
"price的百分比变化"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L536-L542 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.close_pct_change | def close_pct_change(self):
'返回DataStruct.close的百分比变化'
res = self.close.groupby(level=1).apply(lambda x: x.pct_change())
res.name = 'close_pct_change'
return res | python | def close_pct_change(self):
'返回DataStruct.close的百分比变化'
res = self.close.groupby(level=1).apply(lambda x: x.pct_change())
res.name = 'close_pct_change'
return res | [
"def",
"close_pct_change",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"close",
".",
"groupby",
"(",
"level",
"=",
"1",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"x",
".",
"pct_change",
"(",
")",
")",
"res",
".",
"name",
"=",
"'close_pct_chan... | 返回DataStruct.close的百分比变化 | [
"返回DataStruct",
".",
"close的百分比变化"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L575-L579 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.normalized | def normalized(self):
'归一化'
res = self.groupby('code').apply(lambda x: x / x.iloc[0])
return res | python | def normalized(self):
'归一化'
res = self.groupby('code').apply(lambda x: x / x.iloc[0])
return res | [
"def",
"normalized",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"groupby",
"(",
"'code'",
")",
".",
"apply",
"(",
"lambda",
"x",
":",
"x",
"/",
"x",
".",
"iloc",
"[",
"0",
"]",
")",
"return",
"res"
] | 归一化 | [
"归一化"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L593-L596 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.security_gen | def security_gen(self):
'返回一个基于代码的迭代器'
for item in self.index.levels[1]:
yield self.new(
self.data.xs(item,
level=1,
drop_level=False),
dtype=self.type,
if_fq=self.if_fq
) | python | def security_gen(self):
'返回一个基于代码的迭代器'
for item in self.index.levels[1]:
yield self.new(
self.data.xs(item,
level=1,
drop_level=False),
dtype=self.type,
if_fq=self.if_fq
) | [
"def",
"security_gen",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"index",
".",
"levels",
"[",
"1",
"]",
":",
"yield",
"self",
".",
"new",
"(",
"self",
".",
"data",
".",
"xs",
"(",
"item",
",",
"level",
"=",
"1",
",",
"drop_level",
... | 返回一个基于代码的迭代器 | [
"返回一个基于代码的迭代器"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L618-L627 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.get_dict | def get_dict(self, time, code):
'''
'give the time,code tuple and turn the dict'
:param time:
:param code:
:return: 字典dict 类型
'''
try:
return self.dicts[(QA_util_to_datetime(time), str(code))]
except Exception as e:
raise e | python | def get_dict(self, time, code):
'''
'give the time,code tuple and turn the dict'
:param time:
:param code:
:return: 字典dict 类型
'''
try:
return self.dicts[(QA_util_to_datetime(time), str(code))]
except Exception as e:
raise e | [
"def",
"get_dict",
"(",
"self",
",",
"time",
",",
"code",
")",
":",
"try",
":",
"return",
"self",
".",
"dicts",
"[",
"(",
"QA_util_to_datetime",
"(",
"time",
")",
",",
"str",
"(",
"code",
")",
")",
"]",
"except",
"Exception",
"as",
"e",
":",
"raise... | 'give the time,code tuple and turn the dict'
:param time:
:param code:
:return: 字典dict 类型 | [
"give",
"the",
"time",
"code",
"tuple",
"and",
"turn",
"the",
"dict",
":",
"param",
"time",
":",
":",
"param",
"code",
":",
":",
"return",
":",
"字典dict",
"类型"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L662-L672 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.kline_echarts | def kline_echarts(self, code=None):
def kline_formater(param):
return param.name + ':' + vars(param)
"""plot the market_data"""
if code is None:
path_name = '.' + os.sep + 'QA_' + self.type + \
'_codepackage_' + self.if_fq + '.html'
kline = K... | python | def kline_echarts(self, code=None):
def kline_formater(param):
return param.name + ':' + vars(param)
"""plot the market_data"""
if code is None:
path_name = '.' + os.sep + 'QA_' + self.type + \
'_codepackage_' + self.if_fq + '.html'
kline = K... | [
"def",
"kline_echarts",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"def",
"kline_formater",
"(",
"param",
")",
":",
"return",
"param",
".",
"name",
"+",
"':'",
"+",
"vars",
"(",
"param",
")",
"if",
"code",
"is",
"None",
":",
"path_name",
"=",
... | plot the market_data | [
"plot",
"the",
"market_data"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L680-L769 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.query | def query(self, context):
"""
查询data
"""
try:
return self.data.query(context)
except pd.core.computation.ops.UndefinedVariableError:
print('QA CANNOT QUERY THIS {}'.format(context))
pass | python | def query(self, context):
"""
查询data
"""
try:
return self.data.query(context)
except pd.core.computation.ops.UndefinedVariableError:
print('QA CANNOT QUERY THIS {}'.format(context))
pass | [
"def",
"query",
"(",
"self",
",",
"context",
")",
":",
"try",
":",
"return",
"self",
".",
"data",
".",
"query",
"(",
"context",
")",
"except",
"pd",
".",
"core",
".",
"computation",
".",
"ops",
".",
"UndefinedVariableError",
":",
"print",
"(",
"'QA CAN... | 查询data | [
"查询data"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L791-L800 | train |
QUANTAXIS/QUANTAXIS | QUANTAXIS/QAData/base_datastruct.py | _quotation_base.groupby | def groupby(
self,
by=None,
axis=0,
level=None,
as_index=True,
sort=False,
group_keys=False,
squeeze=False,
**kwargs
):
"""仿dataframe的groupby写法,但控制了by的code和datetime
Keyword Arguments:
... | python | def groupby(
self,
by=None,
axis=0,
level=None,
as_index=True,
sort=False,
group_keys=False,
squeeze=False,
**kwargs
):
"""仿dataframe的groupby写法,但控制了by的code和datetime
Keyword Arguments:
... | [
"def",
"groupby",
"(",
"self",
",",
"by",
"=",
"None",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"as_index",
"=",
"True",
",",
"sort",
"=",
"False",
",",
"group_keys",
"=",
"False",
",",
"squeeze",
"=",
"False",
",",
"*",
"*",
"kwarg... | 仿dataframe的groupby写法,但控制了by的code和datetime
Keyword Arguments:
by {[type]} -- [description] (default: {None})
axis {int} -- [description] (default: {0})
level {[type]} -- [description] (default: {None})
as_index {bool} -- [description] (default: {True})
... | [
"仿dataframe的groupby写法",
"但控制了by的code和datetime"
] | bb1fe424e4108b62a1f712b81a05cf829297a5c0 | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L802-L843 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.