Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zengbin93
czsc
提交
6e12c653
C
czsc
项目概览
zengbin93
/
czsc
通知
23
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
czsc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6e12c653
编写于
8月 05, 2019
作者:
Z
zengbin93
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add xd_mark
上级
e16f3db6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
4 deletion
+19
-4
chan/utils.py
chan/utils.py
+19
-4
未找到文件。
chan/utils.py
浏览文件 @
6e12c653
...
...
@@ -123,6 +123,7 @@ def find_bi(kline):
kline
.
loc
[
i
,
'bi_mark'
]
=
mark
mark
+=
1
del
kline
[
'fx'
]
return
kline
...
...
@@ -140,7 +141,7 @@ def find_xd(kline):
i
=
4
mark
=
0
kline
[
'
xd_mark
'
]
=
None
kline
[
'
fx
'
]
=
None
while
i
<=
kline
[
'bi_mark'
].
max
():
gd1
=
kline
[
kline
[
'bi_mark'
]
==
i
-
3
].
iloc
[
0
]
...
...
@@ -150,20 +151,33 @@ def find_xd(kline):
# 第二个顶分型的最高价小于或等于第一个顶分型的最高价,向上过程有可能结束
if
direction
==
"向上"
and
gd2
[
'high'
]
<=
gd1
[
'high'
]:
kline
.
loc
[
gd1
.
name
,
'
xd_mark'
]
=
mark
kline
.
loc
[
gd1
.
name
,
'
fx'
]
=
0
mark
+=
1
direction
=
"向下"
# 第二个底分型的最低价大于或等于第一个底分型的最低价,向下过程有可能结束
elif
direction
==
"向下"
and
dd2
[
'low'
]
>=
dd1
[
'low'
]:
kline
.
loc
[
dd1
.
name
,
'
xd_mark'
]
=
mark
kline
.
loc
[
dd1
.
name
,
'
fx'
]
=
1
mark
+=
1
direction
=
"向上"
i
+=
2
# 线段有效的基础: 标准特征序列中至少含一笔
# TODO(zengbin): 检查线段的有效性
# 添加 线段标记 - 从第一个有效顶分型开始标记
kline
[
'xd_mark'
]
=
None
mark
=
0
for
i
,
row
in
kline
.
iterrows
():
if
mark
==
0
and
row
[
'fx'
]
==
0
:
kline
.
loc
[
i
,
'xd_mark'
]
=
mark
mark
+=
1
continue
if
mark
>
0
and
row
[
'fx'
]
in
[
0
,
1
]:
kline
.
loc
[
i
,
'xd_mark'
]
=
mark
mark
+=
1
del
kline
[
'fx'
]
return
kline
...
...
@@ -222,3 +236,4 @@ def boll(kline):
kline
[
'boll-top'
]
=
kline
[
'boll-top'
].
apply
(
round
,
args
=
(
4
,))
kline
[
'boll-bottom'
]
=
kline
[
'boll-bottom'
].
apply
(
round
,
args
=
(
4
,))
return
kline
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录