This is a websocket server that connects to the Kucoin exchange API. This server subscribes to the ticker and kline (candles) endpoint.
Prerequisite:
Start the server. Default port is 3000.
go run main.go
Websocket endpoint:
ws://localhost:3000/ws
You can subscribe to 2 topics: ticker
and kline
. Send the following JSON to the server:
Subscribe to ticker topic
{"type": "ticker"}
Subscribe to kline topic
{"type": "kline"}
Go to the clients
directory:
# Run a Kline subscriber client
go run klinesubscriber.go
# Run a Ticker subscriber client
go run tickersubscriber.go
- Sometimes it takes a few seconds to start the server because the server needs to fetch the symbols list, and the kucoin REST API can be a bit unstable at times.
- Takes a bit of time for the Kline sub to start streaming data because the server needs to subscribe to all of the topics (1000+ topics)