Nodes/ComfyUI_Baikong_Buying/BK Housing Decision
ComfyUI Node

BK Housing Decision

Should you actually buy that house? This node simulates your finances month by month

By JayLyu·Created 2 years ago·Updated about a year ago· 4
BK Housing Decision
    • 趋势图
    • 结论
    初始资金池1000000
    房价2500000
    首付比例0.30
    交房等待月份24
    房贷年限20
    公积金贷款额度600000
    公积金贷款利率0.0285
    商业贷款利率0.0290
    未来是否卖出房产true
    卖出月份84
    房产增值率0.20
    月开销5000
    租房费用5000
    月收入15000
    工资年涨幅0.05
    公积金5000
    年终奖50000
    剩余工作年限3
    年化收益率0.02
    通货膨胀率0.005
    地区房价指数1.00
    地区首付比例要求0.15
    地区月供收入比上限50.0
    地区房价增长预期0.05
    地区失业率0.05
    地区经济增长预期0.03

    This is the node people install ComfyUI_Baikong_Buying for. BK Housing Decision doesn't touch a single pixel - it's a financial simulator that runs your household's income, mortgage, and savings month by month, for years into the future, and tells you whether buying beats renting-and-investing. In ComfyUI. Which is either the cleverest or the most unhinged use of a node graph you'll see this month, depending on your tolerance for 26 Chinese-named input widgets.

    The pack is by JayLyu (GitHub alias "baikong"), it's built around China's homebuying mechanics - 公积金 (housing provident fund), 首付 (down payment), 等额本息 (equal principal-and-interest mortgages) - and this node is its heart.

    How it actually works

    Behind the widgets is a month-by-month loop over (剩余工作年限 + post-work years) × 12 months - the author assumes you earn for 剩余工作年限 more years, then hit an "unemployment point" (失业时点) where income stops and expenses drop to 60%. While working: your salary and provident fund grow at 工资年涨幅 yearly, expenses inflate at 通货膨胀率, and a year-end bonus lands every December. The fund pool earns 年化收益率/12 in interest each month.

    On the property side it computes the down payment (房价 × 首付比例), splits the loan into a provident-fund portion (capped at min(公积金贷款额度, 房价 − 首付)) plus a commercial loan, and calculates the monthly payment with the standard amortization formula. You pay rent until 交房等待月份 (delivery), and if 未来是否卖出房产 is on, you sell at 交房等待月份 + 卖出月份 for 房价 × (1 + 房产增值率) and pay off the balance.

    The smart part: it runs the same cash through a parallel "no-buy" fund pool - rent forever, invest the would-be down payment instead - so the final comparison isn't a vibe check, it's two numbers side by side. It also tracks your minimum pool balance (cashflow risk) and your worst post-unemployment monthly surplus.

    The inputs that matter

    All 26 are required-with-defaults, but a beginner really needs these:

    • 初始资金池 / 月收入 / 月开销 / 剩余工作年限 - your starting cash and current cashflow, and how many more years you'll earn. This last one drives the whole unemployment sub-scenario; set it to your actual horizon or the advice lines about unemployment are meaningless.
    • 房价 / 首付比例 / 房贷年限 - the property and the loan term.
    • 未来是否卖出房产 + 卖出月份 + 房产增值率 - flip the toggle off to model holding forever, or set how and when you'd exit.
    • 地区月供收入比上限 - your region's debt-to-income cap as a percentage (50 = 50%); the node compares your computed 月供收入比 against it.

    Everything monetary is in yuan, rates and ratios are decimals (0.05 = 5%), and the whole UI is Chinese.

    What you get out

    Two outputs: 趋势图 (IMAGE) and 结论 (STRING). The chart is a two-panel seaborn figure - top panel plots your buying fund pool, the no-buy pool, and the mortgage balance over time with red/green/magenta vertical lines at the unemployment, delivery, and sale points; bottom panel plots monthly income vs. spending. The conclusion is a Chinese report: 房价收入比, down-payment %, 月供收入比, the buy-vs-no-buy final pool difference in 万元, then nine numbered recommendations covering price pressure, unemployment risk, cashflow warnings, and sale profit.

    The honest take

    This is a deterministic what-if calculator, not a prophecy. The output swings hard on two assumptions - 房产增值率 and 地区房价增长预期 - which nobody can actually know in advance. Use it to stress-test scenarios (what if the region cools? what if I lose my job at month 36?), not to pick a house. Think of the chart as the payoff: watching the two pools diverge is genuinely the clearest way this tool tells its story.

    Installing

    Same pack, same one-time install - ComfyUI Manager, search "ComfyUI_Baikong_Buying", restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JayLyu/ComfyUI_Baikong_Buying
    

    Dependencies are torch, pandas, numpy, matplotlib, seaborn (all pip-managed by Manager; nothing exotic). No models, no weights, no API keys, no network - the entire "AI" here is numpy math and a two-panel chart. The only real gotcha beyond the Chinese labels is that a fresh graph defaults to a demo scenario (a ¥2.5M apartment with ¥1M saved up), so change every field before trusting any advice - or you'll be deciding on a stranger's mortgage.

    Category⭐️ Baikong

    Inputs (26)

    NameTypeDefaultDescription
    初始资金池INT10000000–99999999999
    房价INT25000000–99999999999
    首付比例FLOAT0.300–1
    交房等待月份INT240–100
    房贷年限INT200–100
    公积金贷款额度INT6000000–99999999999
    公积金贷款利率FLOAT0.02850–1
    商业贷款利率FLOAT0.02900–1
    未来是否卖出房产BOOLEANtrue
    卖出月份INT84
    房产增值率FLOAT0.20-1–10
    月开销INT50000–99999999999
    租房费用INT50000–99999999999
    月收入INT150000–99999999999
    工资年涨幅FLOAT0.050–1
    公积金INT50000–99999999999
    年终奖INT500000–99999999999
    剩余工作年限INT30–100
    年化收益率FLOAT0.020–1
    通货膨胀率FLOAT0.0050–1
    地区房价指数FLOAT1.000–10
    地区首付比例要求FLOAT0.150–1
    地区月供收入比上限FLOAT50.00–100
    地区房价增长预期FLOAT0.05-1–1
    地区失业率FLOAT0.050–1
    地区经济增长预期FLOAT0.03-1–1

    Outputs (2)

    NameTypeDescription
    趋势图IMAGE
    结论STRING