[Mod]修改中信期权接口的op_station获取

This commit is contained in:
vn.py 2017-12-04 17:44:54 +08:00
parent ac993cffad
commit a8dbe6cc27
2 changed files with 36 additions and 2 deletions

View File

@ -1 +1 @@
lBUnZalf043zoNavP3G6rA==
rGu69UiZhQTMFXCkVHH1kg==

View File

@ -3,8 +3,12 @@
import sys
import os
import json
import socket
import urllib
from time import sleep
import wmi
from vnpy.api.cshshlp import CsHsHlp
from vnpy.api.ctp import MdApi
from vnpy.trader.vtGateway import *
@ -586,10 +590,40 @@ class CshshlpTdApi(CsHsHlp):
def connect(self, opEntrustWay, opStation, fundAccount, password):
""""""
self.opEntrustWay = opEntrustWay
self.opStation = opStation
#self.opStation = opStation
self.fundAccount = fundAccount
self.password = password
# 生成op_station
data = json.loads(urllib.urlopen("http://ip.jsontest.com/").read())
iip = data["ip"]
c = wmi.WMI()
for interface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1):
mac = interface.MACAddress # MAC地址
lip = interface.IPAddress[0] # 公网IP
for processor in c.Win32_Processor():
cpu = temp.processor.strip() # CPU编号
for disk in c.Win32_DiskDrive(): # 硬盘编号
hdd = disk.SerialNumber.strip()
for disk in c.Win32_LogicalDisk (DriveType=3): # 硬盘分区信息
pi = ','.join([disk.Caption, disk.Size])
pcn = socket.gethostname() # 计算机名称
self.opStation = 'TYJR-%s-IIP.%s-LIP.%s-MAC.%s-HD.%s-PCN.%s-CPU.%s-PI.%s' %(opStation,
iip,
lip,
mac,
hd,
pcn,
cpu,
pi)
# 读取配置文件
i = self.loadConfig("Hsconfig.ini")
if i: