@adaptic/utils 0.1.43 → 0.1.45
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 +61 -153
- package/dist/index.cjs +5356 -60315
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5356 -60054
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +361 -824
- package/dist/test.js.map +1 -1
- package/dist/types/adaptic.d.ts +2 -2
- package/dist/types/adaptic.d.ts.map +1 -1
- package/dist/types/alpaca-functions.d.ts +233 -0
- package/dist/types/alpaca-functions.d.ts.map +1 -0
- package/dist/types/alpaca-market-data-api.d.ts +9 -24
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/alpaca-trading-api.d.ts +12 -12
- package/dist/types/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types/alphavantage.d.ts +1 -1
- package/dist/types/alphavantage.d.ts.map +1 -1
- package/dist/types/asset-allocation-algorithm.d.ts +1 -7
- package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
- package/dist/types/cache/stampede-protected-cache.d.ts.map +1 -1
- package/dist/types/crypto.d.ts +4 -4
- package/dist/types/crypto.d.ts.map +1 -1
- package/dist/types/display-manager.d.ts +1 -1
- package/dist/types/display-manager.d.ts.map +1 -1
- package/dist/types/examples/asset-allocation-example.d.ts +6 -7
- package/dist/types/examples/asset-allocation-example.d.ts.map +1 -1
- package/dist/types/format-tools.d.ts.map +1 -1
- package/dist/types/index.d.ts +55 -393
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logging.d.ts +1 -1
- package/dist/types/logging.d.ts.map +1 -1
- package/dist/types/market-hours.d.ts.map +1 -1
- package/dist/types/market-time.d.ts +13 -75
- package/dist/types/market-time.d.ts.map +1 -1
- package/dist/types/metrics-calcs.d.ts.map +1 -1
- package/dist/types/misc-utils.d.ts +1 -4
- package/dist/types/misc-utils.d.ts.map +1 -1
- package/dist/types/performance-metrics.d.ts +6 -6
- package/dist/types/performance-metrics.d.ts.map +1 -1
- package/dist/types/polygon-indices.d.ts +3 -3
- package/dist/types/polygon-indices.d.ts.map +1 -1
- package/dist/types/polygon.d.ts +1 -1
- package/dist/types/polygon.d.ts.map +1 -1
- package/dist/types/price-utils.d.ts.map +1 -1
- package/dist/types/technical-analysis.d.ts +9 -9
- package/dist/types/technical-analysis.d.ts.map +1 -1
- package/dist/types/time-utils.d.ts.map +1 -1
- package/dist/types/types/adaptic-types.d.ts +1 -1
- package/dist/types/types/adaptic-types.d.ts.map +1 -1
- package/dist/types/types/alpaca-types.d.ts +89 -252
- package/dist/types/types/alpaca-types.d.ts.map +1 -1
- package/dist/types/types/alphavantage-types.d.ts +2 -2
- package/dist/types/types/asset-allocation-types.d.ts +11 -11
- package/dist/types/types/index.d.ts +8 -8
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/logging-types.d.ts +2 -2
- package/dist/types/types/logging-types.d.ts.map +1 -1
- package/dist/types/types/market-time-types.d.ts +4 -4
- package/dist/types/types/market-time-types.d.ts.map +1 -1
- package/dist/types/types/metrics-types.d.ts +4 -4
- package/dist/types/types/metrics-types.d.ts.map +1 -1
- package/dist/types/types/polygon-indices-types.d.ts +6 -6
- package/dist/types/types/polygon-types.d.ts +3 -3
- package/dist/types/types/ta-types.d.ts +3 -3
- package/package.json +6 -24
- package/dist/types/__tests__/alpaca-functions.test.d.ts +0 -2
- package/dist/types/__tests__/alpaca-functions.test.d.ts.map +0 -1
- package/dist/types/__tests__/api-endpoints.test.d.ts +0 -2
- package/dist/types/__tests__/api-endpoints.test.d.ts.map +0 -1
- package/dist/types/__tests__/asset-allocation.test.d.ts +0 -2
- package/dist/types/__tests__/asset-allocation.test.d.ts.map +0 -1
- package/dist/types/__tests__/auth-validator.test.d.ts +0 -2
- package/dist/types/__tests__/auth-validator.test.d.ts.map +0 -1
- package/dist/types/__tests__/cache.test.d.ts +0 -2
- package/dist/types/__tests__/cache.test.d.ts.map +0 -1
- package/dist/types/__tests__/errors.test.d.ts +0 -2
- package/dist/types/__tests__/errors.test.d.ts.map +0 -1
- package/dist/types/__tests__/financial-regression.test.d.ts +0 -2
- package/dist/types/__tests__/financial-regression.test.d.ts.map +0 -1
- package/dist/types/__tests__/format-tools.test.d.ts +0 -2
- package/dist/types/__tests__/format-tools.test.d.ts.map +0 -1
- package/dist/types/__tests__/http-keep-alive.test.d.ts +0 -2
- package/dist/types/__tests__/http-keep-alive.test.d.ts.map +0 -1
- package/dist/types/__tests__/http-timeout.test.d.ts +0 -2
- package/dist/types/__tests__/http-timeout.test.d.ts.map +0 -1
- package/dist/types/__tests__/logger.test.d.ts +0 -2
- package/dist/types/__tests__/logger.test.d.ts.map +0 -1
- package/dist/types/__tests__/market-time.test.d.ts +0 -2
- package/dist/types/__tests__/market-time.test.d.ts.map +0 -1
- package/dist/types/__tests__/misc-utils.test.d.ts +0 -2
- package/dist/types/__tests__/misc-utils.test.d.ts.map +0 -1
- package/dist/types/__tests__/paginator.test.d.ts +0 -2
- package/dist/types/__tests__/paginator.test.d.ts.map +0 -1
- package/dist/types/__tests__/performance-metrics.test.d.ts +0 -2
- package/dist/types/__tests__/performance-metrics.test.d.ts.map +0 -1
- package/dist/types/__tests__/polygon.test.d.ts +0 -2
- package/dist/types/__tests__/polygon.test.d.ts.map +0 -1
- package/dist/types/__tests__/price-utils.test.d.ts +0 -2
- package/dist/types/__tests__/price-utils.test.d.ts.map +0 -1
- package/dist/types/__tests__/property-based-financial.test.d.ts +0 -2
- package/dist/types/__tests__/property-based-financial.test.d.ts.map +0 -1
- package/dist/types/__tests__/rate-limiter.test.d.ts +0 -2
- package/dist/types/__tests__/rate-limiter.test.d.ts.map +0 -1
- package/dist/types/__tests__/schema-validation.test.d.ts +0 -2
- package/dist/types/__tests__/schema-validation.test.d.ts.map +0 -1
- package/dist/types/__tests__/technical-analysis.test.d.ts +0 -2
- package/dist/types/__tests__/technical-analysis.test.d.ts.map +0 -1
- package/dist/types/__tests__/time-utils.test.d.ts +0 -2
- package/dist/types/__tests__/time-utils.test.d.ts.map +0 -1
- package/dist/types/alpaca/client.d.ts +0 -95
- package/dist/types/alpaca/client.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/data.d.ts +0 -281
- package/dist/types/alpaca/crypto/data.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/index.d.ts +0 -75
- package/dist/types/alpaca/crypto/index.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/orders.d.ts +0 -221
- package/dist/types/alpaca/crypto/orders.d.ts.map +0 -1
- package/dist/types/alpaca/index.d.ts +0 -205
- package/dist/types/alpaca/index.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/account.d.ts +0 -34
- package/dist/types/alpaca/legacy/account.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/assets.d.ts +0 -13
- package/dist/types/alpaca/legacy/assets.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/auth.d.ts +0 -18
- package/dist/types/alpaca/legacy/auth.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/index.d.ts +0 -15
- package/dist/types/alpaca/legacy/index.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/market-data.d.ts +0 -32
- package/dist/types/alpaca/legacy/market-data.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/orders.d.ts +0 -84
- package/dist/types/alpaca/legacy/orders.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/positions.d.ts +0 -66
- package/dist/types/alpaca/legacy/positions.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/utils.d.ts +0 -18
- package/dist/types/alpaca/legacy/utils.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/bars.d.ts +0 -142
- package/dist/types/alpaca/market-data/bars.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/index.d.ts +0 -13
- package/dist/types/alpaca/market-data/index.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/news.d.ts +0 -87
- package/dist/types/alpaca/market-data/news.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/quotes.d.ts +0 -85
- package/dist/types/alpaca/market-data/quotes.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/trades.d.ts +0 -98
- package/dist/types/alpaca/market-data/trades.d.ts.map +0 -1
- package/dist/types/alpaca/options/contracts.d.ts +0 -279
- package/dist/types/alpaca/options/contracts.d.ts.map +0 -1
- package/dist/types/alpaca/options/data.d.ts +0 -126
- package/dist/types/alpaca/options/data.d.ts.map +0 -1
- package/dist/types/alpaca/options/index.d.ts +0 -17
- package/dist/types/alpaca/options/index.d.ts.map +0 -1
- package/dist/types/alpaca/options/orders.d.ts +0 -366
- package/dist/types/alpaca/options/orders.d.ts.map +0 -1
- package/dist/types/alpaca/options/strategies.d.ts +0 -224
- package/dist/types/alpaca/options/strategies.d.ts.map +0 -1
- package/dist/types/alpaca/streams/base-stream.d.ts +0 -143
- package/dist/types/alpaca/streams/base-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/crypto-stream.d.ts +0 -173
- package/dist/types/alpaca/streams/crypto-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/index.d.ts +0 -54
- package/dist/types/alpaca/streams/index.d.ts.map +0 -1
- package/dist/types/alpaca/streams/option-stream.d.ts +0 -167
- package/dist/types/alpaca/streams/option-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/stock-stream.d.ts +0 -176
- package/dist/types/alpaca/streams/stock-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/stream-manager.d.ts +0 -277
- package/dist/types/alpaca/streams/stream-manager.d.ts.map +0 -1
- package/dist/types/alpaca/streams/trading-stream.d.ts +0 -186
- package/dist/types/alpaca/streams/trading-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams.d.ts +0 -88
- package/dist/types/alpaca/streams.d.ts.map +0 -1
- package/dist/types/alpaca/test-imports.d.ts +0 -7
- package/dist/types/alpaca/test-imports.d.ts.map +0 -1
- package/dist/types/alpaca/trading/account.d.ts +0 -198
- package/dist/types/alpaca/trading/account.d.ts.map +0 -1
- package/dist/types/alpaca/trading/bracket-orders.d.ts +0 -162
- package/dist/types/alpaca/trading/bracket-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/clock.d.ts +0 -99
- package/dist/types/alpaca/trading/clock.d.ts.map +0 -1
- package/dist/types/alpaca/trading/index.d.ts +0 -15
- package/dist/types/alpaca/trading/index.d.ts.map +0 -1
- package/dist/types/alpaca/trading/oco-orders.d.ts +0 -203
- package/dist/types/alpaca/trading/oco-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/order-utils.d.ts +0 -404
- package/dist/types/alpaca/trading/order-utils.d.ts.map +0 -1
- package/dist/types/alpaca/trading/orders.d.ts +0 -199
- package/dist/types/alpaca/trading/orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/oto-orders.d.ts +0 -282
- package/dist/types/alpaca/trading/oto-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/positions.d.ts +0 -389
- package/dist/types/alpaca/trading/positions.d.ts.map +0 -1
- package/dist/types/alpaca/trading/smart-orders.d.ts +0 -301
- package/dist/types/alpaca/trading/smart-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/trailing-stops.d.ts +0 -240
- package/dist/types/alpaca/trading/trailing-stops.d.ts.map +0 -1
- package/dist/types/config/api-endpoints.d.ts +0 -94
- package/dist/types/config/api-endpoints.d.ts.map +0 -1
- package/dist/types/errors/index.d.ts +0 -130
- package/dist/types/errors/index.d.ts.map +0 -1
- package/dist/types/examples/rate-limiter-example.d.ts +0 -7
- package/dist/types/examples/rate-limiter-example.d.ts.map +0 -1
- package/dist/types/http-timeout.d.ts +0 -37
- package/dist/types/http-timeout.d.ts.map +0 -1
- package/dist/types/logger.d.ts +0 -56
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/rate-limiter.d.ts +0 -171
- package/dist/types/rate-limiter.d.ts.map +0 -1
- package/dist/types/schemas/alpaca-schemas.d.ts +0 -779
- package/dist/types/schemas/alpaca-schemas.d.ts.map +0 -1
- package/dist/types/schemas/alphavantage-schemas.d.ts +0 -255
- package/dist/types/schemas/alphavantage-schemas.d.ts.map +0 -1
- package/dist/types/schemas/index.d.ts +0 -21
- package/dist/types/schemas/index.d.ts.map +0 -1
- package/dist/types/schemas/polygon-schemas.d.ts +0 -551
- package/dist/types/schemas/polygon-schemas.d.ts.map +0 -1
- package/dist/types/schemas/validate-response.d.ts +0 -88
- package/dist/types/schemas/validate-response.d.ts.map +0 -1
- package/dist/types/utils/auth-validator.d.ts +0 -32
- package/dist/types/utils/auth-validator.d.ts.map +0 -1
- package/dist/types/utils/http-keep-alive.d.ts +0 -110
- package/dist/types/utils/http-keep-alive.d.ts.map +0 -1
- package/dist/types/utils/paginator.d.ts +0 -154
- package/dist/types/utils/paginator.d.ts.map +0 -1
- package/dist/types/utils/retry.d.ts +0 -78
- package/dist/types/utils/retry.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApolloClientType, NormalizedCacheObject } from
|
|
2
|
-
import { types } from
|
|
1
|
+
import { ApolloClientType, NormalizedCacheObject } from '@adaptic/backend-legacy';
|
|
2
|
+
import { types } from '@adaptic/backend-legacy';
|
|
3
3
|
/**
|
|
4
4
|
* Represents the authentication details for Alpaca.
|
|
5
5
|
*/
|
|
@@ -7,15 +7,15 @@ export interface AlpacaAuth {
|
|
|
7
7
|
adapticAccountId?: string;
|
|
8
8
|
alpacaApiKey?: string;
|
|
9
9
|
alpacaApiSecret?: string;
|
|
10
|
-
type?:
|
|
10
|
+
type?: 'PAPER' | 'LIVE';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Options for fetching Alpaca account details.
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface AlpacaAccountGetOptions {
|
|
16
16
|
accountId?: string;
|
|
17
17
|
client?: ApolloClientType<NormalizedCacheObject>;
|
|
18
|
-
|
|
18
|
+
alpacaAccount?: types.AlpacaAccount;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Represents the configuration of an Alpaca account.
|
|
@@ -40,13 +40,13 @@ export interface AccountConfiguration {
|
|
|
40
40
|
cryptoTradeAllocationPct?: number;
|
|
41
41
|
autoAllocation?: boolean;
|
|
42
42
|
allocation?: AllocationConfig;
|
|
43
|
-
dtbp_check:
|
|
44
|
-
trade_confirm_email:
|
|
43
|
+
dtbp_check: 'both' | 'entry' | 'exit';
|
|
44
|
+
trade_confirm_email: 'all' | 'none';
|
|
45
45
|
no_shorting: boolean;
|
|
46
46
|
fractional_trading: boolean;
|
|
47
|
-
max_margin_multiplier:
|
|
47
|
+
max_margin_multiplier: '1' | '2' | '4';
|
|
48
48
|
max_options_trading_level?: 0 | 1 | 2 | 3;
|
|
49
|
-
pdt_check:
|
|
49
|
+
pdt_check: 'both' | 'entry' | 'exit';
|
|
50
50
|
ptp_no_exception_entry: boolean;
|
|
51
51
|
enablePortfolioTrailingStop?: boolean;
|
|
52
52
|
portfolioTrailPercent?: number;
|
|
@@ -108,7 +108,7 @@ export type AlpacaPosition = {
|
|
|
108
108
|
qty: string;
|
|
109
109
|
qty_available: string;
|
|
110
110
|
avg_entry_price: string;
|
|
111
|
-
side:
|
|
111
|
+
side: 'long' | 'short';
|
|
112
112
|
market_value: string;
|
|
113
113
|
cost_basis: string;
|
|
114
114
|
unrealized_pl: string;
|
|
@@ -119,31 +119,31 @@ export type AlpacaPosition = {
|
|
|
119
119
|
lastday_price: string;
|
|
120
120
|
change_today: string;
|
|
121
121
|
};
|
|
122
|
-
export type OrderSide =
|
|
122
|
+
export type OrderSide = 'buy' | 'sell';
|
|
123
123
|
/**
|
|
124
124
|
* Represents the type of order.
|
|
125
125
|
*/
|
|
126
|
-
export type OrderType =
|
|
126
|
+
export type OrderType = 'market' | 'limit' | 'stop' | 'stop_limit' | 'trailing_stop';
|
|
127
127
|
/**
|
|
128
128
|
* Represents the time in force for an order.
|
|
129
129
|
*/
|
|
130
|
-
export type TimeInForce =
|
|
130
|
+
export type TimeInForce = 'day' | 'gtc' | 'opg' | 'cls' | 'ioc' | 'fok';
|
|
131
131
|
/**
|
|
132
132
|
* Represents the class of an order.
|
|
133
133
|
*/
|
|
134
|
-
export type OrderClass =
|
|
134
|
+
export type OrderClass = 'simple' | 'oco' | 'oto' | 'bracket' | 'mleg';
|
|
135
135
|
/**
|
|
136
136
|
* Represents the status of an order.
|
|
137
137
|
*/
|
|
138
|
-
export type OrderStatus =
|
|
138
|
+
export type OrderStatus = 'new' | 'partially_filled' | 'filled' | 'done_for_day' | 'canceled' | 'expired' | 'replaced' | 'pending_cancel' | 'pending_replace' | 'accepted' | 'pending_new' | 'accepted_for_bidding' | 'stopped' | 'rejected' | 'suspended' | 'calculated';
|
|
139
139
|
/**
|
|
140
140
|
* Represents the class of an asset.
|
|
141
141
|
*/
|
|
142
|
-
export type AssetClass =
|
|
142
|
+
export type AssetClass = 'us_equity' | 'us_option' | 'crypto';
|
|
143
143
|
/**
|
|
144
144
|
* Represents the intent of a position.
|
|
145
145
|
*/
|
|
146
|
-
export type PositionIntent =
|
|
146
|
+
export type PositionIntent = 'buy_to_open' | 'buy_to_close' | 'sell_to_open' | 'sell_to_close';
|
|
147
147
|
/**
|
|
148
148
|
* Parameters for take profit orders.
|
|
149
149
|
*/
|
|
@@ -183,7 +183,7 @@ export interface CreateOrderParams {
|
|
|
183
183
|
legs?: OrderLeg[];
|
|
184
184
|
}
|
|
185
185
|
export interface CreateMultiLegOrderParams {
|
|
186
|
-
order_class:
|
|
186
|
+
order_class: 'mleg';
|
|
187
187
|
qty: string;
|
|
188
188
|
type: OrderType;
|
|
189
189
|
limit_price?: string;
|
|
@@ -199,34 +199,15 @@ export interface CreateMultiLegOrderParams {
|
|
|
199
199
|
* Parameters for getting orders.
|
|
200
200
|
*/
|
|
201
201
|
export interface GetOrdersParams {
|
|
202
|
-
status?:
|
|
202
|
+
status?: 'open' | 'closed' | 'all';
|
|
203
203
|
limit?: number;
|
|
204
204
|
after?: string;
|
|
205
205
|
until?: string;
|
|
206
|
-
direction?:
|
|
206
|
+
direction?: 'asc' | 'desc';
|
|
207
207
|
nested?: boolean;
|
|
208
208
|
symbols?: string[];
|
|
209
209
|
side?: OrderSide;
|
|
210
210
|
}
|
|
211
|
-
/**
|
|
212
|
-
* SDK-compatible parameters for getting orders (with symbols as string)
|
|
213
|
-
*/
|
|
214
|
-
export interface SDKGetOrdersParams {
|
|
215
|
-
status?: "open" | "closed" | "all";
|
|
216
|
-
limit?: number;
|
|
217
|
-
after?: string;
|
|
218
|
-
until?: string;
|
|
219
|
-
direction?: "asc" | "desc";
|
|
220
|
-
nested?: boolean;
|
|
221
|
-
symbols?: string;
|
|
222
|
-
side?: OrderSide;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* SDK options for market data requests with feed parameter
|
|
226
|
-
*/
|
|
227
|
-
export interface SDKMarketDataOptions {
|
|
228
|
-
feed?: DataFeed;
|
|
229
|
-
}
|
|
230
211
|
/**
|
|
231
212
|
* Parameters for replacing an order.
|
|
232
213
|
*/
|
|
@@ -275,7 +256,7 @@ export type AlpacaOrder = {
|
|
|
275
256
|
extended_hours: boolean;
|
|
276
257
|
legs: AlpacaOrder[] | null;
|
|
277
258
|
};
|
|
278
|
-
export type CryptoTimeframe = `${number}Min` | `${number}T` | `${number}Hour` | `${number}H` |
|
|
259
|
+
export type CryptoTimeframe = `${number}Min` | `${number}T` | `${number}Hour` | `${number}H` | '1Day' | '1D' | '1Week' | '1W' | `${1 | 2 | 3 | 4 | 6 | 12}Month` | `${1 | 2 | 3 | 4 | 6 | 12}M`;
|
|
279
260
|
/**
|
|
280
261
|
* Represents a single bar of cryptocurrency market data.
|
|
281
262
|
*/
|
|
@@ -299,9 +280,9 @@ export interface CryptoBarsParams {
|
|
|
299
280
|
end?: Date;
|
|
300
281
|
limit?: number;
|
|
301
282
|
page_token?: string;
|
|
302
|
-
sort?:
|
|
283
|
+
sort?: 'asc' | 'desc';
|
|
303
284
|
}
|
|
304
|
-
export type TimeFrame =
|
|
285
|
+
export type TimeFrame = '1Min' | '5Min' | '15Min' | '30Min' | '1Hour' | '2Hour' | '4Hour' | '1Day' | '1Week' | '1Month';
|
|
305
286
|
/**
|
|
306
287
|
* Response structure for fetching cryptocurrency bars.
|
|
307
288
|
*/
|
|
@@ -311,10 +292,10 @@ export interface CryptoBarsResponse {
|
|
|
311
292
|
};
|
|
312
293
|
next_page_token?: string;
|
|
313
294
|
}
|
|
314
|
-
export type BTCPairs =
|
|
315
|
-
export type USDTPairs =
|
|
316
|
-
export type USDCPairs =
|
|
317
|
-
export type USDPairs =
|
|
295
|
+
export type BTCPairs = 'BCH/BTC' | 'ETH/BTC' | 'LTC/BTC' | 'UNI/BTC';
|
|
296
|
+
export type USDTPairs = 'AAVE/USDT' | 'BCH/USDT' | 'BTC/USDT' | 'DOGE/USDT' | 'ETH/USDT' | 'LINK/USDT' | 'LTC/USDT' | 'SUSHI/USDT' | 'UNI/USDT' | 'YFI/USDT';
|
|
297
|
+
export type USDCPairs = 'AAVE/USDC' | 'AVAX/USDC' | 'BAT/USDC' | 'BCH/USDC' | 'BTC/USDC' | 'CRV/USDC' | 'DOGE/USDC' | 'DOT/USDC' | 'ETH/USDC' | 'GRT/USDC' | 'LINK/USDC' | 'LTC/USDC' | 'MKR/USDC' | 'SHIB/USDC' | 'SUSHI/USDC' | 'UNI/USDC' | 'XTZ/USDC' | 'YFI/USDC';
|
|
298
|
+
export type USDPairs = 'AAVE/USD' | 'AVAX/USD' | 'BAT/USD' | 'BCH/USD' | 'BTC/USD' | 'CRV/USD' | 'DOGE/USD' | 'DOT/USD' | 'ETH/USD' | 'GRT/USD' | 'LINK/USD' | 'LTC/USD' | 'MKR/USD' | 'SHIB/USD' | 'SUSHI/USD' | 'UNI/USD' | 'USDC/USD' | 'USDT/USD' | 'XTZ/USD' | 'YFI/USD';
|
|
318
299
|
/**
|
|
319
300
|
* Represents a cryptocurrency trading pair.
|
|
320
301
|
*/
|
|
@@ -323,7 +304,7 @@ export type CryptoPair = BTCPairs | USDTPairs | USDCPairs | USDPairs;
|
|
|
323
304
|
* Represents an image associated with a news article.
|
|
324
305
|
*/
|
|
325
306
|
export interface NewsImage {
|
|
326
|
-
size:
|
|
307
|
+
size: 'large' | 'small' | 'thumb';
|
|
327
308
|
url: string;
|
|
328
309
|
}
|
|
329
310
|
/**
|
|
@@ -369,13 +350,13 @@ export interface SimpleNews {
|
|
|
369
350
|
*/
|
|
370
351
|
export interface PortfolioHistoryParams {
|
|
371
352
|
period?: string;
|
|
372
|
-
timeframe?:
|
|
373
|
-
intraday_reporting?:
|
|
353
|
+
timeframe?: '1Min' | '5Min' | '15Min' | '1H' | '1D';
|
|
354
|
+
intraday_reporting?: 'market_hours' | 'extended_hours' | 'continuous';
|
|
374
355
|
start?: string;
|
|
375
356
|
end?: string;
|
|
376
357
|
date_end?: string;
|
|
377
358
|
extended_hours?: boolean;
|
|
378
|
-
pnl_reset?:
|
|
359
|
+
pnl_reset?: 'per_day' | 'no_reset';
|
|
379
360
|
cashflow_types?: string;
|
|
380
361
|
}
|
|
381
362
|
/**
|
|
@@ -385,7 +366,7 @@ export interface FetchPortfolioHistoryProps {
|
|
|
385
366
|
params: PortfolioHistoryParams;
|
|
386
367
|
accountId?: string;
|
|
387
368
|
client?: ApolloClientType<NormalizedCacheObject>;
|
|
388
|
-
|
|
369
|
+
alpacaAccount?: types.AlpacaAccount;
|
|
389
370
|
}
|
|
390
371
|
/**
|
|
391
372
|
* Response structure for fetching portfolio history.
|
|
@@ -402,10 +383,9 @@ export interface PortfolioHistoryResponse {
|
|
|
402
383
|
* Parameters for fetching account details.
|
|
403
384
|
*/
|
|
404
385
|
export interface FetchAccountDetailsProps {
|
|
405
|
-
auth?: AlpacaAuth;
|
|
406
386
|
accountId?: string;
|
|
407
387
|
client?: ApolloClientType<NormalizedCacheObject>;
|
|
408
|
-
|
|
388
|
+
alpacaAccount?: types.AlpacaAccount;
|
|
409
389
|
}
|
|
410
390
|
/**
|
|
411
391
|
* Represents the details of an Alpaca account.
|
|
@@ -413,7 +393,7 @@ export interface FetchAccountDetailsProps {
|
|
|
413
393
|
export interface AlpacaAccountDetails {
|
|
414
394
|
id: string;
|
|
415
395
|
account_number: string;
|
|
416
|
-
status:
|
|
396
|
+
status: 'ONBOARDING' | 'SUBMISSION_FAILED' | 'SUBMITTED' | 'ACCOUNT_UPDATED' | 'APPROVAL_PENDING' | 'ACTIVE' | 'REJECTED';
|
|
417
397
|
currency: string;
|
|
418
398
|
cash: string;
|
|
419
399
|
portfolio_value: string;
|
|
@@ -432,7 +412,7 @@ export interface AlpacaAccountDetails {
|
|
|
432
412
|
short_market_value: string;
|
|
433
413
|
equity: string;
|
|
434
414
|
last_equity: string;
|
|
435
|
-
multiplier:
|
|
415
|
+
multiplier: '1' | '2' | '4';
|
|
436
416
|
buying_power: string;
|
|
437
417
|
initial_margin: string;
|
|
438
418
|
maintenance_margin: string;
|
|
@@ -453,11 +433,11 @@ export interface AlpacaAccountDetails {
|
|
|
453
433
|
*/
|
|
454
434
|
export interface AlpacaAsset {
|
|
455
435
|
id: string;
|
|
456
|
-
class:
|
|
436
|
+
class: 'us_equity' | 'us_option' | 'crypto';
|
|
457
437
|
exchange: string;
|
|
458
438
|
symbol: string;
|
|
459
439
|
name: string;
|
|
460
|
-
status:
|
|
440
|
+
status: 'active' | 'inactive';
|
|
461
441
|
tradable: boolean;
|
|
462
442
|
marginable: boolean;
|
|
463
443
|
shortable: boolean;
|
|
@@ -474,7 +454,7 @@ export interface AlpacaAsset {
|
|
|
474
454
|
export interface GetAssetParams {
|
|
475
455
|
symbolOrAssetId: string;
|
|
476
456
|
}
|
|
477
|
-
export type DataFeed =
|
|
457
|
+
export type DataFeed = 'sip' | 'iex' | 'delayed_sip';
|
|
478
458
|
export interface AlpacaQuote {
|
|
479
459
|
t: string;
|
|
480
460
|
ap: number;
|
|
@@ -526,13 +506,13 @@ export interface LatestQuotesResponse {
|
|
|
526
506
|
currency: string;
|
|
527
507
|
}
|
|
528
508
|
export type OptionsTradingLevel = 0 | 1 | 2 | 3;
|
|
529
|
-
export type OptionType =
|
|
530
|
-
export type OptionStyle =
|
|
509
|
+
export type OptionType = 'call' | 'put';
|
|
510
|
+
export type OptionStyle = 'american' | 'european';
|
|
531
511
|
export interface OptionContract {
|
|
532
512
|
id: string;
|
|
533
513
|
symbol: string;
|
|
534
514
|
name: string;
|
|
535
|
-
status:
|
|
515
|
+
status: 'active' | 'inactive';
|
|
536
516
|
tradable: boolean;
|
|
537
517
|
expiration_date: string;
|
|
538
518
|
root_symbol: string;
|
|
@@ -554,7 +534,7 @@ export interface GetOptionContractsParams {
|
|
|
554
534
|
strike_price_gte?: string;
|
|
555
535
|
strike_price_lte?: string;
|
|
556
536
|
type?: OptionType;
|
|
557
|
-
status?:
|
|
537
|
+
status?: 'active' | 'inactive';
|
|
558
538
|
limit?: number;
|
|
559
539
|
page_token?: string;
|
|
560
540
|
}
|
|
@@ -566,8 +546,8 @@ export interface OptionContractsResponse {
|
|
|
566
546
|
export interface OrderLeg {
|
|
567
547
|
symbol: string;
|
|
568
548
|
ratio_qty: string;
|
|
569
|
-
side:
|
|
570
|
-
position_intent:
|
|
549
|
+
side: 'buy' | 'sell';
|
|
550
|
+
position_intent: 'buy_to_open' | 'buy_to_close' | 'sell_to_open' | 'sell_to_close';
|
|
571
551
|
}
|
|
572
552
|
export interface OptionGreeks {
|
|
573
553
|
delta?: number;
|
|
@@ -654,7 +634,7 @@ export interface OptionsChainParams {
|
|
|
654
634
|
* The source feed of the data. opra is the official OPRA feed, indicative is a free indicative feed
|
|
655
635
|
* where trades are delayed and quotes are modified. Default: opra if the user has a subscription, otherwise indicative.
|
|
656
636
|
*/
|
|
657
|
-
feed?:
|
|
637
|
+
feed?: 'opra' | 'indicative';
|
|
658
638
|
/**
|
|
659
639
|
* Number of maximum snapshots to return in a response (1 to 1000)
|
|
660
640
|
* The limit applies to the total number of data points, not the number per symbol!
|
|
@@ -727,7 +707,7 @@ export interface HistoricalOptionsBarsParams {
|
|
|
727
707
|
/** Pagination token for next page */
|
|
728
708
|
page_token?: string;
|
|
729
709
|
/** Sort order (asc or desc) */
|
|
730
|
-
sort?:
|
|
710
|
+
sort?: 'asc' | 'desc';
|
|
731
711
|
}
|
|
732
712
|
export interface HistoricalOptionsTradesParams {
|
|
733
713
|
/** Comma-separated list of option contract symbols */
|
|
@@ -747,7 +727,7 @@ export interface HistoricalOptionsTradesParams {
|
|
|
747
727
|
/** Pagination token for next page */
|
|
748
728
|
page_token?: string;
|
|
749
729
|
/** Sort order (asc or desc) */
|
|
750
|
-
sort?:
|
|
730
|
+
sort?: 'asc' | 'desc';
|
|
751
731
|
}
|
|
752
732
|
export interface OptionsSnapshotsParams {
|
|
753
733
|
/** Comma-separated list of option contract symbols */
|
|
@@ -763,14 +743,14 @@ export interface OptionsConditionCodesResponse {
|
|
|
763
743
|
export interface OptionsExchangeCodesResponse {
|
|
764
744
|
[exchangeCode: string]: string;
|
|
765
745
|
}
|
|
766
|
-
export type OptionTickType =
|
|
746
|
+
export type OptionTickType = 'trade' | 'quote';
|
|
767
747
|
/**
|
|
768
748
|
* Configuration for options spread trading strategies.
|
|
769
749
|
* Now includes a field to target a predicted stock price movement (in percent, scale 100).
|
|
770
750
|
*/
|
|
771
751
|
export interface OptionsSpreadConfig {
|
|
772
752
|
/** Strategy type to use - only spreads allowed */
|
|
773
|
-
strategy:
|
|
753
|
+
strategy: 'call_spread' | 'put_spread';
|
|
774
754
|
/** Days to expiration target (will find closest available) */
|
|
775
755
|
daysToExpiration: number;
|
|
776
756
|
/** Delta target for the long leg (0.1-0.9 range) */
|
|
@@ -789,7 +769,7 @@ export interface OptionsSpreadConfig {
|
|
|
789
769
|
*/
|
|
790
770
|
targetMovePercent100?: number;
|
|
791
771
|
}
|
|
792
|
-
export type OptionActivityType =
|
|
772
|
+
export type OptionActivityType = 'OPEXC' | 'OPASN' | 'OPEXP';
|
|
793
773
|
export interface OptionAccountActivity {
|
|
794
774
|
id: string;
|
|
795
775
|
activity_type: OptionActivityType;
|
|
@@ -799,19 +779,19 @@ export interface OptionAccountActivity {
|
|
|
799
779
|
symbol: string;
|
|
800
780
|
qty: string;
|
|
801
781
|
price?: string;
|
|
802
|
-
status:
|
|
782
|
+
status: 'executed';
|
|
803
783
|
}
|
|
804
784
|
export interface TradeUpdate {
|
|
805
|
-
event:
|
|
785
|
+
event: 'new' | 'fill' | 'partial_fill' | 'canceled' | 'expired' | 'pending_new' | 'pending_cancel' | 'pending_replace' | 'replaced' | 'done_for_day';
|
|
806
786
|
price?: string;
|
|
807
787
|
timestamp: string;
|
|
808
788
|
qty?: string;
|
|
809
789
|
position_qty?: string;
|
|
810
790
|
order: AlpacaOrder;
|
|
811
791
|
}
|
|
812
|
-
export type AlpacaAccountType =
|
|
813
|
-
export type AlpacaOrderType =
|
|
814
|
-
export type EngineType =
|
|
792
|
+
export type AlpacaAccountType = 'PAPER' | 'LIVE';
|
|
793
|
+
export type AlpacaOrderType = 'limit' | 'market' | 'options';
|
|
794
|
+
export type EngineType = 'adaptic' | 'brain' | 'quant';
|
|
815
795
|
export interface AlpacaCredentials {
|
|
816
796
|
accountName: string;
|
|
817
797
|
apiKey: string;
|
|
@@ -820,8 +800,8 @@ export interface AlpacaCredentials {
|
|
|
820
800
|
orderType: AlpacaOrderType;
|
|
821
801
|
engine: EngineType;
|
|
822
802
|
}
|
|
823
|
-
export type { AlpacaTradingAPI } from
|
|
824
|
-
export type { AlpacaMarketDataAPI } from
|
|
803
|
+
export type { AlpacaTradingAPI } from '../alpaca-trading-api';
|
|
804
|
+
export type { AlpacaMarketDataAPI } from '../alpaca-market-data-api';
|
|
825
805
|
/**
|
|
826
806
|
* Base interface for all real-time stream messages from Alpaca.
|
|
827
807
|
* All stream messages will have a 'T' (Type) and 'S' (Symbol) property.
|
|
@@ -835,7 +815,7 @@ export interface AlpacaStreamMessage {
|
|
|
835
815
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#trades
|
|
836
816
|
*/
|
|
837
817
|
export interface AlpacaTradeStream extends AlpacaStreamMessage {
|
|
838
|
-
T:
|
|
818
|
+
T: 't';
|
|
839
819
|
i: number;
|
|
840
820
|
x: string;
|
|
841
821
|
p: number;
|
|
@@ -849,7 +829,7 @@ export interface AlpacaTradeStream extends AlpacaStreamMessage {
|
|
|
849
829
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#quotes
|
|
850
830
|
*/
|
|
851
831
|
export interface AlpacaQuoteStream extends AlpacaStreamMessage {
|
|
852
|
-
T:
|
|
832
|
+
T: 'q';
|
|
853
833
|
ax: string;
|
|
854
834
|
ap: number;
|
|
855
835
|
as: number;
|
|
@@ -865,7 +845,7 @@ export interface AlpacaQuoteStream extends AlpacaStreamMessage {
|
|
|
865
845
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#bars
|
|
866
846
|
*/
|
|
867
847
|
export interface AlpacaBarStream extends AlpacaStreamMessage {
|
|
868
|
-
T:
|
|
848
|
+
T: 'b';
|
|
869
849
|
o: number;
|
|
870
850
|
h: number;
|
|
871
851
|
l: number;
|
|
@@ -879,22 +859,22 @@ export interface AlpacaBarStream extends AlpacaStreamMessage {
|
|
|
879
859
|
* Real-time daily stock bar message. (T: 'd')
|
|
880
860
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#bars
|
|
881
861
|
*/
|
|
882
|
-
export interface AlpacaDailyBarStream extends Omit<AlpacaBarStream,
|
|
883
|
-
T:
|
|
862
|
+
export interface AlpacaDailyBarStream extends Omit<AlpacaBarStream, 'T'> {
|
|
863
|
+
T: 'd';
|
|
884
864
|
}
|
|
885
865
|
/**
|
|
886
866
|
* Real-time updated stock bar message. (T: 'u')
|
|
887
867
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#bars
|
|
888
868
|
*/
|
|
889
|
-
export interface AlpacaUpdatedBarStream extends Omit<AlpacaBarStream,
|
|
890
|
-
T:
|
|
869
|
+
export interface AlpacaUpdatedBarStream extends Omit<AlpacaBarStream, 'T'> {
|
|
870
|
+
T: 'u';
|
|
891
871
|
}
|
|
892
872
|
/**
|
|
893
873
|
* Real-time trading status message. (T: 's')
|
|
894
874
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#trading-status
|
|
895
875
|
*/
|
|
896
876
|
export interface AlpacaTradingStatusStream extends AlpacaStreamMessage {
|
|
897
|
-
T:
|
|
877
|
+
T: 's';
|
|
898
878
|
sc: string;
|
|
899
879
|
sm: string;
|
|
900
880
|
rc: string;
|
|
@@ -907,7 +887,7 @@ export interface AlpacaTradingStatusStream extends AlpacaStreamMessage {
|
|
|
907
887
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#lulds
|
|
908
888
|
*/
|
|
909
889
|
export interface AlpacaLULDStream extends AlpacaStreamMessage {
|
|
910
|
-
T:
|
|
890
|
+
T: 'l';
|
|
911
891
|
ldp: number;
|
|
912
892
|
lup: number;
|
|
913
893
|
i: string;
|
|
@@ -919,7 +899,7 @@ export interface AlpacaLULDStream extends AlpacaStreamMessage {
|
|
|
919
899
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#trade-corrections
|
|
920
900
|
*/
|
|
921
901
|
export interface AlpacaTradeCorrectionStream extends AlpacaStreamMessage {
|
|
922
|
-
T:
|
|
902
|
+
T: 'c';
|
|
923
903
|
oi: number;
|
|
924
904
|
ci: number;
|
|
925
905
|
ox: string;
|
|
@@ -938,7 +918,7 @@ export interface AlpacaTradeCorrectionStream extends AlpacaStreamMessage {
|
|
|
938
918
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#trade-cancelserros
|
|
939
919
|
*/
|
|
940
920
|
export interface AlpacaTradeCancelStream extends AlpacaStreamMessage {
|
|
941
|
-
T:
|
|
921
|
+
T: 'x';
|
|
942
922
|
i: number;
|
|
943
923
|
p: number;
|
|
944
924
|
s: number;
|
|
@@ -950,7 +930,7 @@ export interface AlpacaTradeCancelStream extends AlpacaStreamMessage {
|
|
|
950
930
|
* @see https://docs.alpaca.markets/docs/real-time-stock-pricing-data#order-imbalances
|
|
951
931
|
*/
|
|
952
932
|
export interface AlpacaOrderImbalanceStream extends AlpacaStreamMessage {
|
|
953
|
-
T:
|
|
933
|
+
T: 'i';
|
|
954
934
|
p: number;
|
|
955
935
|
z: string;
|
|
956
936
|
t: string;
|
|
@@ -960,7 +940,7 @@ export interface AlpacaOrderImbalanceStream extends AlpacaStreamMessage {
|
|
|
960
940
|
* @see https://docs.alpaca.markets/docs/real-time-option-data#trades
|
|
961
941
|
*/
|
|
962
942
|
export interface AlpacaOptionTradeStream extends AlpacaStreamMessage {
|
|
963
|
-
T:
|
|
943
|
+
T: 't';
|
|
964
944
|
p: number;
|
|
965
945
|
s: number;
|
|
966
946
|
c: string[];
|
|
@@ -972,7 +952,7 @@ export interface AlpacaOptionTradeStream extends AlpacaStreamMessage {
|
|
|
972
952
|
* @see https://docs.alpaca.markets/docs/real-time-option-data#quotes
|
|
973
953
|
*/
|
|
974
954
|
export interface AlpacaOptionQuoteStream extends AlpacaStreamMessage {
|
|
975
|
-
T:
|
|
955
|
+
T: 'q';
|
|
976
956
|
ap: number;
|
|
977
957
|
as: number;
|
|
978
958
|
ax: string;
|
|
@@ -986,7 +966,7 @@ export interface AlpacaOptionQuoteStream extends AlpacaStreamMessage {
|
|
|
986
966
|
* @see https://docs.alpaca.markets/docs/real-time-option-data#bars
|
|
987
967
|
*/
|
|
988
968
|
export interface AlpacaOptionBarStream extends AlpacaStreamMessage {
|
|
989
|
-
T:
|
|
969
|
+
T: 'b';
|
|
990
970
|
o: number;
|
|
991
971
|
h: number;
|
|
992
972
|
l: number;
|
|
@@ -998,168 +978,25 @@ export interface AlpacaOptionBarStream extends AlpacaStreamMessage {
|
|
|
998
978
|
}
|
|
999
979
|
export type AlpacaStockStreamMessage = AlpacaTradeStream | AlpacaQuoteStream | AlpacaBarStream | AlpacaDailyBarStream | AlpacaUpdatedBarStream | AlpacaTradingStatusStream | AlpacaLULDStream | AlpacaTradeCorrectionStream | AlpacaTradeCancelStream | AlpacaOrderImbalanceStream;
|
|
1000
980
|
export type AlpacaOptionStreamMessage = AlpacaOptionTradeStream | AlpacaOptionQuoteStream | AlpacaOptionBarStream;
|
|
1001
|
-
export type StockStreamEventName =
|
|
1002
|
-
export type OptionStreamEventName =
|
|
981
|
+
export type StockStreamEventName = 'stock-t' | 'stock-q' | 'stock-b' | 'stock-d' | 'stock-u' | 'stock-s' | 'stock-l' | 'stock-c' | 'stock-x' | 'stock-i' | 'stock-data';
|
|
982
|
+
export type OptionStreamEventName = 'option-t' | 'option-q' | 'option-b' | 'option-data';
|
|
1003
983
|
export interface StockStreamEventMap {
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
984
|
+
'stock-t': AlpacaTradeStream;
|
|
985
|
+
'stock-q': AlpacaQuoteStream;
|
|
986
|
+
'stock-b': AlpacaBarStream;
|
|
987
|
+
'stock-d': AlpacaDailyBarStream;
|
|
988
|
+
'stock-u': AlpacaUpdatedBarStream;
|
|
989
|
+
'stock-s': AlpacaTradingStatusStream;
|
|
990
|
+
'stock-l': AlpacaLULDStream;
|
|
991
|
+
'stock-c': AlpacaTradeCorrectionStream;
|
|
992
|
+
'stock-x': AlpacaTradeCancelStream;
|
|
993
|
+
'stock-i': AlpacaOrderImbalanceStream;
|
|
994
|
+
'stock-data': AlpacaStockStreamMessage;
|
|
1015
995
|
}
|
|
1016
996
|
export interface OptionStreamEventMap {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Crypto trade stream message from Alpaca WebSocket
|
|
1024
|
-
* Format: wss://stream.data.alpaca.markets/v1beta3/crypto/us
|
|
1025
|
-
*/
|
|
1026
|
-
export interface AlpacaCryptoTradeStream {
|
|
1027
|
-
T: "t";
|
|
1028
|
-
S: string;
|
|
1029
|
-
p: number;
|
|
1030
|
-
s: number;
|
|
1031
|
-
t: string;
|
|
1032
|
-
i: number;
|
|
1033
|
-
tks: "B" | "S";
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Crypto quote stream message from Alpaca WebSocket
|
|
1037
|
-
*/
|
|
1038
|
-
export interface AlpacaCryptoQuoteStream {
|
|
1039
|
-
T: "q";
|
|
1040
|
-
S: string;
|
|
1041
|
-
bp: number;
|
|
1042
|
-
bs: number;
|
|
1043
|
-
ap: number;
|
|
1044
|
-
as: number;
|
|
1045
|
-
t: string;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Crypto bar stream message from Alpaca WebSocket
|
|
1049
|
-
*/
|
|
1050
|
-
export interface AlpacaCryptoBarStream {
|
|
1051
|
-
T: "b";
|
|
1052
|
-
S: string;
|
|
1053
|
-
o: number;
|
|
1054
|
-
h: number;
|
|
1055
|
-
l: number;
|
|
1056
|
-
c: number;
|
|
1057
|
-
v: number;
|
|
1058
|
-
t: string;
|
|
1059
|
-
n: number;
|
|
1060
|
-
vw: number;
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Crypto daily bar stream message from Alpaca WebSocket
|
|
1064
|
-
*/
|
|
1065
|
-
export interface AlpacaCryptoDailyBarStream {
|
|
1066
|
-
T: "d";
|
|
1067
|
-
S: string;
|
|
1068
|
-
o: number;
|
|
1069
|
-
h: number;
|
|
1070
|
-
l: number;
|
|
1071
|
-
c: number;
|
|
1072
|
-
v: number;
|
|
1073
|
-
t: string;
|
|
1074
|
-
n: number;
|
|
1075
|
-
vw: number;
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
|
-
* Crypto updated bar stream message from Alpaca WebSocket
|
|
1079
|
-
*/
|
|
1080
|
-
export interface AlpacaCryptoUpdatedBarStream {
|
|
1081
|
-
T: "u";
|
|
1082
|
-
S: string;
|
|
1083
|
-
o: number;
|
|
1084
|
-
h: number;
|
|
1085
|
-
l: number;
|
|
1086
|
-
c: number;
|
|
1087
|
-
v: number;
|
|
1088
|
-
t: string;
|
|
1089
|
-
n: number;
|
|
1090
|
-
vw: number;
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Union type for all crypto stream messages
|
|
1094
|
-
*/
|
|
1095
|
-
export type AlpacaCryptoStreamMessage = AlpacaCryptoTradeStream | AlpacaCryptoQuoteStream | AlpacaCryptoBarStream | AlpacaCryptoDailyBarStream | AlpacaCryptoUpdatedBarStream;
|
|
1096
|
-
/**
|
|
1097
|
-
* Type-safe event names for crypto market data streams
|
|
1098
|
-
*/
|
|
1099
|
-
export type CryptoStreamEventName = "crypto-t" | "crypto-q" | "crypto-b" | "crypto-d" | "crypto-u" | "crypto-data";
|
|
1100
|
-
/**
|
|
1101
|
-
* Event payload mapping for crypto streams
|
|
1102
|
-
*/
|
|
1103
|
-
export interface CryptoStreamEventMap {
|
|
1104
|
-
"crypto-t": AlpacaCryptoTradeStream;
|
|
1105
|
-
"crypto-q": AlpacaCryptoQuoteStream;
|
|
1106
|
-
"crypto-b": AlpacaCryptoBarStream;
|
|
1107
|
-
"crypto-d": AlpacaCryptoDailyBarStream;
|
|
1108
|
-
"crypto-u": AlpacaCryptoUpdatedBarStream;
|
|
1109
|
-
"crypto-data": AlpacaCryptoStreamMessage;
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
* WebSocket authorization response message
|
|
1113
|
-
*/
|
|
1114
|
-
export interface AlpacaAuthMessage {
|
|
1115
|
-
stream: "authorization";
|
|
1116
|
-
data: {
|
|
1117
|
-
status: "authorized" | "unauthorized";
|
|
1118
|
-
action: "authenticate";
|
|
1119
|
-
message?: string;
|
|
1120
|
-
};
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* WebSocket listening response message
|
|
1124
|
-
*/
|
|
1125
|
-
export interface AlpacaListenMessage {
|
|
1126
|
-
stream: "listening";
|
|
1127
|
-
data: {
|
|
1128
|
-
streams: string[];
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Generic WebSocket message structure
|
|
1133
|
-
*/
|
|
1134
|
-
export interface AlpacaWebSocketMessage {
|
|
1135
|
-
stream: string;
|
|
1136
|
-
data: AlpacaAuthMessage["data"] | AlpacaListenMessage["data"] | TradeUpdate;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Response from exercising an option
|
|
1140
|
-
*/
|
|
1141
|
-
export interface ExerciseOptionResponse {
|
|
1142
|
-
id: string;
|
|
1143
|
-
symbol: string;
|
|
1144
|
-
side: "long" | "short";
|
|
1145
|
-
qty: string;
|
|
1146
|
-
asset_class: "us_option";
|
|
1147
|
-
status: "pending" | "complete" | "failed";
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Account with allocation configuration
|
|
1151
|
-
* Extends the base BrokerageAccount from backend-legacy with optional allocation fields
|
|
1152
|
-
*/
|
|
1153
|
-
export interface BrokerageAccountWithAllocation {
|
|
1154
|
-
allocation?: AllocationConfig;
|
|
1155
|
-
autoAllocation?: boolean;
|
|
1156
|
-
marketOpen?: boolean;
|
|
1157
|
-
realTime?: boolean;
|
|
1158
|
-
tradeAllocationPct?: number;
|
|
1159
|
-
minPercentageChange?: number;
|
|
1160
|
-
volumeThreshold?: number;
|
|
1161
|
-
cryptoTradingEnabled?: boolean;
|
|
1162
|
-
cryptoTradingPairs?: string[];
|
|
1163
|
-
cryptoTradeAllocationPct?: number;
|
|
997
|
+
'option-t': AlpacaOptionTradeStream;
|
|
998
|
+
'option-q': AlpacaOptionQuoteStream;
|
|
999
|
+
'option-b': AlpacaOptionBarStream;
|
|
1000
|
+
'option-data': AlpacaOptionStreamMessage;
|
|
1164
1001
|
}
|
|
1165
1002
|
//# sourceMappingURL=alpaca-types.d.ts.map
|