z 4 vuotta sitten
commit
b9f5674844
77 muutettua tiedostoa jossa 5175 lisäystä ja 0 poistoa
  1. 17 0
      .vscode/launch.json
  2. 3 0
      .vscode/settings.json
  3. 1797 0
      EmQuantAPI.py
  4. 32 0
      Manualactivate-all.py
  5. 29 0
      StockHistPojo.py
  6. 5 0
      StockPojo.py
  7. 53 0
      StockRestPojo.py
  8. BIN
      __pycache__/EmQuantAPI.cpython-38.pyc
  9. BIN
      __pycache__/EmQuantAPI.cpython-39.pyc
  10. BIN
      __pycache__/StockHistPojo.cpython-38.pyc
  11. BIN
      __pycache__/StockPojo.cpython-38.pyc
  12. BIN
      __pycache__/StockRestPojo.cpython-38.pyc
  13. BIN
      __pycache__/dbOperation.cpython-38.pyc
  14. BIN
      __pycache__/dbOperation_zhaiquan.cpython-38.pyc
  15. BIN
      __pycache__/db_config.cpython-38.pyc
  16. 79 0
      clacHistData.py
  17. 74 0
      clacRestData.py
  18. 100 0
      dbOperation.py
  19. 100 0
      dbOperationStock.py
  20. 30 0
      db_config.py
  21. 374 0
      demo-backup.py
  22. 188 0
      getCst.py
  23. 163 0
      getHistData.py
  24. 170 0
      getHist_gangguData.py
  25. 170 0
      getHist_jijinData.py
  26. 170 0
      getHist_meiguData.py
  27. 171 0
      getHist_zhaiquanData.py
  28. 82 0
      getLimitUpNewsData.py
  29. 210 0
      getRestData.py
  30. 109 0
      getStockListData.py
  31. 109 0
      getStockList_gangguData.py
  32. 112 0
      getStockList_jijinData.py
  33. 109 0
      getStockList_meiguData.py
  34. 109 0
      getStockList_waihuiData.py
  35. 143 0
      getStockList_zhaiquanData.py
  36. 109 0
      getStockList_zhishuData.py
  37. 122 0
      getpg_data.py
  38. 40 0
      installEmQuantAPI.py
  39. 1 0
      libs/linux/x64/ServerList.json.e
  40. BIN
      libs/linux/x64/image/EMApp.ico
  41. BIN
      libs/linux/x64/image/Tips_error.png
  42. BIN
      libs/linux/x64/image/edit_bg.png
  43. BIN
      libs/linux/x64/image/tab1_bg.png
  44. BIN
      libs/linux/x64/image/tab2_bg.png
  45. BIN
      libs/linux/x64/image/tab3_bg.png
  46. BIN
      libs/linux/x64/libEMQuantAPIx64.so
  47. BIN
      libs/linux/x64/loginactivator
  48. BIN
      libs/linux/x64/loginactivator_ubuntu
  49. 1 0
      libs/linux/x86/ServerList.json.e
  50. BIN
      libs/linux/x86/image/EMApp.ico
  51. BIN
      libs/linux/x86/image/Tips_error.png
  52. BIN
      libs/linux/x86/image/edit_bg.png
  53. BIN
      libs/linux/x86/image/tab1_bg.png
  54. BIN
      libs/linux/x86/image/tab2_bg.png
  55. BIN
      libs/linux/x86/image/tab3_bg.png
  56. BIN
      libs/linux/x86/libEMQuantAPI.so
  57. BIN
      libs/linux/x86/loginactivator
  58. BIN
      libs/linux/x86/loginactivator_ubuntu
  59. 1 0
      libs/mac/ServerList.json.e
  60. BIN
      libs/mac/image/EMApp.ico
  61. BIN
      libs/mac/image/Tips_error.png
  62. BIN
      libs/mac/image/edit_bg.png
  63. BIN
      libs/mac/image/tab1_bg.png
  64. BIN
      libs/mac/image/tab2_bg.png
  65. BIN
      libs/mac/image/tab3_bg.png
  66. BIN
      libs/mac/libEMQuantAPIx64.dylib
  67. BIN
      libs/mac/loginactivator_mac
  68. BIN
      libs/windows/EmQuantAPI.dll
  69. BIN
      libs/windows/EmQuantAPI_x64.dll
  70. BIN
      libs/windows/LoginActivator.exe
  71. 1 0
      libs/windows/ServerList.json.e
  72. 1 0
      libs/windows/ServerSelect.txt
  73. 1 0
      libs/windows/logininfo.log
  74. 1 0
      libs/windows/precentflag.dat
  75. 1 0
      libs/windows/userInfo
  76. 121 0
      mongo_demo.py
  77. 67 0
      startGet.py

+ 17 - 0
.vscode/launch.json

@@ -0,0 +1,17 @@
+{
+    // 使用 IntelliSense 了解相关属性。 
+    // 悬停以查看现有属性的描述。
+    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Python: 当前文件",
+            "type": "python",
+            "stopOnEntry": false,
+            "pythonPath": "${command:python.interpreterPath}",
+            "request": "launch",
+            "program": "${file}",
+            "console": "integratedTerminal"
+        }
+    ]
+}

+ 3 - 0
.vscode/settings.json

