Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fix mirror strategy startup fail bug without db enabled, closes #525
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsaraf committed Oct 12, 2020
1 parent 3fc5332 commit ee4a7e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/configs/trader/sample_mirror.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ EXCHANGE_QUOTE="ZUSD"
#EXCHANGE_QUOTE="BTC"

# maximum depth of order levels that we want to create on the orderbook on each side
ORDERBOOK_DEPTH=40
ORDERBOOK_DEPTH=5

# number to divide volume by when placing orders so we can scale volume as needed
VOLUME_DIVIDE_BY=500.0
VOLUME_DIVIDE_BY=4.0

# spread % we should maintain per level between the mirrored exchange and SDEX (0 < spread < 1.0). This moves the price away from the center price on SDEX so we can cover the position on the external exchange, i.e. if this value is > 0 then the spread you provide on SDEX will be more than the spread on the exchange you are mirroring.
# in this example the spread is 0.5%
Expand Down
9 changes: 6 additions & 3 deletions plugins/mirrorStrategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ func makeMirrorStrategy(
log.Printf("backingPair='%s', backingConstraints=%s\n", backingPair, backingConstraints)

// insert into database if needed
backingMarketID, e := FetchOrRegisterMarketID(db, config.Exchange, config.ExchangeBase, config.ExchangeQuote)
if e != nil {
return nil, fmt.Errorf("error calling FetchOrRegisterMarketID: %s", e)
var backingMarketID string
if db != nil {
backingMarketID, e = FetchOrRegisterMarketID(db, config.Exchange, config.ExchangeBase, config.ExchangeQuote)
if e != nil {
return nil, fmt.Errorf("error calling FetchOrRegisterMarketID: %s", e)
}
}

// trigger fill tracking on backing exchange at creation time
Expand Down

0 comments on commit ee4a7e6

Please sign in to comment.