Uniswap Tick Boundary To Liquidity Amounts

tags: Uniswap Tick To Price, Uniswap V3 import math tick_upper_bits = 4294945516 tick_lower_bits = 4294931656 tick_curre_bits = 4294938547 sqrtp_low = price_to_sqrtp(uint32_tick_to_price(tick_lower_bits)) sqrtp_cur = price_to_sqrtp(uint32_tick_to_price(tick_curre_bits)) sqrtp_upp = price_to_sqrtp(uint32_tick_to_price(tick_upper_bits)) def calc_amount0(liq, pa, pb): if pa > pb: pa, pb = pb, pa return int(liq * q96 * (pb - pa) / pa / pb) def calc_amount1(liq, pa, pb): if pa > pb: pa, pb = pb, pa return int(liq * (pb - pa) / q96) liq = 8599967722 amount0 = calc_amount0(liq, sqrtp_upp, sqrtp_cur) amount1 = calc_amount1(liq, sqrtp_low, sqrtp_cur)

November 19, 2024 · 1 min · Gray King

Uniswap Tick To Price

tags: Uniswap V3 def tick_to_price(tick: int) -> float: return 1.0001 ** tick def uint32_tick_to_price(bits: int) -> float: # https://stackoverflow.com/a/20766900 u = bits & ((1 << 32) - 1) tick = (u & ((1 << 31) - 1)) - (u & (1 << 31)) return 1.0001 ** tick q96 = 2**96 def price_to_sqrtp(p): return int(math.sqrt(p) * q96)

November 19, 2024 · 1 min · Gray King

Beancount

November 2, 2024 · 0 min · Gray King

How Precision in Beancount is Determined

source: https://beancount.github.io/docs/precision_tolerances.html#how-precision-is-determined tags: Beancount The sum value for some day is incorrect after I imported my records into beancount. Then I realised that’s the pricision problem. The problem was solved after I turn all my amounts to accurate to two decimal places. For each Transaction: Derive Automatically.

November 2, 2024 · 1 min · Gray King

30 生态缸开缸

底滤板 火山石打底 清洗 火山石冲洗2-3次。 用量 5 斤以内 铺设 平铺后,中间稍低,两边稍高;前低后高 青龙石随意摆放 铺放草泥 前面薄、后面厚 打湿水草泥种水草 种植水草 红绿3:4 前矮后高 两边绿中间红 阴性水草容易 对二氧化碳和光的要求不高。 加水,可以用海绵垫着,防止直冲 灯光 第一天24小时开 后三天每天 5-8 小时 换水 前三天每天换水 二氧化碳 第一个礼拜加大加倍 参考 https://youtu.be/ws89zmwJfcs?si=ig2uVxhgNnRwqy74 https://youtu.be/4weyFa3F9ws?si=aoo_XDUp0q0XPpev https://youtu.be/GxBvWuxhLrY?si=esdnaTrHllYSS5hb

September 23, 2024 · 1 min · Gray King