REPORT function spotlight

This document explains the syntax and various usage patterns of Vektor's powerful REPORT function.

🧠
If you haven’t used VXL before, try our Quick Start Guide! You may also find it useful to first learn about VXL basics and Common Syntax Patterns, or book a call using the CALL function in the app to learn more.

Summary

Vektor's REPORT function allow you to set up periodic reports on any data, which can be delivered automatically on a daily, weekly, monthly, or custom interval basis.

Reports can be considered part of Vektor's Automation capabilities, just like ALERT. The main difference between the two is that ALERTS are conditional; they wait for something to happen before sending a notification ("When X happens, let me know") while REPORTS send data on a pre-determined schedule ("Every Monday at 9AM send me data").

⚠️
Note: Vektor can send the reports by multiple delivery methods (e.g. Emails or Webhooks) and in multiple formats (e.g. CSV, JSON). We will cover these in the examples below.

Function Specification

You can use the built-in subfunctions such as REPORT.DAILY|HOURLY|MONTHLY|QUARTERLY|YEARLY to set up a new report with the period of your preference. Or you can choose any periodicity you like using REPORT.CRON. The other REPORT subfunctions are used to manage the reports you create.

Function Description
REPORT(...) Set up a daily report (default)
REPORT.DAILY(...) Same as REPORT
REPORT.WEEKLY(...) Set up a weekly report
REPORT.MONTHLY(...) Set up a monthly report
REPORT.QUARTERLY(...) Set up a quarterly report
REPORT.YEARLY(...) Set up a yearly report
REPORT.CRON(...) Set up a report whose schedule is defined by a cron expression
REPORT.LIST(...) Get a list of reports
REPORT.GET(...) Get an alert by its id
REPORT.CANCEL(...) Cancel a report
REPORT.HISTORY(...) Get en execution history of reports
REPORT.TRIGGER(...) Trigger a report

REPORT(...) Syntax and Examples

Use REPORT. to set up a new report and then choose the period of the reporting. After that, you have to introduce the delivery type (Email/Webhook) and then the format data of the report (CSV/JSON).

The REPORT function must contain either EMAIL or WEBHOOK functions to define the delivery method
⚠️
Note: The Function Helper box pictured above should be useful in helping guide you through the syntax of Vektor functions. It appears automatically when you open the parentheses of a function.

Emailed reports will come from Vektor and contain the optional report NAME in the subject (if provided).

Example of Vektor Report delivered as an email

The email layout will look something like this:

Even the MESSAGE option can be a nested expression

Once created, Vektor will continue to run the report until it is cancelled.

Daily Report Examples

Send me a report of my lend positions every day at 7am.

REPORT(EMAIL(MESSAGE="HOURLY LEND POSITIONS", ATTACHMENTS=[CSV(LEND.POSITIONS)]), HOUR=7)

Send me a report of the prices of my assets every day.

REPORT(EMAIL(MESSAGE="ASSETS PRICES", ATTACHMENTS=[CSV(PRICES(INCLUDE_ASSETS=COLUMN(BALANCES,"ASSET.SYMBOL")))]))

Send me a report of select stablecoins borrow markets every day

REPORT(EMAIL(MESSAGE="STABLES BORROW MARKETS", ATTACHMENTS=[CSV(BORROW.MARKETS(INCLUDE_ASSETS=[USDT,USDC,DAI]))]),NAME="STABLES BORROW MARKETS")

Here the NAME option will ensure that "STABLES BORROW MARKETS" appears in the email header, and the MESSAGE option will ensure that "STABLES BORROW MARKETS" also appears in the email message body. You can use both, or none, or either.

Create a daily report Webhook of borrow account health factors.

REPORT(WEBHOOK(JSON(BORROW.ACCOUNTS.HEALTH_FACTOR),"HTTPS://WEBHOOK.SITE/AD433134-F24B-4C8F-866F-E4FEC2D0CC4A"))

Send me a report of my spot balance total called "DAILY BALANCE" just showing my total balance value in the message field.

Thanks to the composability of VXL, you can also put dynamic expressions to appear in the MESSAGE field. The MESSAGE option expects a text string so you may need to use the string functions like STRING or STRING.CONCAT to get the message you want.

