Skip to content

Commit

Permalink
Fix fill tracking OrderAction which used to set opposite orderAction …
Browse files Browse the repository at this point in the history
…on sdex
  • Loading branch information
nikhilsaraf committed Jul 1, 2019
1 parent 0c9db72 commit 12c03ce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugins/sdex.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,19 @@ func (sdex *SDEX) getOrderAction(baseAsset horizon.Asset, quoteAsset horizon.Ass
actionSell := model.OrderActionSell
actionBuy := model.OrderActionBuy
if sdexBaseAsset == tradeBaseAsset && sdexQuoteAsset == tradeQuoteAsset {
// this seems counter-intuitive; when assets line up and baseIsSeller then the bot has purchased the base asset
if trade.BaseIsSeller {
return &actionSell
return &actionBuy
}
return &actionBuy
// this seems counter-intuitive; when assets line up and !baseIsSeller then the bot has sold the base asset
return &actionSell
} else if sdexBaseAsset == tradeQuoteAsset && sdexQuoteAsset == tradeBaseAsset {
// conversely, this seems counter-intuitive; when assets do not line up and baseIsSeller then the bot has sold the base asset
if trade.BaseIsSeller {
return &actionBuy
return &actionSell
}
return &actionSell
// and when assets do not line up and !baseIsSeller then the bot has purchased the base asset
return &actionBuy
} else {
return nil
}
Expand Down

0 comments on commit 12c03ce

Please sign in to comment.