stellar-deprecated / kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
https://kelpbot.io
Other
1.09k stars 262 forks source link

Mirror strategy places bid offers are a slightly different price than expected #698

Open nikhilsaraf opened 3 years ago

nikhilsaraf commented 3 years ago

see new orders to be placed vs additional bid ops

2021/05/20 07:46:07 backing orderbook before transformations, including 3 additional buffer orders:
2021/05/20 07:46:07     bids on backing exchange:
2021/05/20 07:46:07         price=2754.97, amount=9.20000
2021/05/20 07:46:07         price=2754.90, amount=1.97369
2021/05/20 07:46:07         price=2754.89, amount=8.00000
2021/05/20 07:46:07         price=2754.87, amount=0.30000
2021/05/20 07:46:07         price=2754.61, amount=0.36338
2021/05/20 07:46:07         price=2754.58, amount=6.13616
2021/05/20 07:46:07         price=2754.48, amount=0.17826
2021/05/20 07:46:07     asks on backing exchange:
2021/05/20 07:46:07         price=2755.30, amount=0.19857
2021/05/20 07:46:07         price=2755.38, amount=0.00731
2021/05/20 07:46:07         price=2755.39, amount=0.01746
2021/05/20 07:46:07         price=2755.51, amount=0.05000
2021/05/20 07:46:07         price=2755.56, amount=0.52649
2021/05/20 07:46:07         price=2755.57, amount=1.50420
2021/05/20 07:46:07         price=2755.62, amount=0.00400
2021/05/20 07:46:07 new orders to be placed (after transforming and filtering orders from backing exchange):
2021/05/20 07:46:07     bids on backing exchange:
2021/05/20 07:46:07         price=2734.31, amount=0.75000
2021/05/20 07:46:07         price=2734.24, amount=0.39474
2021/05/20 07:46:07         price=2734.23, amount=0.75000
2021/05/20 07:46:07         price=2734.21, amount=0.06000
2021/05/20 07:46:07     asks on backing exchange:
2021/05/20 07:46:07         price=2775.96, amount=0.03971
2021/05/20 07:46:07         price=2776.18, amount=0.01000
2021/05/20 07:46:07         price=2776.23, amount=0.10530
2021/05/20 07:46:07         price=2776.24, amount=0.30084
2021/05/20 07:46:07 balanceCoordinator: nothing to constrain since normalizedPrimaryUnits and normalizedBackingUnits were equal (0.7500000000)
2021/05/20 07:46:07 balanceCoordinator: using normalizedPrimaryUnits (0.3947300000) since it is smaller than normalizedBackingUnits (0.3947400000)
2021/05/20 07:46:07 balanceCoordinator: nothing to constrain since normalizedPrimaryUnits and normalizedBackingUnits were equal (0.7500000000)
2021/05/20 07:46:07 balanceCoordinator: using normalizedPrimaryUnits (0.0599900000) since it is smaller than normalizedBackingUnits (0.0600000000)
2021/05/20 07:46:07 returning 0 deleteOps and 4 ops
2021/05/20 07:46:07 num. buyOps in this update: 4
2021/05/20 07:46:07 balanceCoordinator: using normalizedBackingUnits (0.0397000000) since it is smaller than normalizedPrimaryUnits (0.0397100000)
2021/05/20 07:46:07 balanceCoordinator: using normalizedBackingUnits (0.0099900000) since it is smaller than normalizedPrimaryUnits (0.0100000000)
2021/05/20 07:46:07 balanceCoordinator: using normalizedBackingUnits (0.1052900000) since it is smaller than normalizedPrimaryUnits (0.1053000000)
2021/05/20 07:46:07 balanceCoordinator: using normalizedBackingUnits (0.3008300000) since it is smaller than normalizedPrimaryUnits (0.3008400000)
2021/05/20 07:46:07 returning 0 deleteOps and 4 ops
2021/05/20 07:46:07 num. sellOps in this update: 4
2021/05/20 07:46:07 ---> failed placeSellOpsFirst condition where top bid (bids[0]) > first open ask offer (sellingAOffers[0]), placing bidOps first
2021/05/20 07:46:07 ---> buyingOffers:
2021/05/20 07:46:07 --->     offerID=x1, price=2724.7956403, amount=0.7499076
2021/05/20 07:46:07 --->     offerID=x2, price=2724.0533914, amount=0.3875907
2021/05/20 07:46:07 --->     offerID=x3, price=2724.0533914, amount=0.1336925
2021/05/20 07:46:07 --->     offerID=x4, price=2724.0533914, amount=0.3820145
2021/05/20 07:46:07 ---> sellingOffers:
2021/05/20 07:46:07 --->     offerID=y1, price=2766.3400000, amount=0.1200000
2021/05/20 07:46:07 --->     offerID=y2, price=2766.3600000, amount=0.7500000
2021/05/20 07:46:07 --->     offerID=y3, price=2766.4400000, amount=0.7500000
2021/05/20 07:46:07 --->     offerID=y4, price=2766.4600000, amount=0.7499900
2021/05/20 07:46:07 ---> deleteBuyOps:
2021/05/20 07:46:07 ---> deleteSellOps:
2021/05/20 07:46:07 ---> additional bid ops:
2021/05/20 07:46:07 --->     offerID=x1, price=2734.4818157, amount=0.7499529
2021/05/20 07:46:07 --->     offerID=x2, price=2734.4818157, amount=0.3946951
2021/05/20 07:46:07 --->     offerID=x3, price=2734.4818157, amount=0.7499309
2021/05/20 07:46:07 --->     offerID=x4, price=2734.4818157, amount=0.0599840
2021/05/20 07:46:07 ---> additional ask ops:
2021/05/20 07:46:07 --->     offerID=y1, price=2775.9600000, amount=0.0397000
2021/05/20 07:46:07 --->     offerID=y2, price=2776.1800000, amount=0.0099900
2021/05/20 07:46:07 --->     offerID=y3, price=2776.2300000, amount=0.1052900
2021/05/20 07:46:07 --->     offerID=y4, price=2776.2400000, amount=0.3008300