REPORT(EMAIL(MESSAGE=STRING.CONCAT("BALANCE VALUE= " ,STRING((SUM(BALANCES.VALUE)))),NAME= "DAILY BALANCE")

Weekly Report Examples

Send me a weekly report of my lending positions with a message containing their average Supply APY.

REPORT.WEEKLY(EMAIL(MESSAGE=STRING.CONCAT("Supply APY Average= ",STRING(AVERAGE(LEND.POSITIONS.MARKET.SUPPLY_APY))), ATTACHMENTS=[CSV(LEND.POSITIONS)]),NAME="LEND POSITIONS")

Send me a weekly report of my borrow positions at 12am.

REPORT.WEEKLY(EMAIL(MESSAGE="BORROW POSITIONS", ATTACHMENTS=[CSV(BORROW.POSITIONS)]), NAME="BORROW POSITIONS", HOUR=12)

Send me a weekly report of my LP positions by Webhook.

REPORT.WEEKLY(WEBHOOK(CSV(LP.POSITIONS),"HTTPS://WEBHOOK.SITE/AD433134-F24B-4C8F-866F-E4FEC2D0CC4A"), NAME="LP POSITIONS")

Monthly Report Examples

Send me a monthly report of the 20 highest APY liquidity pools with liquidity higher than 1M.

REPORT.WEEKLY(EMAIL(MESSAGE= "TOP 20 HIGHEST APY LIQUIDITY POOLS", ATTACHMENTS=[CSV(LIST.TOP(SORT(FILTER(LP.POOLS,VAL.LIQUIDITY > 1_000_000), "APYS.TOTAL", ASC= FALSE),20))]),NAME="LIQUIDITY POOLS APYS")

Send me a Monthly report with separate attachments for lend + LP positions, and include the sum value of all my positions in the message

REPORT(EMAIL(MESSAGE=STRING.CONCAT("TOTAL POSITIONS VALUE= ",STRING(SUM(LEND.POSITIONS.VALUE)+SUM(LP.POSITIONS.VALUE))),ATTACHMENTS=[CSV(LEND.POSITIONS),CSV(LP.POSITIONS)]),NAME="MONTHLY POSITIONS REPORT")

Send me a Monthly report of all my my borrow debt amounts.

REPORT(EMAIL(MESSAGE=STRING.CONCAT("TOTAL DEBTS= ",STRING(SUM(BORROW.ACCOUNTS.TOTAL_DEBT))),ATTACHMENTS=[CSV(BORROW.ACCOUNTS.TOTAL_DEBT)]),NAME="TOTAL DEBTS REPORT")

Send me a Monthly report of all my lend positions liquidity amounts.

REPORT(EMAIL(MESSAGE="LENDING POSITIONS LIQUIDITIES" ,ATTACHMENTS=[CSV(LEND.POSITIONS.MARKET.LIQUIDITY)]),NAME="LEND POSITIONS LIQUIDITIES REPORT")

Yearly Report Examples

Send me a General Annual Report about all my balances and positions.

REPORT.YEARLY(EMAIL(MESSAGE="ANNUAL REPORT" ,ATTACHMENTS=[CSV(BALANCES),CSV(LEND.POSITIONS),CSV(BORROW.POSITIONS),CSV(LP.POSITIONS)]),NAME="ANNUAL REPORT")

CRON Report Examples

Send me a CSV with my asset prices every Fridays at 12am.

REPORT.CRON( "0 0 * * 5",EMAIL(MESSAGE="ASSETS PRICES", ATTACHMENTS=[CSV(PRICES(INCLUDE_ASSETS=COLUMN(BALANCES,"ASSET.SYMBOL")))]))

REPORT.LIST(...) Syntax and Examples

You can use REPORT.LIST or REPORTS to see a list of all the reports you created.

By default the list shows only RUNNING reports. You can override this behaviour and set INCLUDE_CANCELED=TRUE to include canceled reports.

Each time the reports are triggered, the report will be delivered at the set time and the report will stay in the list until cancelled.

REPORT.LIST(...) Examples

Show me a list of my running reports (with sample output).

Show me a list of my alerts, including running and canceled (with sample output).

REPORT.GET(...) Syntax and Examples

When you create an report, it is assigned a unique 4-character alphanumeric id (e.g. 9BA5 or 7078). You can use this id to refer to the report itself, in order to access other functionality. One example is the REPORT.GET function that can be used to extract specific information about the report.

To see a list of reports and their id's, you can use the REPORT.LIST function covered in the previous section.

⚠️
Note: you need to provide the id to the REPORT.GET function in quotation marks e.g. REPORT.GET("AB12")

REPORT.GET(...) Examples

Get information about a running report (with sample output).

Get information about two different report at once (with sample output).

REPORT.TRIGGER(...) Syntax and Examples

You can trigger a report using REPORT.TRIGGER function. By this way you 'll be able to test your reports before waiting for the set time.

REPORT.TRIGGER(...) Examples

Trigger a running report (with sample output).

REPORT.HISTORY(...) Syntax and Examples

To visualize the history of reports executions you can use the REPORT.HISTORY function. This will tell you all the instances of the report deliveries and when they were executed.

From here you could also take advantage of the Quick Actions and get individual report data.

REPORT.CANCEL(...) Syntax and Examples

To cancel an alert and remove it from the list, use the REPORT.CANCEL function.

You can cancel an individual alert by providing it's id, or you can also cancel a batch of alerts by providing a list of alert ids or a list of report objects.

⚠️
Note: you can only cancel reports that are in the RUNNING state.

REPORT.CANCEL(...) Examples

Cancel a specific report (with sample output)

You can also Cancel all the reports in one command.


Questions?

Email: [email protected]
Zoom: Use CALL function in Vektor