@adaptic/utils 0.1.44 → 0.1.46
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/index.cjs +4558 -59031
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4554 -58772
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +218 -563
- package/dist/test.js.map +1 -1
- 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 +10 -12
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/alpaca-trading-api.d.ts +2 -2
- package/dist/types/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types/alphavantage.d.ts.map +1 -1
- package/dist/types/asset-allocation-algorithm.d.ts +0 -6
- package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
- package/dist/types/crypto.d.ts +2 -2
- package/dist/types/crypto.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/index.d.ts +37 -373
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/market-hours.d.ts.map +1 -1
- package/dist/types/market-time.d.ts +11 -73
- 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 +0 -3
- package/dist/types/misc-utils.d.ts.map +1 -1
- package/dist/types/performance-metrics.d.ts +5 -5
- package/dist/types/performance-metrics.d.ts.map +1 -1
- package/dist/types/polygon-indices.d.ts +2 -2
- package/dist/types/polygon-indices.d.ts.map +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.map +1 -1
- package/dist/types/trading-policy/defaults.d.ts +46 -0
- package/dist/types/trading-policy/defaults.d.ts.map +1 -0
- package/dist/types/trading-policy/index.d.ts +8 -0
- package/dist/types/trading-policy/index.d.ts.map +1 -0
- 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 +17 -91
- package/dist/types/types/alpaca-types.d.ts.map +1 -1
- package/dist/types/types/logging-types.d.ts +1 -1
- package/dist/types/types/logging-types.d.ts.map +1 -1
- package/dist/types/types/metrics-types.d.ts +1 -1
- package/dist/types/types/metrics-types.d.ts.map +1 -1
- package/package.json +10 -25
- 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__/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__/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
|
@@ -28,83 +28,33 @@ export declare class MarketTimeUtil {
|
|
|
28
28
|
*/
|
|
29
29
|
private validateTimezone;
|
|
30
30
|
private formatDate;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
34
|
-
* @param nyDate - Date in market timezone representation
|
|
35
|
-
* @returns true if the date is Saturday or Sunday
|
|
36
|
-
*/
|
|
37
|
-
private isWeekendZoned;
|
|
38
|
-
/**
|
|
39
|
-
* Checks if a NY-zoned date falls on a market holiday.
|
|
40
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
41
|
-
* @param nyDate - Date in market timezone representation
|
|
42
|
-
* @returns true if the date is a holiday
|
|
43
|
-
*/
|
|
44
|
-
private isHolidayZoned;
|
|
45
|
-
/**
|
|
46
|
-
* Checks if a NY-zoned date is an early close day.
|
|
47
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
48
|
-
* @param nyDate - Date in market timezone representation
|
|
49
|
-
* @returns true if the date is an early close day
|
|
50
|
-
*/
|
|
51
|
-
private isEarlyCloseDayZoned;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the early close time for a NY-zoned date.
|
|
54
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
55
|
-
* @param nyDate - Date in market timezone representation
|
|
56
|
-
* @returns The early close time in minutes from midnight, or null if not an early close day
|
|
57
|
-
*/
|
|
58
|
-
private getEarlyCloseTimeZoned;
|
|
59
|
-
/**
|
|
60
|
-
* Checks if a NY-zoned date is a market day (not weekend, not holiday).
|
|
61
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
62
|
-
* @param nyDate - Date in market timezone representation
|
|
63
|
-
* @returns true if the date is a market day
|
|
64
|
-
*/
|
|
65
|
-
private isMarketDayZoned;
|
|
66
|
-
/**
|
|
67
|
-
* Check if a given date is an early close day.
|
|
68
|
-
* Handles timezone conversion from any input date.
|
|
69
|
-
* @param date - The date to check (any timezone)
|
|
70
|
-
* @returns true if the date is an early close day
|
|
71
|
-
*/
|
|
31
|
+
private isWeekend;
|
|
32
|
+
private isHoliday;
|
|
72
33
|
isEarlyCloseDay(date: Date): boolean;
|
|
73
34
|
/**
|
|
74
|
-
* Get the early close time for a given date
|
|
75
|
-
*
|
|
76
|
-
* @param date - The date to check (any timezone)
|
|
35
|
+
* Get the early close time for a given date
|
|
36
|
+
* @param date - The date to get the early close time for
|
|
77
37
|
* @returns The early close time in minutes from midnight, or null if there is no early close
|
|
78
38
|
*/
|
|
79
39
|
getEarlyCloseTime(date: Date): number | null;
|
|
80
40
|
/**
|
|
81
|
-
* Check if a given date is a market day
|
|
82
|
-
*
|
|
83
|
-
* @param date - The date to check (any timezone)
|
|
41
|
+
* Check if a given date is a market day
|
|
42
|
+
* @param date - The date to check
|
|
84
43
|
* @returns true if the date is a market day, false otherwise
|
|
85
44
|
*/
|
|
86
45
|
isMarketDay(date: Date): boolean;
|
|
87
46
|
/**
|
|
88
|
-
* Check if a given date is within market hours
|
|
89
|
-
*
|
|
90
|
-
* @param date - The date to check (any timezone)
|
|
47
|
+
* Check if a given date is within market hours
|
|
48
|
+
* @param date - The date to check
|
|
91
49
|
* @returns true if the date is within market hours, false otherwise
|
|
92
50
|
*/
|
|
93
51
|
isWithinMarketHours(date: Date): boolean;
|
|
94
52
|
/**
|
|
95
|
-
* Check if a
|
|
96
|
-
*
|
|
97
|
-
* @param nyDate - Date in market timezone representation
|
|
98
|
-
* @returns true if the date is within market hours, false otherwise
|
|
99
|
-
*/
|
|
100
|
-
private isWithinMarketHoursZoned;
|
|
101
|
-
/**
|
|
102
|
-
* Check if a NY-zoned date is before market hours.
|
|
103
|
-
* Expects a date already converted to market timezone via toZonedTime.
|
|
104
|
-
* @param nyDate - Date in market timezone representation
|
|
53
|
+
* Check if a given date is before market hours
|
|
54
|
+
* @param date - The date to check
|
|
105
55
|
* @returns true if the date is before market hours, false otherwise
|
|
106
56
|
*/
|
|
107
|
-
private
|
|
57
|
+
private isBeforeMarketHours;
|
|
108
58
|
/**
|
|
109
59
|
* Get the last trading date, i.e. the last date that was a market day
|
|
110
60
|
* @param currentDate - The current date
|
|
@@ -122,18 +72,6 @@ export declare class MarketTimeUtil {
|
|
|
122
72
|
* @property {string} yyyymmdd - The date in YYYY-MM-DD format
|
|
123
73
|
* @property {string} dateISOString - Full ISO date string
|
|
124
74
|
*/
|
|
125
|
-
/**
|
|
126
|
-
* Gets the next market day from a date already in market timezone.
|
|
127
|
-
* @param nyDate - Date in market timezone representation
|
|
128
|
-
* @returns The next market day in market timezone representation
|
|
129
|
-
*/
|
|
130
|
-
private getNextMarketDayZoned;
|
|
131
|
-
/**
|
|
132
|
-
* Gets the next market day from a reference date.
|
|
133
|
-
* Handles timezone conversion from any input date.
|
|
134
|
-
* @param date - The reference date (any timezone)
|
|
135
|
-
* @returns The next market day as a Date (note: internally represented in market timezone)
|
|
136
|
-
*/
|
|
137
75
|
getNextMarketDay(date: Date): Date;
|
|
138
76
|
private getDayBoundaries;
|
|
139
77
|
private calculatePeriodStartDate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market-time.d.ts","sourceRoot":"","sources":["../../src/market-time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"market-time.d.ts","sourceRoot":"","sources":["../../src/market-time.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,iBA0B1B,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,iBAAiB,CAAoB;IAE7C;;;;OAIG;gBAED,QAAQ,GAAE,MAA8B,EACxC,iBAAiB,GAAE,iBAAkC;IAOvD;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,UAAU;IAoBlB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,SAAS;IAYV,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAM3C;;;;OAIG;IACI,iBAAiB,CA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;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,IAAiB,GAAG;IACtE,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,CAQA;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,aAAa,GACd,GAAE;IAAE,aAAa,CAAC,EAAE,IAAI,CAAA;CAAO,GAAG;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAcA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,IAEhC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACnE,IAAI,CAcN;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAanE;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,IAAI,KAAG,QAAQ,GAAG,QAyCtD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAO,GAAG,YAAY,CAoH3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-calcs.d.ts","sourceRoot":"","sources":["../../src/metrics-calcs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics-calcs.d.ts","sourceRoot":"","sources":["../../src/metrics-calcs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqJ5D,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,gBAAgB,EAAE,MAAM,EAAE,GACzB,mBAAmB,CAwFrB;AAwSD,wBAA8B,iBAAiB,CAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,GAAG,EAAE,EAChB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,YAAY,CAAC,CA+BvB"}
|
|
@@ -30,9 +30,6 @@ export declare function hideApiKeyFromurl(url: string): string;
|
|
|
30
30
|
* Fetches a resource with intelligent retry logic for handling transient errors.
|
|
31
31
|
* Features enhanced error logging, rate limit detection, and adaptive backoff.
|
|
32
32
|
*
|
|
33
|
-
* This is a wrapper around the new retry utility for backward compatibility.
|
|
34
|
-
* It wraps fetch calls with retry logic using exponential backoff.
|
|
35
|
-
*
|
|
36
33
|
* @param url - The URL to fetch.
|
|
37
34
|
* @param options - Optional fetch options.
|
|
38
35
|
* @param retries - The number of retry attempts. Defaults to 3.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc-utils.d.ts","sourceRoot":"","sources":["../../src/misc-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc-utils.d.ts","sourceRoot":"","sources":["../../src/misc-utils.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,sDAAuD,CAAC;AAEvE,KAAK,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GACrB,SAAS,MAAM,EACf,OAAO,OAAO,EACd,OAAM,OAAgB,SA6BvB,CAAC;AAqBF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBrD;AAoED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,OAAO,GAAE,MAAU,EACnB,cAAc,GAAE,MAAa,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAiGnB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkB5E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PortfolioHistory,
|
|
1
|
+
import { PortfolioHistory, BenchmarkBar, CalculateBetaResult } from "./types/alpaca-types";
|
|
2
2
|
import { PerformanceMetrics, FetchPerformanceMetricsProps } from "./types/metrics-types";
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the alpha, beta, and annualized Alpha of the portfolio compared to a benchmark.
|
|
@@ -6,7 +6,7 @@ import { PerformanceMetrics, FetchPerformanceMetricsProps } from "./types/metric
|
|
|
6
6
|
* @param benchmarkBars - The historical price data of the benchmark.
|
|
7
7
|
* @returns An object containing alpha, beta, and annualized alpha.
|
|
8
8
|
*/
|
|
9
|
-
export declare function calculateAlphaAndBeta(portfolioHistory:
|
|
9
|
+
export declare function calculateAlphaAndBeta(portfolioHistory: any, benchmarkBars: any[]): Promise<{
|
|
10
10
|
alpha: string;
|
|
11
11
|
alphaAnnualized: string;
|
|
12
12
|
beta: string;
|
|
@@ -73,16 +73,16 @@ export declare function calculateBetaFromReturns(portfolioReturns: number[], ben
|
|
|
73
73
|
* @param benchmarkBars - The historical price data of the benchmark.
|
|
74
74
|
* @returns Information ratio as a formatted string.
|
|
75
75
|
*/
|
|
76
|
-
export declare function calculateInformationRatio(portfolioHistory:
|
|
76
|
+
export declare function calculateInformationRatio(portfolioHistory: any, benchmarkBars: any[]): Promise<string>;
|
|
77
77
|
/**
|
|
78
78
|
* Fetches performance metrics for a given Alpaca account.
|
|
79
79
|
* @param params - The parameters for fetching performance metrics.
|
|
80
80
|
* @param client - The Apollo client instance.
|
|
81
81
|
* @param accountId - The ID of the Alpaca account.
|
|
82
|
-
* @param
|
|
82
|
+
* @param alpacaAccount - The Alpaca account object.
|
|
83
83
|
* @returns A promise that resolves to an object containing various performance metrics.
|
|
84
84
|
* @throws Will throw an error if required parameters are missing or if fetching fails.
|
|
85
85
|
*/
|
|
86
|
-
export declare function fetchPerformanceMetrics({ params, client, accountId,
|
|
86
|
+
export declare function fetchPerformanceMetrics({ params, client, accountId, alpacaAccount, }: FetchPerformanceMetricsProps): Promise<PerformanceMetrics>;
|
|
87
87
|
export {};
|
|
88
88
|
//# sourceMappingURL=performance-metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance-metrics.d.ts","sourceRoot":"","sources":["../../src/performance-metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"performance-metrics.d.ts","sourceRoot":"","sources":["../../src/performance-metrics.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EAKpB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAwT/B;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,GAAG,EACrB,aAAa,EAAE,GAAG,EAAE,GACnB,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CA0ND;AAkCD,UAAU,cAAc;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CACrB,GACL,cAAc,CAuHhB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,GAAE,MAAU,GACnB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAchE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,YAAY,EAAE,GAC5B;IAAE,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAAC,uBAAuB,EAAE,MAAM,EAAE,CAAA;CAAE,CA4E1E;AAkFD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,gBAAgB,EAAE,MAAM,EAAE,GACzB,mBAAmB,CA0DrB;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,gBAAgB,EAAE,GAAG,EACrB,aAAa,EAAE,GAAG,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC,CA4GjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,MAAM,EACN,MAAM,EACN,SAAS,EACT,aAAa,GACd,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuK5D"}
|
|
@@ -59,7 +59,7 @@ export declare const fetchIndicesSnapshot: (params?: PolygonIndicesSnapshotParam
|
|
|
59
59
|
* @param {string} [options.order] - Order results
|
|
60
60
|
* @param {number} [options.limit] - Limit the number of results
|
|
61
61
|
* @param {string} [options.sort] - Sort field
|
|
62
|
-
* @returns {Promise<
|
|
62
|
+
* @returns {Promise<any>} The universal snapshot response
|
|
63
63
|
*/
|
|
64
64
|
export declare const fetchUniversalSnapshot: (tickers: string[], options?: {
|
|
65
65
|
apiKey?: string;
|
|
@@ -67,7 +67,7 @@ export declare const fetchUniversalSnapshot: (tickers: string[], options?: {
|
|
|
67
67
|
order?: string;
|
|
68
68
|
limit?: number;
|
|
69
69
|
sort?: string;
|
|
70
|
-
}) => Promise<
|
|
70
|
+
}) => Promise<any>;
|
|
71
71
|
/**
|
|
72
72
|
* Converts Polygon Indices bar data to a more standardized format
|
|
73
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon-indices.d.ts","sourceRoot":"","sources":["../../src/polygon-indices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"polygon-indices.d.ts","sourceRoot":"","sources":["../../src/polygon-indices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,+BAA+B,EAC/B,oCAAoC,EACpC,4BAA4B,EAC5B,8BAA8B,EAE/B,MAAM,SAAS,CAAC;AAyBjB;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,8BAA8B,EACtC,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,gCAAgC,CA6C1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,eAAe,MAAM,EACrB,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,+BAA+B,CA2BzC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACrC,eAAe,MAAM,EACrB,MAAM,MAAM,EACZ,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,oCAAoC,CA2B9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,4BAA4B,EACrC,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,8BAA8B,CAyCxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EAAE,EACjB,UAAU;IACR,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,KACA,OAAO,CAAC,GAAG,CA6Cb,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,gCAAgC,KACrC,KAAK,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAYA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../src/polygon.ts"],"names":[],"mappings":"AAAA;;oFAEoF;
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../src/polygon.ts"],"names":[],"mappings":"AAAA;;oFAEoF;AAGpF,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAE3B,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAYjB;;;;;;GAMG;AAEH,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CA6FlC,C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,CAAC,EAAE,cAAc,EAC/B,MAAM,CAAC,EAAE,MAAM;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"price-utils.d.ts","sourceRoot":"","sources":["../../src/price-utils.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAS,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAe,cAAc,EAAE,MAAM,eAAe,CAAC;AAyE5D,eAAO,MAAM,gBAAgB,GAAU,OAAO,KAAK,CAAC,KAAK,KAAG,OAAO,CAAC,MAAM,CAiBzE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,WAAW,EAAE,EACzB,gBAAgB,CAAC,EAAE,sBAAsB,EACzC,cAAc,CAAC,EAAE,cAAc,EAC/B,MAAM,CAAC,EAAE,MAAM;;;;;;;;;;;;;;EA0HhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"technical-analysis.d.ts","sourceRoot":"","sources":["../../src/technical-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,EAAE,MAAW,EAAE,kBAAsB,EAAE,GAAE,oBAAyB,GACjE,kBAAkB,EAAE,CAuCtB;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,EAAE,MAAW,EAAE,OAAW,EAAE,GAAE,SAAc,GAC3C,OAAO,EAA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;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,gBAAgB,EAAE,EAC7B,EAAE,SAAa,EAAE,cAAmB,EAAE,GAAE,uBAA4B,GACnE,qBAAqB,EAAE,CAwIzB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utils-tuned trading-policy defaults.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the canonical `TradingPolicyJson` shape from
|
|
5
|
+
* `@adaptic/backend-legacy` (sub-project 2 Area A1) and provides a
|
|
6
|
+
* scalping / short-horizon day-trading calibration as
|
|
7
|
+
* `DEFAULT_TRADING_POLICY_UTILS_TUNED`. The canonical
|
|
8
|
+
* `DEFAULT_TRADING_POLICY` exported by backend-legacy is the
|
|
9
|
+
* lowest-precedence safe fallback consumed by `effectivePolicy()`;
|
|
10
|
+
* the utils-tuned variant collapses the SR `EffectiveTradingPolicy`
|
|
11
|
+
* tunings (per `feat/scalping-defaults-2026-05-10` on
|
|
12
|
+
* `@adaptic/utils` `stable-release`) into the JSON-path locations
|
|
13
|
+
* defined by the canonical shape.
|
|
14
|
+
*
|
|
15
|
+
* Calibration sources:
|
|
16
|
+
* - perTradeEquityPct=0.02, perTradeCryptoPct=0.02 — SR
|
|
17
|
+
* `perTradeEquityAllocationPct=2`, `perTradeCryptoAllocationPct=2`
|
|
18
|
+
* - equityWashTradeCooldownMs=5_000 — SR scalping cooldown vs the
|
|
19
|
+
* canonical 30_000 ms FINRA-5210 row-level fallback
|
|
20
|
+
* - scalping subgroup populated with the 12 SR W3-3 fields
|
|
21
|
+
* - assetClasses: equity+crypto+options enabled (SR baseline)
|
|
22
|
+
*
|
|
23
|
+
* Charter §2.4 fund-scope: all overrides expressed here are
|
|
24
|
+
* fund-scope-safe (F2 allocation, F3 risk, F4 autonomy, F5 sentiment,
|
|
25
|
+
* F7 backtest). No org-scope-only fields are set.
|
|
26
|
+
*
|
|
27
|
+
* @see TradingPolicyJson — canonical shape contract
|
|
28
|
+
* @see effectivePolicy — precedence-ordered read-time merger
|
|
29
|
+
*/
|
|
30
|
+
import type { TradingPolicyJson } from "@adaptic/backend-legacy";
|
|
31
|
+
export type { TradingPolicyJson } from "@adaptic/backend-legacy";
|
|
32
|
+
export { DEFAULT_TRADING_POLICY } from "@adaptic/backend-legacy";
|
|
33
|
+
/**
|
|
34
|
+
* Utils-tuned defaults for short-horizon day trading / scalping. Use as
|
|
35
|
+
* a fund-level override (`Fund.tradingOverrides`) on funds that opt
|
|
36
|
+
* into the scalping profile. Do NOT install at org level — the
|
|
37
|
+
* canonical `DEFAULT_TRADING_POLICY` is the org-wide safe fallback.
|
|
38
|
+
*/
|
|
39
|
+
export declare const DEFAULT_TRADING_POLICY_UTILS_TUNED: TradingPolicyJson;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a frozen deep-copy of the utils-tuned defaults. Use this when
|
|
42
|
+
* passing the defaults into mutable downstream code paths to guard
|
|
43
|
+
* against accidental in-place mutation of the shared constant.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getUtilsTunedTradingPolicy: () => TradingPolicyJson;
|
|
46
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/trading-policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,EAAE,iBA0DhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAO,iBAI7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trading-policy/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptic-types.d.ts","sourceRoot":"","sources":["../../../src/types/adaptic-types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"adaptic-types.d.ts","sourceRoot":"","sources":["../../../src/types/adaptic-types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -12,10 +12,10 @@ export interface AlpacaAuth {
|
|
|
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.BrokerageAccount;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Represents the configuration of an Alpaca account.
|
|
@@ -208,25 +208,6 @@ export interface GetOrdersParams {
|
|
|
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
|
*/
|
|
@@ -385,7 +366,7 @@ export interface FetchPortfolioHistoryProps {
|
|
|
385
366
|
params: PortfolioHistoryParams;
|
|
386
367
|
accountId?: string;
|
|
387
368
|
client?: ApolloClientType<NormalizedCacheObject>;
|
|
388
|
-
|
|
369
|
+
alpacaAccount?: types.BrokerageAccount;
|
|
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.BrokerageAccount;
|
|
409
389
|
}
|
|
410
390
|
/**
|
|
411
391
|
* Represents the details of an Alpaca account.
|
|
@@ -1024,19 +1004,19 @@ export interface OptionStreamEventMap {
|
|
|
1024
1004
|
* Format: wss://stream.data.alpaca.markets/v1beta3/crypto/us
|
|
1025
1005
|
*/
|
|
1026
1006
|
export interface AlpacaCryptoTradeStream {
|
|
1027
|
-
T:
|
|
1007
|
+
T: 't';
|
|
1028
1008
|
S: string;
|
|
1029
1009
|
p: number;
|
|
1030
1010
|
s: number;
|
|
1031
1011
|
t: string;
|
|
1032
1012
|
i: number;
|
|
1033
|
-
tks:
|
|
1013
|
+
tks: 'B' | 'S';
|
|
1034
1014
|
}
|
|
1035
1015
|
/**
|
|
1036
1016
|
* Crypto quote stream message from Alpaca WebSocket
|
|
1037
1017
|
*/
|
|
1038
1018
|
export interface AlpacaCryptoQuoteStream {
|
|
1039
|
-
T:
|
|
1019
|
+
T: 'q';
|
|
1040
1020
|
S: string;
|
|
1041
1021
|
bp: number;
|
|
1042
1022
|
bs: number;
|
|
@@ -1048,7 +1028,7 @@ export interface AlpacaCryptoQuoteStream {
|
|
|
1048
1028
|
* Crypto bar stream message from Alpaca WebSocket
|
|
1049
1029
|
*/
|
|
1050
1030
|
export interface AlpacaCryptoBarStream {
|
|
1051
|
-
T:
|
|
1031
|
+
T: 'b';
|
|
1052
1032
|
S: string;
|
|
1053
1033
|
o: number;
|
|
1054
1034
|
h: number;
|
|
@@ -1063,7 +1043,7 @@ export interface AlpacaCryptoBarStream {
|
|
|
1063
1043
|
* Crypto daily bar stream message from Alpaca WebSocket
|
|
1064
1044
|
*/
|
|
1065
1045
|
export interface AlpacaCryptoDailyBarStream {
|
|
1066
|
-
T:
|
|
1046
|
+
T: 'd';
|
|
1067
1047
|
S: string;
|
|
1068
1048
|
o: number;
|
|
1069
1049
|
h: number;
|
|
@@ -1078,7 +1058,7 @@ export interface AlpacaCryptoDailyBarStream {
|
|
|
1078
1058
|
* Crypto updated bar stream message from Alpaca WebSocket
|
|
1079
1059
|
*/
|
|
1080
1060
|
export interface AlpacaCryptoUpdatedBarStream {
|
|
1081
|
-
T:
|
|
1061
|
+
T: 'u';
|
|
1082
1062
|
S: string;
|
|
1083
1063
|
o: number;
|
|
1084
1064
|
h: number;
|
|
@@ -1096,70 +1076,16 @@ export type AlpacaCryptoStreamMessage = AlpacaCryptoTradeStream | AlpacaCryptoQu
|
|
|
1096
1076
|
/**
|
|
1097
1077
|
* Type-safe event names for crypto market data streams
|
|
1098
1078
|
*/
|
|
1099
|
-
export type CryptoStreamEventName =
|
|
1079
|
+
export type CryptoStreamEventName = 'crypto-t' | 'crypto-q' | 'crypto-b' | 'crypto-d' | 'crypto-u' | 'crypto-data';
|
|
1100
1080
|
/**
|
|
1101
1081
|
* Event payload mapping for crypto streams
|
|
1102
1082
|
*/
|
|
1103
1083
|
export interface CryptoStreamEventMap {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
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;
|
|
1084
|
+
'crypto-t': AlpacaCryptoTradeStream;
|
|
1085
|
+
'crypto-q': AlpacaCryptoQuoteStream;
|
|
1086
|
+
'crypto-b': AlpacaCryptoBarStream;
|
|
1087
|
+
'crypto-d': AlpacaCryptoDailyBarStream;
|
|
1088
|
+
'crypto-u': AlpacaCryptoUpdatedBarStream;
|
|
1089
|
+
'crypto-data': AlpacaCryptoStreamMessage;
|
|
1164
1090
|
}
|
|
1165
1091
|
//# sourceMappingURL=alpaca-types.d.ts.map
|