@@ -0,0 +1,3 @@
+{
+    "python.pythonPath": "D:\\Python\\Python38\\python.exe"
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1797 - 0
EmQuantAPI.py


+ 32 - 0
Manualactivate-all.py

@@ -0,0 +1,32 @@
+# -*- coding:utf-8 -*-
+__author__ = 'Administrator'
+
+from EmQuantAPI import *
+import platform
+
+#手动激活范例(单独使用)
+#获取当前安装版本为x86还是x64
+#编辑日期:2018-09-29
+data = platform.architecture()
+
+if data[0] == "64bit":
+    bit = "x64"
+elif data[0] == "32bit":
+    bit = "x86"
+
+data1 = platform.system()
+if data1 == 'Linux':
+    system1 = 'linux'
+    lj = c.setserverlistdir("libs/" + system1 + '/' + bit)
+elif data1 == 'Windows':
+    system1 = 'windows'
+    lj = c.setserverlistdir("libs/" + system1)
+elif data1 == 'Darwin':
+    system1 = 'mac'
+    lj = c.setserverlistdir("libs/" + system1)
+else:
+    pass
+
+data = c.manualactivate("dfcf4198", "an073937", "email=617590286@qq.com")
+if data.ErrorCode != 0:
+    print ("manualactivate failed, ", data.ErrorMsg)

+ 29 - 0
StockHistPojo.py

@@ -0,0 +1,29 @@
+class StockHistPojo:
+    open = ""
+    close = ""
+    high = ""
+    low = ""
+    preclose = ""
+    average = ""
+    change = ""
+    pctchange = ""
+    volume = ""
+    highlimit = ""
+    amount = ""
+    turn = ""
+    tradestatus = ""
+    lowlimit = ""
+    amplitude = ""
+    tnum = ""
+    tafactor = ""
+    fronttafactor = ""
+    isststock = ""
+    isxststock = ""
+    dateYear = ""
+    dateMonth = ""
+    dateWeek = ""
+    dateDay = ""
+    discount = ""
+    discountrate = ""
+    holdvol = ""
+    holdpct = ""

+ 5 - 0
StockPojo.py

@@ -0,0 +1,5 @@
+class StockPojo:
+    id = 0
+    code = 0
+    name = ""
+    listDate = ""

+ 53 - 0
StockRestPojo.py

@@ -0,0 +1,53 @@
+class StockRestPojo:
+    date = "" 
+    time = "" 
+    now = "" 
+    high = "" 
+    low = "" 
+    open = ""
+    close = ""
+    preclose = "" 
+    roundlot = "" 
+    change = "" 
+    pctchange = "" 
+    volume = "" 
+    amount = "" 
+    volumeratio = "" 
+    commissionratio = "" 
+    commissiondiff = "" 
+    tradestatus = "" 
+    outvolume = "" 
+    involume = "" 
+    highlimit = "" 
+    lowlimit = "" 
+    speed = "" 
+    averageprice = "" 
+    buyprice1 = "" 
+    buyprice2 = "" 
+    buyprice3 = "" 
+    buyprice4 = "" 
+    buyprice5 = "" 
+    buyvolume1 = "" 
+    buyvolume2 = "" 
+    buyvolume3 = "" 
+    buyvolume4 = "" 
+    buyvolume5 = "" 
+    sellprice1 = "" 
+    sellprice2 = "" 
+    sellprice3 = "" 
+    sellprice4 = "" 
+    sellprice5 = "" 
+    sellvolume1 = "" 
+    sellvolume2 = "" 
+    sellvolume3 = "" 
+    sellvolume4 = "" 
+    sellvolume5 = "" 
+    closedtime = "" 
+    closedvolume = "" 
+    closedamount = "" 
+    dateOne = ""
+    dateFive = ""
+    dateFifteen = ""
+    dateThirty = ""
+    dateSixty = ""
+    realTime = ""

BIN
__pycache__/EmQuantAPI.cpython-38.pyc


BIN
__pycache__/EmQuantAPI.cpython-39.pyc


BIN
__pycache__/StockHistPojo.cpython-38.pyc


BIN
__pycache__/StockPojo.cpython-38.pyc


BIN
__pycache__/StockRestPojo.cpython-38.pyc


BIN
__pycache__/dbOperation.cpython-38.pyc


BIN
__pycache__/dbOperation_zhaiquan.cpython-38.pyc


BIN
__pycache__/db_config.cpython-38.pyc


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 79 - 0
clacHistData.py


+ 74 - 0
clacRestData.py

@@ -0,0 +1,74 @@
+# -*- coding:utf-8 -*-
+
+import time
+import datetime
+from StockRestPojo import StockRestPojo
+from dbOperation import dbOperation
+import db_config
+from threading import Thread
+from time import sleep
+import asyncio
+
+async def clacGroupData(dbConfig):
+    db = dbOperation(dbConfig)
+    stockPojoList = db.query_list("select id, code, name, list_date listDate from t_stock_base_info where 1 = 1")
+    for stockPojo in stockPojoList:
+        stockRestPojoList = db.query_list("SELECT id, realTime FROM `data_rt_" + stockPojo['code'].replace(".", "_").lower() + "` where dateOne = '0'")
+        sql = ""
+        for stockRestPojo in stockRestPojoList:
+            datTime = stockRestPojo['realTime']
+            min_ = time.localtime(datTime).tm_min # 获取分钟
+            sec_ = time.localtime(datTime).tm_sec # 获取秒数
+
+            # 1分钟数据
+            if sec_ != 0:
+                tempDatTime = datTime + 60 - sec_
+                stockRestPojo['dateOne'] = str(int(tempDatTime))
+            else:
+                stockRestPojo['dateOne'] = str(int(datTime))
+
+            # 5分钟数据
+            if sec_ != 0 or min_%5 != 0:
+                tempDatTime = datTime + (5 * 60) - sec_ - (min_%5 * 60)
+                stockRestPojo['dateFive'] = str(int(tempDatTime))
+            else:
+                stockRestPojo['dateFive'] = str(int(datTime))
+
+            # 15分钟数据
+            if sec_ != 0 or min_%15 != 0:
+                tempDatTime = datTime + (15 * 60) - sec_ - (min_%15 * 60)
+                stockRestPojo['dateFifteen'] = str(int(tempDatTime))
+            else:
+                stockRestPojo['dateFifteen'] = str(int(datTime))
+
+            # 30分钟数据
+            if sec_ != 0 or min_%30 != 0:
+                tempDatTime = datTime + (30 * 60) - sec_ - (min_%30 * 60)
+                stockRestPojo['dateThirty'] = str(int(tempDatTime))
+            else:
+                stockRestPojo['dateThirty'] = str(int(datTime))
+
+            # 60分钟数据
+            if sec_ != 0 or min_%60 != 0:
+                tempDatTime = datTime + (60 * 60) - sec_ - (min_%60 * 60)
+                stockRestPojo['dateSixty'] = str(int(tempDatTime))
+            else:
+                stockRestPojo['dateSixty'] = str(int(datTime))
+
+            sql = sql + "update `data_rt_" + stockPojo['code'].replace(".", "_").lower() + "` set dateOne = '" + str(stockRestPojo['dateOne']) + "', dateFive = '" + str(stockRestPojo['dateFive']) + "', dateFifteen = '" + str(stockRestPojo['dateFifteen']) + "', dateThirty = '" + str(stockRestPojo['dateThirty']) + "', dateSixty = '" + str(stockRestPojo['dateSixty']) + "' where id = '" + str(stockRestPojo['id']) + "';"
+        db.update(sql)
+    print("运行完成")
+    db.close
+
+
+async def main():
+    await asyncio.gather(
+        clacGroupData(db_config.db_gupiao)
+    )
+
+try:
+    #定时任务 每3秒钟触发一次
+    asyncio.run(main())
+
+except Exception as ee:
+    print("error >>>",ee)

+ 100 - 0
dbOperation.py

@@ -0,0 +1,100 @@
+
+import pymysql
+import db_config
+import re
+
+class dbOperation:
+
+     #建立数据库连接,新建一个查询页面
+    def __init__(self, dbName):
+        # port要转为int
+        # print("连接数据库")
+        self.mysql = pymysql.connect(host = db_config.host # 连接名称,默认127.0.0.1 
+                                    ,port = db_config.port # 端口,默认为3306
+                                    ,user = db_config.user # 用户名
+                                    ,passwd = db_config.passwd # 密码
+                                    ,db = dbName # 数据库名称
+                                    ,charset = db_config.charset # 字符编码
+                                    )
+        self.cursor = self.mysql.cursor(pymysql.cursors.DictCursor)   # fetchone 是字典 fetchall是list套dict
+
+    def table_exists(self,table_name):        #这个函数用来判断表是否存在
+        sql = "show tables;"
+        self.cursor.execute(sql)
+        tables = [self.cursor.fetchall()]
+        table_list = re.findall('(\'.*?\')',str(tables))
+        table_list = [re.sub("'",'',each) for each in table_list]
+        if table_name in table_list:
+            return 1        #存在返回1
+        else:
+            return 0        #不存在返回0
+
+    def created_table(self, sql, tableName):
+        self.cursor.execute("show tables;")
+        tables = [self.cursor.fetchall()]
+        tableList = re.findall('(\'.*?\')',str(tables))
+        tableList = [re.sub("'",'',each) for each in tableList]
+        if tableName in tableList:
+            print("该表已经存在,无需创建")
+        else:
+            # self.cursor.execute("DROP " + tableName + " IF EXISTS EMPLOYEE") #创建表前 先删除表
+            self.cursor.execute(sql)
+            print("该表创建成功")
+
+    #获取查询结果,结果是dict,上面建立游标指定了是dict
+    def query_one(self, sql):
+        self.cursor.execute(sql)
+        data = self.cursor.fetchone()
+        return data
+
+    #获取查询结果,结果是dict,上面建立游标指定了是dict
+    def query_list(self, sql):
+        self.cursor.execute(sql)
+        data = self.cursor.fetchall()
+        return data
+
+    def insert(self, sql):
+        try:
+            # 执行sql语句
+            self.cursor.execute(sql)
+            # 提交到数据库执行
+            self.mysql.commit()
+        except Exception as e:
+            # Rollback in case there is any error
+            # print("失败" + str(Exception))
+            print ('str(e):\t\t', str(e))   #输出 str(e):		integer division or modulo by zero
+            self.mysql.rollback()
+
+    def batchInsert(self, tableName, key, vlues):
+        try:
+            sql = "insert into `" + tableName + "`(" + key + ") values " + vlues +";"
+            print(sql)
+            # text = input("press any key to cancel csq \r\n")
+            # 执行sql语句
+            self.cursor.execute(sql)
+            # 提交到数据库执行
+            self.mysql.commit()
+        except Exception as e:
+            # Rollback in case there is any error
+            # print("失败" + str(Exception))
+            print ('str(e):\t\t', str(e))   #输出 str(e):		integer division or modulo by zero
+            self.mysql.rollback()
+
+    def dele(self, sql):
+        try:
+            self.cursor.execute(sql) # 执行插入的sql语句
+            self.mysql.commit() # 提交到数据库执行
+        except:
+            self.mysql.rollback()# 如果发生错误则回滚
+
+    def update(self, sql):
+        try:
+            self.cursor.execute(sql) # 执行插入的sql语句
+            self.mysql.commit() # 提交到数据库执行
+        except:
+            self.mysql.rollback()# 如果发生错误则回滚
+
+    #关闭查询页面,关闭连接
+    def close(self):
+        self.cursor.close()
+        self.mysql.close()

+ 100 - 0
dbOperationStock.py

@@ -0,0 +1,100 @@
+
+import pymysql
+import db_config
+import re
+
+class dbOperation:
+
+     #建立数据库连接,新建一个查询页面
+    def __init__(self, dbName):
+        # port要转为int
+        # print("连接数据库")
+        self.mysql = pymysql.connect(host = db_config.hoststock # 连接名称,默认127.0.0.1 
+                                    ,port = db_config.portstock # 端口,默认为3306
+                                    ,user = db_config.userstock # 用户名
+                                    ,passwd = db_config.passwdstock # 密码
+                                    ,db = dbName # 数据库名称
+                                    ,charset = db_config.charset # 字符编码
+                                    )
+        self.cursor = self.mysql.cursor(pymysql.cursors.DictCursor)   # fetchone 是字典 fetchall是list套dict
+
+    def table_exists(self,table_name):        #这个函数用来判断表是否存在
+        sql = "show tables;"
+        self.cursor.execute(sql)
+        tables = [self.cursor.fetchall()]
+        table_list = re.findall('(\'.*?\')',str(tables))
+        table_list = [re.sub("'",'',each) for each in table_list]
+        if table_name in table_list:
+            return 1        #存在返回1
+        else:
+            return 0        #不存在返回0
+
+    def created_table(self, sql, tableName):
+        self.cursor.execute("show tables;")
+        tables = [self.cursor.fetchall()]
+        tableList = re.findall('(\'.*?\')',str(tables))
+        tableList = [re.sub("'",'',each) for each in tableList]
+        if tableName in tableList:
+            print("该表已经存在,无需创建")
+        else:
+            # self.cursor.execute("DROP " + tableName + " IF EXISTS EMPLOYEE") #创建表前 先删除表
+            self.cursor.execute(sql)
+            print("该表创建成功")
+
+    #获取查询结果,结果是dict,上面建立游标指定了是dict
+    def query_one(self, sql):
+        self.cursor.execute(sql)
+        data = self.cursor.fetchone()
+        return data
+
+    #获取查询结果,结果是dict,上面建立游标指定了是dict
+    def query_list(self, sql):
+        self.cursor.execute(sql)
+        data = self.cursor.fetchall()
+        return data
+
+    def insert(self, sql):
+        try:
+            # 执行sql语句
+            self.cursor.execute(sql)
+            # 提交到数据库执行
+            self.mysql.commit()
+        except Exception as e:
+            # Rollback in case there is any error
+            # print("失败" + str(Exception))
+            print ('str(e):\t\t', str(e))   #输出 str(e):		integer division or modulo by zero
+            self.mysql.rollback()
+
+    def batchInsert(self, tableName, key, vlues):
+        try:
+            sql = "insert into `" + tableName + "`(" + key + ") values " + vlues +";"
+            print(sql)
+            # text = input("press any key to cancel csq \r\n")
+            # 执行sql语句
+            self.cursor.execute(sql)
+            # 提交到数据库执行
+            self.mysql.commit()
+        except Exception as e:
+            # Rollback in case there is any error
+            # print("失败" + str(Exception))
+            print ('str(e):\t\t', str(e))   #输出 str(e):		integer division or modulo by zero
+            self.mysql.rollback()
+
+    def dele(self, sql):
+        try:
+            self.cursor.execute(sql) # 执行插入的sql语句
+            self.mysql.commit() # 提交到数据库执行
+        except:
+            self.mysql.rollback()# 如果发生错误则回滚
+
+    def update(self, sql):
+        try:
+            self.cursor.execute(sql) # 执行插入的sql语句
+            self.mysql.commit() # 提交到数据库执行
+        except:
+            self.mysql.rollback()# 如果发生错误则回滚
+
+    #关闭查询页面,关闭连接
+    def close(self):
+        self.cursor.close()
+        self.mysql.close()

+ 30 - 0
db_config.py

@@ -0,0 +1,30 @@
+host = 'hk-cdb-mw8z8p47.sql.tencentcdb.com' # 连接名称,默认127.0.0.1 
+port = 63791 # 端口,默认为3306
+user = 'root' # 用户名
+passwd='TestBicon@123' # 密码
+
+hoststock = '47.96.39.5' # 连接名称,默认127.0.0.1 
+portstock = 3306 # 端口,默认为3306
+userstock = 'root' # 用户名
+passwdstock ='root' # 密码
+
+charset = 'utf8' # 字符编码
+
+db_gupiao = 'stock_data' # 股票
+
+db_ganggu = 'stock_data_ganggu' #港股
+
+db_jijin = 'stock_data_jijin' #基金
+
+db_lilv = 'stock_data_lilv' #利率
+
+db_meigu = 'stock_data_meigu' #美股
+
+db_waihui = 'stock_data_waihui' #外汇
+
+db_zhaiquan = 'stock_data_zhaiquan' #债券
+
+db_zhishu = 'stock_data_zhishu' #指数
+
+
+db_stock = 'stock2chen' # 股票

+ 374 - 0
demo-backup.py

@@ -0,0 +1,374 @@
+# -*- coding:utf-8 -*-
+
+__author__ = 'weijie'
+
+from EmQuantAPI import *
+from datetime import timedelta, datetime
+import time as _time
+import traceback
+print("开始了")
+def mainCallback(quantdata):
+    """
+    mainCallback 是主回调函数,可捕捉如下错误
+    在start函数第三个参数位传入,该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("mainCallback",str(quantdata))
+    print("开始了2222")
+    #登录掉线或者 登陆数达到上线(即登录被踢下线) 这时所有的服务都会停止
+    if str(quantdata.ErrorCode) == "10001011" or str(quantdata.ErrorCode) == "10001009":
+        print ("Your account is disconnect. You can force login automatically here if you need.")
+    #行情登录验证失败(每次连接行情服务器时需要登录验证)或者行情流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001021" or str(quantdata.ErrorCode) == "10001022":
+        print ("Your all csq subscribe have stopped.")
+    #行情服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002009":
+        print ("Your all csq subscribe have stopped, reconnect 6 times fail.")
+        # 行情订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_QUOTE_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002012":
+        print ("csq subscribe break on some error, reconnect and request automatically.")
+        # 资讯服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002014":
+        print ("Your all cnq subscribe have stopped, reconnect 6 times fail.")
+    # 资讯订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_INFO_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002013":
+        print ("cnq subscribe break on some error, reconnect and request automatically.")
+    # 资讯登录验证失败(每次连接资讯服务器时需要登录验证)或者资讯流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001024" or str(quantdata.ErrorCode) == "10001025":
+        print("Your all cnq subscribe have stopped.")
+    else:
+        pass
+
+def startCallback(message):
+    print("[EmQuantAPI Python]", message)
+    return 1
+def csqCallback(quantdata):
+    """
+    csqCallback 是csq订阅时提供的回调函数模板。该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("csqCallback,", str(quantdata))
+
+def cstCallBack(quantdata):
+    '''
+    cstCallBack 是日内跳价服务提供的回调函数模板
+    '''
+    for i in range(0, len(quantdata.Codes)):
+        length = len(quantdata.Dates)
+        for it in quantdata.Data.keys():
+            print(it)
+            for k in range(0, length):
+                for j in range(0, len(quantdata.Indicators)):
+                    print(quantdata.Data[it][j * length + k], " ",end = "")
+                print()
+def cnqCallback(quantdata):
+    """
+    csqCallback 是cnq订阅时提供的回调函数模板。该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    # print ("cnqCallback,", str(quantdata))
+    print("cnqCallback,")
+    for code in quantdata.Data:
+        total = len(quantdata.Data[code])
+        for k in range(0, len(quantdata.Data[code])):
+            print(quantdata.Data[code][k])
+
+try:
+    #调用登录函数(激活后使用,不需要用户名密码)
+    loginResult = c.start("ForceLogin=1", '', mainCallback)
+    if(loginResult.ErrorCode != 0):
+        print("login in fail")
+        exit()
+
+    # 资讯查询使用范例
+    # data = c.cfn("300059.SZ,600519.SH,300024.SZ", "companynews,industrynews", eCfnMode_EndCount,
+    #              "starttime=20190501010000,endtime=20190725,count=10")
+    # print("cfn输出结果======分隔线======")
+    # if (not isinstance(data, c.EmQuantData)):
+    #     print (data)
+    # else:
+    #     if (data.ErrorCode != 0):
+    #         print("request cfn Error, ", data.ErrorMsg)
+    #     else:
+    #         for code in data.Data:
+    #             total = len(data.Data[code])
+    #             for k in range(0, len(data.Data[code])):
+    #                 print(data.Data[code][k])
+
+    # 板块树查询使用范例
+    # data = c.cfnquery("")
+    # print("cfnquery输出结果======分隔线======")
+    # if (not isinstance(data, c.EmQuantData)):
+    #     print(data)
+    # else:
+    #     if (data.ErrorCode != 0):
+    #         print("request cfnquery Error, ", data.ErrorMsg)
+    #     else:
+    #         for code in data.Codes:
+    #             for i in range(0, len(data.Indicators)):
+    #                 print(data.Data[code][i])
+
+    # 资讯订阅使用范例
+    # data = c.cnq("S888005002API", "sectornews", "", cnqCallback)
+    # if data.ErrorCode != 0:
+    #     print("request cnq Error, ", data.ErrorMsg)
+    # else:
+    #     print("cnq输出结果======分隔线======")
+    #     _time.sleep(60)
+    #     text = input("press any key to cancel cnq \r\n")
+    #     # 取消订阅
+    #     data = c.cnqcancel(data.SerialID)
+
+    # # cmc使用范例
+    # data = c.cmc("300059.SZ", "OPEN,CLOSE,HIGH", (datetime.today() + timedelta(-6)).strftime("%Y-%m-%d"), datetime.today().strftime("%Y-%m-%d"), "RowIndex=2,Ispandas=0")
+    # print("cmc输出结果======分隔线======")
+    # if(not isinstance(data, c.EmQuantData)):
+    #     print(data)
+    # else:
+    #     if(data.ErrorCode != 0):
+    #         print("request cmc Error, ", data.ErrorMsg)
+    #     else:
+    #         for i in range(0, len(data.Indicators)):
+    #             for j in range(0, len(data.Dates)):
+    #                 print("indicator=%s, value=%s" % (data.Indicators[i], str(data.Data[i][j])))
+
+    # # csd使用范例
+    # data = c.csd("300059.SZ,600425.SH", "open,close", "2016-07-01", "2016-07-06", "RowIndex=1,period=1,adjustflag=1,curtype=1,pricetype=1,year=2016,Ispandas=0")
+
+    # print("csd输出结果======分隔线======")
+    # if not isinstance(data, c.EmQuantData):
+    #     print(data)
+    # else:
+    #     if(data.ErrorCode != 0):
+    #         print("request csd Error, ", data.ErrorMsg)
+    #     else:
+    #         for code in data.Codes:
+    #             for i in range(0, len(data.Indicators)):
+    #                 for j in range(0, len(data.Dates)):
+    #                     print(data.Data[code][i][j])
+
+    # # css使用范例
+    # data = c.css("300059.SZ,000002.SZ", "open,close", "TradeDate=20170308, Ispandas=0")
+    # print("css输出结果======分隔线======")
+    # if not isinstance(data, c.EmQuantData):
+    #     print(data)
+    # else:
+    #     if(data.ErrorCode != 0):
+    #         print("request css Error, ", data.ErrorMsg)
+    #     else:
+    #         for code in data.Codes:
+    #             for i in range(0, len(data.Indicators)):
+    #                 print(data.Data[code][i])
+
+    # # sector使用范例
+    # # 001004 全部A股板块
+    # data = c.sector("001004", "2016-04-26")
+    # if data.ErrorCode != 0:
+    #     print("request sector Error, ", data.ErrorMsg)
+    # else:
+    #     print("sector输出结果======分隔线======")
+    #     for code in data.Data:
+    #         print(code)
+
+    # # tradedate使用范例
+    # data = c.tradedates("2016-07-01", "2016-07-12")
+    # if(data.ErrorCode != 0):
+    #     print("request tradedates Error, ", data.ErrorMsg)
+    # else:
+    #     print("tradedate输出结果======分隔线======")
+    #     for item in data.Data:
+    #         print(item)
+
+    # # getdate使用范例
+    # data = c.getdate("20160426", -3, "Market=CNSESH")
+    # if(data.ErrorCode != 0):
+    #     print("request getdate Error, ", data.ErrorMsg)
+    # else:
+    #     print("getdate输出结果======分隔线======")
+    #     print(data.Data)
+
+    #实时行情订阅使用范例
+    data = c.csq('600000.SH,300059.SZ', 'TIME,Now,Volume','Pushtype=2',csqCallback)
+    if(data.ErrorCode != 0):
+        print("request csq Error, ", data.ErrorMsg)
+    else:
+        print("csq输出结果======分隔线======")
+        _time.sleep(2)
+        text = input("press any key to cancel csq \r\n")
+        #取消订阅
+        data = c.csqcancel(data.SerialID)
+    
+    # #实时行情订阅使用范例
+    # data = c.csq('AUDUSD.FX', 'Time,now','Pushtype=0,alltick=1',csqCallback)
+    # if(data.ErrorCode != 0):
+    #     print("request csq Error, ", data.ErrorMsg)
+    # else:
+    #     print("csq输出结果======分隔线======")
+    #     _time.sleep(2)
+    #     text = input("press any key to cancel csq \r\n")
+    #     #取消订阅
+    #     data = c.csqcancel(data.SerialID)
+    
+    # #日内跳价使用范例
+    # data = c.cst('600000.SH,300059.SZ', 'TIME,OPEN,HIGH,LOW,NOW', '093000', '094000','',cstCallBack)
+    # if(data.ErrorCode != 0):
+    #     print("request cst Error, ", data.ErrorMsg)
+    # else:
+    #     print("cst输出结果======分割线======")
+    #     _time.sleep(2)
+    #     input("press any key to quit cst \r\n")
+
+    # #行情快照使用范例
+    # data = c.csqsnapshot("000005.SZ,600602.SH,600652.SH,600653.SH,600654.SH,600601.SH,600651.SH,000004.SZ,000002.SZ,000001.SZ,000009.SZ", "PRECLOSE,OPEN,HIGH,LOW,NOW,AMOUNT", "Ispandas=0")
+    # if not isinstance(data, c.EmQuantData):
+    #     print(data)
+    # else:
+    #     if(data.ErrorCode != 0):
+    #         print("request csqsnapshot Error, ", data.ErrorMsg)
+    #     else:
+    #         print("csqsnapshot输出结果======分割线======")
+    #         for key,value in data.Data.items():
+    #             print(key, ">>> ", end="")
+    #             for v in value:
+    #                 print(v, " ", end="")
+    #             print()
+            
+    # #获取专题报表使用范例
+    # data = c.ctr("INDEXCOMPOSITION", "", "IndexCode=000300.SH,EndDate=2017-01-13")
+    # if(data.ErrorCode != 0):
+    #     print("request ctr Error, ", data.ErrorMsg)
+    # else:
+    #     print("ctr输出结果======分割线======")
+    #     for key,value in data.Data.items():
+    #         for v in value:
+    #              print(v, " ", end="")
+    #         print()
+
+    # #选股使用范例
+    # data = c.cps("B_001004", "s0,OPEN,2017/2/27,1;s1,NAME", "[s0]>0", "orderby=rd([s0]),top=max([s0],100)")
+    # if(data.ErrorCode != 0):
+    #     print("request cps Error, ", data.ErrorMsg)
+    # else:
+    #     print("cps输出结果======分割线======")
+    #     for it in data.Data:
+    #        print(it)
+
+    # #宏观指标服务
+    # data = c.edb("EMM00087117","IsPublishDate=1,RowIndex=1,Ispandas=1")
+    # if not isinstance(data, c.EmQuantData):
+    #     print(data)
+    # else:
+    #     if(data.ErrorCode != 0):
+    #         print("request edb Error, ", data.ErrorMsg)
+    #     else:
+    #         print("edbid           date          ",end="")
+    #         for ind in data.Indicators:
+    #             print(ind, end="   ")
+    #         print("")
+    #         for code in data.Codes:
+    #             for j in range(0, len(data.Dates)):
+    #                 print(code, "    ", data.Dates[j], end="   ")
+    #                 for i in range(0, len(data.Indicators)):
+    #                     print(data.Data[code][i][j], end="   ")
+    #                 print("")
+
+    # #宏观指标id详情查询
+    # data = c.edbquery("EMM00058124,EMM00087117,EMG00147350")
+    # if(data.ErrorCode != 0):
+    #     print("request edbquery Error, ", data.ErrorMsg)
+    # else:
+    #     print("edbid         ",end="")
+    #     for ind in data.Indicators:
+    #         print(ind, end="   ")
+    #     print("")
+    #     for code in data.Codes:
+    #         for j in range(0, len(data.Dates)):
+    #             print(code, "    ", end="   ")
+    #             for i in range(0, len(data.Indicators)):
+    #                 print(data.Data[code][i][j], end="   ")
+    #             print("")
+
+    # #新建组合
+    # data = c.pcreate("quant001", "组合牛股", 100000000, "这是一个牛股的组合")
+    # if(data.ErrorCode != 0):
+    #     print("request pcreate Error, ", data.ErrorMsg)
+    # else:
+    #     print("create succeed")
+
+    # # 组合资金调配
+    # data = c.pctransfer("quant001", "IN", "2019-08-13", 10000, "追加资金", "TRANSFERTYPE=1")
+    # if (data.ErrorCode != 0):
+    #     print("request pctransfer Error, ", data.ErrorMsg)
+    # else:
+    #     print("pctransfer succeed")
+
+    # # 组合下单
+    # orderdict = {'code': ['300059.SZ', '600000.SH'],
+    #              'volume': [1000, 200],
+    #              'price': [13.11, 12.12],
+    #              'date': ['2017-08-14', '2017-08-24'],
+    #              'time': ['14:22:18', '14:22:52'],
+    #              'optype': [eOT_buy, eOT_buy],
+    #              'cost': [0, 3],
+    #              'rate': [0, 2],
+    #              'destvolume': [0, 0],
+    #              'weight': [0.1, 0.1]}
+    # data = c.porder("quant001", orderdict, "this is a test")
+    # if(data.ErrorCode != 0):
+    #     print("porder Error, ", data.ErrorMsg)
+    # else:
+    #     print("order succeed")
+
+    # #组合报表查询
+    # data = c.preport("quant001", "record", "startdate=2017/07/12,enddate=2018/01/15")
+    # if(data.ErrorCode != 0):
+    #     print("request preport Error, ", data.ErrorMsg)
+    # else:
+    #     for ind in data.Indicators:
+    #         print(ind, end="   ")
+    #     print("")
+    #     for k in data.Data:
+    #         for it in data.Data[k]:
+    #             print(it, end="   ")
+    #         print("")
+
+    # #组合信息查询
+    # data = c.pquery()
+    # if(data.ErrorCode != 0):
+    #     print("request pquery Error, ", data.ErrorMsg)
+    # else:
+    #     print("[key]:",end="")
+    #     for index in range(0, len(data.Indicators)):
+    #         print("\t", data.Indicators[index],end="")
+    #     print("")
+    #     for k,v in data.Data.items():
+    #         print(k,": ", end="")
+    #         for vv in v:
+    #             print("\t", vv, end="")
+    #         print("")
+
+    # #删除组合
+    # data = c.pdelete("quant001")
+    # if(data.ErrorCode != 0):
+    #     print("request pdelete Error, ", data.ErrorMsg)
+    # else:
+    #     print("delete succeed")
+
+    # #获取区间日期内的交易日天数
+    # data = c.tradedatesnum("2018-01-01", "2018-09-15")
+    # if data.ErrorCode != 0:
+    #     print("request tradedatesnum Error, ", data.ErrorMsg)
+    # else:
+    #     print("tradedatesnum======分割线======")
+    #     print(data.Data)
+
+#退出
+    data = logoutResult = c.stop()
+except Exception as ee:
+    print("error >>>",ee)
+    traceback.print_exc()
+else:
+    print("demo end")

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 188 - 0
getCst.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 163 - 0
getHistData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 170 - 0
getHist_gangguData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 170 - 0
getHist_jijinData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 170 - 0
getHist_meiguData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 171 - 0
getHist_zhaiquanData.py


+ 82 - 0
getLimitUpNewsData.py

@@ -0,0 +1,82 @@
+# -*- coding:utf-8 -*-
+
+__author__ = 'weijie'
+
+from EmQuantAPI import *
+from datetime import timedelta, datetime
+import time as _time
+import traceback
+print("开始了")
+def mainCallback(quantdata):
+    """
+    mainCallback 是主回调函数,可捕捉如下错误
+    在start函数第三个参数位传入,该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("mainCallback",str(quantdata))
+    print("开始了2222")
+    #登录掉线或者 登陆数达到上线(即登录被踢下线) 这时所有的服务都会停止
+    if str(quantdata.ErrorCode) == "10001011" or str(quantdata.ErrorCode) == "10001009":
+        print ("Your account is disconnect. You can force login automatically here if you need.")
+    #行情登录验证失败(每次连接行情服务器时需要登录验证)或者行情流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001021" or str(quantdata.ErrorCode) == "10001022":
+        print ("Your all csq subscribe have stopped.")
+    #行情服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002009":
+        print ("Your all csq subscribe have stopped, reconnect 6 times fail.")
+        # 行情订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_QUOTE_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002012":
+        print ("csq subscribe break on some error, reconnect and request automatically.")
+        # 资讯服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002014":
+        print ("Your all cnq subscribe have stopped, reconnect 6 times fail.")
+    # 资讯订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_INFO_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002013":
+        print ("cnq subscribe break on some error, reconnect and request automatically.")
+    # 资讯登录验证失败(每次连接资讯服务器时需要登录验证)或者资讯流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001024" or str(quantdata.ErrorCode) == "10001025":
+        print("Your all cnq subscribe have stopped.")
+    else:
+        pass
+
+def cnqCallback(quantdata):
+    """
+    csqCallback 是cnq订阅时提供的回调函数模板。该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("cnqCallback,", str(quantdata))
+    # print("cnqCallback,")
+    for code in quantdata.Data:
+        total = len(quantdata.Data[code])
+        for k in range(0, len(quantdata.Data[code])):
+            print(quantdata.Data[code][k])
+
+try:
+    #调用登录函数(激活后使用,不需要用户名密码)
+    loginResult = c.start("ForceLogin=1", '', mainCallback)
+    if(loginResult.ErrorCode != 0):
+        print("login in fail")
+        exit()
+
+
+    # 资讯订阅使用范例 0072255 昨日涨停
+    data = c.cnq("0072255", "sectornews", "", cnqCallback)
+    if data.ErrorCode != 0:
+        print("request cnq Error, ", data.ErrorMsg)
+    else:
+        print("cnq输出结果======分隔线======")
+        _time.sleep(60)
+        text = input("press any key to cancel cnq \r\n")
+        # 取消订阅
+        data = c.cnqcancel(data.SerialID)
+
+
+#退出
+    data = logoutResult = c.stop()
+except Exception as ee:
+    print("error >>>",ee)
+    traceback.print_exc()
+else:
+    print("demo end")

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 210 - 0
getRestData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 109 - 0
getStockListData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 109 - 0
getStockList_gangguData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 112 - 0
getStockList_jijinData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 109 - 0
getStockList_meiguData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 109 - 0
getStockList_waihuiData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 143 - 0
getStockList_zhaiquanData.py


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 109 - 0
getStockList_zhishuData.py


+ 122 - 0
getpg_data.py

@@ -0,0 +1,122 @@
+# -*- coding:utf-8 -*-
+
+__author__ = 'weijie'
+
+from EmQuantAPI import *
+from datetime import timedelta, datetime
+import time as _time
+import traceback
+
+print("开始了")
+def mainCallback(quantdata):
+    """
+    mainCallback 是主回调函数,可捕捉如下错误
+    在start函数第三个参数位传入,该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("mainCallback",str(quantdata))
+    print("开始了2222")
+    #登录掉线或者 登陆数达到上线(即登录被踢下线) 这时所有的服务都会停止
+    if str(quantdata.ErrorCode) == "10001011" or str(quantdata.ErrorCode) == "10001009":
+        print ("Your account is disconnect. You can force login automatically here if you need.")
+    #行情登录验证失败(每次连接行情服务器时需要登录验证)或者行情流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001021" or str(quantdata.ErrorCode) == "10001022":
+        print ("Your all csq subscribe have stopped.")
+    #行情服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002009":
+        print ("Your all csq subscribe have stopped, reconnect 6 times fail.")
+        # 行情订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_QUOTE_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002012":
+        print ("csq subscribe break on some error, reconnect and request automatically.")
+        # 资讯服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002014":
+        print ("Your all cnq subscribe have stopped, reconnect 6 times fail.")
+    # 资讯订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_INFO_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002013":
+        print ("cnq subscribe break on some error, reconnect and request automatically.")
+    # 资讯登录验证失败(每次连接资讯服务器时需要登录验证)或者资讯流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001024" or str(quantdata.ErrorCode) == "10001025":
+        print("Your all cnq subscribe have stopped.")
+    else:
+        pass
+
+def startCallback(message):
+    print("[EmQuantAPI Python]", message)
+    return 1
+def csqCallback(quantdata):
+    """
+    csqCallback 是csq订阅时提供的回调函数模板。该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    print ("csqCallback,", str(quantdata))
+
+def cstCallBack(quantdata):
+    '''
+    cstCallBack 是日内跳价服务提供的回调函数模板
+    '''
+    for i in range(0, len(quantdata.Codes)):
+        length = len(quantdata.Dates)
+        for it in quantdata.Data.keys():
+            print(it)
+            for k in range(0, length):
+                for j in range(0, len(quantdata.Indicators)):
+                    print(quantdata.Data[it][j * length + k], " ",end = "")
+                print()
+def cnqCallback(quantdata):
+    """
+    csqCallback 是cnq订阅时提供的回调函数模板。该函数只有一个为c.EmQuantData类型的参数quantdata
+    :param quantdata:c.EmQuantData
+    :return:
+    """
+    # print ("cnqCallback,", str(quantdata))
+    print("cnqCallback,")
+    for code in quantdata.Data:
+        total = len(quantdata.Data[code])
+        for k in range(0, len(quantdata.Data[code])):
+            print(quantdata.Data[code][k])
+
+try:
+    #调用登录函数(激活后使用,不需要用户名密码)
+    loginResult = c.start("ForceLogin=1", '', mainCallback)
+    if(loginResult.ErrorCode != 0):
+        print("login in fail")
+        exit()
+
+     # csd使用范例
+    data = c.csd("300059.SZ,600425.SH", "open,close", "2016-07-01", "2016-07-06", "RowIndex=1,period=1,adjustflag=1,curtype=1,pricetype=1,year=2016,Ispandas=0")
+
+    print("csd输出结果======分隔线======")
+    if not isinstance(data, c.EmQuantData):
+        print(data)
+    else:
+        if(data.ErrorCode != 0):
+            print("request csd Error, ", data.ErrorMsg)
+        else:
+            for code in data.Codes:
+                for i in range(0, len(data.Indicators)):
+                    for j in range(0, len(data.Dates)):
+                        print(data.Data[code][i][j])
+
+    # css使用范例
+    data = c.css("300059.SZ,000002.SZ", "open,close", "TradeDate=20170308, Ispandas=0")
+    print("css输出结果======分隔线======")
+    if not isinstance(data, c.EmQuantData):
+        print(data)
+    else:
+        if(data.ErrorCode != 0):
+            print("request css Error, ", data.ErrorMsg)
+        else:
+            for code in data.Codes:
+                for i in range(0, len(data.Indicators)):
+                    print(data.Data[code][i])
+
+
+#退出
+    data = logoutResult = c.stop()
+except Exception as ee:
+    print("error >>>",ee)
+    traceback.print_exc()
+else:
+    print("demo end")

+ 40 - 0
installEmQuantAPI.py

@@ -0,0 +1,40 @@
+__author__ = 'weijie'
+
+from EmQuantAPI import *
+import sys as _sys, os as _os
+
+def installEmQuantAPI():
+    print("Start to install EmQuantAPI...")
+
+    if UtilAccess.adapter.get_py_name() != PY_Python3:
+        print('Error: Python version must be 3.x!')
+        return
+
+    currDir = _os.path.split(_os.path.realpath(__file__))[0]
+    site_pkg_names = ["site-packages"]
+    if(UtilAccess.adapter.get_os_name() == OS_Linux):
+        site_pkg_names.append("dist-packages")
+
+    #get site-packages path
+    packagepath = ""
+    for site_pkg_name in site_pkg_names:
+        if packagepath != "":
+            break
+        for spath in _sys.path:
+            pos = spath.find(site_pkg_name)
+            if(pos >= 0 and spath[pos:]==site_pkg_name):
+                packagepath = spath
+                break
+
+    if packagepath != "":
+        pthPath = _os.path.join(packagepath, "EmQuantAPI.pth")
+        pthFile = open(pthPath, "w")
+        pthFile.writelines(currDir)
+        pthFile.close()
+        print("Success:", "EmQuantAPI installed.")
+    else:
+        print( "Error: EmQuantApi install fail!(in get pth)")
+
+if __name__ == "__main__":
+    installEmQuantAPI()
+

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/linux/x64/ServerList.json.e


BIN
libs/linux/x64/image/EMApp.ico


BIN
libs/linux/x64/image/Tips_error.png


BIN
libs/linux/x64/image/edit_bg.png


BIN
libs/linux/x64/image/tab1_bg.png


BIN
libs/linux/x64/image/tab2_bg.png


BIN
libs/linux/x64/image/tab3_bg.png


BIN
libs/linux/x64/libEMQuantAPIx64.so


BIN
libs/linux/x64/loginactivator


BIN
libs/linux/x64/loginactivator_ubuntu


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/linux/x86/ServerList.json.e


BIN
libs/linux/x86/image/EMApp.ico


BIN
libs/linux/x86/image/Tips_error.png


BIN
libs/linux/x86/image/edit_bg.png


BIN
libs/linux/x86/image/tab1_bg.png


BIN
libs/linux/x86/image/tab2_bg.png


BIN
libs/linux/x86/image/tab3_bg.png


BIN
libs/linux/x86/libEMQuantAPI.so


BIN
libs/linux/x86/loginactivator


BIN
libs/linux/x86/loginactivator_ubuntu


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/mac/ServerList.json.e


BIN
libs/mac/image/EMApp.ico


BIN
libs/mac/image/Tips_error.png


BIN
libs/mac/image/edit_bg.png


BIN
libs/mac/image/tab1_bg.png


BIN
libs/mac/image/tab2_bg.png


BIN
libs/mac/image/tab3_bg.png


BIN
libs/mac/libEMQuantAPIx64.dylib


BIN
libs/mac/loginactivator_mac


BIN
libs/windows/EmQuantAPI.dll


BIN
libs/windows/EmQuantAPI_x64.dll


BIN
libs/windows/LoginActivator.exe


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/windows/ServerList.json.e


+ 1 - 0
libs/windows/ServerSelect.txt

@@ -0,0 +1 @@
+{"ServerSelect":[{"Net":1,"Type":1},{"Net":1,"Type":2},{"Net":1,"Type":3},{"Net":1,"Type":4},{"Net":1,"Type":5},{"Net":1,"Type":6},{"Net":1,"Type":7},{"Net":1,"Type":8},{"Net":1,"Type":9},{"Net":1,"Type":10},{"Net":1,"Type":11},{"Net":1,"Type":12},{"Net":1,"Type":13},{"Net":1,"Type":17},{"Net":1,"Type":18},{"Net":1,"Type":19},{"Net":1,"Type":20},{"Net":1,"Type":201},{"Net":1,"Type":202},{"Net":1,"Type":203}]}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/windows/logininfo.log


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/windows/precentflag.dat


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
libs/windows/userInfo


+ 121 - 0
mongo_demo.py

@@ -0,0 +1,121 @@
+from pymongo import MongoClient
+
+db = MongoClient('127.0.0.1',27017)
+my_db = db.my_db
+my_infor = my_db.my_infor
+
+# 向文件中插入数据
+user = [{'name':'jiesen','age':15,'sex':'男'},{'name':'jiesen','age':35,'sex':'男'},{'name':'jiesen','age':23,'sex':'男'}]
+# my_infor.insert(user)
+'''
+insert():可以实现单条或多条数据的插入
+save():只能完成单条数据的插入,并且数据必须是字典结构
+'''
+
+# 查询数据
+res = my_infor.find({'name':'jiesen'})
+# for item in res:
+#     print(item)
+
+# 更新数据
+# multi: 布尔类型, 设置数据更新时是否一次性更新多条数据, 默认为False
+# upsert: 设置数据更新时,如果数据不存在,是否将本次数据添加到文件中,默认为False
+# my_infor.update({'name':'jiesen1'},{'$set':{'age':20,'sex':'woman'}},multi=True,upsert=True)
+
+# 删除数据
+# delete_one(): 删除数据中一条数据
+# delete_many(): 一次性删除多条满足的数据
+# my_infor.delete_many({'name':'jiesen'})
+
+# mongodb条件查询:
+'''
+> : $gt
+< : $lt
+>= : $gte
+<= : $lte
+$in:(m,n,) : 提取在指定内容中的数据
+
+$all[n,m,...]: 查找数据库中某一条数据是否全部包含all中的数据, 如果'全部'包含则返回该条数据,否则不反悔
+
+$push: 向已有数据源中按照字段进行数据的添加.基于'列表'
+
+$pop: 将数据库中对应数据的某一个字段数据按照指定方式进行删除. 其中 -1:从列表的起始位置开始删除; 1: 从列表的最后位置开始删除
+
+$pull: 将对应数据中指定的数据分布进行删除(按值删除)
+
+$or : 或者指令, 该指令通常作为字典的键, 其对应的值是一个'列表'结构,列表中每一个元素之间是'并列'的关系.
+
+"在字典中所有的键值对之间代表的是一种'并且'的关系."
+
+.sort('age',1): 将查找之后的结果按照指定的字段进行排序, 1为升序,-1为降序
+
+.skip(m).limit(n): 将查找结果的取值显示为,跳过m条数据,显示n条数据.  即只显示m+1~m+1+n的数据
+'''
+#例:
+#查询年龄在[5,25]之间的所有数据
+res = my_infor.find({
+    'age':{'$gte':5,"$lte":25}
+})
+# for item in res:
+#     print(item)
+
+#查询年龄15以下或25以上,name是jiesen的数据
+res1 = my_infor.find({
+    '$or':[
+        {'age':{'$gte':25}},
+        {'age':{'$lte':15}}
+    ],
+    'name':'jiesen'
+})
+
+
+# $in: 提取在指定内容中的数据
+res3 = my_infor.find({
+    'age':{'$in':(15,23)}
+})
+
+obj = {
+    'name':'ysh',
+    'sex':'男',
+    'age':77,
+    'photo':['img/1.jpg','img/2.jpg'],
+    'score':[12,15,17,90]
+}
+# my_infor.insert(obj)
+
+res4 = my_infor.find({
+    'score':{'$all':[12,15,90]}
+})
+
+# $push: 向已有数据源中按照字段进行数据的添加.基于'列表'
+# my_infor.update(
+#     {'name':'ysh'},   #指定数据的条件
+#     {'$push':{'score':[103,120]}}
+# )
+
+# $pop: 将数据库中对应数据的某一个字段数据按照指定方式进行删除. 其中 -1:从列表的起始位置开始删除; 1: 从列表的最后位置开始删除
+# $pull: 将对应数据中指定的数据分布进行删除(按值删除)
+my_infor.update(
+    {'name':'ysh'},
+    # {'$pop':{'score':1}},
+    {'$pull':{'score':90}}
+)
+
+#多路查询
+res5 = my_infor.find({
+    'score.0':{'$gt':10}
+})
+
+obj1 = {
+    'name':'YSH',
+    'son':[
+        {'name':'ete','age':17},
+        {'name':"ete1",'age':15}
+    ]
+}
+# my_infor.insert(obj1)
+res6 = my_infor.find({
+    'son.1.age':15
+})
+for item in res6:
+    print(item)

+ 67 - 0
startGet.py

@@ -0,0 +1,67 @@
+from threading import Thread
+from time import sleep
+import asyncio
+from EmQuantAPI import *
+from datetime import timedelta, datetime
+import time
+import traceback
+import json
+from StockRestPojo import StockRestPojo
+from dbOperation import dbOperation
+from threading import Thread
+import db_config
+
+async def getHistStock():
+    print(1)
+
+async def getHistIndex():
+    print(2)
+
+def mainCallback(quantdata):
+    print ("mainCallback",str(quantdata))
+    #登录掉线或者 登陆数达到上线(即登录被踢下线) 这时所有的服务都会停止
+    if str(quantdata.ErrorCode) == "10001011" or str(quantdata.ErrorCode) == "10001009":
+        print ("Your account is disconnect. You can force login automatically here if you need.")
+    #行情登录验证失败(每次连接行情服务器时需要登录验证)或者行情流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001021" or str(quantdata.ErrorCode) == "10001022":
+        print ("Your all csq subscribe have stopped.")
+    #行情服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002009":
+        print ("Your all csq subscribe have stopped, reconnect 6 times fail.")
+        # 行情订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_QUOTE_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002012":
+        print ("csq subscribe break on some error, reconnect and request automatically.")
+        # 资讯服务器断线自动重连连续6次失败(1分钟左右)不过重连尝试还会继续进行直到成功为止,遇到这种情况需要确认两边的网络状况
+    elif str(quantdata.ErrorCode) == "10002014":
+        print ("Your all cnq subscribe have stopped, reconnect 6 times fail.")
+    # 资讯订阅遇到一些错误(这些错误会导致重连,错误原因通过日志输出,统一转换成EQERR_INFO_RECONNECT在这里通知),正自动重连并重新订阅,可以做个监控
+    elif str(quantdata.ErrorCode) == "10002013":
+        print ("cnq subscribe break on some error, reconnect and request automatically.")
+    # 资讯登录验证失败(每次连接资讯服务器时需要登录验证)或者资讯流量验证失败时,会取消所有订阅,用户需根据具体情况处理
+    elif str(quantdata.ErrorCode) == "10001024" or str(quantdata.ErrorCode) == "10001025":
+        print("Your all cnq subscribe have stopped.")
+    else:
+        pass
+
+async def main():
+    await asyncio.gather(
+        clacGroupData(db_config.db_gupiao)
+    )
+
+print("开始了")
+try:
+    #调用登录函数(激活后使用,不需要用户名密码)
+    loginResult = c.start("ForceLogin=1", '', mainCallback)
+    if(loginResult.ErrorCode != 0):
+        print("login in fail")
+        exit()
+#退出
+    data = logoutResult = c.stop()
+
+
+except Exception as ee:
+    print("error >>>",ee)
+    traceback.print_exc()
+else:
+    print("demo end")
+    asyncio.run(main())