挂单方式变化
This commit is contained in:
parent
a9b3bbb095
commit
83a4c9a199
@ -420,29 +420,14 @@ public class AutoGridStrategy extends BaseStrategy {
|
|||||||
|
|
||||||
// ======================== 网格挂单 ========================
|
// ======================== 网格挂单 ========================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化仅挂下方一格买单,与运行中补单逻辑一致,避免网格间距调整后批量挂单失配。
|
||||||
|
*/
|
||||||
private void placeInitialBuyGrids() {
|
private void placeInitialBuyGrids() {
|
||||||
if (currentPrice == null || currentGridGap == null) {
|
if (currentPrice == null || currentGridGap == null) {
|
||||||
fetchCurrentPriceFromRest();
|
fetchCurrentPriceFromRest();
|
||||||
}
|
}
|
||||||
if (currentPrice == null || currentGridGap == null) {
|
replenishBuyGrids();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (tradeLock) {
|
|
||||||
int remainingSlots = gridCount - pendingBuyOrders.size();
|
|
||||||
if (remainingSlots <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BigDecimal price = alignPriceDown(currentPrice, currentGridGap);
|
|
||||||
int placed = 0;
|
|
||||||
while (price.compareTo(lowerBound) >= 0 && placed < remainingSlots) {
|
|
||||||
if (!hasBuyOrderAt(price)) {
|
|
||||||
placeLimitBuyOrder(price);
|
|
||||||
placed++;
|
|
||||||
}
|
|
||||||
price = price.subtract(currentGridGap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replenishBuyGrids() {
|
private void replenishBuyGrids() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user