開發中程式碼: https://github.com/exsky/HighRiskTrader/blob/master/quote/mtxmonitor.py
日曆 很重要,暗示你要上線,多數的大行情,都反映在重要數值公告的那幾秒鐘!
點位提醒 也很重要,在整數關卡、支撐壓力關卡都應該出來看一下哪邊比較強,要不要上車或跳車!
小台的價格變化幅度十分靈活,拿來觀察看看!
from fugle_marketdata import WebSocketClient
def handle_message(message):
print(message)
def main():
client = WebSocketClient(api_key='YOUR_API_KEY')
futopt = client.futopt
futopt.on('message', handle_message)
futopt.connect()
futopt.subscribe({
'channel': 'trades',
'symbol': 'TXFG4',
'afterHours': True
})
if __name__ == '__main__':
main()
handle_message
是一段 print 訊息的 callback functionmain
function 裡面,由 WebSocketClient 產生的實例,去建立 WebSocketsymbol
要怎麼取得? -> 論「何謂小台指近全」?
內容太多了
{'type': 'FUTURE', 'exchange': 'TAIFEX', 'session': 'AFTERHOURS', 'contractType': 'I', 'data': [{'symbol': 'EXFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨035', 'referencePrice': 1184.75, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}, {'symbol': 'EXFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨065', 'referencePrice': 1184.75, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}, {'symbol': 'EXFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨095', 'referencePrice': 1169.75, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'EXFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨104', 'referencePrice': 1188.75, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}, {'symbol': 'EXFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨114', 'referencePrice': 1189.45, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'EXFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '電子期貨124', 'referencePrice': 1184.75, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}, {'symbol': 'F1FC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-21', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '英國富時100期貨035', 'referencePrice': 8384, 'settlementDate': '2025-03-24', 'startDate': '2024-03-18'}, {'symbol': 'F1FF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '英國富時100期貨065', 'referencePrice': 8435, 'settlementDate': '2025-06-23', 'startDate': '2024-06-24'}, {'symbol': 'F1FI4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-20', 'flowGroup': 13, 'isDynamicBanding': True, 'name': '英國富時100期貨094', 'referencePrice': 8334, 'settlementDate': '2024-09-23', 'startDate': '2023-09-18'}, {'symbol': 'F1FL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '英國富時100期貨124', 'referencePrice': 8345, 'settlementDate': '2024-12-23', 'startDate': '2023-12-18'}, {'symbol': 'MX1J4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-02', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指W1104', 'referencePrice': 22191, 'settlementDate': '2024-10-02', 'startDate': '2024-09-18'}, {'symbol': 'MX4I4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-25', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指W4094', 'referencePrice': 22192, 'settlementDate': '2024-09-25', 'startDate': '2024-09-11'}, {'symbol': 'MXFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指035', 'referencePrice': 22213, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}, {'symbol': 'MXFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指065', 'referencePrice': 22229, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}, {'symbol': 'MXFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指095', 'referencePrice': 21985, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'MXFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指104', 'referencePrice': 22216, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}, {'symbol': 'MXFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指114', 'referencePrice': 22225, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'MXFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指124', 'referencePrice': 22224, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}, {'symbol': 'SOFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨035', 'referencePrice': 5677, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}, {'symbol': 'SOFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨065', 'referencePrice': 5720, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}, {'symbol': 'SOFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨095', 'referencePrice': 5713, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'SOFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨104', 'referencePrice': 5819, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}, {'symbol': 'SOFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨114', 'referencePrice': 5817, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'SOFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '半導體30期貨124', 'referencePrice': 5539, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}, {'symbol': 'SPFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-21', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國標普500期貨035', 'referencePrice': 5815, 'settlementDate': '2025-03-24', 'startDate': '2023-12-18'}, {'symbol': 'SPFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國標普500期貨065', 'referencePrice': 5850, 'settlementDate': '2025-06-23', 'startDate': '2024-03-18'}, {'symbol': 'SPFI4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-20', 'flowGroup': 14, 'isDynamicBanding': True, 'name': '美國標普500期貨094', 'referencePrice': 5710, 'settlementDate': '2024-09-23', 'startDate': '2023-06-19'}, {'symbol': 'SPFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國標普500期貨095', 'referencePrice': 5885, 'settlementDate': '2025-09-22', 'startDate': '2024-06-24'}, {'symbol': 'SPFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國標普500期貨124', 'referencePrice': 5773.5, 'settlementDate': '2024-12-23', 'startDate': '2023-09-18'}, {'symbol': 'SXFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-21', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國費城半導體期貨035', 'referencePrice': 5114.5, 'settlementDate': '2025-03-24', 'startDate': '2024-03-18'}, {'symbol': 'SXFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國費城半導體期貨065', 'referencePrice': 5191, 'settlementDate': '2025-06-23', 'startDate': '2024-06-24'}, {'symbol': 'SXFI4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-20', 'flowGroup': 14, 'isDynamicBanding': True, 'name': '美國費城半導體期貨094', 'referencePrice': 5060, 'settlementDate': '2024-09-23', 'startDate': '2023-12-18'}, {'symbol': 'SXFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國費城半導體期貨124', 'referencePrice': 5106, 'settlementDate': '2024-12-23', 'startDate': '2023-12-18'}, {'symbol': 'TMFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨035', 'referencePrice': 22213, 'settlementDate': '2025-03-19', 'startDate': '2024-07-29'}, {'symbol': 'TMFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨065', 'referencePrice': 22229, 'settlementDate': '2025-06-18', 'startDate': '2024-07-29'}, {'symbol': 'TMFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨095', 'referencePrice': 21985, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'TMFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨104', 'referencePrice': 22216, 'settlementDate': '2024-10-16', 'startDate': '2024-07-29'}, {'symbol': 'TMFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨114', 'referencePrice': 22225, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'TMFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '微型臺指期貨124', 'referencePrice': 22224, 'settlementDate': '2024-12-18', 'startDate': '2024-07-29'}, {'symbol': 'TXFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨035', 'referencePrice': 22213, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}, {'symbol': 'TXFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨065', 'referencePrice': 22229, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}, {'symbol': 'TXFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨095', 'referencePrice': 21985, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'TXFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨104', 'referencePrice': 22216, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}, {'symbol': 'TXFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨114', 'referencePrice': 22225, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'TXFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '臺股期貨124', 'referencePrice': 22224, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}, {'symbol': 'UDFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-21', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國道瓊期貨035', 'referencePrice': 42816, 'settlementDate': '2025-03-24', 'startDate': '2024-03-18'}, {'symbol': 'UDFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國道瓊期貨065', 'referencePrice': 43112, 'settlementDate': '2025-06-23', 'startDate': '2024-06-24'}, {'symbol': 'UDFI4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-20', 'flowGroup': 14, 'isDynamicBanding': True, 'name': '美國道瓊期貨094', 'referencePrice': 42028, 'settlementDate': '2024-09-23', 'startDate': '2023-09-18'}, {'symbol': 'UDFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國道瓊期貨124', 'referencePrice': 42420, 'settlementDate': '2024-12-23', 'startDate': '2023-12-18'}, {'symbol': 'UNFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-21', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國那斯達克100期貨035', 'referencePrice': 20230, 'settlementDate': '2025-03-24', 'startDate': '2023-12-18'}, {'symbol': 'UNFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國那斯達克100期貨065', 'referencePrice': 20434, 'settlementDate': '2025-06-23', 'startDate': '2024-03-18'}, {'symbol': 'UNFI4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-20', 'flowGroup': 14, 'isDynamicBanding': True, 'name': '美國那斯達克100期貨094', 'referencePrice': 19809, 'settlementDate': '2024-09-23', 'startDate': '2023-06-19'}, {'symbol': 'UNFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國那斯達克100期貨095', 'referencePrice': 20618, 'settlementDate': '2025-09-22', 'startDate': '2024-06-24'}, {'symbol': 'UNFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '美國那斯達克100期貨124', 'referencePrice': 20095, 'settlementDate': '2024-12-23', 'startDate': '2023-09-18'}, {'symbol': 'ZEFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨035', 'referencePrice': 1184.75, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}, {'symbol': 'ZEFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨065', 'referencePrice': 1184.75, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}, {'symbol': 'ZEFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨095', 'referencePrice': 1169.75, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}, {'symbol': 'ZEFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨104', 'referencePrice': 1188.75, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}, {'symbol': 'ZEFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨114', 'referencePrice': 1189.45, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}, {'symbol': 'ZEFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型電子期貨124', 'referencePrice': 1184.75, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}]}
篩選一下內容
for tk in tks['data']:
if '小型臺指' in tk['name']:
print(tk)
{'symbol': 'MX1J4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-02', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指W1104', 'referencePrice': 22191, 'settlementDate': '2024-10-02', 'startDate': '2024-09-18'}
{'symbol': 'MX4I4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-09-25', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指W4094', 'referencePrice': 22192, 'settlementDate': '2024-09-25', 'startDate': '2024-09-11'}
{'symbol': 'MXFC5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-03-19', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指035', 'referencePrice': 22213, 'settlementDate': '2025-03-19', 'startDate': '2024-03-21'}
{'symbol': 'MXFF5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-06-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指065', 'referencePrice': 22229, 'settlementDate': '2025-06-18', 'startDate': '2024-06-20'}
{'symbol': 'MXFI5', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2025-09-17', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指095', 'referencePrice': 21985, 'settlementDate': '2025-09-17', 'startDate': '2024-09-19'}
{'symbol': 'MXFJ4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-10-16', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指104', 'referencePrice': 22216, 'settlementDate': '2024-10-16', 'startDate': '2024-07-18'}
{'symbol': 'MXFK4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-11-20', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指114', 'referencePrice': 22225, 'settlementDate': '2024-11-20', 'startDate': '2024-08-22'}
{'symbol': 'MXFL4', 'type': 'FUTURE_AH', 'contractType': 'I', 'endDate': '2024-12-18', 'flowGroup': 10, 'isDynamicBanding': True, 'name': '小型臺指124', 'referencePrice': 22224, 'settlementDate': '2024-12-18', 'startDate': '2023-12-21'}
09/15 (週日休市)
09/16 中石化 +352
09/16 新復興 +4,946
09/17 (中秋節休市)
09/18 彩晶 -87
09/18 華星光 +1,079
09/18 名軒 +142
09/19 (掛單未成交)
09/20 選擇權交易 +16,459 / 之前為了湊交易數買的某某股票還在虧損賣不出
累積資產: 32,791