Developing, Testing, and Building the DIA platform with Docker Compose
Prepare
# Start data store services
(
cd deployments/local/exchange-scraper
docker compose -f docker-compose.yml up --build --force-recreate -d
)
# Define env variables needed
export USE_ENV=true
export INFLUXURL=http://localhost:8086
export INFLUXUSER=test
export INFLUXPASSWORD=testtest
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=password
export POSTGRES_HOST=localhost
export POSTGRES_DB=postgres
export REDISURL=localhost:6379
# Set config directory
export DIA_CONFIG_DIR=./config
# Set local directory as Go dependency
go mod edit -replace "github.com/diadata-org/diadata=$(pwd)" cmd/exchange-scrapers/collector/go.mod
Scrapers
CEX (Kraken as example)
Prepare
# Initialize the exchange and blockchain metadata
go run ./cmd/services/blockchainservice/main.go
# Prepare pairs metadata
go run ./cmd/services/pairDiscoveryService/main.go -exchange=Kraken -mode=verification
Run the scraper
go run ./cmd/exchange-scrapers/collector/collector.go -exchange=Kraken -mode=storeTrades
DEX (CurveFi as example)
Prepare
# Set needed RPC variables
export ETHEREUM_URI_REST=https://rpc.ankr.com/eth
export ETHEREUM_URI_WS=wss://eth-mainnet.g.alchemy.com/v2/7X9hL_lpF-Utavuv1aT49SWkWu9oYZTq
# Prepare the assets metadata
go run ./cmd/assetCollectionService/main.go -source=assetlists -secret=eth_assets -caching=true
go run ./cmd/assetCollectionService/main.go -source=assetlists -secret=non_eth_assets -caching=true
go run ./cmd/assetCollectionService/main.go -source=assetlists -secret=fiat_assets -caching=true
go run ./cmd/assetCollectionService/main.go -source=Curvefi -caching=true
# Prepare and populate pools
go run ./cmd/liquidityScraper/main.go -exchange=Curvefi
Run the scraper
go run ./cmd/exchange-scrapers/collector/collector.go -exchange=Curvefi -mode=storeTrades
On prepare step if you want to connect services between other Compose files, create a deployments/local/exchange-scraper/docker-compose.override.yml file:
And instead of run the services using this command:
# Start data store services
(
cd deployments/local/exchange-scraper
docker compose -f docker-compose.yml -f docker-compose.override.yml up --build --force-recreate -d
)