私たちが独自の株式や先物データのインターフェイスを設計する場合、必然的にいくつかのコードを使用する必要がありますが、今日はすべての投資家の役に立つことを願って、いくつかの一般的なコードを紹介します。
ご存知のとおり、先物取引は有価証券取引の方法の 1 つではありますが、取引モデルや取引条件の多くは株式取引とは大きく異なり、このため、株式先物データ インターフェースのプログラミングも株式取引とは異なります。取引インターフェイス まず、先物取引で一般的に使用されるコードのセットをいくつか紹介します。
#契約情報をクリック
pyautogui.click(x=969,y=51)
#情報のスクリーンショット
タイムスリープ(1)
#クリック決済ヘッジ
pyautogui.click(x=1343,y=151)
タイムスリープ(1)
pyautogui.screenshot(r'C:\Users\Administrator\Desktop\Futures Trading\Settlement Hedging.png',region=(553,293,1671-553,639-293))
オプション={'言語':'chn_eng'}
aipcor=AipOcr(app_id,api_key,secret_key)
image=open(r'C:\Users\Administrator\Desktop\Futures Trading\Settlement Hedging.png','rb')
image1=image.read()
text_list=aipcor.general(image1,options=オプション)
df1=pd.json_normalize(text_list['words_result'])
df1.to_excel(r'C:\Users\Administrator\Desktop\先物取引\決済ヘッジ.xlsx')
df=pd.read_excel(r'C:\Users\Administrator\Desktop\先物取引\決済ヘッジ.xlsx')
#抽出したデータをテーブルデータに加工します
df_words=df['単語'][10:]
日付=[]
価格=[]
buy_ratio_tj=[]
buy_ratio_trader=[]
販売比率_tj=[]
sell_ratio_trader=[]
range(0,len(df_words.tolist()),6) の i の場合:
date.append(df_words.tolist()[i])
価格.append(df_words.tolist()[i+1])
buy_ratio_tj.append(df_words.tolist()[i+2])
buy_ratio_trader.append(df_words.tolist()[i+3])
sell_ratio_tj.append(df_words.tolist()[i+4])
sell_ratio_trader.append(df_words.tolist()[i+5])
now_df=pd.DataFrame({'時刻':date,'決済価格':price,'買い投機比率':buy_ratio_tj,'買い取引比率':buy_ratio_trader,
'売り投資比率':sell_ratio_tj,'売り取引比率':sell_ratio_trader})
印刷(now_df)
now_df.to_excel(r'C:\Users\Administrator\Desktop\Futures Trading\Settlement Hedging.xlsx')
pyttsx3.speak('先物決済ヘッジデータの抽出に成功しました')
一般に、株式と先物のデータ インターフェイスは定量的な先物取引をより効果的に行うのに役立ちますが、この一連のツールを使用して収益を上げられるとは必ずしも意味しません。多くの場合、ツールがどれほど優れていても、人々の思考は変化しないと多くの成果を上げるのは難しい。