lib/Finance/Robinhood/Equity/Instrument.pm

filter: Statementstmt 64.9% 74 / 114 Branchbran 10.7% 3 / 28 Conditioncond 39.1% 9 / 23 MC/DCmcdc 0.0% 0 / 21 Subroutinesub 79.4% 31 / 39 Podpod 100% 12 / 12 totaltotal 54.4% 129 / 237 CC 28 SCAR 19.9
CC
28
Cov
52%
prices
42.0
quote
12.0
fundamentals
12.0
CRAP 7.3
« lib/Finance/Robinhood/Forex/OrderBuilder.pm ↑ Summary lib/Finance/Robinhood/Equity/Watchlist.pm »
1 package Finance::Robinhood::Equity::Instrument;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Equity::Instrument - Represents a Single Equity Instrument
10  
11 =head1 SYNOPSIS
12  
13 use Finance::Robinhood;
14 my $rh = Finance::Robinhood->new;
15 my $instruments = $rh->instruments();
16  
17 for my $instrument ($instruments->all) {
18 CORE::say $instrument->symbol;
19 }
20  
21 =cut
22  
23 1 our $VERSION = '0.92_003';
24 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Finance::Robinhood::Equity::Fundamentals;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Finance::Robinhood::Equity::Quote;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use Finance::Robinhood::Equity::OrderBuilder;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use Finance::Robinhood::Equity::Market;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use Finance::Robinhood::Equity::Ratings;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use Finance::Robinhood::Equity::Tag;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶use Time::Moment;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 1 ▶sub _test__init {
Subroutine _test__init: called CC=2 SCAR=10.3
35 1 my $rh = t::Utility::rh_instance(0);
36 1 my $msft = $rh->equity_instrument_by_symbol('MSFT');
37 1 isa_ok($msft, __PACKAGE__);
38 1 t::Utility::stash('MSFT', $msft); # Store it for later
39 1 ▶ t::Utility::rh_instance(1) // skip_all();
Condition0%0/3
t::Utility::rh_instance(1) // skip_all()
l!l&&r!l&&!r
000
MC/DC0%0/2
t::Utility::rh_instance(1) // skip_all()
t::Utility::rh_instance(1) skip_all()
Truth table0%0/3
A // B
A= t::Utility::rh_instance(1)B= skip_all()
ABresult
1X1
011
000
40 0 $rh = t::Utility::rh_instance(1);
41 0 $msft = $rh->equity_instrument_by_symbol('MSFT');
42 0 isa_ok($msft, __PACKAGE__);
43 0 t::Utility::stash('MSFT_AUTH', $msft);
44 }
45 1 ▶use overload '""' => sub ($s, @) { $s->{url} }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
46  
47 1 ▶sub _test_stringify {
Subroutine _test_stringify: called CC=2 SCAR=7.2
48 1 ▶ t::Utility::stash('MSFT') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT") // skip_all()
l!l
10
MC/DC0%0/2
t::Utility::stash("MSFT") // skip_all()
t::Utility::stash("MSFT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT")B= skip_all()
ABresult
1X1
011
000
49 1 is( +t::Utility::stash('MSFT'),
50 'https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/',
51 );
52 }
53 #
54 1 has _rh => undef => weak => 1;
55  
56 =head1 METHODS
57  
58 =head2 C<bloomberg_unique( )>
59  
60 https://en.wikipedia.org/wiki/Financial_Instrument_Global_Identifier
61  
62 =head2 C<country( )>
63  
64 Country code of location of headquarters.
65  
66 =head2 C<day_trade_ratio( )>
67  
68  
69  
70 =head2 C<id( )>
71  
72 Instrument id used by RH to refer to this particular instrument.
73  
74 =head2 C<list_date( )>
75  
76 Returns a Time::Moment object containing the date the instrument began trading
77 publically.
78  
79 =cut
80  
81 1 ▶sub list_date ($s) {
Subroutine list_date: called CC=1 SCAR=0.0
Pod documented
82 1 Time::Moment->from_string($s->{list_date} . 'T00:00:00.000Z');
83 }
84  
85 1 ▶sub _test_list_date {
Subroutine _test_list_date: called CC=2 SCAR=7.2
86 1 ▶ t::Utility::stash('MSFT') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT") // skip_all()
l!l
10
MC/DC0%0/2
t::Utility::stash("MSFT") // skip_all()
t::Utility::stash("MSFT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT")B= skip_all()
ABresult
1X1
011
000
87 1 isa_ok(t::Utility::stash('MSFT')->list_date(), 'Time::Moment');
88 }
89  
90 =head2 C<maintenance_ratio( )>
91  
92 =head2 C<margin_initial_ratio( )>
93  
94 =head2 C<min_tick_size( )>
95  
96 If applicable, this returns the regulatory defined tick size. See
97 http://www.finra.org/industry/tick-size-pilot-program
98  
99 =head2 C<name( )>
100  
101 Full name of the instrument.
102  
103 =head2 C<rhs_tradability( )>
104  
105 Indicates whether the instrument can be traded specifically on Robinhood.
106 Returns C<tradable> or C<untradable>.
107  
108 =head2 C<simple_name( )>
109  
110 Shorter name for the instrument. Best suited for display.
111  
112 =head2 C<state( )>
113  
114 Indicates whether this instrument is C<active> or C<inactive>.
115  
116 =head2 C<symbol( )>
117  
118 Ticker symbol.
119  
120 =head2 C<tradability( )>
121  
122 Indicates whether or not this instrument can be traded in general. Returns
123 C<tradable> or C<untradable>.
124  
125 =head2 C<tradable_chain_id( )>
126  
127 Id for the related options chain as a UUID.
128  
129 =head2 C<tradeable( )>
130  
131 Returns a boolean value.
132  
133 =head2 C<type( )>
134  
135 Indicates what sort of instrument this is. May one one of these: C<stock>,
136 C<adr>, C<cef>, C<reit>, or C<etp>.
137  
138 =cut
139  
140 1 has ['bloomberg_unique', 'country',
141 'day_trade_ratio', 'id',
142 'maintenance_ratio', 'margin_initial_ratio',
143 'min_tick_size', 'name',
144 'rhs_tradability', 'simple_name',
145 'state', 'symbol',
146 'tradability', 'tradable_chain_id',
147 'tradeable', 'type',
148 'url'
149 ];
150  
151 =head2 C<quote( )>
152  
153 my $quote = $instrument->quote();
154  
155 Builds a Finance::Robinhood::Equity::Quote object with this instrument's quote
156 data.
157  
158 You do not need to be logged in for this to work.
159  
160 =cut
161  
162 0 ▶sub quote ($s) {
Subroutine quote: not called CC=3 SCAR=24.8
Pod documented
163 0 my $res = $s->_rh->_get($s->{quote});
164 $res->is_success
165 ? Finance::Robinhood::Equity::Quote->new(_rh => $s->_rh,
166 0 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 0 0
$res->is_server_error ? : 0 0 0
167 : Finance::Robinhood::Error->new(
168 $res->is_server_error ? (details => $res->message) : $res->json);
169 }
170  
171 1 ▶sub _test_quote {
Subroutine _test_quote: called CC=2 SCAR=9.2
172 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
173 0 isa_ok(t::Utility::stash('MSFT_AUTH')->quote(),
174 'Finance::Robinhood::Equity::Quote');
175 }
176  
177 =head2 C<prices( [...] )>
178  
179 my $prices = $instrument->prices;
180  
181 Builds a Finance::Robinhood::Equity::Prices object with the instrument's price
182 data. You must be logged in for this to work.
183  
184 You may modify the type of information returned with the following options:
185  
186 =over
187  
188 =item C<delayed> - Boolean value. If false, real time quote data is returned.
189  
190 =item C<source> - You may specify C<consolidated> (which is the default) for data from the tape or C<nls> for the Nasdaq last sale price.
191  
192 =back
193  
194 $prices = $instrument->prices(source => 'consolidated', dealyed => 0);
195  
196 This would return live quote data from the tape.
197  
198 =cut
199  
200 0 ▶sub prices ($s, %filters) {
Subroutine prices: not called CC=6 SCAR=37.4
Pod documented
201 $filters{delayed} = !!$filters{delayed} ? 'true' : 'false'
202 0 ▶ if defined $filters{delayed};
Branch: 2 branches
BranchTrueFalseTotal
if defined $filters{"delayed"} 0 0 0
!!$filters{'delayed'} ? : 0 0 0
203 0 ▶ $filters{source} //= 'consolidated';
Condition0%0/2
$filters{"source"} //= "consolidated"
l!l
00
MC/DC0%0/1
$filters{"source"} //= "consolidated"
$filters{"source"}
Truth table0%0/2
A
A= $filters{"source"}
Aresult
11
00
204 my $res = $s->_rh->_get(
205 Mojo::URL->new(
206 0 'https://api.robinhood.com/marketdata/prices/' . $s->{id} . '/'
207 )->query(\%filters)
208 );
209 0 require Finance::Robinhood::Equity::Prices;
210 $res->is_success
211 ? Finance::Robinhood::Equity::Prices->new(_rh => $s->_rh,
212 0 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 0 0
$res->is_server_error ? : 0 0 0
213 : Finance::Robinhood::Error->new(
214 $res->is_server_error ? (details => $res->message) : $res->json);
215 }
216  
217 1 ▶sub _test_prices {
Subroutine _test_prices: called CC=2 SCAR=9.2
218 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
219 0 isa_ok(t::Utility::stash('MSFT_AUTH')->prices(),
220 'Finance::Robinhood::Equity::Prices');
221 }
222  
223 =head2 C<splits( )>
224  
225 my @splits = $instrument->splits->all;
226  
227 Returns an iterator with Finance::Robinhood::Equity::Split objects.
228  
229 =cut
230  
231 2 ▶sub splits ( $s ) {
Subroutine splits: called CC=1 SCAR=0.0
Pod documented
232 Finance::Robinhood::Utilities::Iterator->new(
233 _rh => $s->_rh,
234 2 _next_page => Mojo::URL->new($s->{splits}),
235 _class => 'Finance::Robinhood::Equity::Split'
236 );
237 }
238  
239 1 ▶sub _test_splits {
Subroutine _test_splits: called CC=1 SCAR=0.0
240 1 my $rh = t::Utility::rh_instance(0);
241 1 my $splits = $rh->equity_instrument_by_symbol('JNUG')->splits;
242 1 isa_ok($splits, 'Finance::Robinhood::Utilities::Iterator');
243 1 isa_ok($splits->next, 'Finance::Robinhood::Equity::Split');
244 }
245  
246 =head2 C<market( )>
247  
248 my $market = $instrument->market();
249  
250 Builds a Finance::Robinhood::Equity::Market object with this instrument's quote
251 data.
252  
253 You do not need to be logged in for this to work.
254  
255 =cut
256  
257 1 ▶sub market ($s) {
Subroutine market: called CC=3 SCAR=13.1
Pod documented
258 1 my $res = $s->_rh->_get($s->{market});
259 $res->is_success
260 ? Finance::Robinhood::Equity::Market->new(_rh => $s->_rh,
261 1 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 1 0 1
$res->is_server_error ? : 0 0 0
262 : Finance::Robinhood::Error->new(
263 $res->is_server_error ? (details => $res->message) : $res->json);
264 }
265  
266 1 ▶sub _test_market {
Subroutine _test_market: called CC=2 SCAR=7.0
267 1 my $rh = t::Utility::rh_instance(0);
268 1 my $msft = $rh->equity_instrument_by_symbol('MSFT');
269 1 ▶ $msft // skip_all();
Condition50%1/2
$msft // skip_all()
l!l
10
MC/DC0%0/2
$msft // skip_all()
$msft skip_all()
Truth table33%1/3
A // B
A= $msftB= skip_all()
ABresult
1X1
011
000
270 1 isa_ok($msft->market(), 'Finance::Robinhood::Equity::Market');
271 }
272  
273 =head2 C<fundamentals( )>
274  
275 my $fundamentals = $instrument->fundamentals();
276  
277 Builds a Finance::Robinhood::Equity::Fundamentals object with this instrument's
278 data.
279  
280 You do not need to be logged in for this to work.
281  
282 =cut
283  
284 0 ▶sub fundamentals ($s) {
Subroutine fundamentals: not called CC=3 SCAR=24.8
Pod documented
285 0 my $res = $s->_rh->_get($s->{fundamentals});
286 $res->is_success
287 ? Finance::Robinhood::Equity::Fundamentals->new(_rh => $s->_rh,
288 0 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 0 0
$res->is_server_error ? : 0 0 0
289 : Finance::Robinhood::Error->new(
290 $res->is_server_error ? (details => $res->message) : $res->json);
291 }
292  
293 1 ▶sub _test_fundamentals {
Subroutine _test_fundamentals: called CC=2 SCAR=9.2
294 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
295 0 isa_ok(t::Utility::stash('MSFT_AUTH')->fundamentals(),
296 'Finance::Robinhood::Equity::Fundamentals');
297 }
298  
299 =head2 C<ratings( )>
300  
301 my $fundamentals = $instrument->ratings();
302  
303 Builds a Finance::Robinhood::Equity::Ratings object with this instrument's
304 data.
305  
306 =cut
307  
308 0 ▶sub ratings ($s) {
Subroutine ratings: not called CC=3 SCAR=24.8
Pod documented
309 0 my $res = $s->_rh->_get(
310 'https://midlands.robinhood.com/ratings/' . $s->id . '/');
311 $res->is_success
312 ? Finance::Robinhood::Equity::Ratings->new(_rh => $s->_rh,
313 0 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 0 0
$res->is_server_error ? : 0 0 0
314 : Finance::Robinhood::Error->new(
315 $res->is_server_error ? (details => $res->message) : $res->json);
316 }
317  
318 1 ▶sub _test_ratings {
Subroutine _test_ratings: called CC=2 SCAR=9.2
319 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
320 0 isa_ok(t::Utility::stash('MSFT_AUTH')->ratings(),
321 'Finance::Robinhood::Equity::Ratings');
322 }
323  
324 =head2 C<options_chains( )>
325  
326 $instrument = $rh->search('MSFT')->equity_instruments->[0];
327 my $chains = $instrument->options_chains;
328  
329 Returns an iterator containing chain elements.
330  
331 =cut
332  
333 1 ▶sub options_chains ($s) {
Subroutine options_chains: called CC=1 SCAR=0.0
Pod documented
334 1 $s->_rh->options_chains($s);
335 }
336  
337 1 ▶sub _test_options_chains {
Subroutine _test_options_chains: called CC=1 SCAR=0.0
338 1 my $chains = t::Utility::stash('MSFT')->options_chains;
339 1 isa_ok($chains, 'Finance::Robinhood::Utilities::Iterator');
340 1 isa_ok($chains->current, 'Finance::Robinhood::Options::Chain');
341 }
342  
343 =head2 C<news( )>
344  
345 my $news = $instrument->news;
346  
347 Returns an iterator containing Finance::Robinhood::News elements.
348  
349 =cut
350  
351 1 ▶sub news ($s) { $s->_rh->news($s->symbol) }
Subroutine news: called CC=1 SCAR=0.0
Pod documented
352  
353 1 ▶sub _test_news {
Subroutine _test_news: called CC=1 SCAR=0.0
354 1 my $news = t::Utility::stash('MSFT')->news;
355 1 isa_ok($news, 'Finance::Robinhood::Utilities::Iterator');
356 1 isa_ok($news->current, 'Finance::Robinhood::News');
357 }
358  
359 =head2 C<tags( )>
360  
361 my $tags = $instrument->tags( );
362  
363 Locates an instrument's tags and returns a list of
364 Finance::Robinhood::Equity::Tag objects.
365  
366 =cut
367  
368 1 ▶sub tags ( $s ) {
Subroutine tags: called CC=3 SCAR=15.1
Pod documented
369 1 my $res = $s->_rh->_get(
370 'https://midlands.robinhood.com/tags/instrument/' . $s->id . '/');
371 return $res->is_success
372 ?
373 0 map { Finance::Robinhood::Equity::Tag->new(_rh => $s, %{$_}) }
374 0 ▶ @{$res->json->{tags}}
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 1 1
$res->is_server_error ? : 0 1 1
375 : Finance::Robinhood::Error->new(
376 $res->is_server_error ? (details => $res->message) : $res->json);
377 }
378  
379 1 ▶sub _test_tags {
Subroutine _test_tags: called CC=1 SCAR=2.6
380 1 my @tags = t::Utility::stash('MSFT')->tags;
381 0 ok(@tags);
382 0 isa_ok($tags[0], 'Finance::Robinhood::Equity::Tag');
383 }
384  
385 =head2 C<buy( ... )>
386  
387 my $order = $instrument->buy(34);
388  
389 Returns a Finance::Robinhood::Equity::OrderBuilder object.
390  
391 Without any additional method calls, this will create an order that looks like
392 this:
393  
394 {
395 account => "https://api.robinhood.com/accounts/XXXXXXXXXX/",
396 instrument => "https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/",
397 price => "111.700000", # Automatically grabs last trade price quote on submission
398 quantity => 4, # Actually the number of shares you requested
399 side => "buy",
400 symbol => "MSFT",
401 time_in_force => "gfd",
402 trigger => "immediate",
403 type => "market"
404 }
405  
406 =cut
407  
408 0 ▶sub buy ($s, $quantity, $account = $s->_rh->equity_accounts->next) {
Subroutine buy: not called CC=2 SCAR=17.9
Pod documented
409 0 Finance::Robinhood::Equity::OrderBuilder->new(_rh => $s->_rh,
410 _instrument => $s,
411 _account => $account,
412 quantity => $quantity
413 )->buy;
414 }
415  
416 1 ▶sub _test_buy {
Subroutine _test_buy: called CC=2 SCAR=12.4
417 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
418 #
419 0 my $market = t::Utility::stash('MSFT_AUTH')->buy(4);
420 0 is( {$market->_dump(1)},
421 {account => '--private--',
422 instrument =>
423 'https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/',
424 quantity => 4,
425 side => 'buy',
426 trigger => 'immediate',
427 type => 'market',
428 time_in_force => 'gfd',
429 ref_id => '00000000-0000-0000-0000-000000000000',
430 symbol => 'MSFT',
431 price => '5.00'
432 }
433 );
434  
435 #->stop(43)->limit(55);#->submit;
436 #ddx \{$order->_dump};
437 0 ▶ todo("Write actual tests!" => sub { pass('ugh') });
Subroutine __ANON__: not called CC=1 SCAR=6.9
438  
439 #my $news = t::Utility::stash('MSFT')->news;
440 #isa_ok( $news, 'Finance::Robinhood::Utilities::Iterator' );
441 #isa_ok( $news->current, 'Finance::Robinhood::News' );
442 }
443  
444 =head2 C<sell( ... )>
445  
446 my $order = $instrument->sell(34);
447  
448 Returns a Finance::Robinhood::Equity::OrderBuilder object.
449  
450 Without any additional method calls, this will create an order that looks like
451 this:
452  
453 {
454 account => "https://api.robinhood.com/accounts/XXXXXXXXXX/",
455 instrument => "https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/",
456 price => "111.700000", # Automatically grabs last trade price quote on submission
457 quantity => 4, # Actually the number of shares you requested
458 side => "sell",
459 symbol => "MSFT",
460 time_in_force => "gfd",
461 trigger => "immediate",
462 type => "market"
463 }
464  
465 =cut
466  
467 0 ▶sub sell ($s, $quantity, $account = $s->_rh->equity_accounts->next) {
Subroutine sell: not called CC=2 SCAR=17.9
Pod documented
468 0 Finance::Robinhood::Equity::OrderBuilder->new(_rh => $s->_rh,
469 _instrument => $s,
470 _account => $account,
471 quantity => $quantity
472 )->sell;
473 }
474  
475 1 ▶sub _test_sell {
Subroutine _test_sell: called CC=2 SCAR=12.4
476 1 ▶ t::Utility::stash('MSFT_AUTH') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT_AUTH") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT_AUTH") // skip_all()
t::Utility::stash("MSFT_AUTH") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT_AUTH")B= skip_all()
ABresult
1X1
011
000
477 #
478 0 my $market = t::Utility::stash('MSFT_AUTH')->sell(4);
479 0 is( {$market->_dump(1)},
480 {account => '--private--',
481 instrument =>
482 'https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/',
483 quantity => 4,
484 side => 'sell',
485 trigger => 'immediate',
486 type => 'market',
487 time_in_force => 'gfd',
488 ref_id => '00000000-0000-0000-0000-000000000000',
489 symbol => 'MSFT',
490 price => '5.00'
491 }
492 );
493  
494 #->stop(43)->limit(55);#->submit;
495 #ddx \{$order->_dump};
496 0 ▶ todo("Write actual tests!" => sub { pass('ugh') });
Subroutine __ANON__: not called CC=1 SCAR=6.9
497  
498 #my $news = t::Utility::stash('MSFT')->news;
499 #isa_ok( $news, 'Finance::Robinhood::Utilities::Iterator' );
500 #isa_ok( $news->current, 'Finance::Robinhood::News' );
501 }
502  
503 =head1 LEGAL
504  
505 This is a simple wrapper around the API used in the official apps. The author
506 provides no investment, legal, or tax advice and is not responsible for any
507 damages incurred while using this software. This software is not affiliated
508 with Robinhood Financial LLC in any way.
509  
510 For Robinhood's terms and disclosures, please see their website at
511 https://robinhood.com/legal/
512  
513 =head1 LICENSE
514  
515 Copyright (C) Sanko Robinson.
516  
517 This library is free software; you can redistribute it and/or modify it under
518 the terms found in the Artistic License 2. Other copyrights, terms, and
519 conditions may apply to data transmitted through this module. Please refer to
520 the L<LEGAL> section.
521  
522 =head1 AUTHOR
523  
524 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
525  
526 =cut
527  
528 1 1;
« lib/Finance/Robinhood/Forex/OrderBuilder.pm ↑ Summary lib/Finance/Robinhood/Equity/Watchlist.pm »