@engineering-tf/shared 1.0.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.
@@ -0,0 +1,376 @@
1
+ /**
2
+ * table filters shared for Smart Flow and Full Flow
3
+ */
4
+ type ColumnsState = {
5
+ show?: boolean;
6
+ fixed?: 'right' | 'left' | undefined;
7
+ order?: number;
8
+ disable?: boolean | {
9
+ checkbox: boolean;
10
+ };
11
+ };
12
+ /**
13
+ * the reason why [string] for expiration_date for example
14
+ * is that in the column filter only accept array: filteredValue: tableFilters.expiration_date || null,
15
+ *
16
+ */
17
+ export interface TableFiltersProps {
18
+ /** DAYS UNTIL EXPIRY */
19
+ [TABLEFILTER_KEY.EXPIRY_DAYS]: [string] | null;
20
+ /** TICKER */
21
+ [TABLEFILTER_KEY.SYMBOL]: string | null;
22
+ /** UNDERLYING */
23
+ [TABLEFILTER_KEY.UNDERLYING_TYPE]: [UNDERLYING_TYPE_TAG] | null;
24
+ /** CALL/PUT */
25
+ [TABLEFILTER_KEY.PUT_CALL]: [CALL_PUT_TAG] | null;
26
+ /** STRIKE */
27
+ [TABLEFILTER_KEY.STRIKE]: [string] | null;
28
+ /** PRICE */
29
+ [TABLEFILTER_KEY.PRICE]: [string] | null;
30
+ /** SIZE */
31
+ [TABLEFILTER_KEY.SIZE]: [string] | null;
32
+ /** REF */
33
+ [TABLEFILTER_KEY.UNDERLYING_PRICE]: [string] | null;
34
+ /** SCORE */
35
+ [TABLEFILTER_KEY.SCORE]: [string] | null;
36
+ /** PREM */
37
+ [TABLEFILTER_KEY.PREMIUM]: [string] | null;
38
+ /** VOL */
39
+ [TABLEFILTER_KEY.DAILY_VOLUME]: [string] | null;
40
+ /** OI */
41
+ [TABLEFILTER_KEY.OI]: [string] | null;
42
+ /** TRADE */
43
+ [TABLEFILTER_KEY.OPTION_ACTIVITY_TYPE]: [OPTION_ACTIVITY_TYPE] | null;
44
+ /** MONEYNESS */
45
+ [TABLEFILTER_KEY.MONEYNESS]: [MONEYNESS_LABEL] | null;
46
+ /** SIDE */
47
+ [TABLEFILTER_KEY.SIDE]: [SIDE_LABEL] | null;
48
+ /** SIDE */
49
+ [TABLEFILTER_KEY.SENTIMENT]: [SENTIMENT_TAG] | null;
50
+ /** OPENING */
51
+ [TABLEFILTER_KEY.IS_OPENING_ONLY]: [boolean] | null;
52
+ /** DATE FILTER */
53
+ [TABLEFILTER_KEY.DATE_FILTER]: {
54
+ start_date: string;
55
+ end_date: string;
56
+ max_trading_date: string;
57
+ };
58
+ /** ['09:30:00','15:00:00']*/
59
+ [TABLEFILTER_KEY.TIME_FILTER]: [string, string];
60
+ sorter?: {
61
+ columnKey?: any;
62
+ order?: any;
63
+ };
64
+ pagination: {
65
+ current: number;
66
+ pageSize: number;
67
+ };
68
+ /** LABEL */
69
+ [TABLEFILTER_KEY.STRATEGY_LABEL]: [STRATEGY_LABEL] | null;
70
+ /** DELTA */
71
+ [TABLEFILTER_KEY.DELTA]: [string] | null;
72
+ /** IV */
73
+ [TABLEFILTER_KEY.IV]: [string] | null;
74
+ /**DEI**/
75
+ [TABLEFILTER_KEY.DEI]: [string] | null;
76
+ /**DEX**/
77
+ [TABLEFILTER_KEY.DEX]: [string] | null;
78
+ /** UPCOMING EARNING */
79
+ [TABLEFILTER_KEY.IS_RECENT_EARNING_ONLY]: [boolean] | null;
80
+ /**
81
+ * determine whether smart mode is historical mode, it is supposed to be in the config object
82
+ * but since we need to pass this info into model inside one param, we have to embed it into tableFilters
83
+ */
84
+ columnsStateMap: Record<string, ColumnsState> | null;
85
+ watchlistOnly: boolean;
86
+ watchlist?: string[];
87
+ default: boolean;
88
+ version: string;
89
+ id: string;
90
+ itemOptionChainInfo?: any;
91
+ market_data?: any;
92
+ greek_algo_data?: any;
93
+ option_algo_data?: any;
94
+ symbol_meta_data?: any;
95
+ }
96
+ export declare enum TABLEFILTER_KEY {
97
+ DATE = "date",
98
+ TIME = "time",
99
+ PREMIUM = "premium",
100
+ MONEYNESS = "moneyness",
101
+ OI = "oi",
102
+ DELTA = "delta",
103
+ IV = "iv",
104
+ EXPIRY_DAYS = "expiry_days",
105
+ EXPIRATION_DATE = "expiration_date",
106
+ SYMBOL = "symbol",
107
+ UNDERLYING_TYPE = "underlying_type",
108
+ PUT_CALL = "put_call",
109
+ STRIKE = "strike",
110
+ PRICE = "price",
111
+ SIZE = "size",
112
+ UNDERLYING_PRICE = "underlying_price",
113
+ SCORE = "score",
114
+ SENTIMENT = "sentiment",
115
+ IS_OPENING_ONLY = "is_opening_only",
116
+ DATE_FILTER = "date_filter",
117
+ TIME_FILTER = "time_filter",
118
+ STRATEGY_LABEL = "strategy_label",
119
+ IS_RECENT_EARNING_ONLY = "is_recent_earning_only",
120
+ COLUMNS_STATE_MAP = "columnsStateMap",
121
+ WATCHLIST_ONLY = "watchlistOnly",
122
+ DEFAULT = "default",
123
+ VERSION = "version",
124
+ ID = "id",
125
+ DAILY_VOLUME = "daily_volume",
126
+ OPTION_ACTIVITY_TYPE = "option_activity_type",
127
+ SIDE = "side",
128
+ DEI = "dei",
129
+ DEX = "dex",
130
+ EARNING_DATE = "earning_date",
131
+ TRADE_COUNT = "trade_count",
132
+ SYMBOLS = "symbols"
133
+ }
134
+ /**
135
+ * smart mode fetch request props
136
+ */
137
+ /**
138
+ * full mode fetch request props
139
+ */
140
+ /**
141
+ * @deprecated
142
+ * Base type used in both SmartOptionFlow and FullOptionFlow
143
+ * FF: Full Flow, SM: Smart Flow
144
+ */
145
+ export interface OptionFlowItem {
146
+ /** SHARED BETWEEN SMART FLOW and FULL FLOW */
147
+ id: string;
148
+ size: number;
149
+ /** PRICE */
150
+ price: number;
151
+ /** PREM */
152
+ cost_basis: number;
153
+ bid: number;
154
+ ask: number;
155
+ date: string;
156
+ time: string;
157
+ /** TICKER */
158
+ ticker: string;
159
+ /** CALL/PUT */
160
+ put_call: CALL_PUT_TAG;
161
+ /** STRIKE */
162
+ strike_price: number;
163
+ /** EXPIRY DATE */
164
+ date_expiration: string;
165
+ /** UNDERLYING */
166
+ underlying_type: UNDERLYING_TYPE_TAG;
167
+ /** TRADE */
168
+ option_activity_type: OPTION_ACTIVITY_TYPE;
169
+ /** OI */
170
+ open_interest: number;
171
+ /** DAILY VOLUME */
172
+ volume: number;
173
+ /** REF */
174
+ ref: number;
175
+ sentiment: SENTIMENT_TAG;
176
+ earning: string;
177
+ midpoint: number;
178
+ option_symbol: string;
179
+ trade_count: number;
180
+ updated: number;
181
+ /***********************BELOW IS EXTENDED FIELDS******************************/
182
+ /** the amount of days to expiration */
183
+ expiry_days: number;
184
+ /** side is calculated based on aggressor_ind*/
185
+ side: SIDE_LABEL;
186
+ /** moneyness is calculated based on strike price and ref*/
187
+ moneyness: MONEYNESS_LABEL;
188
+ /** calculate the score */
189
+ ttl: number;
190
+ /** calculate the score */
191
+ score: number;
192
+ /** @deprecated labelling strategy */
193
+ strategy_label: STRATEGY_LABEL[];
194
+ /** delta hedging in shares, aka, DEX, always positive */
195
+ deltaExposure: number;
196
+ /** deltaExposure/daily average stock volume, aka, DEI, eg: 2.3, which represents that the 2.3%, always positive */
197
+ deltaImpact: number;
198
+ /** IV*/
199
+ iv: number;
200
+ /***********************BELOW IS Option Chain Information******************************/
201
+ delta: number;
202
+ theta: number;
203
+ gamma: number;
204
+ vega: number;
205
+ itemOptionChainInfo?: ItemOptionChainInfo;
206
+ }
207
+ /**
208
+ * if expired is false, delta/oi/price could be null
209
+ */
210
+ export interface ItemOptionChainInfo {
211
+ delta?: number;
212
+ openInterest?: number;
213
+ price?: number;
214
+ iv?: number;
215
+ expired: boolean;
216
+ }
217
+ /**
218
+ * @description indicates the props for the request to the full api
219
+ * @usage api-service, process-service
220
+ */
221
+ /**
222
+ * @description Trade Code
223
+ * https://unusualwhales.com/glossary/trade-code
224
+ */
225
+ export declare enum OPTION_ACTIVITY_TYPE {
226
+ /**
227
+ * Aggregated trades are trades that are grouped together by our server if the trade time is exactly the same for the same contract
228
+ */
229
+ AGGREGATED = "AGGREGATED",
230
+ SWEEP = "SWEEP",
231
+ BLOCK = "BLOCK",
232
+ TRADE = "TRADE",
233
+ /** Introduced from MC API */
234
+ MULTILEG = "MULTILEG",
235
+ COMBO = "COMBO",
236
+ /**
237
+ * Transaction represents the option portion of an order involving a single option leg (buy or sell of a call or put) and stock.
238
+ * Prefix appears solely for information: process as a regular transaction.
239
+ */
240
+ BUYWRITE = "BUYWRITE",
241
+ /**
242
+ * Transaction represents the buying of a call and the selling of a put for the same underlying stock or index.
243
+ */
244
+ STRADDLE = "STRADDLE",
245
+ SPREAD = "SPREAD",
246
+ /**
247
+ * Transaction was the execution of an order identified as an Intermarket Sweep Order. Process like normal transaction.
248
+ */
249
+ IntermarketSweep = "IntermarketSweep"
250
+ }
251
+ /**
252
+ * SIDE
253
+ */
254
+ export declare enum SIDE_LABEL {
255
+ ABOVE_ASK = "AASK",
256
+ ASK = "ASK",
257
+ MID = "MID",
258
+ BID = "BID",
259
+ BELOW_BID = "BBID"
260
+ }
261
+ /**
262
+ * MONEYNESS
263
+ */
264
+ export declare enum MONEYNESS_LABEL {
265
+ ITM = "ITM",
266
+ ATM = "ATM",
267
+ OTM = "OTM"
268
+ }
269
+ /**
270
+ * for strategy
271
+ */
272
+ export declare enum SENTIMENT_TAG {
273
+ BULLISH = "BULLISH",
274
+ BEARISH = "BEARISH",
275
+ NEUTRAL = "NEUTRAL"
276
+ }
277
+ export declare enum CALL_PUT_TAG {
278
+ CALL = "CALL",
279
+ PUT = "PUT"
280
+ }
281
+ export declare enum UNDERLYING_TYPE_TAG {
282
+ STOCK = "STOCK",
283
+ ETF = "ETF",
284
+ ETN = "ETN",
285
+ MLB = "MLB",
286
+ REIT = "REIT",
287
+ INDEX = "INDEX"
288
+ }
289
+ export interface FormattedResponse {
290
+ status: STATUS;
291
+ errorMsg?: string;
292
+ errorCode?: string;
293
+ data?: any;
294
+ }
295
+ export declare enum STATUS {
296
+ SUCCESS = "SUCCESS",
297
+ ERROR = "ERROR"
298
+ }
299
+ export declare const FORMATTED_ERROR: {
300
+ AUTHENTICATED_FAILURE: {
301
+ CODE: string;
302
+ MESSAGE: string;
303
+ };
304
+ SESSION_EXPIRED: {
305
+ CODE: string;
306
+ MESSAGE: string;
307
+ };
308
+ SUBSCRIPTION_EXPIRED: {
309
+ CODE: string;
310
+ };
311
+ UNKNOWN_ERROR: {
312
+ CODE: string;
313
+ MESSAGE: string;
314
+ };
315
+ };
316
+ export declare enum STRIPE_SUBSCRIPTION_STATUS {
317
+ ACTIVE = "active",
318
+ PAST_DUE = "past_due",
319
+ CANCELED = "canceled",
320
+ TRIALING = "trialing",
321
+ PAUSED = "paused",
322
+ INCOMPLETE = "incomplete",
323
+ INCOMPLETE_EXPIRED = "incomplete_expired"
324
+ }
325
+ export declare enum CHECKOUT_TYPE {
326
+ REGISTRATION = "registration",
327
+ RESUBSCRIPTION = "resubscription"
328
+ }
329
+ export declare enum HTTP_ERROR_CODE {
330
+ OK = 200,
331
+ BAD_REQUEST = 400,
332
+ UNAUTHORIZED = 401,
333
+ FORBIDDEN = 403,
334
+ INTERNAL_SERVER_ERROR = 500
335
+ }
336
+ /**
337
+ * @deprecated
338
+ */
339
+ /**
340
+ * @deprecated
341
+ * for strategy
342
+ */
343
+ export declare enum STRATEGY_LABEL {
344
+ NONE = 0,
345
+ NOVA = 1,
346
+ SWING = 2,
347
+ DT = "DT",
348
+ ACT = "ACT",
349
+ Δ = "\u0394",
350
+ Δ_plus = "\u0394+",
351
+ Γ = "\u0393",
352
+ Θ = "\u0398",
353
+ V = "V",
354
+ CLR = "CLR",
355
+ SELL = "SELL",
356
+ HV = "HV",
357
+ LV = "LV",
358
+ INSTITUTE_SELL_CALL = "INSTITUTE_SELL_CALL",
359
+ INSTITUTE_BUY_PUT = "INSTITUTE_BUY_PUT",
360
+ EXTEND = "EXTEND",
361
+ FULL = "FULL",
362
+ SMART = "SMART"
363
+ }
364
+ export {};
365
+ /**
366
+ * used in OptionData
367
+ */
368
+ /**
369
+ * @usage cron-service process-service
370
+ * https://documentation.tradier.com/brokerage-api/markets/get-options-chains
371
+ * used in
372
+ */
373
+ /**
374
+ * used to record the daily meta data of a symbol
375
+ * @usage process-service websocket-service
376
+ */
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ /**
3
+ * table filters shared for Smart Flow and Full Flow
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.STRATEGY_LABEL = exports.HTTP_ERROR_CODE = exports.CHECKOUT_TYPE = exports.STRIPE_SUBSCRIPTION_STATUS = exports.FORMATTED_ERROR = exports.STATUS = exports.UNDERLYING_TYPE_TAG = exports.CALL_PUT_TAG = exports.SENTIMENT_TAG = exports.MONEYNESS_LABEL = exports.SIDE_LABEL = exports.OPTION_ACTIVITY_TYPE = exports.TABLEFILTER_KEY = void 0;
7
+ var TABLEFILTER_KEY;
8
+ (function (TABLEFILTER_KEY) {
9
+ TABLEFILTER_KEY["DATE"] = "date";
10
+ TABLEFILTER_KEY["TIME"] = "time";
11
+ TABLEFILTER_KEY["PREMIUM"] = "premium";
12
+ TABLEFILTER_KEY["MONEYNESS"] = "moneyness";
13
+ TABLEFILTER_KEY["OI"] = "oi";
14
+ TABLEFILTER_KEY["DELTA"] = "delta";
15
+ TABLEFILTER_KEY["IV"] = "iv";
16
+ TABLEFILTER_KEY["EXPIRY_DAYS"] = "expiry_days";
17
+ TABLEFILTER_KEY["EXPIRATION_DATE"] = "expiration_date";
18
+ TABLEFILTER_KEY["SYMBOL"] = "symbol";
19
+ TABLEFILTER_KEY["UNDERLYING_TYPE"] = "underlying_type";
20
+ TABLEFILTER_KEY["PUT_CALL"] = "put_call";
21
+ TABLEFILTER_KEY["STRIKE"] = "strike";
22
+ TABLEFILTER_KEY["PRICE"] = "price";
23
+ TABLEFILTER_KEY["SIZE"] = "size";
24
+ TABLEFILTER_KEY["UNDERLYING_PRICE"] = "underlying_price";
25
+ TABLEFILTER_KEY["SCORE"] = "score";
26
+ TABLEFILTER_KEY["SENTIMENT"] = "sentiment";
27
+ TABLEFILTER_KEY["IS_OPENING_ONLY"] = "is_opening_only";
28
+ TABLEFILTER_KEY["DATE_FILTER"] = "date_filter";
29
+ TABLEFILTER_KEY["TIME_FILTER"] = "time_filter";
30
+ TABLEFILTER_KEY["STRATEGY_LABEL"] = "strategy_label";
31
+ TABLEFILTER_KEY["IS_RECENT_EARNING_ONLY"] = "is_recent_earning_only";
32
+ TABLEFILTER_KEY["COLUMNS_STATE_MAP"] = "columnsStateMap";
33
+ TABLEFILTER_KEY["WATCHLIST_ONLY"] = "watchlistOnly";
34
+ TABLEFILTER_KEY["DEFAULT"] = "default";
35
+ TABLEFILTER_KEY["VERSION"] = "version";
36
+ TABLEFILTER_KEY["ID"] = "id";
37
+ TABLEFILTER_KEY["DAILY_VOLUME"] = "daily_volume";
38
+ TABLEFILTER_KEY["OPTION_ACTIVITY_TYPE"] = "option_activity_type";
39
+ TABLEFILTER_KEY["SIDE"] = "side";
40
+ TABLEFILTER_KEY["DEI"] = "dei";
41
+ TABLEFILTER_KEY["DEX"] = "dex";
42
+ TABLEFILTER_KEY["EARNING_DATE"] = "earning_date";
43
+ // fore cf-worker concept
44
+ TABLEFILTER_KEY["TRADE_COUNT"] = "trade_count";
45
+ TABLEFILTER_KEY["SYMBOLS"] = "symbols";
46
+ })(TABLEFILTER_KEY = exports.TABLEFILTER_KEY || (exports.TABLEFILTER_KEY = {}));
47
+ /**
48
+ * @description indicates the props for the request to the full api
49
+ * @usage api-service, process-service
50
+ */
51
+ /**
52
+ * @description Trade Code
53
+ * https://unusualwhales.com/glossary/trade-code
54
+ */
55
+ var OPTION_ACTIVITY_TYPE;
56
+ (function (OPTION_ACTIVITY_TYPE) {
57
+ /**
58
+ * Aggregated trades are trades that are grouped together by our server if the trade time is exactly the same for the same contract
59
+ */
60
+ OPTION_ACTIVITY_TYPE["AGGREGATED"] = "AGGREGATED";
61
+ OPTION_ACTIVITY_TYPE["SWEEP"] = "SWEEP";
62
+ OPTION_ACTIVITY_TYPE["BLOCK"] = "BLOCK";
63
+ OPTION_ACTIVITY_TYPE["TRADE"] = "TRADE";
64
+ /** Introduced from MC API */
65
+ OPTION_ACTIVITY_TYPE["MULTILEG"] = "MULTILEG";
66
+ /*Transaction represents the buying of a call and the selling of a put for the same underlying stock or index.
67
+ Prefix appears solely for information; process as a regular transaction.
68
+ */
69
+ OPTION_ACTIVITY_TYPE["COMBO"] = "COMBO";
70
+ /**
71
+ * Transaction represents the option portion of an order involving a single option leg (buy or sell of a call or put) and stock.
72
+ * Prefix appears solely for information: process as a regular transaction.
73
+ */
74
+ OPTION_ACTIVITY_TYPE["BUYWRITE"] = "BUYWRITE";
75
+ /**
76
+ * Transaction represents the buying of a call and the selling of a put for the same underlying stock or index.
77
+ */
78
+ OPTION_ACTIVITY_TYPE["STRADDLE"] = "STRADDLE";
79
+ /*
80
+ *Transaction represents a trade in two options in the same class (a buy and a sell in the same class).
81
+ Prefix appears solely for information; process as a regular transaction.
82
+ */
83
+ OPTION_ACTIVITY_TYPE["SPREAD"] = "SPREAD";
84
+ /**
85
+ * Transaction was the execution of an order identified as an Intermarket Sweep Order. Process like normal transaction.
86
+ */
87
+ OPTION_ACTIVITY_TYPE["IntermarketSweep"] = "IntermarketSweep";
88
+ })(OPTION_ACTIVITY_TYPE = exports.OPTION_ACTIVITY_TYPE || (exports.OPTION_ACTIVITY_TYPE = {}));
89
+ /**
90
+ * SIDE
91
+ */
92
+ var SIDE_LABEL;
93
+ (function (SIDE_LABEL) {
94
+ SIDE_LABEL["ABOVE_ASK"] = "AASK";
95
+ SIDE_LABEL["ASK"] = "ASK";
96
+ SIDE_LABEL["MID"] = "MID";
97
+ SIDE_LABEL["BID"] = "BID";
98
+ SIDE_LABEL["BELOW_BID"] = "BBID";
99
+ })(SIDE_LABEL = exports.SIDE_LABEL || (exports.SIDE_LABEL = {}));
100
+ /**
101
+ * MONEYNESS
102
+ */
103
+ var MONEYNESS_LABEL;
104
+ (function (MONEYNESS_LABEL) {
105
+ MONEYNESS_LABEL["ITM"] = "ITM";
106
+ MONEYNESS_LABEL["ATM"] = "ATM";
107
+ MONEYNESS_LABEL["OTM"] = "OTM";
108
+ })(MONEYNESS_LABEL = exports.MONEYNESS_LABEL || (exports.MONEYNESS_LABEL = {}));
109
+ /**
110
+ * for strategy
111
+ */
112
+ var SENTIMENT_TAG;
113
+ (function (SENTIMENT_TAG) {
114
+ SENTIMENT_TAG["BULLISH"] = "BULLISH";
115
+ SENTIMENT_TAG["BEARISH"] = "BEARISH";
116
+ SENTIMENT_TAG["NEUTRAL"] = "NEUTRAL";
117
+ })(SENTIMENT_TAG = exports.SENTIMENT_TAG || (exports.SENTIMENT_TAG = {}));
118
+ var CALL_PUT_TAG;
119
+ (function (CALL_PUT_TAG) {
120
+ CALL_PUT_TAG["CALL"] = "CALL";
121
+ CALL_PUT_TAG["PUT"] = "PUT";
122
+ })(CALL_PUT_TAG = exports.CALL_PUT_TAG || (exports.CALL_PUT_TAG = {}));
123
+ var UNDERLYING_TYPE_TAG;
124
+ (function (UNDERLYING_TYPE_TAG) {
125
+ UNDERLYING_TYPE_TAG["STOCK"] = "STOCK";
126
+ UNDERLYING_TYPE_TAG["ETF"] = "ETF";
127
+ UNDERLYING_TYPE_TAG["ETN"] = "ETN";
128
+ UNDERLYING_TYPE_TAG["MLB"] = "MLB";
129
+ UNDERLYING_TYPE_TAG["REIT"] = "REIT";
130
+ UNDERLYING_TYPE_TAG["INDEX"] = "INDEX";
131
+ })(UNDERLYING_TYPE_TAG = exports.UNDERLYING_TYPE_TAG || (exports.UNDERLYING_TYPE_TAG = {}));
132
+ var STATUS;
133
+ (function (STATUS) {
134
+ STATUS["SUCCESS"] = "SUCCESS";
135
+ STATUS["ERROR"] = "ERROR";
136
+ })(STATUS = exports.STATUS || (exports.STATUS = {}));
137
+ exports.FORMATTED_ERROR = {
138
+ AUTHENTICATED_FAILURE: {
139
+ CODE: "AUTHENTICATED_FAILURE",
140
+ MESSAGE: "You are not authorized, please login again",
141
+ },
142
+ SESSION_EXPIRED: {
143
+ CODE: "SESSION_EXPIRED",
144
+ MESSAGE: "Your session has expired, please sign in again",
145
+ },
146
+ SUBSCRIPTION_EXPIRED: {
147
+ CODE: "SUBSCRIPTION_EXPIRED",
148
+ },
149
+ UNKNOWN_ERROR: {
150
+ CODE: "UNKNOWN_ERROR",
151
+ MESSAGE: "Try again",
152
+ },
153
+ };
154
+ var STRIPE_SUBSCRIPTION_STATUS;
155
+ (function (STRIPE_SUBSCRIPTION_STATUS) {
156
+ STRIPE_SUBSCRIPTION_STATUS["ACTIVE"] = "active";
157
+ STRIPE_SUBSCRIPTION_STATUS["PAST_DUE"] = "past_due";
158
+ STRIPE_SUBSCRIPTION_STATUS["CANCELED"] = "canceled";
159
+ STRIPE_SUBSCRIPTION_STATUS["TRIALING"] = "trialing";
160
+ STRIPE_SUBSCRIPTION_STATUS["PAUSED"] = "paused";
161
+ STRIPE_SUBSCRIPTION_STATUS["INCOMPLETE"] = "incomplete";
162
+ STRIPE_SUBSCRIPTION_STATUS["INCOMPLETE_EXPIRED"] = "incomplete_expired";
163
+ })(STRIPE_SUBSCRIPTION_STATUS = exports.STRIPE_SUBSCRIPTION_STATUS || (exports.STRIPE_SUBSCRIPTION_STATUS = {}));
164
+ var CHECKOUT_TYPE;
165
+ (function (CHECKOUT_TYPE) {
166
+ CHECKOUT_TYPE["REGISTRATION"] = "registration";
167
+ CHECKOUT_TYPE["RESUBSCRIPTION"] = "resubscription";
168
+ })(CHECKOUT_TYPE = exports.CHECKOUT_TYPE || (exports.CHECKOUT_TYPE = {}));
169
+ var HTTP_ERROR_CODE;
170
+ (function (HTTP_ERROR_CODE) {
171
+ HTTP_ERROR_CODE[HTTP_ERROR_CODE["OK"] = 200] = "OK";
172
+ HTTP_ERROR_CODE[HTTP_ERROR_CODE["BAD_REQUEST"] = 400] = "BAD_REQUEST";
173
+ HTTP_ERROR_CODE[HTTP_ERROR_CODE["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
174
+ HTTP_ERROR_CODE[HTTP_ERROR_CODE["FORBIDDEN"] = 403] = "FORBIDDEN";
175
+ HTTP_ERROR_CODE[HTTP_ERROR_CODE["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
176
+ })(HTTP_ERROR_CODE = exports.HTTP_ERROR_CODE || (exports.HTTP_ERROR_CODE = {}));
177
+ /**
178
+ * @deprecated
179
+ */
180
+ // import the future cost_cap_ratio
181
+ /**
182
+ * @deprecated
183
+ * for strategy
184
+ */
185
+ var STRATEGY_LABEL;
186
+ (function (STRATEGY_LABEL) {
187
+ STRATEGY_LABEL[STRATEGY_LABEL["NONE"] = 0] = "NONE";
188
+ STRATEGY_LABEL[STRATEGY_LABEL["NOVA"] = 1] = "NOVA";
189
+ STRATEGY_LABEL[STRATEGY_LABEL["SWING"] = 2] = "SWING";
190
+ STRATEGY_LABEL["DT"] = "DT";
191
+ STRATEGY_LABEL["ACT"] = "ACT";
192
+ STRATEGY_LABEL["\u0394"] = "\u0394";
193
+ STRATEGY_LABEL["\u0394_plus"] = "\u0394+";
194
+ STRATEGY_LABEL["\u0393"] = "\u0393";
195
+ STRATEGY_LABEL["\u0398"] = "\u0398";
196
+ STRATEGY_LABEL["V"] = "V";
197
+ STRATEGY_LABEL["CLR"] = "CLR";
198
+ STRATEGY_LABEL["SELL"] = "SELL";
199
+ STRATEGY_LABEL["HV"] = "HV";
200
+ STRATEGY_LABEL["LV"] = "LV";
201
+ STRATEGY_LABEL["INSTITUTE_SELL_CALL"] = "INSTITUTE_SELL_CALL";
202
+ STRATEGY_LABEL["INSTITUTE_BUY_PUT"] = "INSTITUTE_BUY_PUT";
203
+ STRATEGY_LABEL["EXTEND"] = "EXTEND";
204
+ STRATEGY_LABEL["FULL"] = "FULL";
205
+ STRATEGY_LABEL["SMART"] = "SMART";
206
+ })(STRATEGY_LABEL = exports.STRATEGY_LABEL || (exports.STRATEGY_LABEL = {}));
207
+ /**
208
+ * used in OptionData
209
+ */
210
+ /**
211
+ * @usage cron-service process-service
212
+ * https://documentation.tradier.com/brokerage-api/markets/get-options-chains
213
+ * used in
214
+ */
215
+ /**
216
+ * used to record the daily meta data of a symbol
217
+ * @usage process-service websocket-service
218
+ */
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @usage cf-service, web-app
3
+ * @description the params for websocket
4
+ */
5
+ export interface WebSocketParams {
6
+ user_type: string | null;
7
+ symbols: string | null;
8
+ premium: string | null;
9
+ sentiment: string | null;
10
+ underlying_type: string | null;
11
+ moneyness: string | null;
12
+ delta: string | null;
13
+ is_recent_earning_only: string | null;
14
+ strike: string | null;
15
+ expiry_days: string | null;
16
+ put_call: string | null;
17
+ side: string | null;
18
+ oi: string | null;
19
+ iv: string | null;
20
+ option_activity_type: string | null;
21
+ is_opening_only: string | null;
22
+ trade_count: string | null;
23
+ dex: string | null;
24
+ underlying_price: string | null;
25
+ dei: string | null;
26
+ size: string | null;
27
+ daily_volume: string | null;
28
+ aggregation_mode: string | null;
29
+ test_mode?: string | null;
30
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,45 @@
1
+ import moment from "moment-timezone";
2
+ export declare function isTradingDate(todayDateStr?: string): boolean;
3
+ /**
4
+ * @description 取最近的交易日 in New York timezone, in the format of YYYY-MM-DD,
5
+ * exclude weekends and holidays, and before 9:30am(PST)
6
+ */
7
+ export declare function getLastTradeDate(format?: string, currentMoment?: moment.Moment): string;
8
+ /**
9
+ * @description 将Date Object转化为日期string YYYY-MM-DD
10
+ */
11
+ export declare function convertDateToString(date: Date): string | undefined;
12
+ /**
13
+ * @description 将string YYYY-MM-DD convert to YYYYMMDD
14
+ */
15
+ export declare function convertDateFormatToYYYYMMDD(date: string): string;
16
+ /**
17
+ * @description 计算一个未来的日期和今天的相差天数(按照UTC)
18
+ */
19
+ export declare const getDiffDaysBetweenFutureAndToday: (future_date: string | Date) => number;
20
+ /**
21
+ * @description 计算两个日期之间的相差天数
22
+ */
23
+ export declare const getDiffDaysBetweenFutureAndPast: (future_date: string | Date, past_date: string | Date) => number;
24
+ export declare function momentInNewYork(): moment.Moment;
25
+ /**
26
+ * @description whether one date in format of YYYY-MM-DD is before/same before another date
27
+ */
28
+ export declare function isOneDateBeforeAnotherDate(a_date: string, b_date?: string, could_be_same_date?: boolean): boolean;
29
+ /**
30
+ *
31
+ * @param time unix time stamp
32
+ * @returns a date format in YYYY-MM-DD in New York Time Zone
33
+ */
34
+ export declare function convertUnixTimestampToDate(time: string, format?: string): string;
35
+ /**
36
+ *
37
+ * @param time unix time stamp
38
+ * @returns a date format in HH:mm:ss in New York Time Zone
39
+ */
40
+ export declare function convertUnixTimestampToTime(time: string, format?: string): string;
41
+ /**
42
+ * get current timestamp in unix format
43
+ */
44
+ export declare function getTimestamp(): number;
45
+ export declare function isMarketOpen(currentMoment?: moment.Moment): boolean;