
Using asyncio and WebSocket to Retrieve and Record Binance K-Line Market Data
As we know, Binance offers two methods to obtain K-line data: REST API and WebSocket. Among these, WebSocket is the preferred method recommended by Binance for obtaining real-time data. This guide will show you how to use Python asyncio to subscribe to Binance K-line data via WebSocket, and asynchronously record Binance K-line market data as Pandas DataFrame in Parquet format.Connecting to Binance Market Data WebSocketTo get market data via WebSocket, we first need to implement a robust WebSo...

Notes: How the Economic Machine Works
This article summarizes Ray Dalio’s video How The Economic Machine Works The economy operates like a simple machine, yet many people are unaware or disagree with this perspective, leading to unnecessary economic losses. Here is an analysis framework that may not perfectly align with traditional economics but is highly useful:The economy appears complex but functions in a straightforward and mechanical way.It is composed of a few simple parts and countless simple transactions, driven by human ...
Quant Trader / HODLER

Using asyncio and WebSocket to Retrieve and Record Binance K-Line Market Data
As we know, Binance offers two methods to obtain K-line data: REST API and WebSocket. Among these, WebSocket is the preferred method recommended by Binance for obtaining real-time data. This guide will show you how to use Python asyncio to subscribe to Binance K-line data via WebSocket, and asynchronously record Binance K-line market data as Pandas DataFrame in Parquet format.Connecting to Binance Market Data WebSocketTo get market data via WebSocket, we first need to implement a robust WebSo...

Notes: How the Economic Machine Works
This article summarizes Ray Dalio’s video How The Economic Machine Works The economy operates like a simple machine, yet many people are unaware or disagree with this perspective, leading to unnecessary economic losses. Here is an analysis framework that may not perfectly align with traditional economics but is highly useful:The economy appears complex but functions in a straightforward and mechanical way.It is composed of a few simple parts and countless simple transactions, driven by human ...
Quant Trader / HODLER

Subscribe to lostleaf.eth

Subscribe to lostleaf.eth
<100 subscribers
<100 subscribers
Share Dialog
Share Dialog


