mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xmaker: fix sides
This commit is contained in:
parent
ceda1e06b9
commit
b4f2748892
|
@ -937,7 +937,7 @@ func aggregatePriceVolumeSliceWithPriceFilter(pvs types.PriceVolumeSlice, filter
|
||||||
// tryArbitrage tries to arbitrage between the source and maker exchange
|
// tryArbitrage tries to arbitrage between the source and maker exchange
|
||||||
func (s *Strategy) tryArbitrage(ctx context.Context, quote *Quote) (bool, error) {
|
func (s *Strategy) tryArbitrage(ctx context.Context, quote *Quote) (bool, error) {
|
||||||
marginBidPrice := quote.BestBidPrice.Mul(fixedpoint.One.Sub(quote.BidMargin))
|
marginBidPrice := quote.BestBidPrice.Mul(fixedpoint.One.Sub(quote.BidMargin))
|
||||||
marginAskPrice := quote.BestAskPrice.Mul(fixedpoint.One.Add(quote.BidMargin))
|
marginAskPrice := quote.BestAskPrice.Mul(fixedpoint.One.Add(quote.AskMargin))
|
||||||
|
|
||||||
var iocOrders []types.SubmitOrder
|
var iocOrders []types.SubmitOrder
|
||||||
if makerBid, makerAsk, ok := s.makerBook.BestBidAndAsk(); ok {
|
if makerBid, makerAsk, ok := s.makerBook.BestBidAndAsk(); ok {
|
||||||
|
@ -955,8 +955,8 @@ func (s *Strategy) tryArbitrage(ctx context.Context, quote *Quote) (bool, error)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if makerBid.Price.Compare(marginAskPrice) >= 0 {
|
} else if makerBid.Price.Compare(marginAskPrice) >= 0 {
|
||||||
askPvs := s.makerBook.SideBook(types.SideTypeSell)
|
bidPvs := s.makerBook.SideBook(types.SideTypeBuy)
|
||||||
sumPv := aggregatePriceVolumeSliceWithPriceFilter(askPvs, marginBidPrice)
|
sumPv := aggregatePriceVolumeSliceWithPriceFilter(bidPvs, marginBidPrice)
|
||||||
|
|
||||||
// send ioc order for arbitrage
|
// send ioc order for arbitrage
|
||||||
iocOrders = append(iocOrders, types.SubmitOrder{
|
iocOrders = append(iocOrders, types.SubmitOrder{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user