Vektor adds Column Functions!
We sometimes say, "If you can use Excel, you can use Vektor". The beautiful thing about the VXL language is that, like Excel, one function's output can be another function's input. Today, with the launch of familiar functions like MIN, MAX, SUM, AVERAGE, and COLUMN, we're excited to show you the powerful DeFi workflows that become possible with Vektor. 🏋️♀️
- 💎 How much TVL do I have on Curve?
- 💎 What's the Average supply APY across a basket of stablecoins?
- 💎 Alert me when my riskiest debt position is close to getting liquidated!
- 💎 What's the best APY if I LP my stETH?
🛠️ Example: "How much TVL do I have on Curve?"
Vektor's COLUMN function can be used to extract any column from any table or list that you get from other functions. In this example, we use LP.POSITIONS (filitered on the Curve venue) to first fetch our Curve positions (on all chains). Then we wrap it in COLUMN to pull out the USD 'VALUE' data points (alternatively use the dot accessor), and finally SUM to get our total TVL. Magic! 🪄
The above VXL will get the answer in one shot, but for sake of example the below shows each step in turn.
Don't forget, in Vektor this will also be a live-updating metric by default, and you can easily build ALERTs around this or any metric.
🛠️ Example: "What's the Average supply APY across a basket of stablecoins?"
This time, we start with the LEND.MARKETS function which by default queries the supply APYs for all assets, on all venues, on all blockchains. We use an asset filter to only include a basket of stablecoin symbols, and a blockchain filter to focus on just Ethereum. Then we extract the SUPPLY_APY column, and finally AVERAGE it to get a useful basket APY metric!
🛠️ Example: "Alert me when my riskiest debt position is close to getting liquidated!"
Using the MIN function helps us isolate "worst case" situations and manage risk using Vektor. Here, we start with the BORROW.ACCOUNTS list that shows all of our levered debt position accounts. We then extract the HEALTH_FACTOR column (the ratios of total collateral to total debt) and use MIN to find our lowest health factor (wherever it may be across venues and/or blockchains). When this number gets close to 1, it means we're about to get liquidated, so we set a Vektor Alert using the ALERT function to make sure we are notified in time!
Vektor will keep this alert running, whether or not you're using the app. If and when the condition becomes true, you'll receive an email like the above!
🛠️ Example: "What's the best APY if I LP my stETH?"
In this final example, we just want to know which pool to deposit our stETH into for the best APY. We start with the LP.POOLS function, filtered just to show pools that include stETH as a consituent asset. Then we access the 30-day Average APY column, and finally use the MAX function to tell us the best APY!
These are just a few of the many things you can do with the new SUM, MAX, MIN, AVERAGE, and COLUMN functions. Have a use you'd like to share? We'd love to hear from you!
- Lend & Borrow announcement or detailed docs
- LP functions announcement or detailed docs
- Formulaic alert announcement or detailed docs
More updates coming soon... or check our Product Updates History for updates you may have missed. 😎