Skip to content

Commit

Permalink
Mirror 0.9 version issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
xf97 committed Apr 13, 2021
1 parent 2d860fb commit 1ad2970
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 12 deletions.
Binary file modified src/1.xlsx
Binary file not shown.
Binary file modified src/__pycache__/constant.cpython-37.pyc
Binary file not shown.
Binary file modified src/__pycache__/makeDeals.cpython-37.pyc
Binary file not shown.
Binary file modified src/__pycache__/normalization.cpython-37.pyc
Binary file not shown.
12 changes: 12 additions & 0 deletions src/accountAnalysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python
#-*- coding: utf-8 -*-


'''
该文件用于对账户进行分析
'''

class accountAnalysis:
def __init__(self):
#需求待定义
pass
8 changes: 4 additions & 4 deletions src/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
UPPER_LIMIT = 1.1 #涨停
LOWER_LIMIT = 0.9 #跌停
BIAS_UPPER_LIMIT = 1.0 #偏移上限值
BIAS_LOWER_LIMIT = -1.0 #偏移下限值
BIAS_LOWER_LIMIT = 0 #偏移下限值
DATA_PATH = "..\\data\\dataForExp.xlsx"
INIT_PRICE = "initPrice1" #初始价格表名
PURCHASE_PROB = "purchaseProb2" #购买概率表名
SHARE_NUMBER = "initFund2" #初始股票数量
INIT_PRICE = "initPrice" #初始价格表名
PURCHASE_PROB = "purchaseProb" #购买概率表名
SHARE_NUMBER = "initFund" #初始股票数量
MIN_BUY_QUA = 100 #最小买入数量
LOSS_VALUE = 1e-10 #适当损失,用于在归一化时进一步收窄,避免触发涨跌停
ONE_FOURTH_PERIOD = 0.1 #允许连续增长或下跌的周期(价格增长或降幅),超过该值则冷却值变号
11 changes: 11 additions & 0 deletions src/detailTransInfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python
#-*- coding: utf-8 -*-

'''
该文件详细记录每日交易
'''

class detailTranInfo:
def __init__(self):
#需求待定义
pass
14 changes: 7 additions & 7 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
from dict2Excel import *

#常量部分
INIT_TRANS_DAYS = 20 #初始化天数
LAST_YEARS = 20 # 持续调查20年
USERS_NUM = 100 #参与账户数量
SHARES_NUM = 10 #参与的股票数量
DAYS_IN_1_YEAR = 48 #239 #一年平均有239天交易日
DAYS_IN_1_MONTH = list(range(4, 49, 4))#[19, 35, 57, 77, 95, 115, 137, 159, 179, 196, 217, 239] #每月最后一个交易日
INIT_TRANS_DAYS = 100 #初始化天数
LAST_YEARS = 19 # 持续调查20年
USERS_NUM = 500 #参与账户数量
SHARES_NUM = 50 #参与的股票数量
DAYS_IN_1_YEAR = 239 #一年平均有239天交易日
DAYS_IN_1_MONTH = [19, 35, 57, 77, 95, 115, 137, 159, 179, 196, 217, 239] #每月最后一个交易日
SALE_PROBABILITY = 0.5 #想出售的概率
#需要读取的数据文件们, 例如股票的信息, 年报的信息

Expand Down Expand Up @@ -207,7 +207,7 @@ def run(self):
nowMonth = 1 #当前月份
#信息记录字典
infoDict = dict() #键是月份,值是当月所有股票的收盘价,每年重置一次
while nowYear <= 2:
while nowYear <= LAST_YEARS:
#每年开始,先记录当年的初始价格
for share in self.sharesList:
share.setNewYearPrice(share.getPrice())
Expand Down
2 changes: 1 addition & 1 deletion src/makeDeals.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def getNormalListBias(_low, _high, _loc, _bias, _coolingValue, _handCountValue):
_bias = _bias * _coolingValue #* _handCountValue
sigma = _loc * 0.2 / 6
sigma = sigma if sigma < SIGMA else SIGMA
meanValue = _loc + _bias * sigma * 0.5
meanValue = _loc + _bias * sigma
if meanValue > _high:
meanValue = _high
if meanValue < _low:
Expand Down
1 change: 1 addition & 0 deletions src/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def normalization(_list, _highLimit, _lowLimit):
for index, value in enumerate(_list):
try:
resultList[index] = (((value - minValue) / (maxValue - minValue)) * _highLimit + ((value - maxValue) / (minValue - maxValue)) * _lowLimit)
resultList[index] -= 0.5
except ZeroDivisionError:
#对除0错误进行处理
resultList[index] = 1.0
Expand Down

0 comments on commit 1ad2970

Please sign in to comment.