签到
苹果/安卓/wp
苹果/安卓/wp
客户端
0.0
0.00
推广加币
数据VIP
升级SVIP
注册
|
登录
项目交易
CDA数据分析师
CDA网校
CDA社区
CDA认证考试
CDA俱乐部
CDA Live
在线教育
JG学术培训
经管云课堂
CDA网校
CDA数据分析研究院
统计软件培训
金融科技
就学培训网
经管题库
培训证书查询
成为签约讲师
经管文库
专家入驻
学术博客
就学平台
美国在职研究生
论坛BBS
服务一览
VIP服务
数据VIP
贵宾服务
数据库
兑换商城
广告服务
案例库
软件销售
校园代理
文献下载
会员课服务
我的
帖子
收藏
好友
我的空间
关注的人
关注的贴
找人
文库
任务
道具
勋章
网站地图
搜索
搜索
用户
人大经济论坛
›
标签
›
监控
标签: 监控
经管大学堂:名校名师名课
相关帖子
版块
作者
回复/查看
最后发表
Rejoinder:用增量分位数监视网络应用程序 估算
外文文献专区
kedemingshi
2022-3-8
0
162
kedemingshi
2022-3-8 15:30:20
CBINFER:基于变化的卷积神经网络推理 视频数据
外文文献专区
大多数88
2022-3-8
0
281
大多数88
2022-3-8 11:14:50
8.交易品种(板块)相关性分析的MATLAB实现-基于Matlab的量化投资
MATLAB等数学软件专版
faruto
2013-7-18
8
6027
riverdarda
2015-9-27 16:41:16
德意志银行:2013年1月全球资金流动监控报告(免费)
行业分析报告
bigfoot0518
2013-1-14
5
2153
潭生.经济学笔记
2014-12-8 22:22:23
中国安全防范行业年鉴 2006-2011(光盘版)
数据交流中心
nemph200
2013-1-16
10
4401
nodust
2014-11-6 20:20:40
麦肯锡咨询:银行更好监控信贷的方案(1币英文版)
行业分析报告
笙箫作别
2013-3-23
54
3816
吴梦璇
2013-9-17 14:30:57
[轉貼] 浅谈建筑学专业毕业设计质量监控的探索与实践
运营管理(物流与供应链管理)
Toyotomi
2013-8-30
0
825
Toyotomi
2013-8-30 00:27:36
《非赌博式交易》[美]林克(可复制)201004[y]
金融实务版
yl36
2013-8-21
0
969
yl36
2013-8-21 16:11:44
2013环保部重点监控企业名单那
行业分析报告
niki2008910
2013-7-13
3
1865
nnzam
2013-8-19 19:30:10
广发证券-A股量化监控周报:任你摇摆摇摆,我只看多看多-130811
金融实务版
dwy123456789
2013-8-12
0
645
dwy123456789
2013-8-12 11:46:24
【独家发布】授信后管理与风险监控
管理科学与工程
xiaoguo
2013-5-17
10
2220
olderp
2013-8-8 09:15:19
[轉貼] 监控管理系统在烟草加工中的应用
运营管理(物流与供应链管理)
Toyotomi
2013-6-17
0
1417
Toyotomi
2013-6-17 00:30:27
2012年中国挖掘机市场监控分析及预测报告
行业分析报告
nijian320724
2013-1-17
5
1572
dido_draw
2013-6-14 16:06:42
一种新的经济模式:控强经济(用民意机构监控垄断国企)
宏观经济学
hj58
2013-5-21
0
909
hj58
2013-5-21 16:03:26
商业银行资产负债比例管理监控、监测指标
会计与财务管理
huh1954
2013-5-14
1
822
dumb
2013-5-14 10:47:18
2013-05-01_广发证券_A股量化监控周报:GFTD模型修正,继续看空不变
金融学(理论版)
investment2012
2013-5-2
0
1004
investment2012
2013-5-2 15:08:27
CCP体系在无公害蔬菜生产全程监控中的应用
- [!reward_solved!]
求助成功区
linzima
2013-4-26
2
798
linzima
2013-4-27 00:28:52
【独家发布】2012年中国起重机市场监控分析及预测报告
行业分析报告
nijian320724
2013-1-17
1
1442
foxalife
2013-1-17 16:12:31
2008-2009年中国城市视频监控系统市场研究年度报告
行业分析报告
aeco0918
2010-4-29
11
2868
hillxu
2011-1-6 19:48:24
更多...
相关日志
分享
日常组合监控
不诉
2017-2-10 13:53
用python取sqlserver实时行情数据,与产品组合匹配后,推送给influxdb 事件模块代码: # encoding: UTF-8 # 系统模块 from Queue import Queue , Empty from threading import * ######################################################################## class EventManager : #---------------------------------------------------------------------- def __init__ ( self ): """初始化事件管理器""" # 事件对象列表 self .__eventQueue = Queue() # 事件管理器开关 self .__active = False # 事件处理线程 self .__thread = Thread( target = self .__Run) # 这里的__handlers是一个字典,用来保存对应的事件的响应函数 # 其中每个键对应的值是一个列表,列表中保存了对该事件监听的响应函数,一对多 self .__handlers = {} #---------------------------------------------------------------------- def __Run ( self ): """引擎运行""" while self .__active == True : try : # 获取事件的阻塞时间设为1秒 event = self .__eventQueue.get( block = True , timeout = 1 ) self .__EventProcess(event) except Empty: pass #---------------------------------------------------------------------- def __EventProcess ( self , event): """处理事件""" # 检查是否存在对该事件进行监听的处理函数 if event.type_ in self .__handlers: # 若存在,则按顺序将事件传递给处理函数执行 for handler in self .__handlers : handler(event) #---------------------------------------------------------------------- def Start ( self ): """启动""" # 将事件管理器设为启动 self .__active = True # 启动事件处理线程 self .__thread.start() #---------------------------------------------------------------------- def Stop ( self ): """停止""" # 将事件管理器设为停止 self .__active = False # 等待事件处理线程退出 self .__thread.join() #---------------------------------------------------------------------- def AddEventListener ( self , type_ , handler): """绑定事件和监听器处理函数""" # 尝试获取该事件类型对应的处理函数列表,若无则创建 try : handlerList = self .__handlers except KeyError : handlerList = = handlerList # 若要注册的处理器不在该事件的处理器列表中,则注册该事件 if handler not in handlerList: handlerList.append(handler) #---------------------------------------------------------------------- def RemoveEventListener ( self , type_ , handler): """移除监听器的处理函数""" #读者自己试着实现 #---------------------------------------------------------------------- def SendEvent ( self , event): """发送事件,向事件队列中存入事件""" self .__eventQueue.put(event) ######################################################################## """事件对象""" class Event : def __init__ ( self , type_= None ): self .type_ = type_ # 事件类型 self .list = 主程序代码 #!/usr/bin/python # -*- coding: UTF-8 -*- import pymssql import time import datetime #import numpy import decimal #import threading from influxdb import InfluxDBClient #from datetime import datetime #from threading import * from EventManager import * dbhost = '192.168.1.101' dbuser = 'jiyang.wang' dbuser_password = 'Amc_0001' dbhost1 = '10.200.66.125' user = 'root' password = 'root' TradingDB = 'TradingDB' TShengYunDB = 'TShengYunDB' HBTG = 'HBTG' indbname = 'DailyPositionDB' host = 'localhost' port = 8086 StatArb2_Target_500 = dObPV8hL27H26 = dObPV10hL24H23 = GE_PE = Sig_1 = H8 = PVI = V2 = VM1 = E2 = tick_IF = * num client = InfluxDBClient(host , port , user , password , indbname) #事件名称 行情 EVENT_Tick = 'tick' #事件源 公众号 class PublicAccounts : def __init__ ( self , eventManager): self .__eventManager = eventManager def Get_Tick ( self ): #事件对象,新行情进来 var = 1 event = Event( type_ =EVENT_Tick) con = pymssql.connect(dbhost , dbuser , dbuser_password , TShengYunDB , charset = 'utf8' ) while var == 1 : current_timestamp = datetime.datetime.now() current_timestamp = current_timestamp - datetime.timedelta( minutes = 2 ) current_timestamp = current_timestamp.strftime( "%H:%M:%S" ) # current_timestamp = '14:55:00' if current_timestamp '15:00:00' : break if (current_timestamp '11:30:00' and current_timestamp '13:00:00' ) or current_timestamp '09:30:00' : time.sleep( 3 ) continue sql1 = '''select AA. * from HB_lnk.HBTG.dbo.Tick_SH AA join(select max (id) as id from HB_lnk.HBTG.dbo.Tick_SH A where %s group by tkr ) BB on AA.id=BB.id union all select AA. * from HB_lnk.HBTG.dbo.Tick_SZ AA join( select max (id) as id from HB_lnk.HBTG.dbo.Tick_SZ A where %s group by tkr ) BB on AA.id=BB.id''' try : cur1 = con.cursor() cur1.execute(sql1 , (current_timestamp , current_timestamp)) global tick tick = cur1.fetchall() except Exception , err: print "error: %s" % str (err) event.list = tick print ( "Tick is coming!" ) #发送事件 #sql1 = '''select AA.* from HB_lnk.HBTG.dbo.Tick_SH AA join(select max(id) as id from HB_lnk.HBTG.dbo.Tick_SH A where %s group by tkr ) BB on AA.id=BB.id union all select AA.* from HB_lnk.HBTG.dbo.Tick_SZ AA join( select max(id) as id from HB_lnk.HBTG.dbo.Tick_SZ A where %s group by tkr ) BB on AA.id=BB.id''' #cur1 = con.cursor() #cur1.execute(sql1, (current_timestamp, current_timestamp)) #global tick_IF #tick_IF = cur1.fetchall() #event.list_IF = tick_IF #print("Tick is coming!") self .__eventManager.SendEvent(event) time.sleep( 3 ) #print u'公众号发送新文章\n' #监听器 订阅者 class Listener : def __init__ ( self , username): self .__username = username #监听器的处理函数 读文章 def StatArb2_Target_500 ( self , event): self .__username current_tick = event.list a = len (StatArb2_Target_500) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == StatArb2_Target_500 : b = round (StatArb2_Target_500 , 4 ) c = current_tick d = StatArb2_Target_500 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) # portfolio = (StatArb2_Target_500 , StatArb2_Target_500 , StatArb2_Target_500 , current_tick ) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "StatArb2_Target_500 working working!" ) # dObPV8hL27H26 def dObPV8hL27H26 ( self , event): self .__username current_tick = event.list a = len (dObPV8hL27H26) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == dObPV8hL27H26 : b = round (dObPV8hL27H26 , 4 ) c = current_tick d = dObPV8hL27H26 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "dObPV8hL27H26 working working!" ) #dObPV9hL23H22 def dObPV9hL23H22 ( self , event): self .__username current_tick = event.list a = len (dObPV9hL23H22) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == dObPV9hL23H22 : b = round (dObPV9hL23H22 , 4 ) c = current_tick d = dObPV9hL23H22 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "dObPV9hL23H22 working working!" ) # dObPV10hL24H23 def dObPV10hL24H23 ( self , event): self .__username current_tick = event.list a = len (dObPV10hL24H23) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == dObPV10hL24H23 : b = round (dObPV10hL24H23 , 4 ) c = current_tick d = dObPV10hL24H23 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "dObPV10hL24H23 working working!" ) # PVIL10H9 def PVIL10H9 ( self , event): self .__username current_tick = event.list a = len (PVIL10H9) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == PVIL10H9 : b = round (PVIL10H9 , 4 ) c = current_tick d = PVIL10H9 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "PVIL10H9 working working!" ) # GE_PE def GE_PE ( self , event): self .__username current_tick = event.list a = len (GE_PE) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == GE_PE : b = round (GE_PE , 4 ) c = current_tick d = GE_PE portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "GE_PE working working!" ) # cumR1L2ToL5 def cumR1L2ToL5 ( self , event): self .__username current_tick = event.list a = len (cumR1L2ToL5) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == cumR1L2ToL5 : b = round (cumR1L2ToL5 , 4 ) c = current_tick d = cumR1L2ToL5 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "cumR1L2ToL5 working working!" ) # Sig_1 def Sig_1 ( self , event): self .__username current_tick = event.list a = len (Sig_1) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == Sig_1 : b = round (Sig_1 , 4 ) c = current_tick d = Sig_1 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "Sig_1 working working!" ) # Sig_2 def Sig_2 ( self , event): self .__username current_tick = event.list a = len (Sig_2) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == Sig_2 : b = round (Sig_2 , 4 ) c = current_tick d = Sig_2 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "Sig_2 working working!" ) # H8 def H8 ( self , event): self .__username current_tick = event.list a = len (H8) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == H8 : b = round (H8 , 4 ) c = current_tick d = H8 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "H8 working working!" ) # H10 def H10 ( self , event): self .__username current_tick = event.list a = len (H10) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == H10 : b = round (H10 , 4 ) c = current_tick d = H10 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "H10 working working!" ) # PVI def PVI ( self , event): self .__username current_tick = event.list a = len (PVI) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == PVI : b = round (PVI , 4 ) c = current_tick d = PVI portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "PVI working working!" ) # V1 def V1 ( self , event): self .__username current_tick = event.list a = len (V1) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == V1 : b = round (V1 , 4 ) c = current_tick d = V1 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "V1 working working!" ) # V2 def V2 ( self , event): self .__username current_tick = event.list a = len (V2) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == V2 : b = round (V2 , 4 ) c = current_tick d = V2 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "V2 working working!" ) # D1 def D1 ( self , event): self .__username current_tick = event.list a = len (D1) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == D1 : b = round (D1 , 4 ) c = current_tick d = D1 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "D1 working working!" ) # VM1 def VM1 ( self , event): self .__username current_tick = event.list a = len (VM1) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == VM1 : b = round (VM1 , 4 ) c = current_tick d = VM1 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "VM1 working working!" ) # E1 def E1 ( self , event): self .__username current_tick = event.list a = len (E1) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == E1 : b = round (E1 , 4 ) c = current_tick d = E1 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "E1 working working!" ) # E2 def E2 ( self , event): self .__username current_tick = event.list a = len (E2) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == E2 : b = round (E2 , 4 ) c = current_tick d = E2 portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "E2 working working!" ) # StatFM def StatFM ( self , event): self .__username current_tick = event.list a = len (StatFM) portfolio = * a for i in range (a): for j in range ( len (current_tick)): if current_tick == StatFM : b = round (StatFM , 4 ) c = current_tick d = StatFM portfolio = ((c / d) - 1 ) * decimal.Decimal(b) portfoliomove = sum (portfolio) json_body = client.write_points(json_body) print ( "StatFM working working!" ) """权重函数""" def Get_TargetWeight (): sql2 = 'select CONVERT (varchar(10), MAX (TradingDate),23) from JYDB.dbo.QT_TradingDayNew where IfTradingDay=1 and TradingDate( CONVERT (varchar(10), GETDATE(), 23)) and SecuMarket=83' con2 = pymssql.connect(dbhost , dbuser , dbuser_password , TShengYunDB , charset = 'utf8' ) cur2 = con2.cursor() cur2.execute(sql2) day = cur2.fetchone() tradingday = '' .join(day) ################################################################## sql3 = '''select B.SecuCode,A.model_target,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.model_target0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) #roww = cur3.fetchall() global StatArb2_Target_500 StatArb2_Target_500 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.dObPV8hL27H26,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.dObPV8hL27H260 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global dObPV8hL27H26 dObPV8hL27H26 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.dObPV9hL23H22,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.dObPV9hL23H220 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global dObPV9hL23H22 dObPV9hL23H22 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.dObPV10hL24H23,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.dObPV10hL24H230 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global dObPV10hL24H23 dObPV10hL24H23 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.PVIL10H9,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.PVIL10H90 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global PVIL10H9 PVIL10H9 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.GE_PE,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.GE_PE0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global GE_PE GE_PE = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.cumR1L2ToL5,b.ClosePrice from ShengYunDB.dbo.StatArb_TargetPortfolios A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.cumR1L2ToL50 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global cumR1L2ToL5 cumR1L2ToL5 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.Sig_1,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.Sig_10 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global Sig_1 Sig_1 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.Sig_2,b.ClosePrice from ShengYunDB.dbo.StatArb2_Target_500 A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.Sig_20 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global Sig_2 Sig_2 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.H8_w,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.H8_w0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global H8 H8 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.H10_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.H10_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global H10 H10 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.PVI_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.PVI_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global PVI PVI = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.V1_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.V1_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global V1 V1 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.V2_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.V2_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global V2 V2 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.D1_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.D1_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global D1 D1 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.VM1_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.VM1_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global VM1 VM1 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.E1_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.E1_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global E1 E1 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.E2_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.E2_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global E2 E2 = cur3.fetchall() ################################################################## sql3 = '''select B.SecuCode,A.Total_W,b.ClosePrice from ShengYunDB.dbo.StatFM_Info A left join ShengYunDB.dbo.StockDailyTrading B on A.InnerCode=B.InnerCode where A.Total_W0 and A.TradingDay=%s and b.TradingDay=%s''' cur3 = con2.cursor() cur3.execute(sql3 , (tradingday , tradingday)) # roww = cur3.fetchall() global StatFM StatFM = cur3.fetchall() """主函数""" #-------------------------------------------------------------------- def main (): Get_TargetWeight() listner1 = Listener( "StatArb2_Target_500" ) #订阅者1 listner2 = Listener( "dObPV8hL27H26" ) #订阅者2 listner3 = Listener( "dObPV9hL23H22" ) # 订阅者2 listner4 = Listener( "dObPV10hL24H23" ) # 订阅者2 listner5 = Listener( "PVIL10H9" ) # 订阅者2 listner6 = Listener( "GE_PE" ) # 订阅者2 listner7 = Listener( "cumR1L2ToL5" ) # 订阅者2 listner8 = Listener( "Sig_1" ) # 订阅者2 listner9 = Listener( "Sig_2" ) # 订阅者2 listner10 = Listener( "H8" ) # 订阅者2 listner11 = Listener( "H10" ) # 订阅者2 listner12 = Listener( "PVI" ) # 订阅者2 listner13 = Listener( "V1" ) # 订阅者2 listner14 = Listener( "V2" ) # 订阅者2 listner15 = Listener( "D1" ) # 订阅者2 listner16 = Listener( "VM1" ) # 订阅者2 listner17 = Listener( "E1" ) # 订阅者2 listner18 = Listener( "E2" ) # 订阅者2 listner19 = Listener( "StatFM" ) # 订阅者2 eventManager = EventManager() #绑定事件和监听器响应函数(新文章) eventManager.AddEventListener(EVENT_Tick , listner1.StatArb2_Target_500) eventManager.AddEventListener(EVENT_Tick , listner2.dObPV8hL27H26) eventManager.AddEventListener(EVENT_Tick , listner3.dObPV9hL23H22) eventManager.AddEventListener(EVENT_Tick , listner4.dObPV10hL24H23) eventManager.AddEventListener(EVENT_Tick , listner5.PVIL10H9) eventManager.AddEventListener(EVENT_Tick , listner6.GE_PE) eventManager.AddEventListener(EVENT_Tick , listner7.cumR1L2ToL5) eventManager.AddEventListener(EVENT_Tick , listner8.Sig_1) eventManager.AddEventListener(EVENT_Tick , listner9.Sig_2) eventManager.AddEventListener(EVENT_Tick , listner10.H8) eventManager.AddEventListener(EVENT_Tick , listner11.H10) eventManager.AddEventListener(EVENT_Tick , listner12.PVI) eventManager.AddEventListener(EVENT_Tick , listner13.V1) eventManager.AddEventListener(EVENT_Tick , listner14.V2) eventManager.AddEventListener(EVENT_Tick , listner15.D1) eventManager.AddEventListener(EVENT_Tick , listner16.VM1) eventManager.AddEventListener(EVENT_Tick , listner17.E1) eventManager.AddEventListener(EVENT_Tick , listner18.E2) eventManager.AddEventListener(EVENT_Tick , listner19.StatFM) eventManager.Start() publicAcc = PublicAccounts(eventManager) #timer = Timer(2, publicAcc.Get_Tick) #timer.start() publicAcc.Get_Tick() if __name__ == '__main__' : main()
个人分类:
日常监控
|
0
个评论
分享
徽剑IT评点:财迷心窍,外国机构监控5亿中国新浪微博用户?
insight
2015-2-9 17:00
徽剑IT评点:财迷心窍,外国机构监控5亿中国新浪微博用户? (待审核) 2015-2-9 16:57 | 个人分类: 大数据 | 新浪微博 , 中国 , 机构 , 监控 , 用户 徽剑IT评点:财迷心窍,外国机构监控5亿中国新浪微博用户? 作者:徽剑 发布时间:2015-02-06 来源:乌有之乡 字体: 大 | 中 | 小 中国上亿人的政治倾向、政治判断能力等等,通过新浪被美日了如指掌。 一、让总经理王高飞紧张敏感的海外合作伙伴 二、通过新浪微博的数据分析可以得到什么? 三、大数据分析就一定侵犯隐私么? 四、不得不说,在新浪微博发言的隐患 一 、让总经理王高飞紧张敏感的海外合作伙伴 2014年11月,新浪微博总经理王高飞亲自下令把徽剑我的新浪微博给封了,理由是我在造谣新浪微博。 起因是新浪微博公开了其数据分析合作伙伴,然后我指出其合作伙伴中有问题。 当我发出这条微博后,不到半小时,徽剑、徽通社两个账号都被新浪微博封号。新浪微博总经理王高飞发出一条微博。 那么是不是我徽剑真的造谣了呢?这个effyis的公司究竟是什么呢?先看新闻报道: 2014中国大数据技术大会上一位专家的发言 这可是由中国计算机学会(CCF)主办,CCF大数据专家委员会承办,中科院计算所与CSDN共同协办的带有学术性质会议上的专家发言。不会也是造谣吧? 这两条报道可以证实两点: 1、这家叫Effyis的公司在“销售注册用户超过5亿的新浪微博全部数据”,包括“微博发布的数据”等等。 2、这家公司还被日本企业买了。 有人会说,他们是不是只搜集商业信息,那也没事啊?那么我们再来看日本hottolink公司(也就是收购effyis的公司,同时也是新浪微博另一家在上海的数据合作公司的母公司,也在新浪微博数据合作名单里面,大家搜索下)的网站报告。 相信即便不懂日语,也能从里面的汉字看个大概吧?看了以上内容,您非要说这两家日美公司只是纯粹的商业分析,我真的无语了。这个告诉我们,他们完完全全就是通过各种渠道搜集中国的商业、政治、社会等信息。而新浪微博,为了钱,把数据合作接口对其开放了,为其创造了极大的便利。 还有更多的内容,大家可以去搜索下。 二 、通过新浪微博的数据分析可以得到什么? 有人会问,新浪微博那些数据都是公开的,有什么秘密可言? 先来说说题外话――笔迹分析,关于这个,徽剑我曾经在我的微博上做了短暂的表演,就是让我的粉丝写字,我来分析他们的性格,前后分析了几十个人,貌似没人说我分析错了。可以这么说,像我一样的笔迹性格分析人员,能够通过一个人写的字,来分析出一个人的性格特征。 那么在数据分析领域,特别是语义行为分析的研究前沿,通过语义行为来分析一个人的特征,就跟一个人的笔迹一样,通过一个人的发言,可以判断出这个人的喜好、性格,进而判断出他的消费能力、政治取向,甚至可以评估出一个人是否容易出轨,一个人是否贪财,是否是一个很好的合作伙伴等。 一个人的发言,就是这个人的笔迹。他发言的内容,他选择的语气,都能反映这个人的情况。徽剑我恰好是一名有点数据分析技术水平的“自封小腕”,也曾做过一些数据分析业务,尤其是在汉语语义的大数据分析上,有较深入的研究。比如我们就曾经通过新浪微博董事长曹国伟的阅读习惯,分析出曹国伟是否喜欢情趣内衣。我们还通过新浪微博互相之间的好友关系、互动,分析出一堆名人之间关系。比如当初王石和田朴君的关系,我们就是从他们互相间的微博互动的细节分析出来的。 早期的情报机构,就会从一些媒体报道,来分析一个国家的政府行为特征。往往一个很小的细节,就能暴露细节后的大量问题。有时候一张照片,一段话,就能曝光太多的信息。 那么回到新浪微博,我们知道,新浪微博可以公开提供以下情况: 1、个人的身份信息(特别是认证个人) 2、个人的好友互动 3、个人的微博内容。 4、支持者(即粉丝、转发者)的情况 那么通过对新浪微博的身份信息,可以判断这个人的发言价值。通过其支持者,可以判断出其发言内容被大众认可的程度,或者说对大众群体的影响程度。那么从他的好友互动,可以看到一些比如拉帮结派等行为。从微博内容可以看出的问题太多了,比如他的收入水平,他的性格,进而他的购物特征。比如微博上很多人喜欢把私人问题放微博上讲,比如卖房买车,比如有没小孩子,甚至到那里去旅游等的,一旦把你几百、几千条微博全部汇总,你这个人大致上的情况也就出来了。 一旦对个人情况了如指掌,而且这个人数还不是几个人,而是5亿人,考虑到重复帐号,至少也是上亿人。情况就很恐怖了。 商业角度:中国各个地方的商业消费习惯,大家的各行业购买潜力、消费特征等,都可以轻易被商家获取。如果数据分析光是了如指掌那还是小事。相信很多用户在微博上因为提到某个字眼,比如减肥,就会发现一堆卖减肥药的跑来评论或者@ 你吧?这就是很简单的数据分析应用,发现关键词,就去发广告。 如果换成政治角度:中国上亿人的政治倾向、政治判断能力、对时局的看法等等,也是同样了如指掌。而且是被美国日本了如指掌。甚至实施上面说的这种类似广告的舆情鼓动、传播呢?平时无所谓,战时呢?紧张时期呢? 三 、大数据分析就一定侵犯隐私么? 那我们再来谈谈大数据是不是侵犯隐私这个话题。 市面上的大数据分析有两种情况,一种是数据方自己分析,这种也包括分析方为其服务,所有分析成果都是归数据方自己的。还有一种是分析方从数据方处以各种形式获取数据(包括购买许可、自己采集等),然后分析结果归分析方所有,分析方可以拿这个结果去为第三方服务。 显然,第一种数据分析过程情况不会违反任何隐私,因为所有的数据都是数据方自己平台的事情,至于分析结果如何使用,那是另外一个话题。第二种数据分析过程问题就来了,因为第二种涉及到数据交易,换句话说,涉及到数据方向分析方出售数据的行为。 显然在这里,出现的不是数据分析问题,而是数据提供的内容和方式。 我们都知道,法律明文规定,不能买卖出售个人资料。因此数据方向分析方提供数据,必须基于匿名为前提,因为一旦不是匿名,就涉及到明确的个人隐私,这是司法问题。 在我不知道你是谁,不能清晰确定的你的个体身份的话,我对你公开的分析,即使用于商业用途,我也是不违法的,因为我只是在分析一个网络形象个体。但是一旦知道这个人是什么人,清晰知道这个人是谁时候,是在分析一个真实的个人。而这种分析的机会,又是通过商业合作“买”来的,那么你就构成了完整的买卖个人数据产业链。 新浪微博声称自己的对外微博数据合作只是基于关键词检索的,但是他们却忘了,这个关键字检索可以查询到内容,然后内容又可以追溯到个人。 换句话说,对于一个数据分析方,他可以通过数据接口,大量、高效地获取新浪微博上的内容,然后通过web技术对内容做用户匹配,做精确锁定。这种情况下,你是不是公开个人身份,有什么意义么? 再看看新浪微博注册资料里面有什么? 公开的可以获取的,居然就有邮箱和其他通讯资料。有人会说,新浪微博并不提供用户的身份证等信息给第三方,但是确忘了,新浪微博上有大量的认证用户,对于一个认证用户来说,是可以确定他真实身份的,如果同时又把他邮箱等通讯资料提供出去, 我不相信新浪微博的数据分析客户,只是纯粹的、盲目地分析那些内容,而不会去分析这些内容是谁发的,不会去对比下用户的身份信息。更不相信新浪微博会对数据分析客户屏蔽这些认证用户的资料。 同样,我们来看百度、搜狗等的广告联盟,他们也会根据用户使用搜索时候的习惯,记录下来,并加以分析,那么他们是否也涉嫌侵犯隐私呢?我们仔细看看,百度等广告联盟,记录的是你通过百度等搜索时候,输入的搜索词,或者是网民打开了含有推广链接嵌入的页面内容,来评估你的喜好,进而判断你的其他情况。他们给广告主并不提供你的信息(其实他也没太多信息),更不会去关联搜索跟踪。百度、搜狗这种广告联盟,他们的数据分析就是建立在全匿名基础上,因此他们不会构成对用户隐私的侵犯。 我们再看看淘宝的数据分析,那就更简单了,你什么时候见过淘宝把自己用户的资料提供给第三方么?当然那些卖家泄露买家资料,跟淘宝就没关系了。 大家从上面分析可以看出,大数据分析,是没有问题的,问题在于新浪微博违反了大数据分析的基本道德。开放了真实认证用户身份资料给分析方,这是严重泄露隐私的司法问题。 刑法第二百五十三条之一 国家机关或者金融、电信、交通、教育、医疗等单位的工作人员,违反国家规定,将本单位在履行职责或者提供服务过程中获得的公民个人信息,出售或者非法提供给他人,情节严重的,处三年以下有期徒刑或者拘役,并处或者单处罚金。 窃取或者以其他方法非法获取上述信息,情节严重的,依照前款的规定处罚。 单位犯前两款罪的,对单位判处罚金,并对其直接负责的主管人员和其他直接责任人员,依照各该款的规定处罚。 有人会说,这些认证信息不是公开的吗?没错! 新浪微博自己试图在这里规避责任,提供高速的内容数据接口,表面看是盲目的,新浪微博没有提供具体身份信息,但是无论如何数据关键词检索,最终都要找到具体用户,比如有人投诉,你最终必须找到这个投诉用户是谁吧? 然后新浪微博告诉你,我不在数据接口提供这个用户的资料,但是我告诉你用户的名字……然后数据分析方通过web方式去查找这个用户?这不哄鬼么? 简而言之,你网站上有大量用户信息,而且是开放的,别人通过正当的浏览,看到并记录这些信息,是不违法的,因为别人看到或者说获取这些信息的过程是合法的。但是你网站方去向第三方卖这些用户信息,你网站就是违法的,因为网民并没有授权你去卖他们的信息。 新浪微博,其实很清楚这个信息的敏感性,看前面微博的内容,他不停强调自己不提供用户资料,但是数据分析方,很容易找到用户资料这个他回避了。用的是自以为巧妙,有人骂你,微博告诉你,骂你是什么内容、骂你人的名字,至于骂你这个人的资料,请去自行查看。 四 、不得不说,在新浪微博发言的隐患 经过徽剑我的分析,您现在明白了吧。 对于普通网友来说,你的言行举止,被商家拿去做真实用户行为分析,你愿意么? 对于官员来说,你的言行举止,被国外机构拿去做政治动向分析,你愿意么? 对于政府来说,你们把新浪微博捧得越高,在上面搞的什么问政越多,海外机构对中国的社会民情获取就会越方便,你愿意么? 那么有人会问,既然新浪把这些数据开放,作为网民,应该怎么做?徽剑在这里给你点小小建议: 如果您是普通个人,尽量减少在新浪微博上的发言,资料不要填详细,或者改成错误的。尤其是不要在新浪微博谈及个人比如家庭收支、购房买车、孩子成长等消费信息。除非你为了忽悠别人把你当股评家,否则谈及你买了那些股票绝对不是好话题。实在要谈,你可以找一些封闭的圈子之类应用去谈。 有人会说,你徽剑以前怎么也在微博上那么积极发言?答:以前我并没有留意到新浪微博对外的数据合作居然到了这种程度,只是在新浪公开其合作伙伴后,我才反应过来。而且这两个月来没有玩微博,颈椎也好了,工作效率也提升了,算是因祸得福吧。 如果您是政府官员,个人建议,不要在新浪微博上开设认证账号,或者发布能够证实你个人身份的言论。更不要在网上谈及任何政府政策有关的话题,包括争辩。如果你是政府智囊机构的人员,更要学会闭嘴。 特别提醒哪些所谓热衷新媒体的政府领导、部门,新媒体是没错,但是新浪微博被海外监控着呢!你可以去其他微博等地方开账号的。后续我会有文章,专门针对在新浪微博开设政务微博的价值做分析,会用严谨的推理告诉你们,在新浪微博上搞政务微博,就是一场闹剧。有人会说一旦发生舆情事件怎么办?徽剑在后面会在这篇里面,分析新浪微博是如何一手制造舆情事件,一手来搞所谓平息手法。这个话题比较大,这里不多谈。 至于司法机关应该做的事情: 第一,公安机关追究新浪微博这种用用户数据牟利的行为,严格处理有关当事人,并限制以后的这种数据出售行为。新浪微博表面上规避了直接提供用户资料的方式,但是基于新浪微博提供的数据,其合作方很容易查看了解用户的资料。 第二,国家安全机关需要清查新浪这种对外出售数据,购买方的背景,以及已经产生的后果做出应对。想想看,中国有关部门能够接入脸书和推特的数据接口么? 因为徽剑我这里提到了国家安全,而徽剑在网上又是比较知名的“五毛大统领”,因此肯定部分“改革”“自由”网民会有逆反心理,会说,我就一普通人,不怕。那么我告诉你一个商业情景: 新浪微博把你的数据出售后,未来随着数据分析水平的提高,你在微博上的账号会收到更多的@或者评论,甚至一旦跟其他渠道产生关联数据后,比如你在新浪微博上讨论如何买房子,结果你手机就收到房地产公司的销售电话。你一讨论生孩子,你邮箱就就收到卖尿布的广告。你愿意么?你到哪里去旅游,你就收到当地酒店甚至小姐发来的拉客短信,你高兴么? 虽然我徽剑是知名的“五毛大统领”,但是我告诉你,你面前确实是一堆狗屎,你不会也非要逆反地去尝尝吧? 当然你们不动脑子,非要去尝,我也没辙,只能看乐子了。 附言: 关于王高飞的一个笑话,这个笑话是我在知乎上看到的。 按照网友说,这个ID是王高飞的,王高飞用这个ID发了一条微博,炫耀观看毛片,这位名叫网友指出其看的是盗版,结果很快发现,新浪微博就把他的账号给封了。 想想也是醉了,作为一家互联网上市公司的负责人,在自己公司平台上,用小号炫耀观看盗版色情影片,被人指出后,恼羞成怒,把指出的网友给封号。如此…….中国互联网,不,全世界互联网能找出第二个么? 好吧,废话不说了。 近期徽剑会陆续写5-10篇长篇文章,曝光新浪微博、还有各种自媒体的内容。 至于您要看徽剑的文章,都会首发于 徽剑个人公众帐号huijianonline 不过我个人比较懒,欢迎大家点题。徽剑个人联系方式里面有。 徽剑版权申明:所有徽剑的文字,在保留版权申明情况下,任何传统、网络媒体(包括自媒体)均可以自由转发,无需支付稿酬,但是不得篡改或者断章取义。当然如果能给个样刊或者发个链接通知下,那便是极好的。如果发现篡改或未保留版权申明,同样徽剑本人也将保留司法处理的权利。 请支持独立网站,转载请注明本文链接: http://www.wyzxwk.com/Article/yulun/2015/02/338387.html
个人分类:
大数据
|
23 次阅读
|
0
个评论
分享
纺织原材料周涨幅 10强榜单
大智慧数据
2014-4-23 13:55
2014年1季度全国百家大型零企服装销量同比下降3.5%,创近年来新低。在终端销售持续低迷的市场行情下,纺织原材料价格多以整盘调整为主,具体数据敬请关注数据异动监控。
12 次阅读
|
0
个评论
更多...
京ICP备16021002-2号
京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明
GMT+8, 2024-4-20 09:30
积分 0, 距离下一级还需 积分