-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from fasiondog/feature/turnover
add TURNOVER 换手率指标
- Loading branch information
Showing
6 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-04-06 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#include "KDATA.h" | ||
#include "SUM.h" | ||
#include "LIUTONGPAN.h" | ||
#include "TURNOVER.h" | ||
|
||
namespace hku { | ||
|
||
// 不需要乘以 100,成交量已经是手数即100 | ||
Indicator HKU_API TURNOVER(int n) { | ||
HKU_ASSERT(n >= 1); | ||
return n == 1 ? (VOL() / LIUTONGPAN()) : (SUM(VOL(), n) / SUM(LIUTONGPAN(), n)); | ||
} | ||
|
||
Indicator HKU_API TURNOVER(const KData& kdata, int n) { | ||
HKU_ASSERT(n >= 1); | ||
return n == 1 ? (kdata.vol() / LIUTONGPAN(kdata)) | ||
: (SUM(kdata.vol(), n) / SUM(LIUTONGPAN(kdata), n)); | ||
} | ||
|
||
} // namespace hku |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2024 hikyuu.org | ||
* | ||
* Created on: 2024-04-06 | ||
* Author: fasiondog | ||
*/ | ||
|
||
#include "../Indicator.h" | ||
|
||
namespace hku { | ||
|
||
/** | ||
* @brief 换手率=股票成交量/流通股股数×100% | ||
* @param n 窗口周期 | ||
* @return Indicator | ||
*/ | ||
Indicator HKU_API TURNOVER(int n = 1); | ||
|
||
Indicator HKU_API TURNOVER(const KData& kdata, int n = 1); | ||
|
||
} // namespace hku |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters