Beispiel #1
0
 def getParent(self):
     totalCash = 0
     totalGain = 0
     print(u'全部资金情况:')
     # result = self.getDanjuanDingDingBao(headers=requestHeaderManager().getDanjuanLSY())
     # totalCash = totalCash + result[0]
     # totalGain = totalGain + result[1]
     result = self.getDanjuan(
         True, '003474', headers=requestHeaderManager().getDanjuanKSH())
     totalCash = totalCash + result[0]
     totalGain = totalGain + result[1]
     totalCash = round(totalCash, 2)
     totalGain = round(totalGain, 2)
     print(u'\n总现金:{0} 元,总累计收益:{1} 元'.format(totalCash, totalGain))
     cashPath = os.path.join(self.pm.inputPath,
                             u'cash_{0}.txt'.format(self.strategyName))
     cash_lines = []
     # 读入内存
     with open(cashPath, u'r', encoding='utf-8') as f:
         for line in f.readlines():
             cash_lines.append(line)
     #print(cash_lines)
     # 写入磁盘
     with open(cashPath, u'w', encoding='utf-8') as f:
         for line in cash_lines:
             if u'货币基金综合' in line:
                 values = line.split('\t')
                 values[3] = str(totalCash)
                 values[4] = str(totalCash)
                 values[5] = str(totalGain)
                 f.write(u'\t'.join(values) + '\n')
             else:
                 f.write(line)
Beispiel #2
0
 def getSuiShouJi(self):
     # 请求
     url = u'https://www.sui.com/account/account.do'
     headers = requestHeaderManager().getSuiKLQ()
     ssl._create_default_https_context = ssl._create_unverified_context
     requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
     response = requests.get(url, headers=headers, verify=False)
     # 解析
     accountKeys = {\
     u'acc-val-amount-156469181835':u'钱包',\
     u'acc-val-amount-156469181837':u'招商银行卡',\
     u'acc-val-amount-156469181839':u'工商银行卡',\
     u'acc-val-amount-1632793665':u'北京银行卡',\
     u'acc-val-amount-1632796112':u'中国银行卡',\
     u'acc-val-amount-1632797656':u'支付宝',\
     u'acc-val-amount-156469181859':u'招行信用卡'}
     soup = BeautifulSoup(response.text, 'lxml')
     totalCash = 0
     for key in accountKeys.keys():
         inputTag = soup.find(attrs={'id': key})
         if u'信用卡' in accountKeys[key]:
             totalCash = totalCash - float(inputTag['value'])
         else:
             totalCash = totalCash + float(inputTag['value'])
         #print(accountKeys[key],inputTag['value'])
     print(u'银行卡+支付宝+现金-信用卡:{0} 元,累计收益:{1} 元'.format(
         round(totalCash, 2), round(0, 2)))
     return (round(totalCash, 2), round(0, 2))
Beispiel #3
0
 def __init__(self, strategy, strategyName):
     self.strategyName = strategyName
     if strategy == 'a':
         self.pm = pathManager(u'康力泉')
     elif strategy == 'b':
         self.pm = pathManager(u'父母')
     self.requestHeaderManager = requestHeaderManager()
Beispiel #4
0
 def __init__(self):
     self.requestHeaderManager = requestHeaderManager()
     self.pm = pathManager()
     self.indexValueInfoList = []
     self.indexValues = []
     self.qiemanEvaluations = []
     self.danjuanEvaluations = []
     # 读取磁盘数据
     with open(os.path.join(self.pm.configPath,u'indexValueInfo.json'),u'r',encoding='utf-8') as f:
         self.indexValueInfoList = json.loads(f.read())
Beispiel #5
0
 def __init__(self,strategy):
     # 补充 150 份
     self.urlForPlan150 = u'https://qieman.com/pmdj/v2/long-win/ca/assets-summary?capitalAccountId=CA8UKLYHA67WPK&useV2OrderApi=true&classify=true'
     # S 定投
     self.urlForPlanS = u'https://qieman.com/pmdj/v2/long-win/ca/assets-summary?capitalAccountId=CA8FCJKFPANTP2&useV2OrderApi=true&classify=true'
     # ★ 填写验证必须参数
     self.headerManager = requestHeaderManager()
     if strategy == 'a':
         self.pm = pathManager('康力泉')
     elif strategy == 'b':
         self.pm = pathManager('父母')
Beispiel #6
0
    def __init__(self, strategy='a'):

        self.totalMarketCap = 0.0
        self.totalGain = 0.0
        self.results = []
        self.strategy = strategy
        if strategy == 'a':
            self.pm = pathManager(strategyName=u'康力泉')
        elif strategy == 'b':
            self.pm = pathManager(strategyName=u'父母')
        self.headerManager = requestHeaderManager()
