UNPKG

3.92 kBPlain TextView Raw
1import {
2 OrderSide,
3 OrderType,
4 OrderTimeInForce,
5 DataSource,
6} from './entities.js';
7
8export interface AddToWatchList {
9 uuid: string;
10 symbol: string;
11}
12
13export interface CancelOrder {
14 order_id: string;
15}
16
17export interface ClosePosition {
18 symbol: string;
19 qty?: number;
20 percentage?: number;
21}
22
23export interface ClosePositions {
24 cancel_orders?: boolean;
25}
26
27export interface CreateWatchList {
28 name: string;
29 symbols?: string[];
30}
31
32export interface DeleteWatchList {
33 uuid: string;
34}
35
36export interface GetAccountActivities {
37 activity_type?: string;
38 activity_types?: string | string[];
39 date?: string;
40 until?: string;
41 after?: string;
42 direction?: 'asc' | 'desc';
43 page_size?: number;
44 page_token?: string;
45}
46
47export interface GetAsset {
48 asset_id_or_symbol: string;
49}
50
51export interface GetAssets {
52 status?: 'active' | 'inactive';
53 asset_class?: string; // i don't know where to find all asset classes
54}
55
56export interface GetCalendar {
57 start?: Date;
58 end?: Date;
59}
60
61export interface GetTrades {
62 symbol: string;
63 start: Date;
64 end: Date;
65 limit?: number;
66 page_token?: string;
67}
68
69export interface GetQuotes {
70 symbol: string;
71 start: Date;
72 end: Date;
73 limit?: number;
74 page_token?: string;
75}
76
77export interface GetSnapshot {
78 symbol: string;
79}
80
81export interface GetSnapshots {
82 symbols: string[];
83}
84
85export interface GetBars {
86 symbol: string;
87 start: Date;
88 end: Date;
89 limit?: number;
90 page_token?: string;
91 timeframe: BarsTimeframe;
92 adjustment?: 'all' | 'dividend' | 'raw' | 'split';
93}
94
95export interface GetBars_v1 {
96 timeframe: BarsV1Timeframe;
97 symbols: string[];
98 limit?: number;
99 start?: Date;
100 end?: Date;
101 after?: Date;
102 until?: Date;
103}
104
105export interface GetLastQuote_v1 {
106 symbol: string;
107}
108
109export interface GetLastTrade_v1 {
110 symbol: string;
111}
112
113export interface GetOrder {
114 order_id?: string;
115 client_order_id?: string;
116 nested?: boolean;
117}
118
119export interface GetOrders {
120 status?: 'open' | 'closed' | 'all';
121 limit?: number;
122 after?: Date;
123 until?: Date;
124 direction?: 'asc' | 'desc';
125 nested?: boolean;
126 symbols?: string[];
127}
128
129export interface GetPortfolioHistory {
130 period?: string;
131 timeframe?: string;
132 date_end?: Date;
133 extended_hours?: boolean;
134}
135
136export interface GetPosition {
137 symbol: string;
138}
139
140export interface GetWatchList {
141 uuid: string;
142}
143
144export interface PlaceOrder {
145 symbol: string;
146 side: OrderSide;
147 type: OrderType;
148 time_in_force: OrderTimeInForce;
149 qty?: number;
150 notional?: number;
151 limit_price?: number;
152 stop_price?: number;
153 extended_hours?: boolean;
154 client_order_id?: string;
155 trail_price?: number;
156 trail_percent?: number;
157 order_class?: 'simple' | 'bracket' | 'oco' | 'oto';
158 take_profit?: {
159 limit_price: number;
160 };
161 stop_loss?: {
162 stop_price: number;
163 limit_price?: number;
164 };
165}
166
167export interface RemoveFromWatchList {
168 uuid: string;
169 symbol: string;
170}
171
172export interface ReplaceOrder {
173 order_id: string;
174 qty?: number;
175 time_in_force?: OrderTimeInForce;
176 limit_price?: number;
177 stop_price?: number;
178 client_order_id?: string;
179}
180
181export type BarsV1Timeframe = '1Min' | '5Min' | '15Min' | '1Day';
182
183/** Also supports arbitrary minute, hour, and day values. E.g., '37Min', '6Hour', '3Day' */
184export type BarsTimeframe =
185 | BarsV1Timeframe
186 | '30Min'
187 | '1Hour'
188 | '2Hour'
189 | '4Hour';
190
191export interface UpdateAccountConfigurations {
192 dtbp_check?: string;
193 no_shorting?: boolean;
194 suspend_trade?: boolean;
195 trade_confirm_email?: string;
196}
197
198export interface GetLatestTrade {
199 symbol: string;
200 feed?: DataSource;
201 limit?: number;
202}
203
204export interface UpdateWatchList {
205 uuid: string;
206 name?: string;
207 symbols?: string[];
208}
209
210export interface GetNews {
211 symbols?: string[] | string;
212 start?: Date;
213 end?: Date;
214 limit?: number;
215 sort?: 'ASC' | 'DESC';
216 include_content?: boolean;
217 exclude_contentless?: boolean;
218 page_token?: string;
219}