@pear-protocol/core-sdk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +347 -13
- package/dist/core/index.js +7 -0
- package/package.json +2 -2
package/dist/core/index.d.ts
CHANGED
|
@@ -317,6 +317,36 @@ declare class Core {
|
|
|
317
317
|
error?: string | undefined;
|
|
318
318
|
filledPrice?: string | undefined;
|
|
319
319
|
}[] | undefined;
|
|
320
|
+
} | {
|
|
321
|
+
id: string;
|
|
322
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
323
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
324
|
+
createdAt: string;
|
|
325
|
+
updatedAt: string;
|
|
326
|
+
intent: "REVERSE";
|
|
327
|
+
orderType: "MARKET";
|
|
328
|
+
position: {
|
|
329
|
+
id: string;
|
|
330
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
331
|
+
};
|
|
332
|
+
error?: string | undefined;
|
|
333
|
+
orders?: {
|
|
334
|
+
id: string;
|
|
335
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
336
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
337
|
+
createdAt: string;
|
|
338
|
+
updatedAt: string;
|
|
339
|
+
type: "MARKET";
|
|
340
|
+
symbol: string;
|
|
341
|
+
side: "BUY" | "SELL";
|
|
342
|
+
reduceOnly: boolean;
|
|
343
|
+
leverage: number;
|
|
344
|
+
quantity: string;
|
|
345
|
+
price: string;
|
|
346
|
+
filledQuantity: string;
|
|
347
|
+
error?: string | undefined;
|
|
348
|
+
filledPrice?: string | undefined;
|
|
349
|
+
}[] | undefined;
|
|
320
350
|
})[];
|
|
321
351
|
}>;
|
|
322
352
|
};
|
|
@@ -764,7 +794,7 @@ declare class Core {
|
|
|
764
794
|
remainingNotional: string;
|
|
765
795
|
lastSliceAt?: string | undefined;
|
|
766
796
|
cancelledAt?: string | undefined;
|
|
767
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
797
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
768
798
|
fills?: {
|
|
769
799
|
id: string;
|
|
770
800
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -809,7 +839,7 @@ declare class Core {
|
|
|
809
839
|
initialExposure: Record<string, `-${string}` | `+${string}`>;
|
|
810
840
|
lastSliceAt?: string | undefined;
|
|
811
841
|
cancelledAt?: string | undefined;
|
|
812
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
842
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
813
843
|
fills?: {
|
|
814
844
|
id: string;
|
|
815
845
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -859,7 +889,7 @@ declare class Core {
|
|
|
859
889
|
remainingNotional: string;
|
|
860
890
|
lastSliceAt?: string | undefined;
|
|
861
891
|
cancelledAt?: string | undefined;
|
|
862
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
892
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
863
893
|
fills?: {
|
|
864
894
|
id: string;
|
|
865
895
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -904,7 +934,7 @@ declare class Core {
|
|
|
904
934
|
initialExposure: Record<string, `-${string}` | `+${string}`>;
|
|
905
935
|
lastSliceAt?: string | undefined;
|
|
906
936
|
cancelledAt?: string | undefined;
|
|
907
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
937
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
908
938
|
fills?: {
|
|
909
939
|
id: string;
|
|
910
940
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1062,6 +1092,36 @@ declare class Core {
|
|
|
1062
1092
|
error?: string | undefined;
|
|
1063
1093
|
filledPrice?: string | undefined;
|
|
1064
1094
|
}[] | undefined;
|
|
1095
|
+
} | {
|
|
1096
|
+
id: string;
|
|
1097
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1098
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1099
|
+
createdAt: string;
|
|
1100
|
+
updatedAt: string;
|
|
1101
|
+
intent: "REVERSE";
|
|
1102
|
+
orderType: "MARKET";
|
|
1103
|
+
position: {
|
|
1104
|
+
id: string;
|
|
1105
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1106
|
+
};
|
|
1107
|
+
error?: string | undefined;
|
|
1108
|
+
orders?: {
|
|
1109
|
+
id: string;
|
|
1110
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1111
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1112
|
+
createdAt: string;
|
|
1113
|
+
updatedAt: string;
|
|
1114
|
+
type: "MARKET";
|
|
1115
|
+
symbol: string;
|
|
1116
|
+
side: "BUY" | "SELL";
|
|
1117
|
+
reduceOnly: boolean;
|
|
1118
|
+
leverage: number;
|
|
1119
|
+
quantity: string;
|
|
1120
|
+
price: string;
|
|
1121
|
+
filledQuantity: string;
|
|
1122
|
+
error?: string | undefined;
|
|
1123
|
+
filledPrice?: string | undefined;
|
|
1124
|
+
}[] | undefined;
|
|
1065
1125
|
};
|
|
1066
1126
|
}>;
|
|
1067
1127
|
adjust: (positionId: string, body: HttpTypes.CreateTradeAdjust, headers?: ClientHeaders) => Promise<{
|
|
@@ -1177,6 +1237,36 @@ declare class Core {
|
|
|
1177
1237
|
error?: string | undefined;
|
|
1178
1238
|
filledPrice?: string | undefined;
|
|
1179
1239
|
}[] | undefined;
|
|
1240
|
+
} | {
|
|
1241
|
+
id: string;
|
|
1242
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1243
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1244
|
+
createdAt: string;
|
|
1245
|
+
updatedAt: string;
|
|
1246
|
+
intent: "REVERSE";
|
|
1247
|
+
orderType: "MARKET";
|
|
1248
|
+
position: {
|
|
1249
|
+
id: string;
|
|
1250
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1251
|
+
};
|
|
1252
|
+
error?: string | undefined;
|
|
1253
|
+
orders?: {
|
|
1254
|
+
id: string;
|
|
1255
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1256
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1257
|
+
createdAt: string;
|
|
1258
|
+
updatedAt: string;
|
|
1259
|
+
type: "MARKET";
|
|
1260
|
+
symbol: string;
|
|
1261
|
+
side: "BUY" | "SELL";
|
|
1262
|
+
reduceOnly: boolean;
|
|
1263
|
+
leverage: number;
|
|
1264
|
+
quantity: string;
|
|
1265
|
+
price: string;
|
|
1266
|
+
filledQuantity: string;
|
|
1267
|
+
error?: string | undefined;
|
|
1268
|
+
filledPrice?: string | undefined;
|
|
1269
|
+
}[] | undefined;
|
|
1180
1270
|
};
|
|
1181
1271
|
}>;
|
|
1182
1272
|
close: (positionId: string, body: HttpTypes.CreateTradeClose, headers?: ClientHeaders) => Promise<{
|
|
@@ -1292,6 +1382,181 @@ declare class Core {
|
|
|
1292
1382
|
error?: string | undefined;
|
|
1293
1383
|
filledPrice?: string | undefined;
|
|
1294
1384
|
}[] | undefined;
|
|
1385
|
+
} | {
|
|
1386
|
+
id: string;
|
|
1387
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1388
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1389
|
+
createdAt: string;
|
|
1390
|
+
updatedAt: string;
|
|
1391
|
+
intent: "REVERSE";
|
|
1392
|
+
orderType: "MARKET";
|
|
1393
|
+
position: {
|
|
1394
|
+
id: string;
|
|
1395
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1396
|
+
};
|
|
1397
|
+
error?: string | undefined;
|
|
1398
|
+
orders?: {
|
|
1399
|
+
id: string;
|
|
1400
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1401
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1402
|
+
createdAt: string;
|
|
1403
|
+
updatedAt: string;
|
|
1404
|
+
type: "MARKET";
|
|
1405
|
+
symbol: string;
|
|
1406
|
+
side: "BUY" | "SELL";
|
|
1407
|
+
reduceOnly: boolean;
|
|
1408
|
+
leverage: number;
|
|
1409
|
+
quantity: string;
|
|
1410
|
+
price: string;
|
|
1411
|
+
filledQuantity: string;
|
|
1412
|
+
error?: string | undefined;
|
|
1413
|
+
filledPrice?: string | undefined;
|
|
1414
|
+
}[] | undefined;
|
|
1415
|
+
};
|
|
1416
|
+
}>;
|
|
1417
|
+
reverse: (positionId: string, body: HttpTypes.CreateTradeReverse, headers?: ClientHeaders) => Promise<{
|
|
1418
|
+
execution: {
|
|
1419
|
+
id: string;
|
|
1420
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1421
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1422
|
+
createdAt: string;
|
|
1423
|
+
updatedAt: string;
|
|
1424
|
+
intent: "OPEN";
|
|
1425
|
+
orderType: "MARKET";
|
|
1426
|
+
legs: [{
|
|
1427
|
+
symbol: string;
|
|
1428
|
+
side: "BUY" | "SELL";
|
|
1429
|
+
mode: "QUANTITY" | "USD";
|
|
1430
|
+
amount: string;
|
|
1431
|
+
reduceOnly: boolean;
|
|
1432
|
+
}, ...{
|
|
1433
|
+
symbol: string;
|
|
1434
|
+
side: "BUY" | "SELL";
|
|
1435
|
+
mode: "QUANTITY" | "USD";
|
|
1436
|
+
amount: string;
|
|
1437
|
+
reduceOnly: boolean;
|
|
1438
|
+
}[]];
|
|
1439
|
+
error?: string | undefined;
|
|
1440
|
+
orders?: {
|
|
1441
|
+
id: string;
|
|
1442
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1443
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1444
|
+
createdAt: string;
|
|
1445
|
+
updatedAt: string;
|
|
1446
|
+
type: "MARKET";
|
|
1447
|
+
symbol: string;
|
|
1448
|
+
side: "BUY" | "SELL";
|
|
1449
|
+
reduceOnly: boolean;
|
|
1450
|
+
leverage: number;
|
|
1451
|
+
quantity: string;
|
|
1452
|
+
price: string;
|
|
1453
|
+
filledQuantity: string;
|
|
1454
|
+
error?: string | undefined;
|
|
1455
|
+
filledPrice?: string | undefined;
|
|
1456
|
+
}[] | undefined;
|
|
1457
|
+
} | {
|
|
1458
|
+
id: string;
|
|
1459
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1460
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1461
|
+
createdAt: string;
|
|
1462
|
+
updatedAt: string;
|
|
1463
|
+
intent: "ADJUST";
|
|
1464
|
+
orderType: "MARKET";
|
|
1465
|
+
position: {
|
|
1466
|
+
id: string;
|
|
1467
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1468
|
+
};
|
|
1469
|
+
legs: [{
|
|
1470
|
+
symbol: string;
|
|
1471
|
+
side: "BUY" | "SELL";
|
|
1472
|
+
mode: "QUANTITY" | "USD";
|
|
1473
|
+
amount: string;
|
|
1474
|
+
reduceOnly: boolean;
|
|
1475
|
+
}, ...{
|
|
1476
|
+
symbol: string;
|
|
1477
|
+
side: "BUY" | "SELL";
|
|
1478
|
+
mode: "QUANTITY" | "USD";
|
|
1479
|
+
amount: string;
|
|
1480
|
+
reduceOnly: boolean;
|
|
1481
|
+
}[]];
|
|
1482
|
+
error?: string | undefined;
|
|
1483
|
+
orders?: {
|
|
1484
|
+
id: string;
|
|
1485
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1486
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1487
|
+
createdAt: string;
|
|
1488
|
+
updatedAt: string;
|
|
1489
|
+
type: "MARKET";
|
|
1490
|
+
symbol: string;
|
|
1491
|
+
side: "BUY" | "SELL";
|
|
1492
|
+
reduceOnly: boolean;
|
|
1493
|
+
leverage: number;
|
|
1494
|
+
quantity: string;
|
|
1495
|
+
price: string;
|
|
1496
|
+
filledQuantity: string;
|
|
1497
|
+
error?: string | undefined;
|
|
1498
|
+
filledPrice?: string | undefined;
|
|
1499
|
+
}[] | undefined;
|
|
1500
|
+
} | {
|
|
1501
|
+
id: string;
|
|
1502
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1503
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1504
|
+
createdAt: string;
|
|
1505
|
+
updatedAt: string;
|
|
1506
|
+
intent: "CLOSE";
|
|
1507
|
+
orderType: "MARKET";
|
|
1508
|
+
position: {
|
|
1509
|
+
id: string;
|
|
1510
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1511
|
+
};
|
|
1512
|
+
error?: string | undefined;
|
|
1513
|
+
orders?: {
|
|
1514
|
+
id: string;
|
|
1515
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1516
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1517
|
+
createdAt: string;
|
|
1518
|
+
updatedAt: string;
|
|
1519
|
+
type: "MARKET";
|
|
1520
|
+
symbol: string;
|
|
1521
|
+
side: "BUY" | "SELL";
|
|
1522
|
+
reduceOnly: boolean;
|
|
1523
|
+
leverage: number;
|
|
1524
|
+
quantity: string;
|
|
1525
|
+
price: string;
|
|
1526
|
+
filledQuantity: string;
|
|
1527
|
+
error?: string | undefined;
|
|
1528
|
+
filledPrice?: string | undefined;
|
|
1529
|
+
}[] | undefined;
|
|
1530
|
+
} | {
|
|
1531
|
+
id: string;
|
|
1532
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1533
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1534
|
+
createdAt: string;
|
|
1535
|
+
updatedAt: string;
|
|
1536
|
+
intent: "REVERSE";
|
|
1537
|
+
orderType: "MARKET";
|
|
1538
|
+
position: {
|
|
1539
|
+
id: string;
|
|
1540
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1541
|
+
};
|
|
1542
|
+
error?: string | undefined;
|
|
1543
|
+
orders?: {
|
|
1544
|
+
id: string;
|
|
1545
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1546
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1547
|
+
createdAt: string;
|
|
1548
|
+
updatedAt: string;
|
|
1549
|
+
type: "MARKET";
|
|
1550
|
+
symbol: string;
|
|
1551
|
+
side: "BUY" | "SELL";
|
|
1552
|
+
reduceOnly: boolean;
|
|
1553
|
+
leverage: number;
|
|
1554
|
+
quantity: string;
|
|
1555
|
+
price: string;
|
|
1556
|
+
filledQuantity: string;
|
|
1557
|
+
error?: string | undefined;
|
|
1558
|
+
filledPrice?: string | undefined;
|
|
1559
|
+
}[] | undefined;
|
|
1295
1560
|
};
|
|
1296
1561
|
}>;
|
|
1297
1562
|
closeAll: (body: HttpTypes.CreateTradeCloseAll, headers?: ClientHeaders) => Promise<{
|
|
@@ -1407,6 +1672,36 @@ declare class Core {
|
|
|
1407
1672
|
error?: string | undefined;
|
|
1408
1673
|
filledPrice?: string | undefined;
|
|
1409
1674
|
}[] | undefined;
|
|
1675
|
+
} | {
|
|
1676
|
+
id: string;
|
|
1677
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1678
|
+
status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
1679
|
+
createdAt: string;
|
|
1680
|
+
updatedAt: string;
|
|
1681
|
+
intent: "REVERSE";
|
|
1682
|
+
orderType: "MARKET";
|
|
1683
|
+
position: {
|
|
1684
|
+
id: string;
|
|
1685
|
+
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
1686
|
+
};
|
|
1687
|
+
error?: string | undefined;
|
|
1688
|
+
orders?: {
|
|
1689
|
+
id: string;
|
|
1690
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
|
|
1691
|
+
status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
|
|
1692
|
+
createdAt: string;
|
|
1693
|
+
updatedAt: string;
|
|
1694
|
+
type: "MARKET";
|
|
1695
|
+
symbol: string;
|
|
1696
|
+
side: "BUY" | "SELL";
|
|
1697
|
+
reduceOnly: boolean;
|
|
1698
|
+
leverage: number;
|
|
1699
|
+
quantity: string;
|
|
1700
|
+
price: string;
|
|
1701
|
+
filledQuantity: string;
|
|
1702
|
+
error?: string | undefined;
|
|
1703
|
+
filledPrice?: string | undefined;
|
|
1704
|
+
}[] | undefined;
|
|
1410
1705
|
})[];
|
|
1411
1706
|
}>;
|
|
1412
1707
|
setLeverage: (body: HttpTypes.SetLeverage, headers?: ClientHeaders) => Promise<Record<string, never>>;
|
|
@@ -1491,10 +1786,14 @@ declare class Core {
|
|
|
1491
1786
|
mode: "QUANTITY" | "USD";
|
|
1492
1787
|
amount: string;
|
|
1493
1788
|
}[]];
|
|
1789
|
+
attachedTriggers: {
|
|
1790
|
+
kind: "STATIC" | "TRAILING";
|
|
1791
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
1792
|
+
}[];
|
|
1494
1793
|
};
|
|
1495
1794
|
triggeredAt?: string | undefined;
|
|
1496
1795
|
cancelledAt?: string | undefined;
|
|
1497
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
1796
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1498
1797
|
fills?: {
|
|
1499
1798
|
id: string;
|
|
1500
1799
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1624,7 +1923,7 @@ declare class Core {
|
|
|
1624
1923
|
};
|
|
1625
1924
|
triggeredAt?: string | undefined;
|
|
1626
1925
|
cancelledAt?: string | undefined;
|
|
1627
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
1926
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1628
1927
|
fills?: {
|
|
1629
1928
|
id: string;
|
|
1630
1929
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1787,7 +2086,7 @@ declare class Core {
|
|
|
1787
2086
|
};
|
|
1788
2087
|
triggeredAt?: string | undefined;
|
|
1789
2088
|
cancelledAt?: string | undefined;
|
|
1790
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2089
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1791
2090
|
fills?: {
|
|
1792
2091
|
id: string;
|
|
1793
2092
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -1898,10 +2197,14 @@ declare class Core {
|
|
|
1898
2197
|
mode: "QUANTITY" | "USD";
|
|
1899
2198
|
amount: string;
|
|
1900
2199
|
}[]];
|
|
2200
|
+
attachedTriggers: {
|
|
2201
|
+
kind: "STATIC" | "TRAILING";
|
|
2202
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
2203
|
+
}[];
|
|
1901
2204
|
};
|
|
1902
2205
|
triggeredAt?: string | undefined;
|
|
1903
2206
|
cancelledAt?: string | undefined;
|
|
1904
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2207
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
1905
2208
|
fills?: {
|
|
1906
2209
|
id: string;
|
|
1907
2210
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2031,7 +2334,7 @@ declare class Core {
|
|
|
2031
2334
|
};
|
|
2032
2335
|
triggeredAt?: string | undefined;
|
|
2033
2336
|
cancelledAt?: string | undefined;
|
|
2034
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2337
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2035
2338
|
fills?: {
|
|
2036
2339
|
id: string;
|
|
2037
2340
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2194,7 +2497,7 @@ declare class Core {
|
|
|
2194
2497
|
};
|
|
2195
2498
|
triggeredAt?: string | undefined;
|
|
2196
2499
|
cancelledAt?: string | undefined;
|
|
2197
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2500
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2198
2501
|
fills?: {
|
|
2199
2502
|
id: string;
|
|
2200
2503
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2305,10 +2608,14 @@ declare class Core {
|
|
|
2305
2608
|
mode: "QUANTITY" | "USD";
|
|
2306
2609
|
amount: string;
|
|
2307
2610
|
}[]];
|
|
2611
|
+
attachedTriggers: {
|
|
2612
|
+
kind: "STATIC" | "TRAILING";
|
|
2613
|
+
bracketType: "STOP_LOSS" | "TAKE_PROFIT";
|
|
2614
|
+
}[];
|
|
2308
2615
|
};
|
|
2309
2616
|
triggeredAt?: string | undefined;
|
|
2310
2617
|
cancelledAt?: string | undefined;
|
|
2311
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2618
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2312
2619
|
fills?: {
|
|
2313
2620
|
id: string;
|
|
2314
2621
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2438,7 +2745,7 @@ declare class Core {
|
|
|
2438
2745
|
};
|
|
2439
2746
|
triggeredAt?: string | undefined;
|
|
2440
2747
|
cancelledAt?: string | undefined;
|
|
2441
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2748
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2442
2749
|
fills?: {
|
|
2443
2750
|
id: string;
|
|
2444
2751
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2601,7 +2908,7 @@ declare class Core {
|
|
|
2601
2908
|
};
|
|
2602
2909
|
triggeredAt?: string | undefined;
|
|
2603
2910
|
cancelledAt?: string | undefined;
|
|
2604
|
-
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | undefined;
|
|
2911
|
+
cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | "POSITION_NETTED" | "POSITION_REVERSED" | undefined;
|
|
2605
2912
|
fills?: {
|
|
2606
2913
|
id: string;
|
|
2607
2914
|
status: "PROVISIONAL" | "CONFIRMED" | "RECONCILED";
|
|
@@ -2773,6 +3080,19 @@ declare class Core {
|
|
|
2773
3080
|
status: "FINAL";
|
|
2774
3081
|
createdAt: string;
|
|
2775
3082
|
updatedAt: string;
|
|
3083
|
+
executionContext?: {
|
|
3084
|
+
intent: "OPEN" | "CLOSE" | "ADJUST" | "REVERSE";
|
|
3085
|
+
orderType: "MARKET";
|
|
3086
|
+
executionStatus: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
3087
|
+
legs: {
|
|
3088
|
+
symbol: string;
|
|
3089
|
+
side: "BUY" | "SELL";
|
|
3090
|
+
reduceOnly: boolean;
|
|
3091
|
+
}[];
|
|
3092
|
+
positionId?: string | undefined;
|
|
3093
|
+
scheduleId?: string | undefined;
|
|
3094
|
+
triggerId?: string | undefined;
|
|
3095
|
+
} | undefined;
|
|
2776
3096
|
notionalQuote?: string | undefined;
|
|
2777
3097
|
notionalUsd?: string | undefined;
|
|
2778
3098
|
weightedSlippageBps?: string | undefined;
|
|
@@ -2851,6 +3171,19 @@ declare class Core {
|
|
|
2851
3171
|
status: "FINAL";
|
|
2852
3172
|
createdAt: string;
|
|
2853
3173
|
updatedAt: string;
|
|
3174
|
+
executionContext?: {
|
|
3175
|
+
intent: "OPEN" | "CLOSE" | "ADJUST" | "REVERSE";
|
|
3176
|
+
orderType: "MARKET";
|
|
3177
|
+
executionStatus: "CANCELLED" | "ACTIVE" | "COMPLETED" | "IDLE" | "FAILED";
|
|
3178
|
+
legs: {
|
|
3179
|
+
symbol: string;
|
|
3180
|
+
side: "BUY" | "SELL";
|
|
3181
|
+
reduceOnly: boolean;
|
|
3182
|
+
}[];
|
|
3183
|
+
positionId?: string | undefined;
|
|
3184
|
+
scheduleId?: string | undefined;
|
|
3185
|
+
triggerId?: string | undefined;
|
|
3186
|
+
} | undefined;
|
|
2854
3187
|
notionalQuote?: string | undefined;
|
|
2855
3188
|
notionalUsd?: string | undefined;
|
|
2856
3189
|
weightedSlippageBps?: string | undefined;
|
|
@@ -2864,6 +3197,7 @@ declare class Core {
|
|
|
2864
3197
|
fillCount: number;
|
|
2865
3198
|
notionalQuote?: string | undefined;
|
|
2866
3199
|
notionalUsd?: string | undefined;
|
|
3200
|
+
weightedSlippageBps?: string | undefined;
|
|
2867
3201
|
totalSlippageUsd?: string | undefined;
|
|
2868
3202
|
totalTradeFee?: string | undefined;
|
|
2869
3203
|
totalPearFee?: string | undefined;
|
package/dist/core/index.js
CHANGED
|
@@ -305,6 +305,13 @@ class Core {
|
|
|
305
305
|
body: this.withClientId(body)
|
|
306
306
|
});
|
|
307
307
|
},
|
|
308
|
+
reverse: async (positionId, body, headers) => {
|
|
309
|
+
return await this.client.fetch(`/trade/${positionId}/reverse`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
headers,
|
|
312
|
+
body
|
|
313
|
+
});
|
|
314
|
+
},
|
|
308
315
|
closeAll: async (body, headers) => {
|
|
309
316
|
return await this.client.fetch(`/trade/close-all`, {
|
|
310
317
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Pear Protocol Core SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@pear-protocol/types": "^1.
|
|
28
|
+
"@pear-protocol/types": "^1.3.0",
|
|
29
29
|
"@pear-protocol/utils": "^0.0.23",
|
|
30
30
|
"qs": "^6.14.0"
|
|
31
31
|
},
|