3b40eb98 / pyth-history

Index historical Pyth price oracle data for charting using Redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pyth History

plot

Collects and aggregates trades from Pyth Network for display in a TradingView chart. This is powering the charts on trade.zeta.markets. Feel free to improve and extend for the benefit for the larger Solana ecosystem.

Note: This does not include a functioning trading view to inspect the data.

Check the mango markets gui code for a reference how to use this API to display a TradingView.

Configuration

  • pricefeeds: should be added to the dictionaries in src/index.ts

  • All other configuration should be handled via environment variables. So far the following variables exist:

REDISCLOUD_URL: redis connection url (redis://<username>:<password>@<hostname>:<port>)
REDIS_MAX_CONN: maximum number of concurrent connections used by the redis pool
RPC_ENDPOINT_URL: solana rpc connection url
INTERVAL: time in seconds to wait between event queue polls

You can set these via a .env file in the root directory.

Redis Setup

For the sake of optimisations in data fetching and aggregation, I've used the Redis Timeseries module. Therefore when setting up your Redis DB, you must add the Timeseries module for it to work.

Build

To run on a docker container:

docker build -t zeta-pyth-history:latest .
docker run --rm --env-file=.env zeta-pyth-history

Credits

Many thanks to the Mango Markets team (mango.markets) whose original repo Serum History served as the foundation for this code.

Questions / Suggestions?

đź‘‹ Reach out to the respective teams on Discord:

About

Index historical Pyth price oracle data for charting using Redis

License:Other


Languages

Language:TypeScript 96.1%Language:Dockerfile 3.9%