forked from aurbano/robinhood-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
robinhood.d.ts
254 lines (213 loc) · 6.27 KB
/
robinhood.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
import request = require('request')
declare function robinhood(options: robinhood.Options.WebApiOpts, callback: robinhood.InitCallback): robinhood.RobinhoodWebApi;
declare namespace robinhood {
export namespace Options {
interface WebApiOpts {
username?: string
password?: string
token?: string
}
interface OrdersOptions {
updated_at: string
instrument: string
}
interface EarningsOptionsWithSymbol {
range?: number
symbol: string
}
interface EarningsOptionsWithInstrument {
range?: number
instrument: string
}
interface BuySellOptions {
type: OrderType
quantity: number
bid_price: number
instrument: {
url?: string
symbol?: string
}
trigger: TriggerType
time: TimeInForceType
}
}
export type TagType = TagTypes
export type OrderType = OrderTypes
export type IntervalType = IntervalTypes
export type SpanType = SpanTypes
export type TriggerType = TriggerTypes
export type TimeInForceType = TimeInForceTypes
export type InitCallback = () => void
export type TagTypes =
'10-most-popular'
| '100-most-popular'
;
export type TriggerTypes =
'immediate'
| 'day'
;
export type TimeInForceTypes =
'gfd'
| 'gtc'
| 'oco'
;
export type OrderTypes =
'limit'
| 'market'
;
export type IntervalTypes =
'5minute'
| '10minute'
;
export type SpanTypes =
'week'
| 'day'
;
export interface RobinhoodWebApi {
/**
* Revokes the current token for this session.
* @param callback
*/
expire_token (callback: request.RequestCallback): void
/**
* Returns the token for the current session.
*/
auth_token (): string|null
/**
* Get the current user's investment profile.
* @param callback
*/
investment_profile (callback: request.RequestCallback): void
/**
* Return all instruments, or those for a given symbol.
* @param callback
*/
instruments(callback: request.RequestCallback): void
instruments(symbol: string, callback: request.RequestCallback): void
/**
* Get fundamental data about a symbol.
* @param symbol
* @param callback
*/
fundamentals (symbol: string, callback: request.RequestCallback): void
/**
* Get the popularity for a specified stock.
* @param symbol
* @param callback
*/
popularity (symbol: string, callback: request.RequestCallback): void
/**
* Returns account information for the current user session.
* @param callback
*/
accounts (callback: request.RequestCallback): void
/**
* Get the user's quote data for a specified stock.
* @param symbol
* @param callback
*/
quote_data (symbol: string, callback: request.RequestCallback): void
quote_data (symbol: string[], callback: request.RequestCallback): void
/**
* Get the user's order information for the given options or specific order.
* @param options
* @param callback
*/
orders (options: Options.OrdersOptions, callback: request.RequestCallback): void
orders (orderId: string, callback: request.RequestCallback): void
/**
* Get the user's position information.
* @param callback
*/
positions (callback: request.RequestCallback): void
/**
* Get the user's nonzero position information only.
* @param callback
*/
nonzero_positions (callback: request.RequestCallback): void
/**
* Place a buy order on a specified stock.
* @param options
* @param callback
*/
place_buy_order (options: Options.BuySellOptions, callback: request.RequestCallback): void
/**
* Place a sell order on a specified stock.
* @param options
* @param callback
*/
place_sell_order (options: Options.BuySellOptions, callback: request.RequestCallback): void
/**
* Cancel an order with the order object or order ID.
* @param order
* @param callback
*/
cancel_order (order: object, callback: request.RequestCallback): void
cancel_order (orderId: string, callback: request.RequestCallback): void
/**
* Get historical information for the given symbol.
* @param symbol
* @param intv
* @param span
* @param callback
*/
historicals (symbol: string, intv: IntervalType, span: SpanType, callback: request.RequestCallback): void
/**
* Get user information.
* @param callback
*/
user (callback: request.RequestCallback): void
/**
* Returns the user's watchlists
* @param callback
*/
watchlists (callback: request.RequestCallback): void
/**
* Get the earnings information using either the symbol or instrument.
* @param options
* @param callback
*/
earnings (options: Options.EarningsOptionsWithInstrument|Options.EarningsOptionsWithSymbol, callback: request.RequestCallback): void
/**
* Get the user's dividends information.
* @param callback
*/
dividends (callback: request.RequestCallback): void
/**
* Fetch splits for the given instrument.
* @param instrument
* @param callback
*/
splits (instrument: string, callback: request.RequestCallback): void
/**
* Returns news for a given symbol.
* @param symbol
* @param callback
*/
news (symbol: string, callback: request.RequestCallback): void
/**
* Returns information for the given tag.
* Retrieve Robinhood's new Tags: In 2018, Robinhood Web will expose more
* Social and Informational tools. You'll see how popular a security is with
* other Robinhood users, MorningStar ratings, etc.
* @param tag
* @param callback
*/
tag (tag: TagType, callback: request.RequestCallback): void
/**
* Perform a GET request against the given URL.
* Used to get continued or paginated data from the API. Queries with long
* results return a reference to the next set.
* @param url
* @param callback
*/
url (url: string, callback: request.RequestCallback): void
/**
*
* @param callback
*/
sp500_down (callback: request.RequestCallback): void
sp500_up (callback: request.RequestCallback): void
}
}
export = robinhood