Beispiel #7
0
    def getKLQ(self):
        totalCash = 0
        totalGain = 0
        print(u'全部资金情况:')
        result = self.getSuiShouJi()
        totalCash = totalCash + result[0]
        totalGain = totalGain + result[1]
        # 且慢盈米宝之后不会在存现金,历史收益已收录
        # result = self.getQieManYingMiBao(headers=requestHeaderManager().getQiemanKLQ())
        # totalCash = totalCash + result[0]
        # totalGain = totalGain + result[1]

        # 蛋卷
        result = self.getDanjuan(
            True, '003474', headers=requestHeaderManager().getDanjuanKLQ())
        totalCash = totalCash + result[0]
        totalGain = totalGain + result[1]

        # 天天现金
        result = self.getTianTianHuoQiBao(
            u'https://trade.1234567.com.cn/xjb/index',
            self.requestHeaderManager.getTiantianKLQ())
        totalCash = totalCash + result[0]
        totalGain = totalGain + result[1]

        # 华宝证券,现在是手动更新
        totalCash = totalCash + 52607.78
        totalGain = totalGain + 38.3
        print(u'华宝证券:52607.78 元,累计收益:38.3 元')

        totalCash = round(totalCash, 2)
        totalGain = round(totalGain, 2)
        print(u'\n总现金:{0} 元,总累计收益:{1} 元'.format(totalCash, totalGain))
        cashPath = os.path.join(self.pm.inputPath,
                                u'cash_{0}.txt'.format(self.strategyName))
        cash_lines = []
        # 读入内存
        with open(cashPath, u'r', encoding='utf-8') as f:
            for line in f.readlines():
                cash_lines.append(line)
        #print(cash_lines)
        # 写入磁盘
        with open(cashPath, u'w', encoding='utf-8') as f:
            for line in cash_lines:
                if u'货币基金综合' in line:
                    values = line.split('\t')
                    values[3] = str(totalCash)
                    values[4] = str(totalCash)
                    values[5] = str(totalGain)
                    f.write(u'\t'.join(values) + '\n')
                else:
                    f.write(line)
Beispiel #8
0
    def __init__(self, strategy='a'):
        url = 'https://danjuanapp.com/djapi/holding/plan/'

        self.luosidingUrl = url + u'CSI666'
        self.dingdingbao90 = url + u'CSI1021'
        self.dingdingbao365 = url + u'CSI1019'

        self.strategy = strategy
        if strategy == 'a':
            self.pm = pathManager(strategyName='康力泉')
        elif strategy == 'b':
            self.pm = pathManager(strategyName='父母')
        self.headerManager = requestHeaderManager()
 def __init__(self):
     # 场内代码
     self.innerMarketCodes = assetCategoryManager().getEstimableFunds(
         isInnerMarket=True).values()
     self.headerManager = requestHeaderManager()
     self.dateFormat = u'%Y-%m-%d %H:%M:%S'
     self.pm = pathManager()
     self.cacheTimeStamp = 0
     self.cacheFundModelArray = []
     # 尝试查询缓存
     timeStamp, cacheFundModelArray = self.loadCache()
     if timeStamp > 0 and len(cacheFundModelArray) > 0:
         self.cacheTimeStamp = timeStamp
         self.cacheFundModelArray = cacheFundModelArray
