您的位置:首页 > 编程语言 > Python开发

python-pyautogui、pandas、subprocess等打开行情软件,获取数据,并保存到dataframe中

2017-02-25 11:19 537 查看
#打开软件
import pyautogui
import subprocess
import win32api
import time
import pandas as pd
import numpy as np
prs=subprocess.Popen(["C:/Program Files (x86)/绿金在线/绿金在线倚天行情交易客户端/isky.exe  "])
time.sleep(2)
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(856, 305)#登录
time.sleep(0.1)
pyautogui.click()
time.sleep(0.1)
pyautogui.moveTo(727, 39)#关闭报告
time.sleep(0.1)
pyautogui.click()
time.sleep(0.1)
pyautogui.moveTo(51, 38)#点击报价
time.sleep(0.1)
pyautogui.click()
time.sleep(0.1)
pyautogui.moveTo(166, 613)#绿金在线即期现货
time.sleep(0.1)
pyautogui.click()
time.sleep(0.1)
pyautogui.moveTo(119, 152)#双击枸杞
time.sleep(0.1)
pyautogui.doubleClick()
time.sleep(0.1)
pyautogui.moveTo(182, 39)#点击一分钟周期
time.sleep(0.1)
pyautogui.doubleClick()
time.sleep(0.1)
pyautogui.press('F2')
time.sleep(0.1)
pyautogui.moveTo(57, 107)#最上面1分钟明细
time.sleep(0.1)
pyautogui.doubleClick()
time.sleep(0.1)
pyautogui.keyDown('ctrlleft')
pyautogui.press('c')
time.sleep(0.1)
df=pd.DataFrame(columns=['time','date','open','high','low','close','vol','amount','open interest','net change','change percent','amplitude percent','open position','close position','direction'])
df
columns=['time','date','open','high','low','close','vol','amount','open interest','net change','change percent','amplitude percent','open position','close position','direction']
data=pd.read_clipboard(names=columns)
data
df=df.append(data,ignore_index=True)
df
###嘿嘿,满满的成就感,Python做自动化交易平台的框架已经完成了。可以获取数据,可以实现自动交易,接下来,就是要做交易逻辑的分析了,什么时候买,什么时候卖出
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息