Skip to content

Instantly share code, notes, and snippets.

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

To whom it may concern,

It is my pleasure to recommend [Name of the person being recommended]. I had the privilege of working with [Name] at FinLab, a startup company specializing in quantitative investment. Through our professional relationship, I've come to deeply appreciate their expertise and dedication.

Academically, [Name]'s accomplishments speak volumes. [He/She] was honored as the SCC Global Overall Winner, a testament to [his/her] exceptional skills and capability. Moreover, [he/she] bagged the ICPC Taipei Hsinchu Station Bronze Award, which is a highly competitive and esteemed accolade. And as a Taiwan Representative Student at the GCC (Global Cybersecurity Camp), [Name] has showcased both [his/her] potential and prowess on an international platform.

Furthermore, [Name]'s internships at renowned institutions such as KKCompany (KKBox) and our shared workplace, FinLab at Jim Quant Capital, have provided [him/her] with invaluable practical experiences. These internships, coupled with [his/her] robus

const int maxi = CHAR_MAX;
/* int is a int */
/* multiple lines
of comments */
const int maxi = CHAR_MAX;
#pragma token off
int main() {
int a = 1;
from collections import defaultdict, deque
from shioaji import BidAskFOPv1, Exchange
import shioaji as sj
import datetime
import pandas as pd
import talib as ta
import time
from math import ceil
import pysimulation
# Copyright 2021 Optiver Asia Pacific Pty. Ltd.
#
# This file is part of Ready Trader Go.
#
# Ready Trader Go is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Ready Trader Go is distributed in the hope that it will be useful,