Beispiel #10
0
 def getParent(self):
     self.getQieManWenWenDeXingFu(name='父稳稳的幸福', headers=requestHeaderManager().getQiemanKSH())
    def __init__(self, strategy='a'):
        self.strategy = strategy  # 默认 A 策略,即康力泉(不含现金和冻结资金)
        # 拿取最新基金净值
        self.navManager = fundNavManager()
        # 拿一下最新的资产分类配置
        assetCategoryManager().generateFundCategoryJsonFile()
        # 拿取最新指数值
        self.headerManager = requestHeaderManager()
        self.indexValueInfo = indexValueInfo()
        self.indexValueInfo.update()
        # 根据策略生成对于的变量配置参数
        if self.strategy == 'a':
            self.filenames = [
                u'danjuan_螺丝钉.txt', u'danjuan_钉钉宝365.txt',
                u'qieman_10万补充ETF计划.txt', u'qieman_我的S定投计划.txt',
                u'tiantian_康力泉.txt', u'huatai_康力泉.txt', u'huabao_康力泉.txt',
                u'guangfa_支付宝.txt'
            ]
            self.excelFilePathExt = u'康力泉权益类'
            self.echartsJSFilePathExt = u'康力泉'
            self.pm = pathManager(strategyName=u'康力泉')
            self.echartsFile = u'KLQPortfolio.html'
            self.filepaths = []
            for root, dirs, files in os.walk(self.pm.holdingOutputPath,
                                             topdown=False):
                for name in files:
                    if name in self.filenames:
                        self.filepaths.append(os.path.join(root, name))
        elif self.strategy == 'b':
            self.filenames = [
                u'danjuan_母螺丝钉.txt', u'danjuan_父螺丝钉.txt', 'danjuan_母钉钉宝90.txt',
                u'danjuan_母钉钉宝365.txt', u'danjuan_父钉钉宝90.txt',
                u'danjuan_父钉钉宝365.txt', u'tiantian_李淑云.txt', 'cash_父母.txt'
            ]
            self.excelFilePathExt = u'父母'
            self.echartsJSFilePathExt = u'父母'
            self.pm = pathManager(strategyName=u'父母')
            self.echartsFile = u'ParentPortfolio.html'
            self.filepaths = []
            for root, dirs, files in os.walk(self.pm.holdingOutputPath,
                                             topdown=False):
                for name in files:
                    if name in self.filenames:
                        self.filepaths.append(os.path.join(root, name))
        elif self.strategy == 'c':
            self.filenames = [
                u'danjuan_螺丝钉.txt', u'danjuan_钉钉宝365.txt',
                u'qieman_10万补充ETF计划.txt', u'qieman_我的S定投计划.txt',
                u'tiantian_康力泉.txt', u'huatai_康力泉.txt', u'huabao_康力泉.txt',
                u'guangfa_支付宝.txt', u'cash_康力泉.txt', u'freeze_康力泉.txt'
            ]
            self.excelFilePathExt = u'康力泉整体'
            self.echartsJSFilePathExt = u'康力泉'
            self.pm = pathManager(strategyName=u'康力泉')
            self.echartsFile = u'KLQPortfolio.html'
            self.filepaths = []
            for root, dirs, files in os.walk(self.pm.holdingOutputPath,
                                             topdown=False):
                for name in files:
                    if name in self.filenames:
                        self.filepaths.append(os.path.join(root, name))
        elif self.strategy == 'd':
            self.filenames = [u'danjuan_螺丝钉.txt',u'danjuan_钉钉宝365.txt',u'qieman_10万补充ETF计划.txt',u'qieman_我的S定投计划.txt', u'tiantian_康力泉.txt',u'huatai_康力泉.txt',u'huabao_康力泉.txt',u'guangfa_支付宝.txt',u'cash_康力泉.txt',u'freeze_康力泉.txt'\
                ,u'danjuan_母螺丝钉.txt',u'danjuan_父螺丝钉.txt','danjuan_母钉钉宝90.txt',u'danjuan_母钉钉宝365.txt',u'danjuan_父钉钉宝90.txt',u'danjuan_父钉钉宝365.txt',u'tiantian_李淑云.txt','cash_父母.txt']
            self.excelFilePathExt = u'全家整体'
            self.echartsJSFilePathExt = u'全家'
            self.pm = pathManager(strategyName=u'全家')
            klqDir = os.path.join(os.path.dirname(self.pm.holdingOutputPath),
                                  u'康力泉')
            parentDir = os.path.join(
                os.path.dirname(self.pm.holdingOutputPath), u'父母')
            self.filepaths = []
            print(u'全家整体情况,包含如下文件:')
            for root, dirs, files in os.walk(klqDir, topdown=False):
                for name in files:
                    if name in self.filenames:
                        self.filepaths.append(os.path.join(root, name))
                        print(os.path.join(root, name))
            for root, dirs, files in os.walk(parentDir, topdown=False):
                for name in files:
                    if name in self.filenames:
                        self.filepaths.append(os.path.join(root, name))
                        print(os.path.join(root, name))
            self.echartsFile = u'FamilyPortfolio.html'

        # 持仓基金数据的本地保存路径标识
        self.fundJsonFilePathExt = self.excelFilePathExt
        self.fundCategorys = self.getFundCategorys()

        # 基金数据模型集合
        self.fundModelArray = []
        # 资产配置对象模型集合
        self.assetModelArray = []
        # 开始生成
        self.generateJsonFiles()
Beispiel #12
0
 def __init__(self):
     # 注意;这些请求需要从未登录状态,一路点详情进入具体页面才会发送,否则追踪不到
     self.url = u'https://trade.gffunds.com.cn/mapi/account/assets/position-gains?tttt=0.5490600043154694'
     self.headerManager = requestHeaderManager()