1234567891011121314151617181920212223242526272829303132333435 |
- __author__ = 'weijie'
- 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
- def csqCallback(quantdata):
- current_time = datetime.strftime(datetime.now(),"%H:%M:%S")
- time1 = "09:15:00"
- time2 = "11:30:00"
- time3 = "12:59:00"
- time4 = "15:00:00"
- if (current_time > time1 and current_time < time2) or (current_time > time3 and current_time < time4):
- try:
- fileName = "/www/wwwroot/csqdata/tempindex/" + str(round(time.time() * 1000000)) + ".txt"
- with open(fileName, 'w', encoding="utf-8") as file:
- file.write(str(quantdata.Data))
- except Exception as e:
- print(str(e))
- class TempIndexRestData:
- def toGet(self):
- try:
- data = c.csq("000001.SH,399001.SZ,399006.SZ","Date,Time,Now,High,Low,Open,PreClose,Roundlot,Volume,Amount,Change,PctChange,Speed",'Pushtype=2',csqCallback)
- print(data)
- except Exception as ee:
- print("error >>>",ee)
- traceback.print_exc()
|