AnyHedge allows users to take leveraged long or short positions against main-chain BCH. It is permissionless, non-custodial, and on-chain. The contracts are fully funded on creation and have no counterparty risk. The risks are early liquidation, slippage, and oracle risks.
Scrape the blockchain and filter for spent transaction outputs that match the contract's input script template. Aggregate them to compute TVL. The TVL data lags by contract duration since contracts are secret until settled. So, TVL at the current time will always be 0 and can only be calculated in retrospect and stats back-filled when contracts are revealed. For this reason, the code cuts-off the data at 31 days ago. See here for more details: https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md