Refactor triggerType handling in order placement logic

- Updated the triggerType assignment in placeStopLossOrder and related functions to default to "STOP_LOSS" instead of conditionally setting it based on the order side.
- This change simplifies the logic for stop market orders across the order coordinator and GRVT exchange gateway, ensuring consistent behavior.
This commit is contained in:
discountry
2026-02-01 11:15:00 +08:00
parent 1fb6d3d62d
commit 8d79ace8b3
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1337,7 +1337,7 @@ function buildUnsignedOrder(params: {
function buildTriggerMetadata(params: CreateOrderParams): GrvtUnsignedOrder["metadata"]["trigger"] | undefined {
if (params.type === "STOP_MARKET") {
const triggerType = params.triggerType ?? (params.side === "BUY" ? "TAKE_PROFIT" : "STOP_LOSS");
const triggerType = params.triggerType ?? "STOP_LOSS";
const stopPrice = params.stopPrice ?? params.activationPrice;
if (!stopPrice) {
throw new Error("GRVT stop orders require a stopPrice or activationPrice");