I've been using iTerm2 for years, but recently switched to Ghostty — and I'm not going back.
The nudge came from zhangchitc, who shared a polished Ghostty config along with a relevant data point: Boris, the lead on Claude Code, has said his team's go-to terminal is Ghostty — running five instances in parallel. If the people building Claude Code are running it in Ghostty, that's a reasonable signal worth paying attention to.
zhangchitc open-sourced his config, I ran it for a few days, adjusted it to fit my workflow, and here's where I landed.
zhangchitc's config is already well thought-out — the changes I made are purely personal preference:
Font: Maple Mono NF CN → Monaco Nerd Font Mono — just find Monaco easier on the eyes for code
Theme: Catppuccin Mocha → Selenized Black — pure black background, high contrast, easier to read logs for long stretches
No background transparency: zhangchitc uses background-opacity = 0.85 for a frosted-glass look, which is nice, but I prefer a solid background for reading focus
Cursor: non-blinking block cursor (block + blink = false), with shell-integration-features = no-cursor to prevent shell integration from overriding it
Removed Ghostty's native splits: my workflow puts different SSH connections in separate Ghostty tabs, with tmux handling splits on the remote side — so the cmd+d split keybinds are gone
No window state persistence: dropped window-save-state = always, so each launch starts clean
Net result: pure black background, solid block cursor, no transparency, no native splits — as minimal as a terminal gets.
The terminal is one of those tools you use every day but rarely optimize. A few areas where Ghostty genuinely helps:
GPU rendering: when backtests are dumping large volumes of log output, iTerm2 can stutter. Ghostty renders on the GPU — scrolling through dense output stays smooth
Quick Terminal: global hotkey Ctrl+` drops a terminal down from the top of the screen from any app. Great for a quick script or a fast git push without switching context
Claude Code workflow: one tab running Claude Code, another SSH'd into a server tailing live logs, Quick Terminal for one-off commands — tab switching is fast and all tabs share a consistent color scheme
tmux on the remote: remote servers use tmux for multi-pane process management (data feeds, strategy processes, monitoring). Ghostty handles local tabs and connections; tmux handles remote layout. They don't step on each other.
On macOS: brew install --cask ghostty. Config goes in ~/.config/ghostty/config.
One macOS gotcha (possibly a bug): the system config at ~/Library/Application Support/com.mitchellh.ghostty/config may contain a line like theme = TokyoNight Night. If it does, comment it out — otherwise it overrides your theme setting in ~/.config/ghostty/config, locking you into TokyoNight Night regardless of what you set.
My config:
# ============================================
# Ghostty Terminal - My Config
# ============================================
# Location: ~/.config/ghostty/config
# Hot reload: Cmd+Shift+,
#
# Reference: config shared by zhangchitc
# https://gist.github.com/zhangchitc/7dead7c1b517390e061e07759ed80277
#
# Based on the reference config, adjusted to personal preferences:
# - Font: switched to Monaco Nerd Font Mono
# - Theme: switched to Selenized Black
# - Transparency: no background transparency, solid color for focused reading
# - Split keybinds: removed Ghostty native splits
# different SSH connections separated by Ghostty tabs, remote splits handled by tmux
# - Quick Terminal: enabled, globally summon with Ctrl+` anytime, supplements regular terminal windows
# - Window state: not saved
# --- Font & Typography ---
font-family = "Monaco Nerd Font Mono"
font-size = 14
# --- Theme ---
theme = "Selenized Black"
# Increase ANSI faint/dim text opacity to prevent it from being too light on the Selenized Black theme
faint-opacity = 0.8
# --- Window Appearance ---
# No transparency, solid background
window-padding-x = 10
window-padding-y = 8
# --- Cursor ---
# Non-blinking block cursor
cursor-style = block
cursor-style-blink = false
shell-integration-features = no-cursor
# --- Mouse ---
# Hide mouse pointer while typing
mouse-hide-while-typing = true
# Selection is copied directly to system clipboard
copy-on-select = clipboard
# --- Quick Terminal (global dropdown terminal) ---
# Global hotkey Ctrl+` to summon/dismiss from the top of the screen
# Can be triggered from any app, useful for quick commands and git operations
quick-terminal-position = top
# Appears on the screen where the mouse is (multi-monitor friendly)
quick-terminal-screen = mouse
# Auto-hide when clicking another window
quick-terminal-autohide = true
quick-terminal-animation-duration = 0.15
# --- Security ---
# Prevent malicious content from injecting commands via clipboard
clipboard-paste-protection = true
clipboard-paste-bracketed-safe = true
# --- Shell Integration ---
# Auto-detect zsh/bash/fish and inject integration scripts
shell-integration = detect
# --- Performance ---
# ~25MB scrollback buffer
scrollback-limit = 25000000
# --- Keybinds ---
# Tabs (use case: different SSH connections in separate tabs)
keybind = cmd+t=new_tab
keybind = cmd+shift+left=previous_tab
keybind = cmd+shift+right=next_tab
keybind = cmd+w=close_surface
# Quick Terminal global hotkey
keybind = global:ctrl+grave_accent=toggle_quick_terminal
# Font size
keybind = cmd+plus=increase_font_size:1
keybind = cmd+minus=decrease_font_size:1
keybind = cmd+zero=reset_font_size
# Hot reload config file (no restart needed after config changes)
keybind = cmd+shift+comma=reload_config
zhangchitc's original config:
I've been using iTerm2 for years, but recently switched to Ghostty — and I'm not going back.
The nudge came from zhangchitc, who shared a polished Ghostty config along with a relevant data point: Boris, the lead on Claude Code, has said his team's go-to terminal is Ghostty — running five instances in parallel. If the people building Claude Code are running it in Ghostty, that's a reasonable signal worth paying attention to.
zhangchitc open-sourced his config, I ran it for a few days, adjusted it to fit my workflow, and here's where I landed.
zhangchitc's config is already well thought-out — the changes I made are purely personal preference:
Font: Maple Mono NF CN → Monaco Nerd Font Mono — just find Monaco easier on the eyes for code
Theme: Catppuccin Mocha → Selenized Black — pure black background, high contrast, easier to read logs for long stretches
No background transparency: zhangchitc uses background-opacity = 0.85 for a frosted-glass look, which is nice, but I prefer a solid background for reading focus
Cursor: non-blinking block cursor (block + blink = false), with shell-integration-features = no-cursor to prevent shell integration from overriding it
Removed Ghostty's native splits: my workflow puts different SSH connections in separate Ghostty tabs, with tmux handling splits on the remote side — so the cmd+d split keybinds are gone
No window state persistence: dropped window-save-state = always, so each launch starts clean
Net result: pure black background, solid block cursor, no transparency, no native splits — as minimal as a terminal gets.
The terminal is one of those tools you use every day but rarely optimize. A few areas where Ghostty genuinely helps:
GPU rendering: when backtests are dumping large volumes of log output, iTerm2 can stutter. Ghostty renders on the GPU — scrolling through dense output stays smooth
Quick Terminal: global hotkey Ctrl+` drops a terminal down from the top of the screen from any app. Great for a quick script or a fast git push without switching context
Claude Code workflow: one tab running Claude Code, another SSH'd into a server tailing live logs, Quick Terminal for one-off commands — tab switching is fast and all tabs share a consistent color scheme
tmux on the remote: remote servers use tmux for multi-pane process management (data feeds, strategy processes, monitoring). Ghostty handles local tabs and connections; tmux handles remote layout. They don't step on each other.
On macOS: brew install --cask ghostty. Config goes in ~/.config/ghostty/config.
One macOS gotcha (possibly a bug): the system config at ~/Library/Application Support/com.mitchellh.ghostty/config may contain a line like theme = TokyoNight Night. If it does, comment it out — otherwise it overrides your theme setting in ~/.config/ghostty/config, locking you into TokyoNight Night regardless of what you set.
My config:
# ============================================
# Ghostty Terminal - My Config
# ============================================
# Location: ~/.config/ghostty/config
# Hot reload: Cmd+Shift+,
#
# Reference: config shared by zhangchitc
# https://gist.github.com/zhangchitc/7dead7c1b517390e061e07759ed80277
#
# Based on the reference config, adjusted to personal preferences:
# - Font: switched to Monaco Nerd Font Mono
# - Theme: switched to Selenized Black
# - Transparency: no background transparency, solid color for focused reading
# - Split keybinds: removed Ghostty native splits
# different SSH connections separated by Ghostty tabs, remote splits handled by tmux
# - Quick Terminal: enabled, globally summon with Ctrl+` anytime, supplements regular terminal windows
# - Window state: not saved
# --- Font & Typography ---
font-family = "Monaco Nerd Font Mono"
font-size = 14
# --- Theme ---
theme = "Selenized Black"
# Increase ANSI faint/dim text opacity to prevent it from being too light on the Selenized Black theme
faint-opacity = 0.8
# --- Window Appearance ---
# No transparency, solid background
window-padding-x = 10
window-padding-y = 8
# --- Cursor ---
# Non-blinking block cursor
cursor-style = block
cursor-style-blink = false
shell-integration-features = no-cursor
# --- Mouse ---
# Hide mouse pointer while typing
mouse-hide-while-typing = true
# Selection is copied directly to system clipboard
copy-on-select = clipboard
# --- Quick Terminal (global dropdown terminal) ---
# Global hotkey Ctrl+` to summon/dismiss from the top of the screen
# Can be triggered from any app, useful for quick commands and git operations
quick-terminal-position = top
# Appears on the screen where the mouse is (multi-monitor friendly)
quick-terminal-screen = mouse
# Auto-hide when clicking another window
quick-terminal-autohide = true
quick-terminal-animation-duration = 0.15
# --- Security ---
# Prevent malicious content from injecting commands via clipboard
clipboard-paste-protection = true
clipboard-paste-bracketed-safe = true
# --- Shell Integration ---
# Auto-detect zsh/bash/fish and inject integration scripts
shell-integration = detect
# --- Performance ---
# ~25MB scrollback buffer
scrollback-limit = 25000000
# --- Keybinds ---
# Tabs (use case: different SSH connections in separate tabs)
keybind = cmd+t=new_tab
keybind = cmd+shift+left=previous_tab
keybind = cmd+shift+right=next_tab
keybind = cmd+w=close_surface
# Quick Terminal global hotkey
keybind = global:ctrl+grave_accent=toggle_quick_terminal
# Font size
keybind = cmd+plus=increase_font_size:1
keybind = cmd+minus=decrease_font_size:1
keybind = cmd+zero=reset_font_size
# Hot reload config file (no restart needed after config changes)
keybind = cmd+shift+comma=reload_config
zhangchitc's original config:
No activity yet