File Coverage

lib/Finance/Robinhood/Options/Chain/Underlying.pm
Criterion Covered Total %
statement 11 23 47.8
branch n/a
condition 1 2 50.0
subroutine 5 8 62.5
pod 0 1 0.0
total 17 34 50.0


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Options::Chain::Underlying;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Options::Chain::Underlying - Represents a Single Options
10             Chain's Underlying Equity Instrument
11              
12             =head1 SYNOPSIS
13              
14             use Finance::Robinhood;
15             my $rh = Finance::Robinhood->new->login('user', 'pass');
16             my $account = $rh->accounts->current();
17              
18             # TODO
19              
20             =cut
21              
22             our $VERSION = '0.92_003';
23 1     1   8 use Mojo::Base-base, -signatures;
  1         112  
  1         7  
24 1     1   187 use Mojo::URL;
  1         2  
  1         5  
25              
26             sub _test__init {
27 1     1   12168 my $rh = t::Utility::rh_instance(1);
28              
29             #my $instrument = $rh->options_instruments(
30             # chain_id => $rh->search('MSFT')->equity_instruments->[0]->tradable_chain_id,
31             # tradability => 'tradable'
32             #)->current;
33             #isa_ok( $instrument, __PACKAGE__ );
34             #t::Utility::stash( 'INSTRUMENT', $instrument ); # Store it for later
35 0     0   0 todo("Write actual tests!" => sub { pass('ugh') });
  0         0  
36             }
37 1     1   131 use overload '""' => sub ($s, @) { $s->{instrument} }, fallback => 1;
  1     0   2  
  1         7  
  0         0  
  0         0  
  0         0  
  0         0  
38              
39             sub _test_stringify {
40 1   50 1   2063 t::Utility::stash('UNDERLYING') // skip_all();
41 0           like(+t::Utility::stash('UNDERLYING'),
42             qr'^https://api.robinhood.com/instruments/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/$'i
43             );
44             }
45             #
46             has _rh => undef => weak => 1;
47             has ['id', 'quantity'];
48              
49 0     0 0   sub instrument($s) {
  0            
  0            
50             Finance::Robinhood::Equity::Instrument->new(
51             _rh => $s->_rh,
52 0           %{$s->_rh->_get($s->{instrument})->json}
  0            
53             );
54             }
55              
56             =head1 LEGAL
57              
58             This is a simple wrapper around the API used in the official apps. The author
59             provides no investment, legal, or tax advice and is not responsible for any
60             damages incurred while using this software. This software is not affiliated
61             with Robinhood Financial LLC in any way.
62              
63             For Robinhood's terms and disclosures, please see their website at
64             https://robinhood.com/legal/
65              
66             =head1 LICENSE
67              
68             Copyright (C) Sanko Robinson.
69              
70             This library is free software; you can redistribute it and/or modify it under
71             the terms found in the Artistic License 2. Other copyrights, terms, and
72             conditions may apply to data transmitted through this module. Please refer to
73             the L section.
74              
75             =head1 AUTHOR
76              
77             Sanko Robinson Esanko@cpan.orgE
78              
79             =cut
80              
81             1;