You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Jupiter SDK中设置限价单滑点?到账金额不符咨询

Jupiter SDK限价单滑点问题解答

交易详情

+-----------------------------------------------------------------------------------------------------+
| Transaction Type: Buy                                                                               |
| sellAmount: 0.135241916                                                                             |
| buyAmount: 18.749259                                                                                |
| sellAddress: So11111111111111111111111111111111111111112                                            |
| buyAddress: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v                                            |
| buy price: 138.634973736                                                                            |
| Signature: 4tnsKHFNZU5Nxw3aG4D1M7SC7DkZtG5CvgB7CdzP7WL6KXsiHtTSgGWYXwbTkX39pDUugeGuEuMRiUPhA1qC6Bp3 |
+-----------------------------------------------------------------------------------------------------+

问题描述

我使用jupiter SDK在Solana上按照上述参数创建了一笔limit order,代码如下:

const { tx, orderPubKey } = await limitOrder.createOrder({
  owner: walletKeyPair.publicKey,
  inAmount:  new anchor.BN(sellAmount.toString()), 
  outAmount: new anchor.BN(buyAmount.toString()),
  inputMint: new PublicKey(sellAddress),
  outputMint: new PublicKey(buyAddress),
  expiredAt: transactionExpiry, // Example: new BN(new Date().valueOf() / 1000)
  base: base.publicKey,
});

我设置的outAmount为18749259 USDC,但实际收到的金额为18730510 USDC,低于设置值。请问Jupiter SDK是否会自动在内部应用slippage?如果是,如何将其设置为0%?

解答

Jupiter SDK的限价单默认会应用0.1%的滑点,这就是实际到账金额低于设定值的原因。

要将滑点设置为0%,只需在createOrder的参数中添加slippageBps字段并设为0(bps即基点,1%=100bps)。修改后的代码如下:

const { tx, orderPubKey } = await limitOrder.createOrder({
  owner: walletKeyPair.publicKey,
  inAmount:  new anchor.BN(sellAmount.toString()), 
  outAmount: new anchor.BN(buyAmount.toString()),
  inputMint: new PublicKey(sellAddress),
  outputMint: new PublicKey(buyAddress),
  expiredAt: transactionExpiry, // Example: new BN(new Date().valueOf() / 1000)
  base: base.publicKey,
  slippageBps: 0 // 滑点设为0%
});

注意:设置0%滑点后,订单仅会在完全匹配你设定的价格时执行,若市场价格未达限价,订单可能无法成交。


内容的提问来源于stack exchange,提问作者shadow

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 17:36:15