forked from alpacahq/alpaca-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entities.d.ts
1585 lines (1585 loc) · 38.2 KB
/
entities.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
export interface Endpoints {
rest: {
beta: 'https://data.alpaca.markets/v1beta1';
account: 'https://api.alpaca.markets/v2';
market_data_v2: 'https://data.alpaca.markets/v2';
market_data_v1: 'https://data.alpaca.markets/v1';
};
websocket: {
account: 'wss://api.alpaca.markets/stream';
market_data: (source: DataSource) => string;
};
}
/**
* Your Alpaca key id and secret.
* Can be passed to the AlpacaClient and AlpacaStream.
*/
export interface DefaultCredentials {
key: string;
secret: string;
paper?: boolean;
}
/**
* Client ID for Oauth requests on behalf of users.
* Can be passed to the AlpacaClient.
*/
export interface OAuthCredentials {
access_token: String;
paper?: boolean;
}
/**
* The account information with unparsed types, exactly as Alpaca provides it.
* We encourage you to use the Account interface, which has many of these fields parsed.
*/
export interface RawAccount {
account_blocked: boolean;
account_number: string;
buying_power: string;
cash: string;
created_at: string;
currency: string;
daytrade_count: number;
daytrading_buying_power: string;
equity: string;
id: string;
initial_margin: string;
last_equity: string;
last_maintenance_margin: string;
long_market_value: string;
maintenance_margin: string;
multiplier: string;
pattern_day_trader: boolean;
portfolio_value: string;
regt_buying_power: string;
short_market_value: string;
shorting_enabled: boolean;
sma: string;
status: string;
trade_suspended_by_user: boolean;
trading_blocked: boolean;
transfers_blocked: boolean;
}
/**
* The following are the possible account status values. Most likely, the account status
* is ACTIVE unless there is any problem. The account status may get in ACCOUNT_UPDATED
* when personal information is being updated from the dashboard, in which case you may
* not be allowed trading for a short period of time until the change is approved.
*/
export declare type AccountStatus =
/**
* The account is onboarding.
*/
'ONBOARDING'
/**
* The account application submission failed for some reason.
*/
| 'SUBMISSION_FAILED'
/**
* The account application has been submitted for review.
*/
| 'SUBMITTED'
/**
* The account information is being updated.
*/
| 'ACCOUNT_UPDATED'
/**
* The final account approval is pending.
*/
| 'APPROVAL_PENDING'
/**
* The account is active for trading.
*/
| 'ACTIVE'
/**
* The account application has been rejected.
*/
| 'REJECTED';
/**
* Information related to an Alpaca account, such as account status, funds, and various
* flags relevant to an account's ability to trade.
*/
export interface Account {
/**
* Get the raw data, exactly as it came from Alpaca
*/
raw(): RawAccount;
/**
* If true, the account activity by user is prohibited.
*/
account_blocked: boolean;
/**
* Account number.
*/
account_number: string;
/**
* Current available $ buying power; If multiplier = 4, this is your daytrade buying
* power which is calculated as (last_equity - (last) maintenance_margin) * 4; If
* multiplier = 2, buying_power = max(equity – initial_margin,0) * 2; If multiplier = 1,
* buying_power = cash
*/
buying_power: number;
/**
* Cash balance
*/
cash: number;
/**
* Timestamp this account was created at
*/
created_at: Date;
/**
* "USD"
*/
currency: string;
/**
* The current number of daytrades that have been made in the last 5 trading days
* (inclusive of today)
*/
daytrade_count: number;
/**
* Your buying power for day trades (continuously updated value)
*/
daytrading_buying_power: number;
/**
* Cash + long_market_value + short_market_value
*/
equity: number;
/**
* Account ID.
*/
id: string;
/**
* Reg T initial margin requirement (continuously updated value)
*/
initial_margin: number;
/**
* Equity as of previous trading day at 16:00:00 ET
*/
last_equity: number;
/**
* Your maintenance margin requirement on the previous trading day
*/
last_maintenance_margin: number;
/**
* Real-time MtM value of all long positions held in the account
*/
long_market_value: number;
/**
* Maintenance margin requirement (continuously updated value)
*/
maintenance_margin: number;
/**
* Buying power multiplier that represents account margin classification; valid values 1
* (standard limited margin account with 1x buying power), 2 (reg T margin account with
* 2x intraday and overnight buying power; this is the default for all non-PDT accounts
* with $2,000 or more equity), 4 (PDT account with 4x intraday buying power and 2x reg
* T overnight buying power)
*/
multiplier: number;
/**
* Whether or not the account has been flagged as a pattern day trader
*/
pattern_day_trader: boolean;
/**
* Total value of cash + holding positions (This field is deprecated. It is equivalent
* to the equity field.)
*/
portfolio_value: number;
/**
* Your buying power under Regulation T (your excess equity - equity minus margin
* value - times your margin multiplier)
*/
regt_buying_power: number;
/**
* Real-time MtM value of all short positions held in the account
*/
short_market_value: number;
/**
* Flag to denote whether or not the account is permitted to short
*/
shorting_enabled: boolean;
/**
* Value of special memorandum account (will be used at a later date to provide
* additional buying_power)
*/
sma: number;
/**
* The following are the possible account status values. Most likely, the account status
* is ACTIVE unless there is any problem. The account status may get in ACCOUNT_UPDATED
* when personal information is being updated from the dashboard, in which case you may
* not be allowed trading for a short period of time until the change is approved.
*/
status: AccountStatus;
/**
* User setting. If true, the account is not allowed to place orders.
*/
trade_suspended_by_user: boolean;
/**
* If true, the account is not allowed to place orders.
*/
trading_blocked: boolean;
/**
* If true, the account is not allowed to request money transfers.
*/
transfers_blocked: boolean;
}
export interface AccountConfigurations {
/**
* both, entry, or exit. Controls Day Trading Margin Call (DTMC) checks.
*/
dtbp_check: 'both' | 'entry' | 'exit';
/**
* If true, account becomes long-only mode.
*/
no_shorting: boolean;
/**
* If true, new orders are blocked.
*/
suspend_trade: boolean;
/**
* all or none. If none, emails for order fills are not sent.
*/
trade_confirm_email: 'all' | 'none';
}
export interface AccountUpdate {
id: string;
created_at: string;
updated_at: string;
deleted_at: any;
status: string;
currency: string;
cash: string;
cash_withdrawable: string;
}
export interface AggregateMinute {
ev: string;
T: string;
v: number;
av: number;
op: number;
vw: number;
o: number;
c: number;
h: number;
l: number;
a: number;
s: number;
e: number;
}
export declare type AssetExchange = 'AMEX' | 'ARCA' | 'BATS' | 'NYSE' | 'NASDAQ' | 'NYSEARCA';
export declare type AssetStatus = 'active' | 'inactive';
/**
* The assets API serves as the master list of assets available for trade and data
* consumption from Alpaca. Assets are sorted by asset class, exchange and symbol. Some
* assets are only available for data consumption via Polygon, and are not tradable with
* Alpaca. These assets will be marked with the flag tradable=false.
*/
export interface Asset {
/**
* Asset ID
*/
id: string;
/**
* "us_equity"
*/
class: string;
/**
* AMEX, ARCA, BATS, NYSE, NASDAQ or NYSEARCA
*/
exchange: AssetExchange;
/**
* Asset symbol
*/
symbol: string;
/**
* active or inactive
*/
status: AssetStatus;
/**
* Asset is tradable on Alpaca or not
*/
tradable: boolean;
/**
* Asset is marginable or not
*/
marginable: boolean;
/**
* Asset is shortable or not
*/
shortable: boolean;
/**
* Asset is easy-to-borrow or not (filtering for easy_to_borrow = True is the best way
* to check whether the name is currently available to short at Alpaca).
*/
easy_to_borrow: boolean;
/**
* Asset is fractionable or not.
*/
fractionable: boolean;
}
/**
* Contains the time of open and close for a market on a particular day from 1970 to 2029
*/
export interface Calendar {
/**
* Date string in YYYY-MM-DD format
*/
date: string;
/**
* The time the market opens at on this date in HH:MM format
*/
open: string;
/**
* The time the market closes at on this date in HH:MM format
*/
close: string;
}
export interface RawClock {
timestamp: string;
is_open: boolean;
next_open: string;
next_close: string;
}
/**
* The clock API serves the current market timestamp, whether or not the market is
* currently open, as well as the times of the next market open and close.
*/
export interface Clock {
/**
* Get the raw data, exactly as it came from Alpaca
*/
raw(): RawClock;
/**
* Current timestamp
*/
timestamp: Date;
/**
* Whether or not the market is open
*/
is_open: boolean;
/**
* Next market open timestamp
*/
next_open: Date;
/**
* Next market close timestamp
*/
next_close: Date;
}
/** A trade which occurred. */
export interface RawTrade {
/** Trade symbol. */
S: string;
/** Timestamp in RFC-3339 format with nanosecond precision. */
t: string;
/** Exchange where the trade happened. */
x: string;
/** Trade price. */
p: number;
/** Trade size. */
s: number;
/** Trade conditions. */
c: string[];
/** Trade ID. */
i: number;
/** Tape. */
z: string;
}
/** A page of one or many trades. */
export interface RawPageOfTrades {
/** Array of trades. */
trades: RawTrade[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/** A trade which occurred. */
export interface Trade {
/** Get the raw data as it came from Alpaca. */
raw(): RawTrade;
/** Trade symbol. */
S: string;
/** Timestamp in RFC-3339 format with nanosecond precision. */
t: Date;
/** Exchange where the trade happened. */
x: string;
/** Trade price. */
p: number;
/** Trade size. */
s: number;
/** Trade conditions. */
c: string[];
/** Trade ID. */
i: number;
/** Tape. */
z: string;
}
/** A page of one or many trades. */
export interface PageOfTrades {
/** Get the raw data as it came from Alpaca. */
raw(): RawPageOfTrades;
/** Array of trades. */
trades: Trade[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/** A quote for a symbol. */
export interface RawQuote {
/** Quote symbol. */
S: string;
/** Timestamp in RFC-3339 format with nanosecond precision. */
t: string;
/** Ask exchange. */
ax: string;
/** Ask price. */
ap: number;
/** Ask size. */
as: number;
/** Bid exchange. */
bx: string;
/** Bid price. */
bp: number;
/** Bid size. */
bs: number;
/** Quote conditions. */
c: string[];
}
/** A page of one or many quotes. */
export interface RawPageOfQuotes {
/** Array of quotes. */
quotes: RawQuote[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/** A quote for a symbol. */
export interface Quote {
/** Get the raw data as it came from Alpaca. */
raw(): RawQuote;
/** Quote symbol. */
S: string;
/** Timestamp in Date format. */
t: Date;
/** Ask exchange. */
ax: string;
/** Ask price. */
ap: number;
/** Ask size. */
as: number;
/** Bid exchange. */
bx: string;
/** Bid price. */
bp: number;
/** Bid size. */
bs: number;
/** Quote conditions. */
c: string[];
}
/** A page of one or many quotes. */
export interface PageOfQuotes {
/** Get the raw data as it came from Alpaca. */
raw(): RawPageOfQuotes;
/** Array of quotes. */
quotes: Quote[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/** A bar for a symbol. */
export interface RawBar {
/** Bar symbol. */
S: string;
/** Timestamp in RFC-3339 format with nanosecond precision. */
t: string;
/** Open price. */
o: number;
/** High price. */
h: number;
/** Low price. */
l: number;
/** Close price. */
c: number;
/** Volume. */
v: number;
}
/** A page of one or many bars. */
export interface RawPageOfBars {
/** Array of bars. */
bars: RawBar[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/** A bar for a symbol. */
export interface Bar {
/** Get the raw data as it came from Alpaca. */
raw(): RawBar;
/** Bar symbol. */
S: string;
/** Timestamp in Date format. */
t: Date;
/** Open price. */
o: number;
/** High price. */
h: number;
/** Low price. */
l: number;
/** Close price. */
c: number;
/** Volume. */
v: number;
}
/** A page of one or many bars. */
export interface PageOfBars {
/** Get the raw data as it came from Alpaca. */
raw(): RawPageOfBars;
/** Array of bars. */
bars: Bar[];
/** Symbol that was queried. */
symbol: string;
/** Token that can be used to query the next page. */
next_page_token: string;
}
/**
* The parsed result of an order cancelation request.
*/
export interface OrderCancelation {
id: string;
status: number;
order: Order;
}
/**
* The id, http status code and order as part of the cancel all orders request.
*/
export interface RawOrderCancelation {
id: string;
status: number;
body: RawOrder;
}
/**
* The order entity with unparsed fields, exactly as Alpaca provides it.
* We encourage you to use the Order interface, which has many of these fields parsed.
*/
export interface RawOrder {
id: string;
client_order_id: string;
created_at: string;
updated_at: string;
submitted_at: string;
filled_at: string;
expired_at: string;
canceled_at: string;
failed_at: string;
replaced_at: string;
replaced_by: string;
replaces: string;
asset_id: string;
symbol: string;
asset_class: string;
qty: string;
filled_qty: string;
type: string;
side: string;
time_in_force: string;
limit_price: string;
stop_price: string;
filled_avg_price: string;
status: string;
extended_hours: boolean;
legs: RawOrder[];
trail_price: string;
trail_percent: string;
hwm: string;
order_class?: OrderClass;
}
/**
* Price and volume data during a particular time interval
*/
export interface Bar_v1 {
/**
* the beginning time of this bar as a Unix epoch in seconds
*/
t: number;
/**
* open price
*/
o: number;
/**
* high price
*/
h: number;
/**
* low price
*/
l: number;
/**
* close price
*/
c: number;
/**
* volume
*/
v: number;
}
/**
* Last quote details for a symbol
*/
export interface LastQuote_v1 {
status: string;
symbol: string;
last: {
/**
* the current ask price
*/
askprice: number;
/**
* the current ask size
*/
asksize: number;
/**
* the exchange code of the ask quote
*/
askexchange: number;
/**
* the current bid price
*/
bidprice: number;
/**
* the current bid size
*/
bidsize: number;
/**
* the exchange code of the bid quote
*/
bidexchange: number;
/**
* epoch timestamp in nanoseconds
*/
timestamp: number;
};
}
/**
* Last trade details for a symbol
*/
export interface LastTrade_v1 {
status: string;
symbol: string;
last: {
/**
* last trade price
*/
price: number;
/**
* last trade volume size
*/
size: number;
/**
* exchange code where the last trade was made
*/
exchange: number;
/**
* condition flag 1
*/
cond1: number;
/**
* condition flag 2
*/
cond2: number;
/**
* condition flag 3
*/
cond3: number;
/**
* condition flag 4
*/
cond4: number;
/**
* epoch timestamp in nanoseconds
*/
timestamp: number;
};
}
export interface RawSnapshot {
symbol: string;
latestTrade: {
t: string;
x: string;
p: number;
s: number;
c?: string[] | null;
i: number;
z: string;
};
latestQuote: {
t: string;
ax: string;
ap: number;
as: number;
bx: string;
bp: number;
bs: number;
c?: string[] | null;
};
minuteBar: {
t: string;
o: number;
h: number;
l: number;
c: number;
v: number;
};
dailyBar: {
t: string;
o: number;
h: number;
l: number;
c: number;
v: number;
};
prevDailyBar: {
t: string;
o: number;
h: number;
l: number;
c: number;
v: number;
};
}
export interface Snapshot {
/** Get the raw data as it came from Alpaca. */
raw(): RawSnapshot;
symbol: string;
latestTrade: {
t: Date;
x: string;
p: number;
s: number;
c?: string[] | null;
i: number;
z: string;
};
latestQuote: {
t: Date;
ax: string;
ap: number;
as: number;
bx: string;
bp: number;
bs: number;
c?: string[] | null;
};
minuteBar: {
t: Date;
o: number;
h: number;
l: number;
c: number;
v: number;
};
dailyBar: {
t: Date;
o: number;
h: number;
l: number;
c: number;
v: number;
};
prevDailyBar: {
t: Date;
o: number;
h: number;
l: number;
c: number;
v: number;
};
}
export declare type DataSource = 'iex' | 'sip';
export declare type OrderType = 'market' | 'limit' | 'stop' | 'stop_limit' | 'trailing_stop';
export declare type OrderClass = 'simple' | 'bracket' | 'oto' | 'oco';
export declare type OrderSide = 'buy' | 'sell';
export declare type OrderTimeInForce =
/**
* A day order is eligible for execution only on the day it is live. By default, the
* order is only valid during Regular Trading Hours (9:30am - 4:00pm ET). If unfilled
* after the closing auction, it is automatically canceled. If submitted after the
* close, it is queued and submitted the following trading day. However, if marked as
* eligible for extended hours, the order can also execute during supported extended
* hours.
*/
'day'
/**
* The order is good until canceled. Non-marketable GTC limit orders are subject to
* price adjustments to offset corporate actions affecting the issue. We do not
* currently support Do Not Reduce(DNR) orders to opt out of such price adjustments.
*/
| 'gtc'
/**
* Use this TIF with a market/limit order type to submit "market on open" (MOO) and
* "limit on open" (LOO) orders. This order is eligible to execute only in the market
* opening auction. Any unfilled orders after the open will be cancelled. OPG orders
* submitted after 9:28am but before 7:00pm ET will be rejected. OPG orders submitted
* after 7:00pm will be queued and routed to the following day's opening auction. On
* open/on close orders are routed to the primary exchange. Such orders do not
* necessarily execute exactly at 9:30am / 4:00pm ET but execute per the exchange's
* auction rules.
*/
| 'opg'
/**
* Use this TIF with a market/limit order type to submit "market on close" (MOC) and
* "limit on close" (LOC) orders. This order is eligible to execute only in the market
* closing auction. Any unfilled orders after the close will be cancelled. CLS orders
* submitted after 3:50pm but before 7:00pm ET will be rejected. CLS orders submitted
* after 7:00pm will be queued and routed to the following day's closing auction. Only
* available with API v2.
*/
| 'cls'
/**
* An Immediate Or Cancel (IOC) order requires all or part of the order to be executed
* immediately. Any unfilled portion of the order is canceled. Only available with API
* v2.
*/
| 'ioc'
/**
* A Fill or Kill (FOK) order is only executed if the entire order quantity can be
* filled, otherwise the order is canceled. Only available with API v2.
*/
| 'fok';
export declare type OrderStatus =
/**
* The order has been received by Alpaca, and routed to exchanges for execution. This
* is the usual initial state of an order.
*/
'new'
/**
* The order has been partially filled.
*/
| 'partially_filled'
/**
* The order has been filled, and no further updates will occur for the order.
*/
| 'filled'
/**
* The order is done executing for the day, and will not receive further updates until
* the next trading day.
*/
| 'done_for_day'
/**
* The order has been canceled, and no further updates will occur for the order. This
* can be either due to a cancel request by the user, or the order has been canceled by
* the exchanges due to its time-in-force.
*/
| 'canceled'
/**
* The order has expired, and no further updates will occur for the order.
*/
| 'expired'
/**
* The order was replaced by another order, or was updated due to a market event such
* as corporate action.
*/
| 'replaced'
/**
* The order is waiting to be canceled.
*/
| 'pending_cancel'
/**
* The order is waiting to be replaced by another order. The order will reject cancel
* request while in this state.
*/
| 'pending_replace'
/**
* (Uncommon) The order has been received by Alpaca, but hasn't yet been routed to the
* execution venue. This could be seen often out side of trading session hours.
*/
| 'accepted'
/**
* (Uncommon) The order has been received by Alpaca, and routed to the exchanges, but
* has not yet been accepted for execution. This state only occurs on rare occasions.
*/
| 'pending_new'
/**
* (Uncommon) The order has been received by exchanges, and is evaluated for pricing.
* This state only occurs on rare occasions.
*/
| 'accepted_for_bidding'
/**
* (Uncommon) The order has been stopped, and a trade is guaranteed for the order,
* usually at a stated price or better, but has not yet occurred. This state only
* occurs on rare occasions.
*/
| 'stopped'
/**
* (Uncommon) The order has been rejected, and no further updates will occur for the
* order. This state occurs on rare occasions and may occur based on various conditions
* decided by the exchanges.
*/
| 'rejected'
/**
* (Uncommon) The order has been suspended, and is not eligible for trading. This state
* only occurs on rare occasions.
*/
| 'suspended'
/**
* (Uncommon) The order has been completed for the day (either filled or done for day),
* but remaining settlement calculations are still pending. This state only occurs on
* rare occasions.
*/
| 'calculated';
export interface RawLatestTrade {
symbol: string;
trade: {
t: string;
x: string;
p: number;
s: number;
c: string[];
i: number;
z: string;
};
}
export interface LatestTrade {
raw(): RawLatestTrade;
symbol: string;
trade: {
t: Date;
x: string;
p: number;
s: number;
c: string[];
i: number;
z: string;
};
}
/**
* An Order in Alpaca
*/
export interface Order {
/**
* Get the raw data, exactly as it came from Alpaca
*/
raw(): RawOrder;
/**
* Order id
*/
id: string;
/**
* Client unique order id
*/
client_order_id: string;
/**
* When the order was created
*/
created_at: Date;
/**
* When the order was last updated
*/
updated_at: Date;
/**
* When the order was submitted
*/
submitted_at: Date;
/**
* When the order was filled
*/
filled_at: Date;
/**
* When the order expired
*/
expired_at: Date;
/**
* When the order was canceled
*/
canceled_at: Date;
/**
* When the order failed
*/