Skip to content

Commit

Permalink
添加筹码分布的python算法
Browse files Browse the repository at this point in the history
  • Loading branch information
myhhub committed Jan 7, 2025
1 parent 48343cb commit 80a6784
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions instock/core/kline/cyq.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def __init__(self):

# *计算指定百分比的筹码
# * @ param {number} percent 百分比大于0,小于1
def compute_percent_chips(self, percent):
@staticmethod
def compute_percent_chips(percent):
if percent > 1 or percent < 0:
raise ValueError('argument "percent" out of range')
ps = [(1 - percent) / 2, (1 + percent) / 2]
Expand All @@ -139,7 +140,8 @@ def compute_percent_chips(self, percent):

# *获取指定价格的获利比例
# * @ param {number} price 价格
def get_benefit_part(self, price):
@staticmethod
def get_benefit_part(price):
below = 0
for i in range(factor):
x = float(f"{xdata[i]:.12g}")
Expand Down

0 comments on commit 80a6784

Please sign in to comment.