Add Adrena Protocol Open/Close PERP trade support

This commit is contained in:
Orex
2025-01-01 14:57:55 +04:00
parent 61abe10b0d
commit a68f26d009
8 changed files with 21577 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ Anyone - whether an SF-based AI researcher or a crypto-native builder - can brin
- Jito Bundles
- Pyth Price feeds for fetching Asset Prices
- Register/resolve Alldomains
- Perpetuals Trading with Adrena Protocol
- **Solana Blinks**
- Lending by Lulo (Best APR for USDC)
@@ -220,6 +221,32 @@ const price = await agent.pythFetchPrice(
console.log("Price in BTC/USD:", price);
```
### Open PERP Trade
```typescript
import { PublicKey } from "@solana/web3.js";
const signature = await agent.openPerpTradeLong({
price: 300, // $300 SOL Max price
collateralAmount: 10, // 10 jitoSOL in
collateralMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), // jitoSOL
leverage: 50000, // x5
tradeMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), // jitoSOL
slippage: 0.3, // 0.3%
});
```
### Close PERP Trade
```typescript
import { PublicKey } from "@solana/web3.js";
const signature = await agent.closePerpTradeLong({
price: 200, // $200 SOL price
tradeMint: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), // jitoSOL
});
```
## Examples
### LangGraph Multi-Agent System