Skip to content

Commit

Permalink
Started to add project description
Browse files Browse the repository at this point in the history
  • Loading branch information
EstDavid committed Oct 4, 2022
1 parent 97af174 commit e29799a
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,94 @@
# Uniswap V3 Charts
Uniswap V3 Charts is a web app that reads price data from a set of Uniswap V3 pools and displays it on candlestick charts.
The app allows adjusting the charts to different timeframes and also allows adding up to 5 moving average indicators These indicators can be a simple moving average (SMA) or exponential moving average (EMA)

The price data is produced by another app called [Uniswap V3 Oracle Reader (UV3OR)](https://github.com/EstDavid/UniswapV3OracleReader "Uniswap V3 Oracle Reader"). The UV3OR reads historical price data from different token pair pools on Uniswap V3 and writes it to Google Cloud Storage.

Uniswap V3 Charts uses an express server to download all the price data from Google Cloud Storage.

## Express server
### Setup
### Retrieving symbol list
### Retrieving price data

## Charting App
### Reading price data
Price data is stored in a .json file. The .json file contains an object with the following structure, where the AAVEUSDT token pair is used as an example:

```javascript
{
symbol: "AAVEUSDT",
baseToken:
{
chainId: 1,
decimals: 18,
symbol: "AAVE",
name: "Aave",
isNative: false,
isToken: true,
address: "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
logoURI: "https://assets.coingecko.com/coins/images/12645/thumb/AAVE.png?1601374110"
},
quoteToken:
{
chainId: 1,
decimals: 6,
symbol: "USDT",
name: "Tether",
isNative: false,
isToken: true,
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
logoURI: "https://assets.coingecko.com/coins/images/325/thumb/Tether-logo.png?1598003707"
},
poolAddress: "0x4D1Ad4A9e61Bc0E5529d64F38199cCFca56f5a42",
poolFee: 3000,
observationTimeframe:
{
name: "30 seconds",
seconds: 30
},
arrayTypes: ["open","high","low","close"],
extraMinutesData: 180,
observations: {
"1661765250": 88.118166402644,
"1661765280": 88.118166402644,
...,
"1663663710": 205.31315964938253,
"1663663740": 205.31315964938253
},
startTimestamp: "1661769990",
endTimestamp: "1663663740",
maxObservations: 396
}
```
Price data is an object where the keys are timestamps, and the values are price observations a the given timestamp. To avoid mistakes, price is always referred to as the ratio between the base token and the quote token, or how much of the quote token is needed to buy one unit of the base token.
The main object contains not only price data, but also data about both tokens of the pair, pool data and the timeframe of the base obvservations. In this case observations have been made every 30 seconds.

All of this data is downloaded from the express server and stored in the state of the `priceData` slice by the use of the following reducer function which uses the object from the .json file as payload:

```javascript
initPriceObject: (state, {payload}) => {
state.priceObject.symbol = payload.symbol;
state.priceObject.baseToken = payload.baseToken;
state.priceObject.quoteToken = payload.quoteToken;
state.priceObject.poolAddress = payload.poolAddress;
state.priceObject.poolFee = payload.poolFee;
state.priceObject.observationTimeframe = payload.observationTimeframe;
state.priceObject.arrayTypes = payload.arrayTypes;
state.priceObject.startTimestamp = payload.startTimestamp;
state.priceObject.endTimestamp = payload.endTimestamp;
state.priceObject.observations = payload.observations;
state.priceObject.maxTimestamp = Math.max(...Object.keys(payload.observations));
state.loadingPriceObject = false;
}
```


### Moving average indicators
### Connecting Metamask



# Main features of the app
- [ ] Reading data from storage
- [ ] Processing data for display
Expand Down

0 comments on commit e29799a

Please sign in to comment.