@stryke-xyz/premarket-sdk 1.2.6 → 1.2.8
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/README.md +40 -0
- package/dist/cjs/api/orderbook-api/deserializers.js +3 -0
- package/dist/cjs/package.json +1 -1
- package/dist/esm/api/orderbook-api/deserializers.js +3 -0
- package/dist/esm/package.json +1 -1
- package/dist/types/api/orderbook-api/deserializers.d.ts +3 -0
- package/dist/types/shared/types.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -894,6 +894,9 @@ export interface BaseMarket {
|
|
|
894
894
|
Public exports:
|
|
895
895
|
|
|
896
896
|
- `UserPosition` — raw position fields (holding, cost, proceeds, PnL)
|
|
897
|
+
- `totalCost` is lifetime accumulated cost.
|
|
898
|
+
- `openCostBasis` is the current open-position basis.
|
|
899
|
+
- `avgEntryPrice` is derived from `openCostBasis / holding`.
|
|
897
900
|
- `EventEnrichment` — optional market/instrument metadata attached to positions
|
|
898
901
|
and history events (`collateralSymbol`, `marketId`, `marketName`,
|
|
899
902
|
`instrumentName`, `logoUri`, `collateralDecimals`, `collateralToken`)
|
|
@@ -901,6 +904,23 @@ Public exports:
|
|
|
901
904
|
additional instrument fields:
|
|
902
905
|
|
|
903
906
|
```ts
|
|
907
|
+
export type CostBasisMethod = "weighted_average";
|
|
908
|
+
|
|
909
|
+
export interface UserPosition {
|
|
910
|
+
id: string;
|
|
911
|
+
tokenId: string;
|
|
912
|
+
holding: string;
|
|
913
|
+
totalCost: string;
|
|
914
|
+
openCostBasis: string;
|
|
915
|
+
avgEntryPrice: string; // collateral per 1 PRM/oPRM, scaled by 1e18
|
|
916
|
+
costBasisMethod: CostBasisMethod;
|
|
917
|
+
totalProceeds: string;
|
|
918
|
+
realizedPnL: string;
|
|
919
|
+
tradePnl: string;
|
|
920
|
+
redeemExercisePnl: string;
|
|
921
|
+
updatedAt: string;
|
|
922
|
+
}
|
|
923
|
+
|
|
904
924
|
export interface EnrichedPosition extends UserPosition, EventEnrichment {
|
|
905
925
|
isOpen: boolean; // true when holding > 0
|
|
906
926
|
isOPrm: boolean; // true = oPRM (outcome), false = PRM (write/minted)
|
|
@@ -950,6 +970,26 @@ export interface EnrichedPositionsResponse {
|
|
|
950
970
|
- `TokenPnL`
|
|
951
971
|
- `Erc20PnL`
|
|
952
972
|
|
|
973
|
+
```ts
|
|
974
|
+
export interface TokenPnL {
|
|
975
|
+
tokenId: string;
|
|
976
|
+
position: {
|
|
977
|
+
holding: string;
|
|
978
|
+
totalCost: string;
|
|
979
|
+
openCostBasis: string;
|
|
980
|
+
avgEntryPrice: string; // collateral per 1 PRM/oPRM, scaled by 1e18
|
|
981
|
+
costBasisMethod: "weighted_average";
|
|
982
|
+
totalProceeds: string;
|
|
983
|
+
realizedPnL: string;
|
|
984
|
+
} | null;
|
|
985
|
+
trading: TradingPnL | null;
|
|
986
|
+
redeemExercise: SettlementPnL | null;
|
|
987
|
+
tradePnl: string;
|
|
988
|
+
redeemExercisePnl: string;
|
|
989
|
+
totalPnl: string;
|
|
990
|
+
}
|
|
991
|
+
```
|
|
992
|
+
|
|
953
993
|
### History DTOs
|
|
954
994
|
|
|
955
995
|
Public exports:
|
|
@@ -221,6 +221,9 @@ function submarketToBigInt(submarket) {
|
|
|
221
221
|
tokenId: BigInt(pos.tokenId),
|
|
222
222
|
holding: BigInt(pos.holding),
|
|
223
223
|
totalCost: BigInt(pos.totalCost),
|
|
224
|
+
openCostBasis: BigInt(pos.openCostBasis),
|
|
225
|
+
avgEntryPrice: BigInt(pos.avgEntryPrice),
|
|
226
|
+
costBasisMethod: pos.costBasisMethod,
|
|
224
227
|
totalProceeds: BigInt(pos.totalProceeds),
|
|
225
228
|
realizedPnL: BigInt(pos.realizedPnL),
|
|
226
229
|
updatedAt: BigInt(pos.updatedAt)
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.7","type":"commonjs"}
|
|
@@ -179,6 +179,9 @@ function submarketToBigInt(submarket) {
|
|
|
179
179
|
tokenId: BigInt(pos.tokenId),
|
|
180
180
|
holding: BigInt(pos.holding),
|
|
181
181
|
totalCost: BigInt(pos.totalCost),
|
|
182
|
+
openCostBasis: BigInt(pos.openCostBasis),
|
|
183
|
+
avgEntryPrice: BigInt(pos.avgEntryPrice),
|
|
184
|
+
costBasisMethod: pos.costBasisMethod,
|
|
182
185
|
totalProceeds: BigInt(pos.totalProceeds),
|
|
183
186
|
realizedPnL: BigInt(pos.realizedPnL),
|
|
184
187
|
updatedAt: BigInt(pos.updatedAt)
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.7","type":"module"}
|
|
@@ -123,6 +123,9 @@ export declare function positionToBigInt(pos: UserPosition): {
|
|
|
123
123
|
tokenId: bigint;
|
|
124
124
|
holding: bigint;
|
|
125
125
|
totalCost: bigint;
|
|
126
|
+
openCostBasis: bigint;
|
|
127
|
+
avgEntryPrice: bigint;
|
|
128
|
+
costBasisMethod: "weighted_average";
|
|
126
129
|
totalProceeds: bigint;
|
|
127
130
|
realizedPnL: bigint;
|
|
128
131
|
updatedAt: bigint;
|
|
@@ -234,11 +234,15 @@ export interface MarketsResponse {
|
|
|
234
234
|
total: number;
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
+
export type CostBasisMethod = "weighted_average";
|
|
237
238
|
export interface UserPosition {
|
|
238
239
|
id: string;
|
|
239
240
|
tokenId: string;
|
|
240
241
|
holding: string;
|
|
241
242
|
totalCost: string;
|
|
243
|
+
openCostBasis: string;
|
|
244
|
+
avgEntryPrice: string;
|
|
245
|
+
costBasisMethod: CostBasisMethod;
|
|
242
246
|
totalProceeds: string;
|
|
243
247
|
realizedPnL: string;
|
|
244
248
|
/** PnL contribution from limit-order trades */
|
|
@@ -322,6 +326,9 @@ export interface TokenPnL {
|
|
|
322
326
|
position: {
|
|
323
327
|
holding: string;
|
|
324
328
|
totalCost: string;
|
|
329
|
+
openCostBasis: string;
|
|
330
|
+
avgEntryPrice: string;
|
|
331
|
+
costBasisMethod: CostBasisMethod;
|
|
325
332
|
totalProceeds: string;
|
|
326
333
|
realizedPnL: string;
|
|
327
334
|
} | null;
|