@pear-protocol/types 2.20.0 → 2.22.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/bundle.d.ts +1 -0
- package/dist/fee/entities.d.ts +1 -0
- package/dist/fee/responses.d.ts +26 -0
- package/dist/index.js +7355 -3
- package/dist/rewards/entities.d.ts +28 -0
- package/dist/rewards/payloads.d.ts +7 -0
- package/dist/rewards/responses.d.ts +73 -0
- package/dist/statistics/queries.d.ts +25 -0
- package/dist/statistics/responses.d.ts +120 -0
- package/dist/sync/responses.d.ts +1 -0
- package/dist/users/entities.d.ts +4 -0
- package/dist/users/response.d.ts +3 -0
- package/package.json +4 -3
- package/dist/auth/api-keys.js +0 -44
- package/dist/auth/entities.js +0 -25
- package/dist/auth/index.js +0 -4
- package/dist/auth/payloads.js +0 -84
- package/dist/auth/response.js +0 -82
- package/dist/baskets/recommended/entities.js +0 -22
- package/dist/baskets/recommended/index.js +0 -2
- package/dist/baskets/recommended/responses.js +0 -8
- package/dist/baskets/saved/entities.js +0 -23
- package/dist/baskets/saved/payloads.js +0 -18
- package/dist/baskets/saved/responses.js +0 -14
- package/dist/bundle.js +0 -36
- package/dist/common/address.js +0 -5
- package/dist/common/array.js +0 -17
- package/dist/common/client-id.js +0 -5
- package/dist/common/hex-string.js +0 -5
- package/dist/common/index.js +0 -4
- package/dist/common/refinement.js +0 -64
- package/dist/common/request.js +0 -24
- package/dist/common/response.js +0 -28
- package/dist/common/schema.js +0 -18
- package/dist/common/trade-legs.js +0 -50
- package/dist/connector/index.js +0 -12
- package/dist/copy/entities.js +0 -151
- package/dist/copy/index.js +0 -5
- package/dist/copy/payloads.js +0 -8
- package/dist/copy/performance.js +0 -63
- package/dist/copy/queries.js +0 -20
- package/dist/copy/responses.js +0 -89
- package/dist/execution/entities.js +0 -196
- package/dist/execution/index.js +0 -3
- package/dist/execution/queries.js +0 -18
- package/dist/execution/responses.js +0 -12
- package/dist/fee/entities.js +0 -34
- package/dist/fee/index.js +0 -3
- package/dist/fee/queries.js +0 -12
- package/dist/fee/responses.js +0 -29
- package/dist/fill/entities.js +0 -82
- package/dist/fill/index.js +0 -3
- package/dist/fill/queries.js +0 -14
- package/dist/fill/responses.js +0 -23
- package/dist/funding/entities.js +0 -16
- package/dist/funding/index.js +0 -3
- package/dist/funding/queries.js +0 -8
- package/dist/funding/responses.js +0 -11
- package/dist/instrument/entities.js +0 -102
- package/dist/instrument/index.js +0 -3
- package/dist/instrument/queries.js +0 -15
- package/dist/instrument/responses.js +0 -20
- package/dist/instrument-precision/index.js +0 -56
- package/dist/ladder/entities.js +0 -24
- package/dist/ladder/index.js +0 -4
- package/dist/ladder/payloads.js +0 -96
- package/dist/ladder/queries.js +0 -12
- package/dist/ladder/responses.js +0 -18
- package/dist/leverage/index.js +0 -2
- package/dist/leverage/payloads.js +0 -14
- package/dist/leverage/response.js +0 -5
- package/dist/margin/index.js +0 -2
- package/dist/margin/payloads.js +0 -20
- package/dist/margin/response.js +0 -11
- package/dist/market/entities.js +0 -52
- package/dist/market/index.js +0 -4
- package/dist/market/payloads.js +0 -11
- package/dist/market/queries.js +0 -19
- package/dist/market/responses.js +0 -18
- package/dist/misc/index.js +0 -2
- package/dist/misc/payloads.js +0 -99
- package/dist/misc/responses.js +0 -85
- package/dist/notification/entities.js +0 -274
- package/dist/notification/index.js +0 -4
- package/dist/notification/payloads.js +0 -15
- package/dist/notification/queries.js +0 -29
- package/dist/notification/responses.js +0 -20
- package/dist/order/entities.js +0 -81
- package/dist/order/index.js +0 -1
- package/dist/portfolio/entities.js +0 -77
- package/dist/portfolio/index.js +0 -3
- package/dist/portfolio/queries.js +0 -34
- package/dist/portfolio/responses.js +0 -33
- package/dist/position/entities.js +0 -433
- package/dist/position/index.js +0 -3
- package/dist/position/queries.js +0 -109
- package/dist/position/responses.js +0 -41
- package/dist/price/entities.js +0 -10
- package/dist/price/index.js +0 -3
- package/dist/price/queries.js +0 -8
- package/dist/price/responses.js +0 -15
- package/dist/realtime/channels.js +0 -16
- package/dist/realtime/frames.js +0 -140
- package/dist/realtime/index.js +0 -6
- package/dist/realtime/messages.js +0 -118
- package/dist/realtime/public-events.js +0 -92
- package/dist/realtime/user-events.js +0 -32
- package/dist/realtime/vault-events.js +0 -42
- package/dist/rebalance/entities.js +0 -86
- package/dist/rebalance/index.js +0 -4
- package/dist/rebalance/payloads.js +0 -56
- package/dist/rebalance/queries.js +0 -14
- package/dist/rebalance/responses.js +0 -41
- package/dist/schedule/entities.js +0 -239
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/payloads.js +0 -85
- package/dist/schedule/queries.js +0 -30
- package/dist/schedule/randomization.js +0 -15
- package/dist/schedule/responses.js +0 -22
- package/dist/schedule/twap-config.js +0 -29
- package/dist/statistics/entities.js +0 -105
- package/dist/statistics/index.js +0 -3
- package/dist/statistics/queries.js +0 -93
- package/dist/statistics/responses.js +0 -17
- package/dist/sync/index.js +0 -2
- package/dist/sync/payloads.js +0 -136
- package/dist/sync/responses.js +0 -26
- package/dist/tca/entities.js +0 -9
- package/dist/tca/index.js +0 -3
- package/dist/tca/queries.js +0 -14
- package/dist/tca/responses.js +0 -126
- package/dist/trade/entities.js +0 -101
- package/dist/trade/index.js +0 -4
- package/dist/trade/payloads.js +0 -84
- package/dist/trade/queries.js +0 -9
- package/dist/trade/responses.js +0 -25
- package/dist/trade-accounts/entities.js +0 -61
- package/dist/trade-accounts/index.js +0 -4
- package/dist/trade-accounts/payloads.js +0 -132
- package/dist/trade-accounts/queries.js +0 -7
- package/dist/trade-accounts/response.js +0 -79
- package/dist/traders/index.js +0 -2
- package/dist/traders/performance.js +0 -21
- package/dist/traders/public.js +0 -192
- package/dist/trigger/common/index.js +0 -39
- package/dist/trigger/entities/conditions.js +0 -174
- package/dist/trigger/entities/index.js +0 -257
- package/dist/trigger/index.js +0 -9
- package/dist/trigger/oracle.js +0 -22
- package/dist/trigger/payloads/conditions.js +0 -213
- package/dist/trigger/payloads/config.js +0 -3
- package/dist/trigger/payloads/index.js +0 -173
- package/dist/trigger/queries.js +0 -16
- package/dist/trigger/refinement/index.js +0 -2
- package/dist/trigger/refinement/static.refinement.js +0 -50
- package/dist/trigger/refinement/trailing.refinement.js +0 -83
- package/dist/trigger/responses.js +0 -18
- package/dist/triggers/entities.js +0 -27
- package/dist/triggers/index.js +0 -3
- package/dist/triggers/queries.js +0 -10
- package/dist/triggers/responses.js +0 -9
- package/dist/users/entities.js +0 -45
- package/dist/users/index.js +0 -4
- package/dist/users/payloads.js +0 -33
- package/dist/users/queries.js +0 -8
- package/dist/users/response.js +0 -27
- package/dist/vaults/entities.js +0 -96
- package/dist/vaults/index.js +0 -4
- package/dist/vaults/payloads.js +0 -65
- package/dist/vaults/queries.js +0 -66
- package/dist/vaults/responses.js +0 -368
- /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { EthereumAddress } from '../common/address';
|
|
3
|
-
import { HexString } from '../common/hex-string';
|
|
4
|
-
|
|
5
|
-
const CreateHyperliquidCredentials = z.object({
|
|
6
|
-
signer_key: HexString
|
|
7
|
-
});
|
|
8
|
-
const CreateHyperliquidMetadata = z.object({
|
|
9
|
-
agentWalletAddress: EthereumAddress,
|
|
10
|
-
isSubaccount: z.boolean(),
|
|
11
|
-
mainAccountAddress: EthereumAddress
|
|
12
|
-
});
|
|
13
|
-
const BinanceApiKeyPair = z.object({
|
|
14
|
-
api_key: z.string().min(1, "API key is required"),
|
|
15
|
-
api_secret: z.string().min(1, "API secret is required")
|
|
16
|
-
});
|
|
17
|
-
const CreateBinanceCredentials = z.object({
|
|
18
|
-
read: BinanceApiKeyPair,
|
|
19
|
-
write: BinanceApiKeyPair
|
|
20
|
-
});
|
|
21
|
-
const CreateBybitCredentials = z.object({
|
|
22
|
-
api_key: z.string().min(1, "API key is required"),
|
|
23
|
-
api_secret: z.string().min(1, "API secret is required")
|
|
24
|
-
});
|
|
25
|
-
const CreateOkxCredentials = z.object({
|
|
26
|
-
api_key: z.string().min(1, "API key is required"),
|
|
27
|
-
api_secret: z.string().min(1, "API secret is required"),
|
|
28
|
-
api_pass: z.string().min(1, "API passphrase is required")
|
|
29
|
-
});
|
|
30
|
-
const CreateLighterCredentials = z.object({
|
|
31
|
-
api_private_key: z.string().min(1, "API private key is required"),
|
|
32
|
-
api_key_index: z.number().int().min(4, "API key slots 0-3 are reserved; use 4-254").max(254, "API key index must be <= 254")
|
|
33
|
-
});
|
|
34
|
-
const CreateLighterMetadata = z.object({
|
|
35
|
-
l1_address: EthereumAddress
|
|
36
|
-
});
|
|
37
|
-
const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
|
|
38
|
-
const CreateHyperliquidAccount = z.object({
|
|
39
|
-
connector: z.literal("hyperliquid"),
|
|
40
|
-
alias: AccountAlias,
|
|
41
|
-
exchangeIdentifier: EthereumAddress,
|
|
42
|
-
credentials: CreateHyperliquidCredentials,
|
|
43
|
-
metadata: CreateHyperliquidMetadata
|
|
44
|
-
});
|
|
45
|
-
const CreateBinanceAccount = z.object({
|
|
46
|
-
connector: z.literal("binance"),
|
|
47
|
-
alias: AccountAlias,
|
|
48
|
-
credentials: CreateBinanceCredentials,
|
|
49
|
-
metadata: z.void({}).transform(() => void 0)
|
|
50
|
-
});
|
|
51
|
-
const CreateBybitAccount = z.object({
|
|
52
|
-
connector: z.literal("bybit"),
|
|
53
|
-
alias: AccountAlias,
|
|
54
|
-
credentials: CreateBybitCredentials,
|
|
55
|
-
metadata: z.void({}).transform(() => void 0)
|
|
56
|
-
});
|
|
57
|
-
const CreateOkxAccount = z.object({
|
|
58
|
-
connector: z.literal("okx"),
|
|
59
|
-
alias: AccountAlias,
|
|
60
|
-
credentials: CreateOkxCredentials,
|
|
61
|
-
metadata: z.void({}).transform(() => void 0)
|
|
62
|
-
});
|
|
63
|
-
const CreateLighterAccount = z.object({
|
|
64
|
-
connector: z.literal("lighter"),
|
|
65
|
-
alias: AccountAlias,
|
|
66
|
-
exchangeIdentifier: z.string().regex(/^\d+$/, "Exchange identifier must be the numeric Lighter account index"),
|
|
67
|
-
credentials: CreateLighterCredentials,
|
|
68
|
-
metadata: CreateLighterMetadata
|
|
69
|
-
});
|
|
70
|
-
const CreateLighterRhcAccount = CreateLighterAccount.extend({
|
|
71
|
-
connector: z.literal("lighter_rhc")
|
|
72
|
-
});
|
|
73
|
-
const UpdateHyperliquidAccount = z.object({
|
|
74
|
-
connector: z.literal("hyperliquid"),
|
|
75
|
-
alias: AccountAlias.optional(),
|
|
76
|
-
credentials: CreateHyperliquidCredentials.optional(),
|
|
77
|
-
metadata: CreateHyperliquidMetadata.optional()
|
|
78
|
-
});
|
|
79
|
-
const UpdateBinanceAccount = z.object({
|
|
80
|
-
connector: z.literal("binance"),
|
|
81
|
-
alias: AccountAlias.optional(),
|
|
82
|
-
credentials: CreateBinanceCredentials.optional(),
|
|
83
|
-
metadata: z.void({}).transform(() => void 0)
|
|
84
|
-
});
|
|
85
|
-
const UpdateBybitAccount = z.object({
|
|
86
|
-
connector: z.literal("bybit"),
|
|
87
|
-
alias: AccountAlias.optional(),
|
|
88
|
-
credentials: CreateBybitCredentials.optional(),
|
|
89
|
-
metadata: z.void({}).transform(() => void 0)
|
|
90
|
-
});
|
|
91
|
-
const UpdateOkxAccount = z.object({
|
|
92
|
-
connector: z.literal("okx"),
|
|
93
|
-
alias: AccountAlias.optional(),
|
|
94
|
-
credentials: CreateOkxCredentials.optional(),
|
|
95
|
-
metadata: z.void({}).transform(() => void 0)
|
|
96
|
-
});
|
|
97
|
-
const UpdateLighterAccount = z.object({
|
|
98
|
-
connector: z.literal("lighter"),
|
|
99
|
-
alias: AccountAlias.optional(),
|
|
100
|
-
credentials: CreateLighterCredentials.optional(),
|
|
101
|
-
metadata: CreateLighterMetadata.optional()
|
|
102
|
-
});
|
|
103
|
-
const UpdateLighterRhcAccount = UpdateLighterAccount.extend({
|
|
104
|
-
connector: z.literal("lighter_rhc")
|
|
105
|
-
});
|
|
106
|
-
const CreateTradeAccount = z.discriminatedUnion("connector", [
|
|
107
|
-
CreateHyperliquidAccount,
|
|
108
|
-
CreateBinanceAccount,
|
|
109
|
-
CreateBybitAccount,
|
|
110
|
-
CreateOkxAccount,
|
|
111
|
-
CreateLighterAccount,
|
|
112
|
-
CreateLighterRhcAccount
|
|
113
|
-
]);
|
|
114
|
-
const CreateVaultTradeAccount = z.object({
|
|
115
|
-
vaultAddress: EthereumAddress,
|
|
116
|
-
alias: AccountAlias,
|
|
117
|
-
/**
|
|
118
|
-
* Optional caller-supplied key. Reusing it attaches a transport retry to the first attempt;
|
|
119
|
-
* omitting it starts a new create attempt.
|
|
120
|
-
*/
|
|
121
|
-
idempotencyKey: z.string().min(1).max(128).optional()
|
|
122
|
-
});
|
|
123
|
-
const UpdateTradeAccount = z.discriminatedUnion("connector", [
|
|
124
|
-
UpdateHyperliquidAccount,
|
|
125
|
-
UpdateBinanceAccount,
|
|
126
|
-
UpdateBybitAccount,
|
|
127
|
-
UpdateOkxAccount,
|
|
128
|
-
UpdateLighterAccount,
|
|
129
|
-
UpdateLighterRhcAccount
|
|
130
|
-
]);
|
|
131
|
-
|
|
132
|
-
export { CreateTradeAccount, CreateVaultTradeAccount, UpdateTradeAccount };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { TradeAccount } from './entities';
|
|
3
|
-
|
|
4
|
-
const TradeAccountResponse = z.object({
|
|
5
|
-
account: TradeAccount
|
|
6
|
-
});
|
|
7
|
-
const TradeAccountListResponse = z.object({
|
|
8
|
-
accounts: z.array(TradeAccount)
|
|
9
|
-
});
|
|
10
|
-
const VaultTradeAccountStatus = z.discriminatedUnion("exists", [
|
|
11
|
-
z.object({
|
|
12
|
-
exists: z.literal(false)
|
|
13
|
-
}),
|
|
14
|
-
z.object({
|
|
15
|
-
exists: z.literal(true),
|
|
16
|
-
tradeAccountId: z.string(),
|
|
17
|
-
account: TradeAccount
|
|
18
|
-
})
|
|
19
|
-
]);
|
|
20
|
-
const VaultTradeAccountStatusResponse = z.object({
|
|
21
|
-
status: VaultTradeAccountStatus
|
|
22
|
-
});
|
|
23
|
-
const HyperliquidCredentialsResponse = z.object({
|
|
24
|
-
connector: z.literal("hyperliquid"),
|
|
25
|
-
account: TradeAccount,
|
|
26
|
-
credentials: z.object({
|
|
27
|
-
signer_key: z.string()
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
const BinanceApiKeyPairResponse = z.object({
|
|
31
|
-
api_key: z.string(),
|
|
32
|
-
api_secret: z.string()
|
|
33
|
-
});
|
|
34
|
-
const BinanceCredentialsResponse = z.object({
|
|
35
|
-
connector: z.literal("binance"),
|
|
36
|
-
account: TradeAccount,
|
|
37
|
-
credentials: z.object({
|
|
38
|
-
read: BinanceApiKeyPairResponse,
|
|
39
|
-
write: BinanceApiKeyPairResponse
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
const BybitCredentialsResponse = z.object({
|
|
43
|
-
connector: z.literal("bybit"),
|
|
44
|
-
account: TradeAccount,
|
|
45
|
-
credentials: z.object({
|
|
46
|
-
api_key: z.string(),
|
|
47
|
-
api_secret: z.string()
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
const OkxCredentialsResponse = z.object({
|
|
51
|
-
connector: z.literal("okx"),
|
|
52
|
-
account: TradeAccount,
|
|
53
|
-
credentials: z.object({
|
|
54
|
-
api_key: z.string(),
|
|
55
|
-
api_secret: z.string(),
|
|
56
|
-
api_pass: z.string()
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
const LighterCredentialsResponse = z.object({
|
|
60
|
-
connector: z.literal("lighter"),
|
|
61
|
-
account: TradeAccount,
|
|
62
|
-
credentials: z.object({
|
|
63
|
-
api_private_key: z.string(),
|
|
64
|
-
api_key_index: z.number()
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
const LighterRhcCredentialsResponse = LighterCredentialsResponse.extend({
|
|
68
|
-
connector: z.literal("lighter_rhc")
|
|
69
|
-
});
|
|
70
|
-
const ExchangeCredentialsResponse = z.discriminatedUnion("connector", [
|
|
71
|
-
HyperliquidCredentialsResponse,
|
|
72
|
-
BinanceCredentialsResponse,
|
|
73
|
-
BybitCredentialsResponse,
|
|
74
|
-
OkxCredentialsResponse,
|
|
75
|
-
LighterCredentialsResponse,
|
|
76
|
-
LighterRhcCredentialsResponse
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
export { ExchangeCredentialsResponse, TradeAccountListResponse, TradeAccountResponse, VaultTradeAccountStatus, VaultTradeAccountStatusResponse };
|
package/dist/traders/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SignedDecimalString } from '../common/schema';
|
|
3
|
-
|
|
4
|
-
const TraderPerformanceQuery = z.object({
|
|
5
|
-
range: z.enum([
|
|
6
|
-
"24h",
|
|
7
|
-
"7d",
|
|
8
|
-
"30d"
|
|
9
|
-
]).default("24h")
|
|
10
|
-
}).strict();
|
|
11
|
-
const TraderPerformancePoint = z.object({
|
|
12
|
-
at: z.string().datetime(),
|
|
13
|
-
equityUsd: SignedDecimalString.optional(),
|
|
14
|
-
pnlUsd: SignedDecimalString.optional(),
|
|
15
|
-
roiPercent: SignedDecimalString.optional()
|
|
16
|
-
});
|
|
17
|
-
const TraderPerformanceResponse = z.object({
|
|
18
|
-
points: z.array(TraderPerformancePoint)
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { TraderPerformancePoint, TraderPerformanceQuery, TraderPerformanceResponse };
|
package/dist/traders/public.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CursorResponse } from '../common';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
import { CopyFollower } from '../copy/entities';
|
|
5
|
-
import { Ladder } from '../ladder/entities';
|
|
6
|
-
import { OpenPosition, OpenPositionLeg, ClosedPosition, ClosedPositionLeg } from '../position/entities';
|
|
7
|
-
import { ClosedPositionListParams } from '../position/queries';
|
|
8
|
-
import { TWAPOpen, TWAPClose } from '../schedule/entities';
|
|
9
|
-
import { TriggerMarketOpen, TriggerMarketAdjust, TriggerMarketClose, TriggerTWAPAdjust, TriggerTWAPClose } from '../trigger/entities';
|
|
10
|
-
|
|
11
|
-
const PublicTraderParams = z.object({
|
|
12
|
-
tradeAccountId: z.uuid()
|
|
13
|
-
});
|
|
14
|
-
const PublicTraderQuery = z.object({
|
|
15
|
-
/** Accept exact HTTP boolean strings without treating the string "false" as true. */
|
|
16
|
-
includeCopyState: z.union([
|
|
17
|
-
z.boolean(),
|
|
18
|
-
z.stringbool({
|
|
19
|
-
truthy: [
|
|
20
|
-
"true"
|
|
21
|
-
],
|
|
22
|
-
falsy: [
|
|
23
|
-
"false"
|
|
24
|
-
],
|
|
25
|
-
case: "sensitive"
|
|
26
|
-
})
|
|
27
|
-
]).optional().default(false)
|
|
28
|
-
});
|
|
29
|
-
const PublicTraderClosedPositionsParams = z.object({
|
|
30
|
-
limit: ClosedPositionListParams.shape.limit,
|
|
31
|
-
cursor: ClosedPositionListParams.shape.cursor,
|
|
32
|
-
startDate: ClosedPositionListParams.shape.startDate,
|
|
33
|
-
endDate: ClosedPositionListParams.shape.endDate,
|
|
34
|
-
positionId: ClosedPositionListParams.shape.positionId
|
|
35
|
-
}).strict();
|
|
36
|
-
const ViewerCopyStatus = z.enum([
|
|
37
|
-
"COPIED",
|
|
38
|
-
"PARTIAL",
|
|
39
|
-
"NOT_COPIED",
|
|
40
|
-
"PENDING",
|
|
41
|
-
"UNKNOWN"
|
|
42
|
-
]);
|
|
43
|
-
const PublicOpenPosition = OpenPosition.pick({
|
|
44
|
-
positionId: true,
|
|
45
|
-
status: true,
|
|
46
|
-
connector: true,
|
|
47
|
-
openedAt: true,
|
|
48
|
-
updatedAt: true,
|
|
49
|
-
copySubscriptionId: true,
|
|
50
|
-
realizedGrossPnl: true,
|
|
51
|
-
netCashflow: true
|
|
52
|
-
}).extend({
|
|
53
|
-
/** The selected follower's result for this leader position; absent without viewer context. */
|
|
54
|
-
copyStatus: ViewerCopyStatus.optional(),
|
|
55
|
-
/** The recorded attempt, exclusion, or lifecycle reason for this follower's result. */
|
|
56
|
-
copyReason: z.string().optional(),
|
|
57
|
-
legs: z.array(OpenPositionLeg.pick({
|
|
58
|
-
asset: true,
|
|
59
|
-
side: true,
|
|
60
|
-
realized: true,
|
|
61
|
-
remaining: true
|
|
62
|
-
}))
|
|
63
|
-
});
|
|
64
|
-
const PublicClosedPosition = ClosedPosition.pick({
|
|
65
|
-
positionId: true,
|
|
66
|
-
status: true,
|
|
67
|
-
connector: true,
|
|
68
|
-
openedAt: true,
|
|
69
|
-
closedAt: true,
|
|
70
|
-
closedReason: true,
|
|
71
|
-
grossPnl: true,
|
|
72
|
-
netPnl: true,
|
|
73
|
-
hasProvisionalFills: true
|
|
74
|
-
}).extend({
|
|
75
|
-
legs: z.array(ClosedPositionLeg.pick({
|
|
76
|
-
asset: true,
|
|
77
|
-
side: true,
|
|
78
|
-
entryVwap: true,
|
|
79
|
-
exitVwap: true,
|
|
80
|
-
entryNotional: true,
|
|
81
|
-
grossPnl: true,
|
|
82
|
-
netPnl: true
|
|
83
|
-
}))
|
|
84
|
-
});
|
|
85
|
-
const PublicTraderClosedPositionsResponse = CursorResponse.extend({
|
|
86
|
-
positions: z.array(PublicClosedPosition)
|
|
87
|
-
});
|
|
88
|
-
const triggerFields = {
|
|
89
|
-
id: true,
|
|
90
|
-
connector: true,
|
|
91
|
-
status: true,
|
|
92
|
-
intent: true,
|
|
93
|
-
type: true,
|
|
94
|
-
bracketType: true,
|
|
95
|
-
semanticBracketType: true,
|
|
96
|
-
condition: true,
|
|
97
|
-
context: true,
|
|
98
|
-
ladderId: true,
|
|
99
|
-
ladderIndex: true,
|
|
100
|
-
parentTriggerId: true,
|
|
101
|
-
triggeredAt: true,
|
|
102
|
-
cancelledAt: true,
|
|
103
|
-
cancelledReason: true,
|
|
104
|
-
createdAt: true,
|
|
105
|
-
updatedAt: true
|
|
106
|
-
};
|
|
107
|
-
const PublicTrigger = z.discriminatedUnion("type", [
|
|
108
|
-
z.discriminatedUnion("intent", [
|
|
109
|
-
TriggerMarketOpen.pick(triggerFields),
|
|
110
|
-
TriggerMarketAdjust.pick({
|
|
111
|
-
...triggerFields,
|
|
112
|
-
trailing: true
|
|
113
|
-
}),
|
|
114
|
-
TriggerMarketClose.pick({
|
|
115
|
-
...triggerFields,
|
|
116
|
-
trailing: true
|
|
117
|
-
})
|
|
118
|
-
]),
|
|
119
|
-
z.discriminatedUnion("intent", [
|
|
120
|
-
TriggerTWAPAdjust.pick({
|
|
121
|
-
...triggerFields,
|
|
122
|
-
trailing: true,
|
|
123
|
-
scheduleId: true
|
|
124
|
-
}),
|
|
125
|
-
TriggerTWAPClose.pick({
|
|
126
|
-
...triggerFields,
|
|
127
|
-
trailing: true,
|
|
128
|
-
scheduleId: true
|
|
129
|
-
})
|
|
130
|
-
])
|
|
131
|
-
]);
|
|
132
|
-
const scheduleFields = {
|
|
133
|
-
id: true,
|
|
134
|
-
connector: true,
|
|
135
|
-
status: true,
|
|
136
|
-
strategy: true,
|
|
137
|
-
intent: true,
|
|
138
|
-
executionType: true,
|
|
139
|
-
positionKey: true,
|
|
140
|
-
startAt: true,
|
|
141
|
-
endAt: true,
|
|
142
|
-
lastSliceAt: true,
|
|
143
|
-
sliceIntervalSec: true,
|
|
144
|
-
sliceCount: true,
|
|
145
|
-
randomization: true,
|
|
146
|
-
cancelledAt: true,
|
|
147
|
-
cancelledReason: true,
|
|
148
|
-
createdAt: true,
|
|
149
|
-
updatedAt: true
|
|
150
|
-
};
|
|
151
|
-
const PublicSchedule = z.discriminatedUnion("intent", [
|
|
152
|
-
TWAPOpen.pick({
|
|
153
|
-
...scheduleFields,
|
|
154
|
-
legs: true,
|
|
155
|
-
targetNotional: true,
|
|
156
|
-
remainingNotional: true
|
|
157
|
-
}),
|
|
158
|
-
TWAPClose.pick({
|
|
159
|
-
...scheduleFields,
|
|
160
|
-
positionId: true,
|
|
161
|
-
initialExposure: true
|
|
162
|
-
})
|
|
163
|
-
]);
|
|
164
|
-
const PublicLadder = Ladder.pick({
|
|
165
|
-
id: true,
|
|
166
|
-
connector: true,
|
|
167
|
-
status: true,
|
|
168
|
-
positionKey: true,
|
|
169
|
-
config: true,
|
|
170
|
-
attachTriggers: true,
|
|
171
|
-
createdAt: true,
|
|
172
|
-
updatedAt: true
|
|
173
|
-
}).extend({
|
|
174
|
-
triggers: z.array(PublicTrigger)
|
|
175
|
-
});
|
|
176
|
-
const PublicTraderResponse = z.object({
|
|
177
|
-
connector: Connector.describe("Exchange connector type"),
|
|
178
|
-
// Omit X identity when the owner hides it or has not linked an account.
|
|
179
|
-
xHandle: z.string().optional().describe("Public X handle at the last authorization; absent when hidden or unlinked"),
|
|
180
|
-
xName: z.string().optional().describe("Public X display name; absent when hidden or unlinked"),
|
|
181
|
-
xAvatarUrl: z.string().optional().describe("Public X avatar URL; absent when hidden or unlinked"),
|
|
182
|
-
xUserId: z.string().optional().describe("Immutable X numeric user ID; absent when hidden or unlinked"),
|
|
183
|
-
// Followers are complete; the latest-20 limit applies only to trading records.
|
|
184
|
-
followers: z.array(CopyFollower),
|
|
185
|
-
followerCount: z.number().int().nonnegative(),
|
|
186
|
-
positions: z.array(PublicOpenPosition),
|
|
187
|
-
triggers: z.array(PublicTrigger),
|
|
188
|
-
schedules: z.array(PublicSchedule),
|
|
189
|
-
ladders: z.array(PublicLadder)
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
export { PublicClosedPosition, PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderClosedPositionsParams, PublicTraderClosedPositionsResponse, PublicTraderParams, PublicTraderQuery, PublicTraderResponse, PublicTrigger, ViewerCopyStatus };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const TriggerIntent = z.enum([
|
|
4
|
-
"OPEN",
|
|
5
|
-
"ADJUST",
|
|
6
|
-
"CLOSE"
|
|
7
|
-
]);
|
|
8
|
-
const TriggerStatus = z.enum([
|
|
9
|
-
"ACTIVE",
|
|
10
|
-
"TRIGGERED",
|
|
11
|
-
"CANCELLED"
|
|
12
|
-
]);
|
|
13
|
-
const TriggerCancelledReason = z.enum([
|
|
14
|
-
"POSITION_CLOSED",
|
|
15
|
-
"USER",
|
|
16
|
-
"SYSTEM",
|
|
17
|
-
"POSITION_NETTED",
|
|
18
|
-
"POSITION_LIQUIDATED",
|
|
19
|
-
"POSITION_REVERSED"
|
|
20
|
-
]);
|
|
21
|
-
const BracketType = z.enum([
|
|
22
|
-
"STOP_LOSS",
|
|
23
|
-
"TAKE_PROFIT",
|
|
24
|
-
"NONE"
|
|
25
|
-
]);
|
|
26
|
-
const MetricTrack = z.enum([
|
|
27
|
-
"PEAK",
|
|
28
|
-
"TROUGH"
|
|
29
|
-
]);
|
|
30
|
-
const TpSlBracketType = z.enum([
|
|
31
|
-
"TAKE_PROFIT",
|
|
32
|
-
"STOP_LOSS"
|
|
33
|
-
]);
|
|
34
|
-
const TrailingMode = z.enum([
|
|
35
|
-
"RELATIVE_BPS",
|
|
36
|
-
"ABSOLUTE_POINTS"
|
|
37
|
-
]);
|
|
38
|
-
|
|
39
|
-
export { BracketType, MetricTrack, TpSlBracketType, TrailingMode, TriggerCancelledReason, TriggerIntent, TriggerStatus };
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Side } from '../../common/schema';
|
|
3
|
-
import { Connector } from '../../connector';
|
|
4
|
-
import { InstrumentId } from '../../instrument';
|
|
5
|
-
import { PriceSource } from '../../price';
|
|
6
|
-
import { MetricTrack } from '../common';
|
|
7
|
-
|
|
8
|
-
const Ratio = z.object({
|
|
9
|
-
type: z.literal("ratio"),
|
|
10
|
-
data: z.object({
|
|
11
|
-
priceSource: PriceSource,
|
|
12
|
-
symbol_a: InstrumentId,
|
|
13
|
-
symbol_b: InstrumentId,
|
|
14
|
-
track: MetricTrack,
|
|
15
|
-
threshold: z.number()
|
|
16
|
-
})
|
|
17
|
-
});
|
|
18
|
-
const Price = z.object({
|
|
19
|
-
type: z.literal("price"),
|
|
20
|
-
data: z.object({
|
|
21
|
-
priceSource: PriceSource,
|
|
22
|
-
symbol: InstrumentId,
|
|
23
|
-
track: MetricTrack,
|
|
24
|
-
threshold: z.number()
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
const WeightedRatio = z.object({
|
|
28
|
-
type: z.literal("weighted_ratio"),
|
|
29
|
-
data: z.object({
|
|
30
|
-
priceSource: PriceSource,
|
|
31
|
-
basket: z.array(z.object({
|
|
32
|
-
symbol: InstrumentId,
|
|
33
|
-
side: Side,
|
|
34
|
-
weight: z.number()
|
|
35
|
-
})),
|
|
36
|
-
track: MetricTrack,
|
|
37
|
-
threshold: z.number()
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
const Notional = z.object({
|
|
41
|
-
type: z.literal("notional"),
|
|
42
|
-
data: z.object({
|
|
43
|
-
priceSource: PriceSource,
|
|
44
|
-
track: MetricTrack,
|
|
45
|
-
threshold: z.number()
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
const Upnl = z.object({
|
|
49
|
-
type: z.literal("upnl"),
|
|
50
|
-
data: z.object({
|
|
51
|
-
priceSource: PriceSource,
|
|
52
|
-
track: MetricTrack,
|
|
53
|
-
threshold: z.number()
|
|
54
|
-
})
|
|
55
|
-
});
|
|
56
|
-
const UpnlBps = z.object({
|
|
57
|
-
type: z.literal("upnl_bps"),
|
|
58
|
-
data: z.object({
|
|
59
|
-
priceSource: PriceSource,
|
|
60
|
-
track: MetricTrack,
|
|
61
|
-
threshold: z.number()
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
const FundingRate = z.object({
|
|
65
|
-
type: z.literal("funding_rate"),
|
|
66
|
-
data: z.object({
|
|
67
|
-
connector: Connector,
|
|
68
|
-
symbol: InstrumentId,
|
|
69
|
-
track: MetricTrack,
|
|
70
|
-
threshold: z.number()
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
const PredictionMarket = z.object({
|
|
74
|
-
type: z.literal("prediction_market"),
|
|
75
|
-
data: z.object({
|
|
76
|
-
source: z.enum([
|
|
77
|
-
"kalshi",
|
|
78
|
-
"polymarket"
|
|
79
|
-
]),
|
|
80
|
-
marketKey: z.string().min(1),
|
|
81
|
-
track: MetricTrack,
|
|
82
|
-
threshold: z.number()
|
|
83
|
-
})
|
|
84
|
-
});
|
|
85
|
-
const BtcDominance = z.object({
|
|
86
|
-
type: z.literal("btc_dominance"),
|
|
87
|
-
data: z.object({
|
|
88
|
-
source: z.literal("coingecko"),
|
|
89
|
-
track: MetricTrack,
|
|
90
|
-
threshold: z.number()
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
const RatioTrailing = z.object({
|
|
94
|
-
type: z.literal("ratio_trailing"),
|
|
95
|
-
data: z.object({
|
|
96
|
-
priceSource: PriceSource,
|
|
97
|
-
symbol_a: InstrumentId,
|
|
98
|
-
symbol_b: InstrumentId
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
const PriceTrailing = z.object({
|
|
102
|
-
type: z.literal("price_trailing"),
|
|
103
|
-
data: z.object({
|
|
104
|
-
priceSource: PriceSource,
|
|
105
|
-
symbol: InstrumentId
|
|
106
|
-
})
|
|
107
|
-
});
|
|
108
|
-
const WeightedRatioTrailing = z.object({
|
|
109
|
-
type: z.literal("weighted_ratio_trailing"),
|
|
110
|
-
data: z.object({
|
|
111
|
-
priceSource: PriceSource,
|
|
112
|
-
basket: z.array(z.object({
|
|
113
|
-
symbol: InstrumentId,
|
|
114
|
-
side: Side,
|
|
115
|
-
weight: z.number()
|
|
116
|
-
}))
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
const NotionalTrailing = z.object({
|
|
120
|
-
type: z.literal("notional_trailing"),
|
|
121
|
-
data: z.object({
|
|
122
|
-
priceSource: PriceSource
|
|
123
|
-
})
|
|
124
|
-
});
|
|
125
|
-
const UpnlTrailing = z.object({
|
|
126
|
-
type: z.literal("upnl_trailing"),
|
|
127
|
-
data: z.object({
|
|
128
|
-
priceSource: PriceSource
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
const UpnlBpsTrailing = z.object({
|
|
132
|
-
type: z.literal("upnl_bps_trailing"),
|
|
133
|
-
data: z.object({
|
|
134
|
-
priceSource: PriceSource
|
|
135
|
-
})
|
|
136
|
-
});
|
|
137
|
-
const TriggerConditionOpen = z.discriminatedUnion("type", [
|
|
138
|
-
Ratio,
|
|
139
|
-
Price,
|
|
140
|
-
WeightedRatio,
|
|
141
|
-
FundingRate,
|
|
142
|
-
PredictionMarket,
|
|
143
|
-
BtcDominance
|
|
144
|
-
]);
|
|
145
|
-
const TriggerConditionAdjust = z.discriminatedUnion("type", [
|
|
146
|
-
Ratio,
|
|
147
|
-
Price,
|
|
148
|
-
WeightedRatio,
|
|
149
|
-
Notional,
|
|
150
|
-
Upnl,
|
|
151
|
-
UpnlBps,
|
|
152
|
-
FundingRate,
|
|
153
|
-
PredictionMarket,
|
|
154
|
-
BtcDominance
|
|
155
|
-
]);
|
|
156
|
-
const TriggerConditionClose = z.discriminatedUnion("type", [
|
|
157
|
-
Ratio,
|
|
158
|
-
Price,
|
|
159
|
-
WeightedRatio,
|
|
160
|
-
Notional,
|
|
161
|
-
Upnl,
|
|
162
|
-
UpnlBps,
|
|
163
|
-
RatioTrailing,
|
|
164
|
-
PriceTrailing,
|
|
165
|
-
WeightedRatioTrailing,
|
|
166
|
-
NotionalTrailing,
|
|
167
|
-
UpnlTrailing,
|
|
168
|
-
UpnlBpsTrailing,
|
|
169
|
-
FundingRate,
|
|
170
|
-
PredictionMarket,
|
|
171
|
-
BtcDominance
|
|
172
|
-
]);
|
|
173
|
-
|
|
174
|
-
export { TriggerConditionAdjust, TriggerConditionClose, TriggerConditionOpen };
|