Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zengbin93
czsc
提交
3b9affee
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 搜索 >>
提交
3b9affee
编写于
5月 29, 2020
作者:
Z
zengbin93
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
0.3.3 优化中枢识别代码
上级
216e5246
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
19 deletion
+24
-19
chan/__init__.py
chan/__init__.py
+1
-1
chan/analyze.py
chan/analyze.py
+12
-8
test/test_analyze.py
test/test_analyze.py
+11
-10
未找到文件。
chan/__init__.py
浏览文件 @
3b9affee
...
...
@@ -7,7 +7,7 @@ from .solid import SolidAnalyze
from
.solid
import
is_in_tolerance
,
is_first_buy
,
is_first_sell
,
is_second_buy
,
\
is_second_sell
,
is_third_buy
,
is_third_sell
,
is_xd_buy
,
is_xd_sell
__version__
=
"0.3.
2
"
__version__
=
"0.3.
3
"
__author__
=
"zengbin93"
__email__
=
"zeng_bin8888@163.com"
...
...
chan/analyze.py
浏览文件 @
3b9affee
...
...
@@ -461,27 +461,31 @@ class KlineAnalyze(object):
zs_xd
=
[]
for
i
in
range
(
len
(
k_xd
)):
if
len
(
zs_xd
)
<
3
:
if
len
(
zs_xd
)
<
5
:
zs_xd
.
append
(
k_xd
[
i
])
continue
xd_p
=
k_xd
[
i
]
zs_d
=
max
([
x
[
'xd'
]
for
x
in
zs_xd
[:
3
]
if
x
[
'fx_mark'
]
==
'd'
])
zs_g
=
min
([
x
[
'xd'
]
for
x
in
zs_xd
[:
3
]
if
x
[
'fx_mark'
]
==
'g'
])
zs_d
=
max
([
x
[
'xd'
]
for
x
in
zs_xd
[
1
:
5
]
if
x
[
'fx_mark'
]
==
'd'
])
zs_g
=
min
([
x
[
'xd'
]
for
x
in
zs_xd
[
1
:
5
]
if
x
[
'fx_mark'
]
==
'g'
])
if
zs_g
<=
zs_d
:
zs_xd
.
append
(
k_xd
[
i
])
zs_xd
.
pop
(
0
)
continue
if
xd_p
[
'fx_mark'
]
==
"d"
and
xd_p
[
'xd'
]
>
zs_g
:
# 线段在中枢上方结束,形成三买
k_zs
.
append
({
'zs'
:
(
zs_d
,
zs_g
),
"zs_xd"
:
deepcopy
(
zs_xd
)})
zs_xd
=
deepcopy
(
k_xd
[
i
-
2
:
i
+
1
])
zs_xd
=
deepcopy
(
k_xd
[
i
:
i
+
1
])
elif
xd_p
[
'fx_mark'
]
==
"g"
and
xd_p
[
'xd'
]
<
zs_d
:
# 线段在中枢下方结束,形成三卖
k_zs
.
append
({
'zs'
:
(
zs_d
,
zs_g
),
"zs_xd"
:
deepcopy
(
zs_xd
)})
zs_xd
=
deepcopy
(
k_xd
[
i
-
2
:
i
+
1
])
zs_xd
=
deepcopy
(
k_xd
[
i
:
i
+
1
])
else
:
zs_xd
.
append
(
deepcopy
(
xd_p
))
if
len
(
zs_xd
)
>=
4
:
zs_d
=
max
([
x
[
'xd'
]
for
x
in
zs_xd
if
x
[
'fx_mark'
]
==
'd'
])
zs_g
=
min
([
x
[
'xd'
]
for
x
in
zs_xd
if
x
[
'fx_mark'
]
==
'g'
])
if
len
(
zs_xd
)
>=
5
:
zs_d
=
max
([
x
[
'xd'
]
for
x
in
zs_xd
[
1
:
5
]
if
x
[
'fx_mark'
]
==
'd'
])
zs_g
=
min
([
x
[
'xd'
]
for
x
in
zs_xd
[
1
:
5
]
if
x
[
'fx_mark'
]
==
'g'
])
k_zs
.
append
({
'zs'
:
(
zs_d
,
zs_g
),
"zs_xd"
:
deepcopy
(
zs_xd
)})
return
k_zs
...
...
test/test_analyze.py
浏览文件 @
3b9affee
...
...
@@ -15,21 +15,21 @@ def test_bei_chi():
ka
=
KlineAnalyze
(
df
)
# 线段背驰
zs1
=
[
'2018-07-26 15:00:00'
,
'2018-10-19 15:00:00'
]
zs2
=
[
'2018-01-29 15:00:00'
,
'2018-07-06 15:00:00'
]
assert
is_bei_chi
(
ka
,
zs1
,
zs2
,
direction
=
'down'
,
mode
=
'xd'
,
adjust
=
0.9
)
zs1
=
{
"start_dt"
:
'2018-07-26 15:00:00'
,
"end_dt"
:
'2018-10-19 15:00:00'
,
"direction"
:
"down"
}
zs2
=
{
"start_dt"
:
'2018-01-29 15:00:00'
,
"end_dt"
:
'2018-07-06 15:00:00'
,
"direction"
:
"down"
}
assert
is_bei_chi
(
ka
,
zs1
,
zs2
,
mode
=
'xd'
,
adjust
=
0.9
)
zs1
=
[
'2013-12-10 15:00:00'
,
'2014-01-20 15:00:00'
]
zs2
=
[
'2013-09-12 15:00:00'
,
'2013-11-14 15:00:00'
]
assert
not
is_bei_chi
(
ka
,
zs1
,
zs2
,
direction
=
'down'
,
mode
=
'xd'
,
adjust
=
0.9
)
zs1
=
{
"start_dt"
:
'2013-12-10 15:00:00'
,
"end_dt"
:
'2014-01-20 15:00:00'
,
"direction"
:
"down"
}
zs2
=
{
"start_dt"
:
'2013-09-12 15:00:00'
,
"end_dt"
:
'2013-11-14 15:00:00'
,
"direction"
:
"down"
}
assert
not
is_bei_chi
(
ka
,
zs1
,
zs2
,
mode
=
'xd'
,
adjust
=
0.9
)
# 笔背驰
zs1
=
[
'2019-05-17 15:00:00'
,
'2019-06-10 15:00:00'
]
zs2
=
[
'2019-04-08 15:00:00'
,
'2019-05-10 15:00:00'
]
zs1
=
{
"start_dt"
:
'2019-05-17 15:00:00'
,
"end_dt"
:
'2019-06-10 15:00:00'
}
zs2
=
{
"start_dt"
:
'2019-04-08 15:00:00'
,
"end_dt"
:
'2019-05-10 15:00:00'
}
assert
is_bei_chi
(
ka
,
zs1
,
zs2
,
mode
=
'bi'
,
adjust
=
0.9
)
zs1
=
[
'2018-09-28 15:00:00'
,
'2018-10-19 15:00:00'
]
zs2
=
[
'2018-08-28 15:00:00'
,
'2018-09-12 15:00:00'
]
zs1
=
{
"start_dt"
:
'2018-09-28 15:00:00'
,
"end_dt"
:
'2018-10-19 15:00:00'
}
zs2
=
{
"start_dt"
:
'2018-08-28 15:00:00'
,
"end_dt"
:
'2018-09-12 15:00:00'
}
assert
not
is_bei_chi
(
ka
,
zs1
,
zs2
,
mode
=
'bi'
,
adjust
=
0.9
)
...
...
@@ -44,5 +44,6 @@ def test_kline_analyze():
# 测试背驰识别
assert
not
ka
.
bi_bei_chi
()
assert
not
ka
.
xd_bei_chi
()
print
(
ka
.
zs
[
-
2
])
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录