Skip to content

Instantly share code, notes, and snippets.

@Leon2xiaowu
Leon2xiaowu / HkStock2RmbPrice.py
Last active March 12, 2026 01:38
自动更新港股通(深交所)的买入结算汇兑比率到Beancount
#!/usr/bin/env python3
import requests
import os
import random
def fetch_exchange_rate():
random_number = random.random()
# 获取深交所结算汇兑比率
@Leon2xiaowu
Leon2xiaowu / Fava Dashboards Sunburst Support SubClass.yaml
Last active February 23, 2025 10:03
Fava Dashboards Sunburst Support SubClass
dashboards:
- name: Assets
panels:
- title: Asset Classes 🏦
width: 50%
queries:
- bql: &assets_bql |
SELECT currency, CONVERT(SUM(position), '{{ledger.ccy}}') as market_value
WHERE account_sortkey(account) ~ '^[01]'
@Leon2xiaowu
Leon2xiaowu / dashboards.yaml
Last active November 19, 2024 14:32
fava_dashboards Sankey diagram configuration optimization, handle the display of losing investments
- name: IncomeStatementSankey
panels:
- title: IncomeStatementSankey 💸
height: 800px
link: /mainbook/income_statement/
queries:
- bql: |
SELECT account, CONVERT(SUM(position), '{{ledger.ccy}}') AS value
WHERE account ~ '^(Income|Expenses):'
GROUP BY account