| 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 | 1 | our $VERSION = '0.92_003'; | |||||||||||||||||
| 23 | 1 | ▶ | use Mojo::Base-base, -signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 24 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=2.6
| |||||||||||||||||||
| 27 | 1 | 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 | ▶ | todo("Write actual tests!" => sub { pass('ugh') }); | ||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||
| 36 | } | ||||||||||||||||||
| 37 | 0 | ▶ | use overload '""' => sub ($s, @) { $s->{instrument} }, fallback => 1; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||
| 38 | |||||||||||||||||||
| 39 | 1 | ▶ | sub _test_stringify { | ||||||||||||||||
|
Subroutine
_test_stringify: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 40 | 1 | ▶ | t::Utility::stash('UNDERLYING') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("UNDERLYING") // skip_all()
MC/DC0%0/2
t::Utility::stash("UNDERLYING") // skip_all()
t::Utility::stash("UNDERLYING")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("UNDERLYING")B= 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 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 47 | 1 | has ['id', 'quantity']; | |||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | 0 | ▶ | sub instrument($s) { | ||||||||||||||||
|
Subroutine
instrument: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 50 | Finance::Robinhood::Equity::Instrument->new( | ||||||||||||||||||
| 51 | _rh => $s->_rh, | ||||||||||||||||||
| 52 | 0 | %{$s->_rh->_get($s->{instrument})->json} | |||||||||||||||||
| 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<LEGAL> section. | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | =head1 AUTHOR | ||||||||||||||||||
| 76 | |||||||||||||||||||
| 77 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 78 | |||||||||||||||||||
| 79 | =cut | ||||||||||||||||||
| 80 | |||||||||||||||||||
| 81 | 1 | 1; | |||||||||||||||||