-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated webapi project and readme document
- Loading branch information
1 parent
9f2dc5d
commit 08bc9fc
Showing
7 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
## Overview | ||
|
||
This project has a console application [also a web api, mentioned below] written in c# which connects to the `Uniswap API v3` and collects the liquidity positions | ||
of both the cryptocurrencies of a user defined liquidity pool. | ||
|
||
Below are the information it fetches and shows them on console (in addition to writting them in log files). | ||
|
||
- Position of token0 (USDC in this example) | ||
- Position of token1 (ETH in this example) | ||
- Current price of token0:token1 (USDC per ETH in this example) | ||
|
||
Example: Lets say, you want to fetch the below highlighted information for pool id [245953](https://app.uniswap.org/#/pool/245953). | ||
|
||
![Uniswap Interface](./images/245953.png) | ||
|
||
Run the application and here is the output information fetched from `Uniswap API v3`. | ||
|
||
![Console output](./images/output.png) | ||
|
||
**Note:** | ||
- You can set the pool id, precisions and also the interval after which the application should fetch the information from `Uniswap API v3`. | ||
|
||
``` | ||
# app.config | ||
<appSettings> | ||
<add key="PoolId" value="245953" /> | ||
<add key="PrecisionForPosition0" value="3" /> | ||
<add key="PrecisionForPosition1" value="6" /> | ||
<add key="PrecisionForCurrentPrice" value="2" /> | ||
<add key="IntervalInSeconds" value="60" /> | ||
</appSettings> | ||
``` | ||
- You can also control the output by customizing configuration in `log4net.config`. (eg.: change the log directory, pattern, rolling style etc.) | ||
|
||
``` | ||
# log4net.config | ||
<root> | ||
<level value="ALL" /> | ||
<!--<appender-ref ref="console" />--> | ||
<appender-ref ref="file" /> | ||
</root> | ||
``` | ||
- When network is disconnected/fluctuated, It retries in a smart way which automatically calculates the number of retries to be done exponentially based on `IntervalInSeconds` provided | ||
in `app.config`. For example: for a given interval 60 seconds, lets say first trigger is at `10:30`. If Uniswap API can not be connected, then there will be maximum 4 retries (auto calculated). | ||
- First retry will be done after 5 seconds `[10:30:05]` | ||
- 2nd retry will be done after 10 seconds `[10:30:15]` | ||
- 3rd retry will be done after 15 seconds `[10:30:30]` | ||
- 4th retry will be done after 20 seconds `[10:30:50]` | ||
- If API still can not be connected, then send error `Unable to retrieve the data from server after 4 retries.` | ||
- A new timer will be triggered at `[10:31:00]`. | ||
|
||
- There is also an webapi project, which exposes endpoint `positions` to allow you fetch the same information. Please check [demo](https://uniswap-v3.vercel.app/positions/245953) url. | ||
|
||
![API output](./images/api.png) | ||
|
||
**Note:** | ||
- Format of api is `positions/<pool_id>/<token0_precision>/<token1_precision>/<currentprice_precision>`. Few examples: | ||
- https://uniswap-v3.vercel.app/positions/245953 => Shows the information with no truncation. | ||
- https://uniswap-v3.vercel.app/positions/245953/3 => Truncates only token0 position with 3 decimal precision | ||
- https://uniswap-v3.vercel.app/positions/245953/3/6 => Truncates token0 position with 3 decimal precisions and token1 position with 6 precision. | ||
- https://uniswap-v3.vercel.app/positions/245953/null/null/2 => Truncate only current price with 2 decimal precision. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
08bc9fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
uniswap-v3 – ./
uniswap-v3-ernitingarg.vercel.app
uniswap-v3-git-master-ernitingarg.vercel.app
uniswap-v3-eight.vercel.app