command
Version:
v0.0.0-...-057c172
Opens a new window with list of versions in this module.
Published: Sep 22, 2020
License: BSD-2-Clause
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
install kafka on mac
brew install kafka
run zookeeper
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
run kafka
kafka-server-start /usr/local/etc/kafka/server.properties &
compile and run trade-server
cd ..
Compile : github.com/coinsky/trade-server/
Run : ./trade-server
run examples to recv data from websocket connection
cd examples
go run websocket_examples.go
Feed data to the trade-server
kafka-console-producer --broker-list localhost:9092 --topic coinex-dex --property parse.key=true --property key.separator=# < ../docs/dex_msgs_data.txt
Test Order Depth Update
-
运行trade-server
-
运行websocket测试程序,接收websocket的推送
go run websocket_examples.go
2019/09/11 16:29:00 recv: {"type":"depth", "payload":{"trading_pair":"abcd/cet","bids":[{"p":"0.005200000000000000","a":"0"}],"asks":null}}
2019/09/11 16:29:00 recv: {"type":"depth", "payload":{"trading_pair":"abcd/cet","bids":[{"p":"0.005200000000000000","a":"0"}],"asks":null}}
2019/09/11 16:29:00 recv: {"type":"depth", "payload":{"trading_pair":"abcd/cet","bids":[{"p":"0.005200000000000000","a":"0"}],"asks":null}}
-
向kafka中输入测试数据
kafka-console-producer --broker-list localhost:9092 --topic coinex-dex --property parse.key=true --property key.separator=# < data.txt
- 该文本文件包含3笔IOC的买单;将这些数据喂给kafka;然后由trade-server进行消费.
-
测试Rest接口的查询
curl -X GET "http://localhost:8000/market/depths?market=abcd%2Fcet&count=10" -H "accept: application/json"
- Return value :
{"sell":[],"buy":[]}
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.