This commit is contained in:
maxinxin 2025-07-09 18:43:20 +08:00
parent 54d999b15a
commit 5cb5bcb676
6 changed files with 108 additions and 92 deletions

View File

@ -23,7 +23,9 @@ scripts_path = os.path.dirname(os.path.realpath(__file__))
from pathlib import Path from pathlib import Path
root_path = Path(__file__).parent.parent root_path = Path(__file__).parent.parent
path = os.path.join(root_path,'broker_xiadan','金长江网上交易汇智版','xiadan.exe')
# 直接默认使用C:'金长江网上交易汇智版','xiadan.exe'
path = os.path.join('C:','金长江网上交易汇智版','xiadan.exe')
global engine global engine
engine = create_engine( engine = create_engine(
@ -128,6 +130,24 @@ class ChangJiangClientTrader:
proxy_port = item['port'] proxy_port = item['port']
set_proxy(proxy_ip, proxy_port) set_proxy(proxy_ip, proxy_port)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '长江证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
# 启动软件进程,输入账号密码
self._app = pywinauto.Application().start(self.path) self._app = pywinauto.Application().start(self.path)
while True: while True:
try: try:
@ -167,20 +187,7 @@ class ChangJiangClientTrader:
break break
self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=60) self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=60)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '长江证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
#关闭弹窗 #关闭弹窗
for i in range(3): for i in range(3):

View File

@ -146,26 +146,8 @@ class DongWuClientTrader:
proxy_ip = item['ip'] proxy_ip = item['ip']
proxy_port = item['port'] proxy_port = item['port']
set_proxy(proxy_ip,proxy_port) set_proxy(proxy_ip,proxy_port)
self.logger.info('全局代理设置成功') self.logger.info('全局代理设置成功')
# 开始登录
time.sleep(2)
self._app = pywinauto.Application().start(self.path)
while True:
try:
self._app.window(title_re='用户登录.*').wait("ready")
break
except RuntimeError:
pass
self._app.window(title_re='用户登录.*').Edit1.type_keys(self.securities_name)
time.sleep(0.1)
self._app.window(title_re='用户登录.*').Edit2.type_keys(self.securities_password)
time.sleep(0.1)
pywinauto.keyboard.send_keys("{ENTER}")
self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=30)
# ip和mac入库 # ip和mac入库
new_mac = set_mac.get_macinfos() new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(), insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
@ -180,6 +162,21 @@ class DongWuClientTrader:
'Location': item['prov'] + ':' + item['city']}]) 'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append') insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.logger.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库') self.logger.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
# 开始登录
self._app = pywinauto.Application().start(self.path)
self._app.window(title_re='用户登录.*').wait("ready",timeout=30)
self._app.window(title_re='用户登录.*').Edit1.type_keys(self.securities_name)
time.sleep(0.1)
self._app.window(title_re='用户登录.*').Edit2.type_keys(self.securities_password)
time.sleep(0.1)
pywinauto.keyboard.send_keys("{ENTER}")
self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=30)
#关闭弹窗 #关闭弹窗
for i in range(3): for i in range(3):
self._turn_off_advertising() self._turn_off_advertising()

View File

