---
# System prepended metadata

title: APY.Vision Back End Take-Home Assessment

---

# Back End Take-Home Assessment

## About APY Vision
APY Vision is an All-in-one liquidity pool analytics and yield farming rewards tracking tool. **Our goal is to be the Bloomberg for liquidity providers in DeFi**. We believe that providing liquidity on AMMs is new but is here to stay, and we want to build the tools and analytics that will give actionable insight to the liquidity providers that we serve. In addition to liquidity pool analytics, we plan to offer new services such as insurance and alerts.


## About the Assignment
This assignment will test your knowledge about your fullstack Javascript/TS skills.

This is meant to be a light exercise where we assess your code style and your backend architecture skills. The exercise is designed to be implemented in 3 to 4 hours. If you can't finish, don't worry -- try to do as much as you can so we can see how you can structure your code and style your code.

## The task
Imagine you are building a simulation to help onboard new users to the world of liquidity providing on decentralized exchanges. Specifically, we want to create a fantasy game where people can sign up and be given a virtual 100,000 USD to practice and then can see their portfolio value over time. 

They can take use that money to add to a liquidity pool and get back LP tokens (that represent their share of the pool). They can only pick 1 pool and they have to use all of the $100,000 USD at the same time. We note the amount of the LP token shares the user gets, then we store that information in the database.

After picking the pool, they will be shown their portfolio value (based on the current value of the LP tokens they’ve acquired). 

Please note you don't need front end styling for this, just the minimum components (text/input) to send to backend is fine.

## Requirements

Please use NestJS to set up a project with the typeorm models included, based on these requirements.

These are the requirements for the project:
- As a user, I want to see a list of available pools to invest my $100,000 USD 
- As a user, I can enter my email and then pick a pool to invest all $100,000 USD into a pool and get confirmation that I entered the pool and be shown my portfolio value afterwards
- As the system, we should store the user's email and portfolio with the number of LP tokens purchased based on a $100,000 of investment
- As the system, we should have a leaderboard api endpoint to return the portfolio based on an email. The portfolio value in USD is based on the LP tokens they have when they entered the contest multipled by the current LP token price.

For the list to show the pool for the user to choose from and to calculate the portfolio value, please use this endpoint. Also, to calculate the current LP token price for the leaderboard, use the same endpoint:

https://stats.apy.vision/api/v1/pool_search/advanced_search?avg_period_daily_volume_usd=50000&avg_period_reserve_usd=500000&min_pool_age_days=7&vr=0&exchanges=&access_token=a816e1a5-c738-418f-8084-1d07c204fb99

(There are a lot of data, but you only need to display the pool name and the current LP token price to the user in the initial list)

(Please note that the api above updates the price once every 12 hours, so the LP calculation might not update from the time the user selects to the time of the leaderboard access. That is okay, you can just return the current LP tokens the user has * the current price)

## Delieverables
A project using NestJS with a front end page that allows the user to enter an email and pick a portfolio and be shown their portfolio value (in USD) and all other players' portfolio values afterwards. When the user comes back to the site later, the system should load the user (you can save the email in local storage for ease of access)

[Optional] Deploy this project on a free site (ie. Heroku)

## Notes
Please use NestJS's module system to ensure code is clean
Please use TypeORM for the object relational mapping
Please use Postgres for the database
