# -*- coding: utf-8 -*- import sys,haohaninfo from indicator import getFutureDailyInfo # 定義契約(需要輸入期交所查詢行情的商品名稱) WebProduct=sys.argv[1] # 定義交易商品 Product=sys.argv[2] # 定義券商 Broker='Simulator' # 取得期貨行情資料 DailyInfo=getFutureDailyInfo(WebProduct,1)[0] DailyTime,DailyHigh,DailyLow,DailyClose=DailyInfo[0],float(DailyInfo[4]),float(DailyInfo[5]),float(DailyInfo[6]) # 計算 CDP CDP=(DailyHigh+DailyLow+DailyClose)/3 AH=CDP+DailyHigh-DailyLow NH=2*CDP-DailyLow NL=2*CDP-DailyHigh AL=CDP-DailyHigh+DailyLow print('NH',NH,'NL',NL) # 訂閱報價 GO = haohaninfo.GOrder.GOQuote() for row in GO.Subscribe( Broker, 'match', Product ): # 取得價格欄位 Price=float(row[2]) # 突破壓力支撐價位 if Price > NH: print('當前價',Price,'突破壓力價位',NH,',代表可能反轉或有趨勢發生')
# -*- coding: utf-8 -*- import sys from indicator import getFutureDailyInfo # 定義契約、取得日期 product = sys.argv[1] info_num = int(sys.argv[2]) print(getFutureDailyInfo(product, info_num))
# -*- coding: utf-8 -*- import sys from indicator import getFutureDailyInfo, getFutureContractInfo # 取得最前一日的行情資料 LastDailyInfo = getFutureDailyInfo('MTX', 1) OnOpenInterest = sum([int(i[13]) for i in LastDailyInfo]) # 取得最前三日的法人資料 LastContractInfo = getFutureContractInfo('MXF', 1) LegalBuyOnOpenInterest = sum([int(i[8]) for i in LastContractInfo]) LegalSellOnOpenInterest = sum([int(i[10]) for i in LastContractInfo]) # 計算散戶的多空剩餘留倉部位 IndividualBuy = OnOpenInterest - LegalBuyOnOpenInterest IndividualSell = OnOpenInterest - LegalSellOnOpenInterest # 將散戶的多空剩餘留倉部位相除,取得散戶多空比例 IndividualRatio = IndividualBuy / IndividualSell # 若散戶留多單則市場趨勢看跌 if IndividualRatio > 1: print('散戶看多,市場看跌') # 若散戶留空單則市場趨勢看漲 elif IndividualRatio < 1: print('散戶看多,市場看跌')
# -*- coding: utf-8 -*- import sys from indicator import getFutureDailyInfo # 定義契約、取得日期 product = sys.argv[1] info_num = 1 # 取得期貨行情資料 DailyInfo = getFutureDailyInfo(product, 1)[0] DailyTime = DailyInfo[0] DailyHigh = float(DailyInfo[4]) DailyLow = float(DailyInfo[5]) DailyClose = float(DailyInfo[6]) # 計算 Pivot Point PP = (DailyHigh + DailyLow + DailyClose) / 3 R3 = DailyHigh + (2 * (PP - DailyLow)) R2 = PP + DailyHigh - DailyLow R1 = (PP * 2) - DailyLow S1 = (PP * 2) - DailyHigh S2 = PP - DailyHigh + DailyLow S3 = DailyLow + (2 * (DailyHigh - PP)) print(DailyTime, 'R3', R3, 'R2', R2, 'R1', R1,