@ -24,7 +24,7 @@ scripts_path = os.path.dirname(os.path.realpath(__file__))
from pathlib import Path from pathlib import Path
root_path = Path(__file__).parent.parent root_path = Path(__file__).parent.parent
from config import ssid,password from config import ssid,password
path = os.path.join(root_path,'broker_xiadan','gfzqrzrq','xiadan.exe') path = os.path.join('C:','gfzqrzrq','xiadan.exe')
global engine global engine
engine = create_engine( engine = create_engine(
@ -111,6 +111,22 @@ class GFClientTrader:
set_proxy(proxy_ip, proxy_port) set_proxy(proxy_ip, proxy_port)
self.log.info('全局代理设置成功') self.log.info('全局代理设置成功')
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '广发证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
# 启动软件进程,输入账号密码 # 启动软件进程,输入账号密码
self._app = pywinauto.Application().start(self.path) self._app = pywinauto.Application().start(self.path)
while True: while True:
@ -133,20 +149,7 @@ class GFClientTrader:
self._close_prompt_windows() self._close_prompt_windows()
self._app.window(title_re='核新网上交易系统.*').wait("ready",timeout=60) self._app.window(title_re='核新网上交易系统.*').wait("ready",timeout=60)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '广发证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
#关闭弹窗 #关闭弹窗
# for i in range(3): # for i in range(3):
# self._turn_off_advertising() # self._turn_off_advertising()

View File

@ -153,6 +153,22 @@ class HLClientTrader:
set_proxy(proxy_ip, proxy_port) set_proxy(proxy_ip, proxy_port)
self.logger.info('全局代理设置成功') self.logger.info('全局代理设置成功')
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '华龙证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.logger.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
#启动软件进程,输入账号密码 #启动软件进程,输入账号密码
self._app = pywinauto.Application().start(self.path) self._app = pywinauto.Application().start(self.path)
@ -212,20 +228,7 @@ class HLClientTrader:
# self._close_prompt_windows() # self._close_prompt_windows()
self._app.window(title_re='通达信网上交易.*').wait("ready",timeout=30) self._app.window(title_re='通达信网上交易.*').wait("ready",timeout=30)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '华龙证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.logger.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
#设置主窗口及菜单窗口 #设置主窗口及菜单窗口

View File

@ -23,7 +23,7 @@ scripts_path = os.path.dirname(os.path.realpath(__file__))
from pathlib import Path from pathlib import Path
root_path = Path(__file__).parent.parent root_path = Path(__file__).parent.parent
from config import ssid,password from config import ssid,password
path = os.path.join(root_path,'broker_xiadan','华泰证券网上交易委托系统','xiadan.exe') path = os.path.join('C:','华泰证券网上交易委托系统','xiadan.exe')
global engine global engine
engine = create_engine( engine = create_engine(
@ -113,6 +113,22 @@ class HTClientTrader:
set_proxy(proxy_ip, proxy_port) set_proxy(proxy_ip, proxy_port)
self.log.info('全局代理设置成功') self.log.info('全局代理设置成功')
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '华泰证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
self._app = pywinauto.Application().start(self.path) self._app = pywinauto.Application().start(self.path)
while True: while True:
try: try:
@ -137,20 +153,7 @@ class HTClientTrader:
# for i in range(3): # for i in range(3):
# self._turn_off_advertising() # self._turn_off_advertising()
self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=30) self._app.window(title_re='网上股票交易系统5.0.*').wait("ready",timeout=30)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '华泰证券',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
# 关闭弹窗 # 关闭弹窗
self._close_prompt_windows() self._close_prompt_windows()

View File

@ -23,7 +23,7 @@ scripts_path = os.path.dirname(os.path.realpath(__file__))
from pathlib import Path from pathlib import Path
root_path = Path(__file__).parent.parent root_path = Path(__file__).parent.parent
path = os.path.join(root_path,'broker_xiadan','中信建投网上交易极速版(同花顺)','xiadan.exe') path = os.path.join('C:','中信建投网上交易极速版(同花顺)','xiadan.exe')
global engine global engine
engine = create_engine( engine = create_engine(
'mysql+pymysql://cn_ainvest_db:cn_ainvest_sd3a1@rm-2zewagytttzk6f24xno.mysql.rds.aliyuncs.com:3306' 'mysql+pymysql://cn_ainvest_db:cn_ainvest_sd3a1@rm-2zewagytttzk6f24xno.mysql.rds.aliyuncs.com:3306'
@ -110,6 +110,22 @@ class ZXJTClientTrader:
set_proxy(proxy_ip, proxy_port) set_proxy(proxy_ip, proxy_port)
self.log.info('全局代理设置成功') self.log.info('全局代理设置成功')
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '中信建投',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
# 启动软件进程,输入账号密码 # 启动软件进程,输入账号密码
self._app = pywinauto.Application().start(self.path) self._app = pywinauto.Application().start(self.path)
time.sleep(0.5) time.sleep(0.5)
@ -129,20 +145,7 @@ class ZXJTClientTrader:
self._app.window(title_re='网上股票交易系统.*').wait("ready",timeout=30) self._app.window(title_re='网上股票交易系统.*').wait("ready",timeout=30)
# ip和mac入库
new_mac = set_mac.get_macinfos()
insert_data_df = pd.DataFrame([{'As_Of_Date': datetime.date.today(),
'Broker': '中信建投',
'Account_Number': self.account_name,
'Timestamp': datetime.datetime.now(),
'Proxy': True,
'IP_Type': '动态IP',
'Mac': new_mac,
'IP': proxy_ip,
'Port': proxy_port,
'Location': item['prov'] + ':' + item['city']}])
insert_data_df.to_sql('trade_proxyip', engine, schema='user_center', index=False, if_exists='append')
self.log.info(f'IP:{proxy_ip} MAC:{new_mac} 已入库')
#关闭弹窗 #关闭弹窗
self._close_prompt_windows() self._close_prompt_windows()