Contractual transaction refers to the transaction between the buyer and the seller in an agreement that a certain amount of certain assets will be received at a specified price at a certain time in the future. The trading object of contract trading is the standardized contract uniformly formulated by the Exchange, which stipulates the standardized information such as the type of commodity, trading time and quantity. The contract represents the rights and obligations of both parties.
簡單點說就是現在約好未來某個時間地點交易一定數量的某種商品。合約交易是一種金融衍生品,相對于現貨市場的交易,使用者可以在期貨合約交易中通過判斷漲跌,選擇買入做多或賣出做空合約,來獲得價格上漲或者下跌帶來的收益。量化交易程式代碼如下:
import pandas as pd
from aip import AipOcr
import pyautogui
import pywinauto
import time
import ddddocr
import PIL
import akshare as ak
from PIL import Image,ImageDraw
import pyttsx3
from finta import TA
import quantstats as qs
import yagmail
import requests
from bs4 import BeautifulSoup
from lxml import etree
import schedule
import matplotlib.pyplot as plt
import mplfinance as mpf
app_id='252342421225'
api_key='grc71324214ewewlsl8zXo'
secret_key='ny8ClwdaLIDNaondoAINDOLH5jP9s6RbyG3'
#登入同花順期貨通
def featurns_log():
'''
登入同花順期貨通,手動啟動程式可以不用調用這個函數
識别驗證碼自動登入
'''
import time
pywinauto.application.Application(backend='uia').start(r'E:同花順期貨通binhapp.exe')
pyttsx3.speak('運用啟動成功')
#等待程式
time.sleep(1)
#最大化視窗
pyautogui.click(x=1379,y=18)
time.sleep(1)
#點選交易
pyautogui.click(x=941,y=17)
#選擇模拟交易
pyautogui.click(x=1065,y=53)
time.sleep(1)
pyautogui.click(x=1155,y=85)
#等待程式響應
time.sleep(3)
#驗證碼區域截圖
pyautogui.screenshot(imageFilename=r'C:UsersAdministratorDesktop期貨交易驗證碼.png',region=(1042,611,1099-1042,641-611))
#識别驗證碼