Skip to content

Commit

Permalink
Revert "temp metrics change"
Browse files Browse the repository at this point in the history
This reverts commit 83cc892.
  • Loading branch information
chenyaoy committed Jun 4, 2024
1 parent 83cc892 commit fc81475
Showing 1 changed file with 13 additions and 28 deletions.
41 changes: 13 additions & 28 deletions protocol/x/vault/keeper/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,6 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) (
log.ErrorLogWithError(ctx, "Failed to get vault clob orders to cancel", err, "vaultId", vaultId)
return err
}
// Place new CLOB orders.
ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId)

if err != nil {
log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId)
return err
}

for i, order := range ordersToPlace {
replacedOrder := ordersToCancel[i]
if replacedOrder.Subticks != order.Subticks {
vaultId.IncrCounter(
metrics.VaultPlaceOrderDifferentPrice,
)
} else {
vaultId.IncrCounter(
metrics.VaultPlaceOrderSamePrice,
)
}
}

orderExpirationSeconds := k.GetParams(ctx).OrderExpirationSeconds
for _, order := range ordersToCancel {
if _, exists := k.clobKeeper.GetLongTermOrderPlacement(ctx, order.OrderId); exists {
Expand All @@ -120,14 +99,13 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) (
}
}

// // Place new CLOB orders.
// ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId)

// if err != nil {
// log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId)
// return err
// }
// Place new CLOB orders.
ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId)

if err != nil {
log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId)
return err
}
for i, order := range ordersToPlace {
err := k.PlaceVaultClobOrder(ctx, order)
if err != nil {
Expand All @@ -143,6 +121,10 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) (
// Otherwise, send an order place message only.
replacedOrder := ordersToCancel[i]
if replacedOrder.Subticks != order.Subticks {
vaultId.IncrCounter(
metrics.VaultPlaceOrderDifferentPrice,
)

k.GetIndexerEventManager().AddTxnEvent(
ctx,
indexerevents.SubtypeStatefulOrder,
Expand All @@ -165,6 +147,9 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) (
),
)
} else {
vaultId.IncrCounter(
metrics.VaultPlaceOrderDifferentPrice,
)
k.GetIndexerEventManager().AddTxnEvent(
ctx,
indexerevents.SubtypeStatefulOrder,
Expand Down

0 comments on commit fc81475

Please sign in to comment.