priceproxy
fetches prices periodically from sources as listed in its config file. It provides a simple REST API for fetching prices.
Vega trading bots use the price proxy to place orders with real-world prices while avoiding hitting API rate limits on upstream price sources. The bots can then provide liquidity on Testnet, and help make the charts look realistic.
See the releases page.
Either run go get
:
go get github.com/vegaprotocol/priceproxy/cmd/priceproxy@latest
Or clone the repository:
git clone https://github.com/vegaprotocol/priceproxy.git
cd priceproxy
go install ./cmd/priceproxy
A compiled priceproxy
binary should now be in $GOPATH/bin
.
See also:
Makefile
- contains useful commands for running builds, tests, etc.
priceproxy -config /path/to/your/config.yml
Save the following as config.yml
:
server:
listen: ":8080"
logformat: text # json, text
loglevel: info # debug, info, warn, error, fatal
env: prod # dev, prod
sources:
- name: bitstamp
sleepReal: 60 # seconds
sleepWander: 2 # seconds
url:
scheme: https
host: www.bitstamp.net
path: "/api/v2/ticker/{base}{quote}/"
# "{base}" and "{quote}" are replaced at runtime.
prices:
- source: bitstamp
base: BTC
quote: USD
factor: 1.0
wander: true
The following price sources are currently supported. Pull requests are gratefully received for more sources.
- Bitstamp, API docs, see
pricing/bitstamp.go
- Coin Market Cap, API docs, see
pricing/coinmarketcap.go
- FTX, REST API docs, see
pricing/ftx.go
Method | Location | Description |
---|---|---|
GET | /prices?params... |
List some/all prices |
GET | /sources |
List all sources |
GET | /sources/ [name string] |
List one source |
GET | /status |
Resturn status=true |
- source string: Limit the results to ones with the given source.
- base string: Limit the results to ones with the given base.
- quote string: Limit the results to ones with the given quote.
- wander bool: Limit the results to ones with the given wander setting.
Distributed under the MIT License. See LICENSE
for more information.