GithubHelp home page GithubHelp logo

philsong / bitcoin-broker Goto Github PK

View Code? Open in Web Editor NEW
251.0 22.0 98.0 92 KB

BTC trading market broker, smart route the orders to multiple exchange.

Home Page: http://www.jianshu.com/p/fd278144be1d

Shell 0.86% Go 96.54% Python 1.20% Thrift 1.41%
broker bitcoin autotrader okcoin huobi bixin chbtc btc

bitcoin-broker's Introduction

BTC trading market broker

作为经纪商角色,提供thrift标准服务接口。

提供合并交易所深度的标准价格模型,
大并发订单内部自动撮合冲销,
智能自动路由订单并拆大单为小单到不同交易所,
失败订单自动重试处理。

支持haobtc,okcoin,huobi,chbtc等交易所。

本地搭建

1、安装golang开发运行环境

http://golang.org/doc/install

2、下载安装依赖库并编译 broker

./install

3、导入数据库表结构

导入etc目录下的*.sql文件到PostgresDB

4、修改配置

修改conf/config_sample.json 为 conf/config.json

5、运行 broker

./bin/broker

一切顺利的话,broker应该就启动了。

bitcoin-broker's People

Contributors

philsong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcoin-broker's Issues

./install安装出错

trade_service

lib/src/trade_service/tradeservice.go:714: cannot use tradeServiceProcessorPing literal (type *tradeServiceProcessorPing) as type thrift.TProcessorFunction in assignment:
*tradeServiceProcessorPing does not implement thrift.TProcessorFunction (wrong type for Process method)
have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)

how to fix it ?

INFO[20161218 04:11:25] [ main.go ] 37 [ ---------------------------------------------------------->>>
INFO[20161218 04:11:25] [ main.go ] 38 trading broker Engine V1.1 postgres
INFO[20161218 04:11:25] [ main.go ] 39 <<<----------------------------------------------------------]
INFO[20161218 04:11:25] [ trade_center.go ] 49 unit_min_amount,unit_max_amount: 0.01 5
ERRO[20161218 04:11:25] [ db.go ] 49 open: pq: password authentication failed for user "root"
ERRO[20161218 04:11:25] [ trade_order.go ] 88 pq: password authentication failed for user "root"
INFO[20161218 04:11:25] [ amount_limit.go ] 40 init limit: 200 200 0 0
INFO[20161218 04:11:25] [ amount_limit.go ] 123 buy_total_amount: 0
INFO[20161218 04:11:25] [ amount_limit.go ] 132 sell_total_amount: 0
ERRO[20161218 04:11:25] [ db.go ] 49 open: pq: password authentication failed for user "root"
ERRO[20161218 04:11:25] [ exchange_config.go ] 55 pq: password authentication failed for user "root"
INFO[20161218 04:11:25] [ trade_server.go ] 48 Thrift server listening on 127.0.0.1:18030
ERRO[20161218 04:11:26] [ db.go ] 49 open: pq: password authentication failed for user "root"
ERRO[20161218 04:11:26] [ tx.go ] 11 pq: password authentication failed for user "root"
ERRO[20161218 04:11:26] [ tx.go ] 36 TxBegin failed pq: password authentication failed for user "root"
ERRO[20161218 04:11:27] [ db.go ] 49 open: pq: password authentication failed for user "root"

endless.. error.
And how can I use postgres sql?

安装出错 `redeclared in this bloc`

lib/src/trade_service/constants.go:17: EX_INTERNAL_ERROR redeclared in this bloc k
previous declaration at lib/src/trade_service/broker-consts.go:17
lib/src/trade_service/constants.go:18: EX_PRICE_OUT_OF_SCOPE redeclared in this block
previous declaration at lib/src/trade_service/broker-consts.go:18
lib/src/trade_service/constants.go:19: EX_NO_USABLE_FUND redeclared in this bloc k
previous declaration at lib/src/trade_service/broker-consts.go:19
lib/src/trade_service/constants.go:20: EX_NO_USABLE_DEPTH redeclared in this blo ck
previous declaration at lib/src/trade_service/broker-consts.go:20
lib/src/trade_service/constants.go:21: EX_TRADE_QUEUE_FULL redeclared in this bl ock
previous declaration at lib/src/trade_service/broker-consts.go:21
lib/src/trade_service/constants.go:22: EX_DEPTH_INSUFFICIENT redeclared in this block
previous declaration at lib/src/trade_service/broker-consts.go:22
lib/src/trade_service/constants.go:23: EX_PRICE_NOT_SYNC redeclared in this bloc k
previous declaration at lib/src/trade_service/broker-consts.go:23
lib/src/trade_service/constants.go:24: EX_EXIST_ERROR_ORDERS redeclared in this block
previous declaration at lib/src/trade_service/broker-consts.go:24
lib/src/trade_service/trade_service.go:17: TradeService redeclared in this block
previous declaration at lib/src/trade_service/broker.go:1759
lib/src/trade_service/trade_service.go:41: TradeServiceClient redeclared in this block
previous declaration at lib/src/trade_service/broker.go:1783
lib/src/trade_service/trade_service.go:41: too many errors

lib/src/trade_service/broker.go:2449: cannot use tradeServiceProcessorPing literal

安装完所有依赖后,执行install会导致以下报错:

...
install broker...
# trade_service
lib/src/trade_service/broker.go:2449: cannot use tradeServiceProcessorPing literal (type *tradeServiceProcessorPing) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorPing does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2450: cannot use tradeServiceProcessorConfigKeys literal (type *tradeServiceProcessorConfigKeys) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorConfigKeys does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2451: cannot use tradeServiceProcessorConfigAmount literal (type *tradeServiceProcessorConfigAmount) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorConfigAmount does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2452: cannot use tradeServiceProcessorGetExchangeStatus literal (type *tradeServiceProcessorGetExchangeStatus) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorGetExchangeStatus does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2453: cannot use tradeServiceProcessorCheckPrice literal (type *tradeServiceProcessorCheckPrice) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorCheckPrice does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2454: cannot use tradeServiceProcessorBuy literal (type *tradeServiceProcessorBuy) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorBuy does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2455: cannot use tradeServiceProcessorSell literal (type *tradeServiceProcessorSell) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorSell does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2456: cannot use tradeServiceProcessorGetTicker literal (type *tradeServiceProcessorGetTicker) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorGetTicker does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2457: cannot use tradeServiceProcessorGetAccount literal (type *tradeServiceProcessorGetAccount) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorGetAccount does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2458: cannot use tradeServiceProcessorGetAlertOrders literal (type *tradeServiceProcessorGetAlertOrders) as type thrift.TProcessorFunction in assignment:
	*tradeServiceProcessorGetAlertOrders does not implement thrift.TProcessorFunction (wrong type for Process method)
		have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
		want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
lib/src/trade_service/broker.go:2458: too many errors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.