Back end API for Uniswap10 - a customizeable index of cryptocurrencies traded on Uniswap. Track the top cryptocurrencies on the most popular decentralized exchange.
Uniswap10 is an index representing the hypothetical investment performance of a liquidity-weighted allocation strategy. Get broad exposure to the DeFi ecosystem by following market trends. Customize the strategy parameters to fit your trading style.
Technologies: Node, Express, Postgres, GraphQL
Data sources: The Graph, AlphaVantage
Requires Node.js 13.2.0 or later
-
yarn install
ornpm install
-
cp sample.env .env
-
Create prod and test databases in Postgres
-
Put database URLs in .env
-
Put AV API key in .env
-
Migrate DB:
yarn migrate
ornpm migrate
-
(Production) Schedule cron job to run
yarn update-db
ornpm update-db
every 24h
Start server: yarn start
or npm run start
Develop: yarn dev
or npm dev
Fetch new data and update DB: yarn update-db
or npm update-db
Migrate up DB: yarn migrate
or npm migrate
Truncate DB: yarn truncate
or npm run truncate
Deploy to Heroku (must set up first): yarn deploy
or npm run deploy
Generate CSV file of Uniswap10 Index: yarn csv
or npm csv
/api/index
Query params:
rp
- Strategy rebalance period
- integer 1 - 365
lw
- Liquidity weight factor (0 = use volume only)
- integer 0 - 1
c
- base currency
- 'usd' or 'eth'
-
heroku create
-
heroku addons:create heroku-postgresql:hobby-dev
-
yarn migrate:production
ornpm migrate:production
-
heroku addons:create scheduler:standard
-
Configure scheduler on Heroku dashboard to run
yarn update-db
ornpm update-db
every 24 hr -
heroku config:set AV_API_KEY=<your API key>
-
yarn deploy
ornpm run deploy
-
heroku ps:scale web=1