UNPKG

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