Skip to content

Instantly share code, notes, and snippets.

@lawrence910426
lawrence910426 / terminal-output.txt
Created January 28, 2026 03:57
收不到期貨的封包 T_T
lawrence910426@xi-jin-ping:~$ sudo smcroutectl -d show groups
Group Memberships Table
GROUP (S,G) IIF
(*, 224.0.100.100) enp1s0f0np0
(*, 224.0.30.30) enp1s0f0np0
(*, 224.2.100.100) enp1s0f0np0
(*, 224.2.30.30) enp1s0f0np0
(*, 224.4.100.100) enp1s0f0np0
(*, 224.4.30.30) enp1s0f0np0
lawrence910426@xi-jin-ping:~/tests$ cat stdout.log
[UFC] Build date:Jan 17 2024
[UFC] gcc version: 4.4.7 20120313 (Red Hat 4.4.7-11)
[UFCLib] Default Trading Hours[05:50]~[05:15]
[UFCLib] Time zone:8
[UFCLib] Log use us:FALSE
[UFCLib] Log Thread:FALSE
[UFCLib] Line shell:./cloud_monitor.sh
[UFCLib] Line group:1
[UFCLib] Working Dir:/home/lawrence910426/tests
lawrence910426@xi-jin-ping:~/tests$ cat test_query_close.log o
15:47:11.564518 Thread 133943075866432 tid 19020 N3UFC12CachedBufferE start, stack size=135296
15:47:11.564537 Get IPC key[0x2f000022] from file[/tmp/UFC/shm/SpeedyOrderConnection_FRecoverBeginTime_SpeedyAPIClient_28031564465] proj[47] inode[786466].
15:47:11.564542 Attach shm[SpeedyOrderConnection.FRecoverBeginTime.SpeedyAPIClient.28031564465] ID[0x2f000022]
15:47:11.564624 Strictly[1] TradeDate[20260121] NextDate[20260122] (get default with system date)
15:47:11.564628 ------------------------------------------------------------
15:47:11.564739 Thread 133943075723072 tid 19021 SpeedyAPIClient.28031564465 start, stack size=135296
15:47:11.564760 Thread 133943075579712 tid 19022 10TThreadApp start, stack size=135296
15:47:11.564771 [SpeedyAPIClient.28031564465] Message queue size = 102400
15:47:11.564973 Open log file [../logs/SpeedyAPIClient.20260121.log] failed.
@lawrence910426
lawrence910426 / bug.md
Created January 19, 2026 02:02
未提供 `QueryFuncTable.ini` 檔案

Describe the bug

我在查詢平倉時,遇到

OnRspQuery: QueryID[1040401] Result[Y-1Not support query service because QueryFuncTable.ini is not found.] 18:03:42.231295 OnRspQuery QueryID[1040401] Content[Not support query service because QueryFuncTable.ini is not found.]

的錯誤訊息,但是 repo 本身沒有提供 QueryFuncTable.ini 檔案

來源是呼叫 TTaifexConnection.h 中的 TTaifexConncetion::ReqQuery

import time
import logging
import math
import os
import contextlib
import concurrent
import threading
import re
from types import SimpleNamespace
# TODO: FinLab lending fee information
def roc_to_ad(roc_date: str) -> str:
"""Convert ROC date (e.g. 114/07/01) to AD string (e.g. 2025/07/01)."""
parts = roc_date.split("/")
year = int(parts[0]) + 1911
return f"{year}/{parts[1]}/{parts[2]}"
def get_otc_intraday_lending_info(date: str) -> pd.DataFrame:
url = "https://www.tpex.org.tw/www/zh-tw/intraday/fee"
data = {"date": date.replace("-", "/"), "id": "", "response": "json"}
@lawrence910426
lawrence910426 / crawler.py
Created September 4, 2025 08:35
Crawler for lending information
import requests, json
def get_otc_intraday_lending_info(date: str) -> pd.DataFrame:
url = "https://www.tpex.org.tw/www/zh-tw/intraday/fee"
data = {"date": date.replace("-", "/"), "id": "", "response": "json"}
headers = {"User-Agent": "Mozilla/5.0", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}
r = requests.post(url, data=data, headers=headers, timeout=15)
r.raise_for_status()
resp = r.json() if r.headers.get("content-type","").startswith("application/json") else json.loads(r.text)
import time
import logging
import math
import os
import contextlib
import concurrent
import math
from decimal import *
import sys
class Record:
"""Represents a financial record with a category, description, and amount."""
def __init__(self, category, description, amount):
self._category = category
self._description = description
self._amount = float(amount)
@property

To whom it may concern,

I am writing to highly recommend [Your Name] with whom I had the pleasure to work at FinLab, a pioneering startup dedicated to quantitative investment. Through our professional association, I have had ample opportunities to observe and appreciate the exemplary skill and ambition [Your Name] demonstrates in the field of quantitative analysis and financial technology.

[Your Name] has a remarkable academic background, evidenced by a plethora of accolades. Notably, [he/she] emerged as the SCC Global Overall Winner, a testimony to [his/her] intellectual prowess and a thorough understanding of complex computer architectures. Furthermore, the ICPC Taipei Hsinchu Station Bronze Award that [he/she] bagged, along with securing a position among the top 50 in the highly competitive Optiver Ready Trader Go Competition among a thousand contestants, speaks volumes about [his/her] aptitude and tenacity in tackling real-world challenges.

During [his/her] tenure at Jim Quant Capital and later at FinL