修复 买卖点

This commit is contained in:
YuWuKunCheng
2026-05-29 15:01:02 +08:00
parent 5c3179eec8
commit 9900266516
4 changed files with 73 additions and 12 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "chanlun-py"
version = "26.5.86"
version = "26.5.89"
edition = "2021"
description = "缠论技术分析库 — Rust 高性能 Python 绑定"
authors = ["YuYuKunKun"]
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
name = "chanlun"
[dependencies]
chanlun = "26.5.3" # { path = "../chanlun" }
chanlun = { version = "26.5.3", path = "../chanlun" }
pyo3 = { version = "0.28", features = ["extension-module", "experimental-inspect"] }
serde_json = "1"
chrono = "0.4"
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "maturin"
[project]
name = "chanlun"
version = "2605.86"
version = "2605.89"
description = "缠论技术分析库 — Rust 高性能实现"
readme = { file = "README.md", content-type = "text/markdown" }
license = { file = "LICENSE", content-type = "text/plain" }
+7
View File
@@ -71,6 +71,7 @@ impl 基础买卖点Py {
Arc::clone(&.borrow().inner),
,
,
K线.borrow().inner.,
),
}
}
@@ -227,6 +228,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
@@ -248,6 +250,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
@@ -269,6 +272,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
@@ -290,6 +294,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
@@ -311,6 +316,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
@@ -332,6 +338,7 @@ impl 买卖点Py {
,
,
,
K线.borrow().inner.,
),
}
}
+63 -9
View File
@@ -42,6 +42,8 @@ pub struct 基础买卖点 {
pub K线: Option<Arc<K线>>,
pub : f64,
pub : Option<>,
/// 当前缠K的序号 — 与 Python 一致,偏移计算使用缠论K线序号而非标的K线序号
pub : i64,
}
impl {
@@ -51,6 +53,7 @@ impl 基础买卖点 {
: Arc<>,
: String,
: f64,
: i64,
) -> Self {
let K线 = Arc::clone(&.);
Self {
@@ -63,12 +66,13 @@ impl 基础买卖点 {
K线: None,
: ,
: None,
,
}
}
/// 偏移 — 当前K线与买卖点K线序号
/// 偏移 — 当前缠K序号与买卖点K线序号的差(对齐 Python,使用缠论K线序号)
pub fn (&self) -> i64 {
self.K线. - self.K线..load(Ordering::Relaxed)
self. - self.K线..load(Ordering::Relaxed)
}
/// 失效偏移
@@ -118,8 +122,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
pub fn (
@@ -128,8 +140,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
pub fn (
@@ -138,8 +158,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
pub fn (
@@ -148,8 +176,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
pub fn (
@@ -158,8 +194,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
pub fn (
@@ -168,8 +212,16 @@ impl 买卖点 {
_标识: &str,
: String,
: f64,
: i64,
) -> {
::new(::, K线, , , )
::new(
::,
K线,
,
,
,
,
)
}
/// 生成买卖点 — 根据参数自动选择类型
@@ -190,6 +242,8 @@ impl 买卖点 {
// 当前K线 — 从缠K获取其标的K线
let K线 = Arc::clone(&*K.K线.read().unwrap());
// 当前序号 — 使用缠论K线序号(对齐 Python 偏移计算)
let = K..load(Ordering::Relaxed);
let = match (, ) {
("", "") => ::,
@@ -201,6 +255,6 @@ impl 买卖点 {
_ => ::, // fallback
};
::new(, K线, , , )
::new(, K线, , , , )
}
}