Created on 张斌 2018-08-24 15:58:00 @author: zhang bin @email: [email protected] 管家功能--账单(记录、查询) """ import sys, os, time, copy, datetime, mySystem from operator import itemgetter, attrgetter #引用根目录类文件夹--必须,否则非本地目录起动时无法找到自定义类 mySystem.Append_Us("../Prjs", False, __file__) mySystem.Append_Us("", False) import myEnum, myIO, myIO_xlsx, myData, myData_Trans, myDebug #定义账单类型枚举 myBileType = myEnum.enum('买入', '卖出', '受赠', '赠予', '分红', '转账') #myTradeType = myEnum.enum('购物', '买菜', '买衣服', '投资', '红包', '投资回笼') myTradeType = myEnum.enum('投资', '居家', '日用品', '衣服', '餐饮', '交通', '烟酒', '零食', '通讯', '娱乐', '旅游', '人际', '水费', '电费', '燃气', '取暖', '房租', '医疗', '教育', '健身', '美容', '装修') myTradeType_居家_蔬菜 = ['蔬菜', '菜'] myTradeType_居家_肉类 = ['肉', '猪肉', '鸡肉', '牛肉', '羊肉', "鸡蛋"] myTradeType_居家_海鲜 = ["螃蟹", "小龙虾", "虾", "花蛤", "竹蛏"] myTradeType_居家_调料 = ['油', '盐', '调料'] myTradeType_居家_主食 = ['米', '面粉', '面条'] myTradeType_居家 = [] + myTradeType_居家_蔬菜 + myTradeType_居家_肉类 + myTradeType_居家_海鲜 + myTradeType_居家_调料 + myTradeType_居家_主食 myTradeType_投资 = ['活期', '定期', '股票', '基金', '可转债', '国债逆回购', '理财', '转入', '转出'] myTradeType_双向 = ['投资'] #账单对象
# -*- coding: utf-8 -*- """ Created on 张斌 2018-06-12 18:00:00 @author: zhang bin @email: [email protected] md文件操作 """ import sys, os, codecs, re #加载自定义库 import myEnum, myData, myIO, myData_Trans #定义数据结构枚举 myMD_node_Type = myEnum.enum('section', 'table') pattern = '#+\s' # 设置标题信息 def checkLine(strLine, strTag=""): if strTag != "": if strLine.count("<" + strTag) > 0: ind0 = strLine.index("<" + strTag) ind2 = strLine.index('>') strLine = strLine[0: ind0] + strLine[ind2+1:] ind0 = strLine.index("</" + strTag) ind2 = strLine.index('>') strLine = strLine[0: ind0] + strLine[ind2+1:] return strLine
""" Created on 张斌 2018-01-03 18:00:00 @author: zhang bin @email: [email protected] Excel操作 @依赖库: xlrd、xlwt """ import sys, os, datetime, codecs import xlrd, xlwt #加载自定义库 import myEnum, myData, myIO, myData_Trans #定义数据结构枚举 myFiledype = myEnum.enum('string', 'float', 'int', 'bool', 'datetime') #自定义表结构 class DtTable: def __init__(self): self.dataName = "" #数据集名称 self.dataMat = [] #数据集 self.dataField = [] #数据字段集 self.dataFieldType = [] #数据字段类型集 self.sheet = None #Sheet self.sheet_index = 0 #Sheet索引号 def _Rows(self, row_end=-1): return myData.iif(row_end < 0, len(self.dataMat), row_end)
# -*- coding: utf-8 -*- """ Created on 张斌 2018-07-23 11:00:00 @author: zhang bin @email: [email protected] 消息处理器--通用消息处理器 """ import sys, os, copy, time, datetime, threading import myEnum, myData, myData_Trans, myDebug, myIO, myWeb_urlLib, myMQ_Rabbit #, myVoice #定义消息类型枚举 myMsgType = myEnum.enum('TEXT', 'PICTURE', 'VOICE', 'VIDEO', 'NOTE') myMsgPlat = myEnum.enum('robot', 'wx') #自定义消息对象 class myMsg(): def __init__(self, msg, msgID, msgType = myMsgType.TEXT, usrFrom = '', usrPlat = ''): self.msg = msg #消息内容 self.msgID = str(msgID) #消息标识 self.msgType = msgType #消息类型 self.usrFrom = usrFrom #消息来源用户 self.usrPlat = usrPlat #消息来源平台 self.msgUrl = "" #消息链接(多媒体) self.msgTime = datetime.datetime.now() #消息示例时间 def toCSVString(self): strCSV = "\n" + myData_Trans.Tran_ToDatetime_str(self.msgTime) strCSV += "," + self.usrFrom strCSV += "," + self.msg strCSV += "," + self.msgType
@author: zhang bin @email: [email protected] Word操作 @依赖库: python-docx """ import sys, os, datetime, codecs from docx import Document from docx.shared import Inches #加载自定义库 import myEnum, myData, myIO, myData_Trans #定义数据结构枚举 myDcox_paragraph_Type = myEnum.enum('Title', 'Heading', 'Intense_Quote', 'List_Bullet', 'List_Number', 'Normal', 'Other') # Docx段落信息 class myDcox_paragraph: def __init__(self, strTitle=""): self.type = myDcox_paragraph_Type.Other self.level = 0 # 段落级别 self.valid = True # 段落有效,区分虚拟段落 #self.headID = -1 # 段落段落的标题 ID #self.parentID = -1 # 父级ID self.headTitle = "" # 标题名称 self.headID = 0 # 标题ID self.headID_str = "" # 标题ID(父级级联或设定) self.headCount_child = 0 # 标题子级别总数
@email: [email protected] 股票交易员--买卖操作(记录、查询、统计等) """ import sys, os, time, copy, datetime, mySystem from operator import itemgetter, attrgetter #引用根目录类文件夹--必须,否则非本地目录起动时无法找到自定义类 mySystem.Append_Us("../zxcPy.Quotation", False, __file__) mySystem.Append_Us("", False) import myEnum, myIO, myIO_xlsx, myData, myData_Trans, myDebug import myQuote from myGlobal import gol #定义交易类型枚举 myOrderType = myEnum.enum('买入', '卖出', '受赠', '赠予', '分红', '转账') myTradeType_投资 = ['活期', '定期', '股票', '基金', '可转债', '国债逆回购', '理财', '转入', '转出'] myTradeAppetite = ['看涨', '看跌', '看平'] # 交易信息 class myObj_Trade(): def __init__(self, usrID='', tradeInfo=''): self.usrID = usrID #用户名 self.usrOrderType = "" #用户操作类型(买入/卖出/看涨/看跌/看平) self.recordTime = None #记录时间 self.recorder = None #记录人 self.targetID = "" #标的代码 self.targetName = "" #标的名称 self.targetMarket = "" #标的所属市场