Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
f0cii committed Apr 9, 2020
1 parent f2c59ec commit 70e141e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type Broker interface {
GetOrderBook(symbol string, depth int) (result OrderBook, err error)

// 设置合约类型
// pair: 交易对,如: BTC-USD(OKEX) BTC(HBDM)
// currencyPair: 交易对,如: BTC-USD(OKEX) BTC(HBDM)
// contractType: W1,W2,Q1,Q2
SetContractType(pair string, contractType string) (err error)
SetContractType(currencyPair string, contractType string) (err error)

// 获取当前设置的合约ID
GetContractID() (symbol string, err error)
Expand Down
6 changes: 4 additions & 2 deletions brokers/bitmex-broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
// BitMEXBroker the BitMEX broker
type BitMEXBroker struct {
client *bitmex.BitMEX
symbol string
}

func (b *BitMEXBroker) GetName() (name string) {
Expand Down Expand Up @@ -54,12 +55,13 @@ func (b *BitMEXBroker) GetOrderBook(symbol string, depth int) (result OrderBook,
return
}

func (b *BitMEXBroker) SetContractType(pair string, contractType string) (err error) {
func (b *BitMEXBroker) SetContractType(currencyPair string, contractType string) (err error) {
b.symbol = currencyPair
return
}

func (b *BitMEXBroker) GetContractID() (symbol string, err error) {
return
return b.symbol, nil
}

func (b *BitMEXBroker) SetLeverRate(value float64) (err error) {
Expand Down
7 changes: 5 additions & 2 deletions brokers/bitmex-sim-broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type BitMEXSimBroker struct {
openOrders map[string]*Order // Open orders
historyOrders map[string]*Order // History orders
positions map[string]*Position // Position key: symbol

symbol string
}

func (b *BitMEXSimBroker) GetName() (name string) {
Expand Down Expand Up @@ -68,12 +70,13 @@ func (b *BitMEXSimBroker) GetOrderBook(symbol string, depth int) (result OrderBo
return
}

func (b *BitMEXSimBroker) SetContractType(pair string, contractType string) (err error) {
func (b *BitMEXSimBroker) SetContractType(currencyPair string, contractType string) (err error) {
b.symbol = currencyPair
return
}

func (b *BitMEXSimBroker) GetContractID() (symbol string, err error) {
return
return b.symbol, nil
}

func (b *BitMEXSimBroker) SetLeverRate(value float64) (err error) {
Expand Down
6 changes: 4 additions & 2 deletions brokers/bybit-broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// BybitBroker the Bybit broker
type BybitBroker struct {
client *rest.ByBit
symbol string
}

func (b *BybitBroker) GetName() (name string) {
Expand Down Expand Up @@ -59,12 +60,13 @@ func (b *BybitBroker) GetOrderBook(symbol string, depth int) (result OrderBook,
return
}

func (b *BybitBroker) SetContractType(pair string, contractType string) (err error) {
func (b *BybitBroker) SetContractType(currencyPair string, contractType string) (err error) {
b.symbol = currencyPair
return
}

func (b *BybitBroker) GetContractID() (symbol string, err error) {
return
return b.symbol, nil
}

func (b *BybitBroker) SetLeverRate(value float64) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion brokers/deribit-broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (b *DiribitBroker) GetOrderBook(symbol string, depth int) (result OrderBook
return
}

func (b *DiribitBroker) SetContractType(pair string, contractType string) (err error) {
func (b *DiribitBroker) SetContractType(currencyPair string, contractType string) (err error) {
return
}

Expand Down

0 comments on commit 70e141e

Please sign in to comment.