@pear-protocol/core-sdk 0.0.21 → 0.0.23

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.
@@ -63,11 +63,43 @@ declare class Core {
63
63
  delete: (id: string, headers?: ClientHeaders) => Promise<void>;
64
64
  credentials: (id: string, headers?: ClientHeaders) => Promise<{
65
65
  connector: "hyperliquid";
66
+ account: {
67
+ id: string;
68
+ alias: string;
69
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
70
+ exchangeIdentifier: string;
71
+ createdAt: string;
72
+ updatedAt: string;
73
+ metadata?: {
74
+ agentWalletAddress: string;
75
+ isSubaccount: boolean;
76
+ mainAccountAddress: string;
77
+ } | {
78
+ l1_address: string;
79
+ } | undefined;
80
+ deletedAt?: string | undefined;
81
+ };
66
82
  credentials: {
67
83
  signer_key: string;
68
84
  };
69
85
  } | {
70
86
  connector: "binance";
87
+ account: {
88
+ id: string;
89
+ alias: string;
90
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
91
+ exchangeIdentifier: string;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ metadata?: {
95
+ agentWalletAddress: string;
96
+ isSubaccount: boolean;
97
+ mainAccountAddress: string;
98
+ } | {
99
+ l1_address: string;
100
+ } | undefined;
101
+ deletedAt?: string | undefined;
102
+ };
71
103
  credentials: {
72
104
  read: {
73
105
  api_key: string;
@@ -80,12 +112,44 @@ declare class Core {
80
112
  };
81
113
  } | {
82
114
  connector: "bybit";
115
+ account: {
116
+ id: string;
117
+ alias: string;
118
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
119
+ exchangeIdentifier: string;
120
+ createdAt: string;
121
+ updatedAt: string;
122
+ metadata?: {
123
+ agentWalletAddress: string;
124
+ isSubaccount: boolean;
125
+ mainAccountAddress: string;
126
+ } | {
127
+ l1_address: string;
128
+ } | undefined;
129
+ deletedAt?: string | undefined;
130
+ };
83
131
  credentials: {
84
132
  api_key: string;
85
133
  api_secret: string;
86
134
  };
87
135
  } | {
88
136
  connector: "okx";
137
+ account: {
138
+ id: string;
139
+ alias: string;
140
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
141
+ exchangeIdentifier: string;
142
+ createdAt: string;
143
+ updatedAt: string;
144
+ metadata?: {
145
+ agentWalletAddress: string;
146
+ isSubaccount: boolean;
147
+ mainAccountAddress: string;
148
+ } | {
149
+ l1_address: string;
150
+ } | undefined;
151
+ deletedAt?: string | undefined;
152
+ };
89
153
  credentials: {
90
154
  api_key: string;
91
155
  api_secret: string;
@@ -93,6 +157,22 @@ declare class Core {
93
157
  };
94
158
  } | {
95
159
  connector: "lighter";
160
+ account: {
161
+ id: string;
162
+ alias: string;
163
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter";
164
+ exchangeIdentifier: string;
165
+ createdAt: string;
166
+ updatedAt: string;
167
+ metadata?: {
168
+ agentWalletAddress: string;
169
+ isSubaccount: boolean;
170
+ mainAccountAddress: string;
171
+ } | {
172
+ l1_address: string;
173
+ } | undefined;
174
+ deletedAt?: string | undefined;
175
+ };
96
176
  credentials: {
97
177
  api_private_key: string;
98
178
  api_key_index: number;
@@ -352,6 +432,16 @@ declare class Core {
352
432
  mark: Record<string, string>;
353
433
  }>;
354
434
  };
435
+ rebalance: {
436
+ manually: (positionId: string, body: HttpTypes.RebalanceManually, headers?: ClientHeaders) => Promise<{
437
+ plan: {
438
+ outcome: "full_rebalance";
439
+ } | {
440
+ outcome: "partial_rebalance" | "no_rebalance";
441
+ messages: [string, ...string[]];
442
+ };
443
+ }>;
444
+ };
355
445
  schedules: {
356
446
  list: (query: HttpTypes.ScheduleListParamsInput, headers?: ClientHeaders) => Promise<{
357
447
  limit: number;
@@ -1041,35 +1131,24 @@ declare class Core {
1041
1131
  intent: "OPEN";
1042
1132
  type: "MARKET";
1043
1133
  condition: {
1044
- type: "ratio_v1";
1134
+ type: "ratio";
1045
1135
  data: {
1046
1136
  priceSource: "mark" | "mid";
1047
1137
  symbol_a: string;
1048
1138
  symbol_b: string;
1049
- direction: "ABOVE" | "BELOW";
1139
+ track: "PEAK" | "TROUGH";
1050
1140
  threshold: number;
1051
1141
  };
1052
1142
  } | {
1053
- type: "price_v1";
1143
+ type: "price";
1054
1144
  data: {
1055
1145
  priceSource: "mark" | "mid";
1056
1146
  symbol: string;
1057
- direction: "ABOVE" | "BELOW";
1058
- threshold: number;
1059
- };
1060
- } | {
1061
- type: "index_v1";
1062
- data: {
1063
- priceSource: "mark" | "mid";
1064
- basket: {
1065
- symbol: string;
1066
- weight: number;
1067
- }[];
1068
- direction: "ABOVE" | "BELOW";
1147
+ track: "PEAK" | "TROUGH";
1069
1148
  threshold: number;
1070
1149
  };
1071
1150
  } | {
1072
- type: "weighted_ratio_v1";
1151
+ type: "weighted_ratio";
1073
1152
  data: {
1074
1153
  priceSource: "mark" | "mid";
1075
1154
  basket: {
@@ -1077,7 +1156,7 @@ declare class Core {
1077
1156
  side: "BUY" | "SELL";
1078
1157
  weight: number;
1079
1158
  }[];
1080
- direction: "ABOVE" | "BELOW";
1159
+ track: "PEAK" | "TROUGH";
1081
1160
  threshold: number;
1082
1161
  };
1083
1162
  };
@@ -1132,35 +1211,24 @@ declare class Core {
1132
1211
  intent: "ADJUST";
1133
1212
  type: "MARKET";
1134
1213
  condition: {
1135
- type: "ratio_v1";
1214
+ type: "ratio";
1136
1215
  data: {
1137
1216
  priceSource: "mark" | "mid";
1138
1217
  symbol_a: string;
1139
1218
  symbol_b: string;
1140
- direction: "ABOVE" | "BELOW";
1219
+ track: "PEAK" | "TROUGH";
1141
1220
  threshold: number;
1142
1221
  };
1143
1222
  } | {
1144
- type: "price_v1";
1223
+ type: "price";
1145
1224
  data: {
1146
1225
  priceSource: "mark" | "mid";
1147
1226
  symbol: string;
1148
- direction: "ABOVE" | "BELOW";
1149
- threshold: number;
1150
- };
1151
- } | {
1152
- type: "index_v1";
1153
- data: {
1154
- priceSource: "mark" | "mid";
1155
- basket: {
1156
- symbol: string;
1157
- weight: number;
1158
- }[];
1159
- direction: "ABOVE" | "BELOW";
1227
+ track: "PEAK" | "TROUGH";
1160
1228
  threshold: number;
1161
1229
  };
1162
1230
  } | {
1163
- type: "weighted_ratio_v1";
1231
+ type: "weighted_ratio";
1164
1232
  data: {
1165
1233
  priceSource: "mark" | "mid";
1166
1234
  basket: {
@@ -1168,29 +1236,29 @@ declare class Core {
1168
1236
  side: "BUY" | "SELL";
1169
1237
  weight: number;
1170
1238
  }[];
1171
- direction: "ABOVE" | "BELOW";
1239
+ track: "PEAK" | "TROUGH";
1172
1240
  threshold: number;
1173
1241
  };
1174
1242
  } | {
1175
- type: "position_value_v1";
1243
+ type: "notional";
1176
1244
  data: {
1177
1245
  priceSource: "mark" | "mid";
1178
- direction: "ABOVE" | "BELOW";
1246
+ track: "PEAK" | "TROUGH";
1179
1247
  threshold: number;
1180
1248
  };
1181
1249
  } | {
1182
- type: "position_upnl_value_v1";
1250
+ type: "upnl";
1183
1251
  data: {
1184
1252
  priceSource: "mark" | "mid";
1185
- direction: "ABOVE" | "BELOW";
1253
+ track: "PEAK" | "TROUGH";
1186
1254
  threshold: number;
1187
1255
  };
1188
1256
  } | {
1189
- type: "position_upnl_percentage_v1";
1257
+ type: "upnl_bps";
1190
1258
  data: {
1191
1259
  priceSource: "mark" | "mid";
1192
- direction: "ABOVE" | "BELOW";
1193
- threshold_bps: number;
1260
+ track: "PEAK" | "TROUGH";
1261
+ threshold: number;
1194
1262
  };
1195
1263
  };
1196
1264
  context: {
@@ -1240,8 +1308,12 @@ declare class Core {
1240
1308
  } | undefined;
1241
1309
  }[] | undefined;
1242
1310
  trailing?: {
1311
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
1243
1312
  deltaValue: number;
1244
- activationValue: number;
1313
+ activationValue?: number | undefined;
1314
+ bestMetricSeen?: number | undefined;
1315
+ currentStopValue?: number | undefined;
1316
+ stopBreachedAt?: number | undefined;
1245
1317
  } | undefined;
1246
1318
  } | {
1247
1319
  id: string;
@@ -1254,35 +1326,70 @@ declare class Core {
1254
1326
  intent: "CLOSE";
1255
1327
  type: "MARKET";
1256
1328
  condition: {
1257
- type: "ratio_v1";
1329
+ type: "ratio";
1258
1330
  data: {
1259
1331
  priceSource: "mark" | "mid";
1260
1332
  symbol_a: string;
1261
1333
  symbol_b: string;
1262
- direction: "ABOVE" | "BELOW";
1334
+ track: "PEAK" | "TROUGH";
1263
1335
  threshold: number;
1264
1336
  };
1265
1337
  } | {
1266
- type: "price_v1";
1338
+ type: "price";
1267
1339
  data: {
1268
1340
  priceSource: "mark" | "mid";
1269
1341
  symbol: string;
1270
- direction: "ABOVE" | "BELOW";
1342
+ track: "PEAK" | "TROUGH";
1271
1343
  threshold: number;
1272
1344
  };
1273
1345
  } | {
1274
- type: "index_v1";
1346
+ type: "weighted_ratio";
1275
1347
  data: {
1276
1348
  priceSource: "mark" | "mid";
1277
1349
  basket: {
1278
1350
  symbol: string;
1351
+ side: "BUY" | "SELL";
1279
1352
  weight: number;
1280
1353
  }[];
1281
- direction: "ABOVE" | "BELOW";
1354
+ track: "PEAK" | "TROUGH";
1355
+ threshold: number;
1356
+ };
1357
+ } | {
1358
+ type: "notional";
1359
+ data: {
1360
+ priceSource: "mark" | "mid";
1361
+ track: "PEAK" | "TROUGH";
1282
1362
  threshold: number;
1283
1363
  };
1284
1364
  } | {
1285
- type: "weighted_ratio_v1";
1365
+ type: "upnl";
1366
+ data: {
1367
+ priceSource: "mark" | "mid";
1368
+ track: "PEAK" | "TROUGH";
1369
+ threshold: number;
1370
+ };
1371
+ } | {
1372
+ type: "upnl_bps";
1373
+ data: {
1374
+ priceSource: "mark" | "mid";
1375
+ track: "PEAK" | "TROUGH";
1376
+ threshold: number;
1377
+ };
1378
+ } | {
1379
+ type: "ratio_trailing";
1380
+ data: {
1381
+ priceSource: "mark" | "mid";
1382
+ symbol_a: string;
1383
+ symbol_b: string;
1384
+ };
1385
+ } | {
1386
+ type: "price_trailing";
1387
+ data: {
1388
+ priceSource: "mark" | "mid";
1389
+ symbol: string;
1390
+ };
1391
+ } | {
1392
+ type: "weighted_ratio_trailing";
1286
1393
  data: {
1287
1394
  priceSource: "mark" | "mid";
1288
1395
  basket: {
@@ -1290,29 +1397,21 @@ declare class Core {
1290
1397
  side: "BUY" | "SELL";
1291
1398
  weight: number;
1292
1399
  }[];
1293
- direction: "ABOVE" | "BELOW";
1294
- threshold: number;
1295
1400
  };
1296
1401
  } | {
1297
- type: "position_value_v1";
1402
+ type: "notional_trailing";
1298
1403
  data: {
1299
1404
  priceSource: "mark" | "mid";
1300
- direction: "ABOVE" | "BELOW";
1301
- threshold: number;
1302
1405
  };
1303
1406
  } | {
1304
- type: "position_upnl_value_v1";
1407
+ type: "upnl_trailing";
1305
1408
  data: {
1306
1409
  priceSource: "mark" | "mid";
1307
- direction: "ABOVE" | "BELOW";
1308
- threshold: number;
1309
1410
  };
1310
1411
  } | {
1311
- type: "position_upnl_percentage_v1";
1412
+ type: "upnl_bps_trailing";
1312
1413
  data: {
1313
1414
  priceSource: "mark" | "mid";
1314
- direction: "ABOVE" | "BELOW";
1315
- threshold_bps: number;
1316
1415
  };
1317
1416
  };
1318
1417
  context: {
@@ -1349,8 +1448,12 @@ declare class Core {
1349
1448
  } | undefined;
1350
1449
  }[] | undefined;
1351
1450
  trailing?: {
1451
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
1352
1452
  deltaValue: number;
1353
- activationValue: number;
1453
+ activationValue?: number | undefined;
1454
+ bestMetricSeen?: number | undefined;
1455
+ currentStopValue?: number | undefined;
1456
+ stopBreachedAt?: number | undefined;
1354
1457
  } | undefined;
1355
1458
  })[];
1356
1459
  }>;
@@ -1366,35 +1469,24 @@ declare class Core {
1366
1469
  intent: "OPEN";
1367
1470
  type: "MARKET";
1368
1471
  condition: {
1369
- type: "ratio_v1";
1472
+ type: "ratio";
1370
1473
  data: {
1371
1474
  priceSource: "mark" | "mid";
1372
1475
  symbol_a: string;
1373
1476
  symbol_b: string;
1374
- direction: "ABOVE" | "BELOW";
1477
+ track: "PEAK" | "TROUGH";
1375
1478
  threshold: number;
1376
1479
  };
1377
1480
  } | {
1378
- type: "price_v1";
1481
+ type: "price";
1379
1482
  data: {
1380
1483
  priceSource: "mark" | "mid";
1381
1484
  symbol: string;
1382
- direction: "ABOVE" | "BELOW";
1383
- threshold: number;
1384
- };
1385
- } | {
1386
- type: "index_v1";
1387
- data: {
1388
- priceSource: "mark" | "mid";
1389
- basket: {
1390
- symbol: string;
1391
- weight: number;
1392
- }[];
1393
- direction: "ABOVE" | "BELOW";
1485
+ track: "PEAK" | "TROUGH";
1394
1486
  threshold: number;
1395
1487
  };
1396
1488
  } | {
1397
- type: "weighted_ratio_v1";
1489
+ type: "weighted_ratio";
1398
1490
  data: {
1399
1491
  priceSource: "mark" | "mid";
1400
1492
  basket: {
@@ -1402,7 +1494,7 @@ declare class Core {
1402
1494
  side: "BUY" | "SELL";
1403
1495
  weight: number;
1404
1496
  }[];
1405
- direction: "ABOVE" | "BELOW";
1497
+ track: "PEAK" | "TROUGH";
1406
1498
  threshold: number;
1407
1499
  };
1408
1500
  };
@@ -1457,35 +1549,24 @@ declare class Core {
1457
1549
  intent: "ADJUST";
1458
1550
  type: "MARKET";
1459
1551
  condition: {
1460
- type: "ratio_v1";
1552
+ type: "ratio";
1461
1553
  data: {
1462
1554
  priceSource: "mark" | "mid";
1463
1555
  symbol_a: string;
1464
1556
  symbol_b: string;
1465
- direction: "ABOVE" | "BELOW";
1557
+ track: "PEAK" | "TROUGH";
1466
1558
  threshold: number;
1467
1559
  };
1468
1560
  } | {
1469
- type: "price_v1";
1561
+ type: "price";
1470
1562
  data: {
1471
1563
  priceSource: "mark" | "mid";
1472
1564
  symbol: string;
1473
- direction: "ABOVE" | "BELOW";
1474
- threshold: number;
1475
- };
1476
- } | {
1477
- type: "index_v1";
1478
- data: {
1479
- priceSource: "mark" | "mid";
1480
- basket: {
1481
- symbol: string;
1482
- weight: number;
1483
- }[];
1484
- direction: "ABOVE" | "BELOW";
1565
+ track: "PEAK" | "TROUGH";
1485
1566
  threshold: number;
1486
1567
  };
1487
1568
  } | {
1488
- type: "weighted_ratio_v1";
1569
+ type: "weighted_ratio";
1489
1570
  data: {
1490
1571
  priceSource: "mark" | "mid";
1491
1572
  basket: {
@@ -1493,29 +1574,29 @@ declare class Core {
1493
1574
  side: "BUY" | "SELL";
1494
1575
  weight: number;
1495
1576
  }[];
1496
- direction: "ABOVE" | "BELOW";
1577
+ track: "PEAK" | "TROUGH";
1497
1578
  threshold: number;
1498
1579
  };
1499
1580
  } | {
1500
- type: "position_value_v1";
1581
+ type: "notional";
1501
1582
  data: {
1502
1583
  priceSource: "mark" | "mid";
1503
- direction: "ABOVE" | "BELOW";
1584
+ track: "PEAK" | "TROUGH";
1504
1585
  threshold: number;
1505
1586
  };
1506
1587
  } | {
1507
- type: "position_upnl_value_v1";
1588
+ type: "upnl";
1508
1589
  data: {
1509
1590
  priceSource: "mark" | "mid";
1510
- direction: "ABOVE" | "BELOW";
1591
+ track: "PEAK" | "TROUGH";
1511
1592
  threshold: number;
1512
1593
  };
1513
1594
  } | {
1514
- type: "position_upnl_percentage_v1";
1595
+ type: "upnl_bps";
1515
1596
  data: {
1516
1597
  priceSource: "mark" | "mid";
1517
- direction: "ABOVE" | "BELOW";
1518
- threshold_bps: number;
1598
+ track: "PEAK" | "TROUGH";
1599
+ threshold: number;
1519
1600
  };
1520
1601
  };
1521
1602
  context: {
@@ -1565,8 +1646,12 @@ declare class Core {
1565
1646
  } | undefined;
1566
1647
  }[] | undefined;
1567
1648
  trailing?: {
1649
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
1568
1650
  deltaValue: number;
1569
- activationValue: number;
1651
+ activationValue?: number | undefined;
1652
+ bestMetricSeen?: number | undefined;
1653
+ currentStopValue?: number | undefined;
1654
+ stopBreachedAt?: number | undefined;
1570
1655
  } | undefined;
1571
1656
  } | {
1572
1657
  id: string;
@@ -1579,35 +1664,70 @@ declare class Core {
1579
1664
  intent: "CLOSE";
1580
1665
  type: "MARKET";
1581
1666
  condition: {
1582
- type: "ratio_v1";
1667
+ type: "ratio";
1583
1668
  data: {
1584
1669
  priceSource: "mark" | "mid";
1585
1670
  symbol_a: string;
1586
1671
  symbol_b: string;
1587
- direction: "ABOVE" | "BELOW";
1672
+ track: "PEAK" | "TROUGH";
1588
1673
  threshold: number;
1589
1674
  };
1590
1675
  } | {
1591
- type: "price_v1";
1676
+ type: "price";
1592
1677
  data: {
1593
1678
  priceSource: "mark" | "mid";
1594
1679
  symbol: string;
1595
- direction: "ABOVE" | "BELOW";
1680
+ track: "PEAK" | "TROUGH";
1596
1681
  threshold: number;
1597
1682
  };
1598
1683
  } | {
1599
- type: "index_v1";
1684
+ type: "weighted_ratio";
1600
1685
  data: {
1601
1686
  priceSource: "mark" | "mid";
1602
1687
  basket: {
1603
1688
  symbol: string;
1689
+ side: "BUY" | "SELL";
1604
1690
  weight: number;
1605
1691
  }[];
1606
- direction: "ABOVE" | "BELOW";
1692
+ track: "PEAK" | "TROUGH";
1607
1693
  threshold: number;
1608
1694
  };
1609
1695
  } | {
1610
- type: "weighted_ratio_v1";
1696
+ type: "notional";
1697
+ data: {
1698
+ priceSource: "mark" | "mid";
1699
+ track: "PEAK" | "TROUGH";
1700
+ threshold: number;
1701
+ };
1702
+ } | {
1703
+ type: "upnl";
1704
+ data: {
1705
+ priceSource: "mark" | "mid";
1706
+ track: "PEAK" | "TROUGH";
1707
+ threshold: number;
1708
+ };
1709
+ } | {
1710
+ type: "upnl_bps";
1711
+ data: {
1712
+ priceSource: "mark" | "mid";
1713
+ track: "PEAK" | "TROUGH";
1714
+ threshold: number;
1715
+ };
1716
+ } | {
1717
+ type: "ratio_trailing";
1718
+ data: {
1719
+ priceSource: "mark" | "mid";
1720
+ symbol_a: string;
1721
+ symbol_b: string;
1722
+ };
1723
+ } | {
1724
+ type: "price_trailing";
1725
+ data: {
1726
+ priceSource: "mark" | "mid";
1727
+ symbol: string;
1728
+ };
1729
+ } | {
1730
+ type: "weighted_ratio_trailing";
1611
1731
  data: {
1612
1732
  priceSource: "mark" | "mid";
1613
1733
  basket: {
@@ -1615,29 +1735,21 @@ declare class Core {
1615
1735
  side: "BUY" | "SELL";
1616
1736
  weight: number;
1617
1737
  }[];
1618
- direction: "ABOVE" | "BELOW";
1619
- threshold: number;
1620
1738
  };
1621
1739
  } | {
1622
- type: "position_value_v1";
1740
+ type: "notional_trailing";
1623
1741
  data: {
1624
1742
  priceSource: "mark" | "mid";
1625
- direction: "ABOVE" | "BELOW";
1626
- threshold: number;
1627
1743
  };
1628
1744
  } | {
1629
- type: "position_upnl_value_v1";
1745
+ type: "upnl_trailing";
1630
1746
  data: {
1631
1747
  priceSource: "mark" | "mid";
1632
- direction: "ABOVE" | "BELOW";
1633
- threshold: number;
1634
1748
  };
1635
1749
  } | {
1636
- type: "position_upnl_percentage_v1";
1750
+ type: "upnl_bps_trailing";
1637
1751
  data: {
1638
1752
  priceSource: "mark" | "mid";
1639
- direction: "ABOVE" | "BELOW";
1640
- threshold_bps: number;
1641
1753
  };
1642
1754
  };
1643
1755
  context: {
@@ -1674,8 +1786,12 @@ declare class Core {
1674
1786
  } | undefined;
1675
1787
  }[] | undefined;
1676
1788
  trailing?: {
1789
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
1677
1790
  deltaValue: number;
1678
- activationValue: number;
1791
+ activationValue?: number | undefined;
1792
+ bestMetricSeen?: number | undefined;
1793
+ currentStopValue?: number | undefined;
1794
+ stopBreachedAt?: number | undefined;
1679
1795
  } | undefined;
1680
1796
  };
1681
1797
  }>;
@@ -1691,35 +1807,24 @@ declare class Core {
1691
1807
  intent: "OPEN";
1692
1808
  type: "MARKET";
1693
1809
  condition: {
1694
- type: "ratio_v1";
1810
+ type: "ratio";
1695
1811
  data: {
1696
1812
  priceSource: "mark" | "mid";
1697
1813
  symbol_a: string;
1698
1814
  symbol_b: string;
1699
- direction: "ABOVE" | "BELOW";
1815
+ track: "PEAK" | "TROUGH";
1700
1816
  threshold: number;
1701
1817
  };
1702
1818
  } | {
1703
- type: "price_v1";
1819
+ type: "price";
1704
1820
  data: {
1705
1821
  priceSource: "mark" | "mid";
1706
1822
  symbol: string;
1707
- direction: "ABOVE" | "BELOW";
1823
+ track: "PEAK" | "TROUGH";
1708
1824
  threshold: number;
1709
1825
  };
1710
1826
  } | {
1711
- type: "index_v1";
1712
- data: {
1713
- priceSource: "mark" | "mid";
1714
- basket: {
1715
- symbol: string;
1716
- weight: number;
1717
- }[];
1718
- direction: "ABOVE" | "BELOW";
1719
- threshold: number;
1720
- };
1721
- } | {
1722
- type: "weighted_ratio_v1";
1827
+ type: "weighted_ratio";
1723
1828
  data: {
1724
1829
  priceSource: "mark" | "mid";
1725
1830
  basket: {
@@ -1727,7 +1832,7 @@ declare class Core {
1727
1832
  side: "BUY" | "SELL";
1728
1833
  weight: number;
1729
1834
  }[];
1730
- direction: "ABOVE" | "BELOW";
1835
+ track: "PEAK" | "TROUGH";
1731
1836
  threshold: number;
1732
1837
  };
1733
1838
  };
@@ -1782,35 +1887,24 @@ declare class Core {
1782
1887
  intent: "ADJUST";
1783
1888
  type: "MARKET";
1784
1889
  condition: {
1785
- type: "ratio_v1";
1890
+ type: "ratio";
1786
1891
  data: {
1787
1892
  priceSource: "mark" | "mid";
1788
1893
  symbol_a: string;
1789
1894
  symbol_b: string;
1790
- direction: "ABOVE" | "BELOW";
1895
+ track: "PEAK" | "TROUGH";
1791
1896
  threshold: number;
1792
1897
  };
1793
1898
  } | {
1794
- type: "price_v1";
1899
+ type: "price";
1795
1900
  data: {
1796
1901
  priceSource: "mark" | "mid";
1797
1902
  symbol: string;
1798
- direction: "ABOVE" | "BELOW";
1799
- threshold: number;
1800
- };
1801
- } | {
1802
- type: "index_v1";
1803
- data: {
1804
- priceSource: "mark" | "mid";
1805
- basket: {
1806
- symbol: string;
1807
- weight: number;
1808
- }[];
1809
- direction: "ABOVE" | "BELOW";
1903
+ track: "PEAK" | "TROUGH";
1810
1904
  threshold: number;
1811
1905
  };
1812
1906
  } | {
1813
- type: "weighted_ratio_v1";
1907
+ type: "weighted_ratio";
1814
1908
  data: {
1815
1909
  priceSource: "mark" | "mid";
1816
1910
  basket: {
@@ -1818,29 +1912,29 @@ declare class Core {
1818
1912
  side: "BUY" | "SELL";
1819
1913
  weight: number;
1820
1914
  }[];
1821
- direction: "ABOVE" | "BELOW";
1915
+ track: "PEAK" | "TROUGH";
1822
1916
  threshold: number;
1823
1917
  };
1824
1918
  } | {
1825
- type: "position_value_v1";
1919
+ type: "notional";
1826
1920
  data: {
1827
1921
  priceSource: "mark" | "mid";
1828
- direction: "ABOVE" | "BELOW";
1922
+ track: "PEAK" | "TROUGH";
1829
1923
  threshold: number;
1830
1924
  };
1831
1925
  } | {
1832
- type: "position_upnl_value_v1";
1926
+ type: "upnl";
1833
1927
  data: {
1834
1928
  priceSource: "mark" | "mid";
1835
- direction: "ABOVE" | "BELOW";
1929
+ track: "PEAK" | "TROUGH";
1836
1930
  threshold: number;
1837
1931
  };
1838
1932
  } | {
1839
- type: "position_upnl_percentage_v1";
1933
+ type: "upnl_bps";
1840
1934
  data: {
1841
1935
  priceSource: "mark" | "mid";
1842
- direction: "ABOVE" | "BELOW";
1843
- threshold_bps: number;
1936
+ track: "PEAK" | "TROUGH";
1937
+ threshold: number;
1844
1938
  };
1845
1939
  };
1846
1940
  context: {
@@ -1890,8 +1984,12 @@ declare class Core {
1890
1984
  } | undefined;
1891
1985
  }[] | undefined;
1892
1986
  trailing?: {
1987
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
1893
1988
  deltaValue: number;
1894
- activationValue: number;
1989
+ activationValue?: number | undefined;
1990
+ bestMetricSeen?: number | undefined;
1991
+ currentStopValue?: number | undefined;
1992
+ stopBreachedAt?: number | undefined;
1895
1993
  } | undefined;
1896
1994
  } | {
1897
1995
  id: string;
@@ -1904,35 +2002,70 @@ declare class Core {
1904
2002
  intent: "CLOSE";
1905
2003
  type: "MARKET";
1906
2004
  condition: {
1907
- type: "ratio_v1";
2005
+ type: "ratio";
1908
2006
  data: {
1909
2007
  priceSource: "mark" | "mid";
1910
2008
  symbol_a: string;
1911
2009
  symbol_b: string;
1912
- direction: "ABOVE" | "BELOW";
2010
+ track: "PEAK" | "TROUGH";
1913
2011
  threshold: number;
1914
2012
  };
1915
2013
  } | {
1916
- type: "price_v1";
2014
+ type: "price";
1917
2015
  data: {
1918
2016
  priceSource: "mark" | "mid";
1919
2017
  symbol: string;
1920
- direction: "ABOVE" | "BELOW";
2018
+ track: "PEAK" | "TROUGH";
1921
2019
  threshold: number;
1922
2020
  };
1923
2021
  } | {
1924
- type: "index_v1";
2022
+ type: "weighted_ratio";
1925
2023
  data: {
1926
2024
  priceSource: "mark" | "mid";
1927
2025
  basket: {
1928
2026
  symbol: string;
2027
+ side: "BUY" | "SELL";
1929
2028
  weight: number;
1930
2029
  }[];
1931
- direction: "ABOVE" | "BELOW";
2030
+ track: "PEAK" | "TROUGH";
1932
2031
  threshold: number;
1933
2032
  };
1934
2033
  } | {
1935
- type: "weighted_ratio_v1";
2034
+ type: "notional";
2035
+ data: {
2036
+ priceSource: "mark" | "mid";
2037
+ track: "PEAK" | "TROUGH";
2038
+ threshold: number;
2039
+ };
2040
+ } | {
2041
+ type: "upnl";
2042
+ data: {
2043
+ priceSource: "mark" | "mid";
2044
+ track: "PEAK" | "TROUGH";
2045
+ threshold: number;
2046
+ };
2047
+ } | {
2048
+ type: "upnl_bps";
2049
+ data: {
2050
+ priceSource: "mark" | "mid";
2051
+ track: "PEAK" | "TROUGH";
2052
+ threshold: number;
2053
+ };
2054
+ } | {
2055
+ type: "ratio_trailing";
2056
+ data: {
2057
+ priceSource: "mark" | "mid";
2058
+ symbol_a: string;
2059
+ symbol_b: string;
2060
+ };
2061
+ } | {
2062
+ type: "price_trailing";
2063
+ data: {
2064
+ priceSource: "mark" | "mid";
2065
+ symbol: string;
2066
+ };
2067
+ } | {
2068
+ type: "weighted_ratio_trailing";
1936
2069
  data: {
1937
2070
  priceSource: "mark" | "mid";
1938
2071
  basket: {
@@ -1940,29 +2073,21 @@ declare class Core {
1940
2073
  side: "BUY" | "SELL";
1941
2074
  weight: number;
1942
2075
  }[];
1943
- direction: "ABOVE" | "BELOW";
1944
- threshold: number;
1945
2076
  };
1946
2077
  } | {
1947
- type: "position_value_v1";
2078
+ type: "notional_trailing";
1948
2079
  data: {
1949
2080
  priceSource: "mark" | "mid";
1950
- direction: "ABOVE" | "BELOW";
1951
- threshold: number;
1952
2081
  };
1953
2082
  } | {
1954
- type: "position_upnl_value_v1";
2083
+ type: "upnl_trailing";
1955
2084
  data: {
1956
2085
  priceSource: "mark" | "mid";
1957
- direction: "ABOVE" | "BELOW";
1958
- threshold: number;
1959
2086
  };
1960
2087
  } | {
1961
- type: "position_upnl_percentage_v1";
2088
+ type: "upnl_bps_trailing";
1962
2089
  data: {
1963
2090
  priceSource: "mark" | "mid";
1964
- direction: "ABOVE" | "BELOW";
1965
- threshold_bps: number;
1966
2091
  };
1967
2092
  };
1968
2093
  context: {
@@ -1999,8 +2124,12 @@ declare class Core {
1999
2124
  } | undefined;
2000
2125
  }[] | undefined;
2001
2126
  trailing?: {
2127
+ mode: "RELATIVE_BPS" | "ABSOLUTE_POINTS";
2002
2128
  deltaValue: number;
2003
- activationValue: number;
2129
+ activationValue?: number | undefined;
2130
+ bestMetricSeen?: number | undefined;
2131
+ currentStopValue?: number | undefined;
2132
+ stopBreachedAt?: number | undefined;
2004
2133
  } | undefined;
2005
2134
  };
2006
2135
  }>;
@@ -123,6 +123,15 @@ class Core {
123
123
  });
124
124
  }
125
125
  };
126
+ rebalance = {
127
+ manually: async (positionId, body, headers) => {
128
+ return await this.client.fetch(`/rebalance/manually/${positionId}`, {
129
+ method: "POST",
130
+ headers,
131
+ body
132
+ });
133
+ }
134
+ };
126
135
  schedules = {
127
136
  list: async (query, headers) => {
128
137
  return await this.client.fetch(`/schedules`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/core-sdk",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Pear Protocol Core SDK",
5
5
  "private": false,
6
6
  "type": "module",
@@ -25,8 +25,8 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@pear-protocol/types": "^0.0.18",
29
- "@pear-protocol/utils": "^0.0.18",
28
+ "@pear-protocol/types": "^0.0.20",
29
+ "@pear-protocol/utils": "^0.0.20",
30
30
  "qs": "^6.14.0"
31
31
  },
32
32
  "devDependencies": {