« lib/Finance/Robinhood/Forex/Historicals/Datapoint.pm
↑ Summary
lib/Finance/Robinhood/Options/Chain.pm »
| 1 | package Finance::Robinhood::Equity::Tag; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | =encoding utf-8 | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | =for stopwords watchlist watchlists untradable urls | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||
| 8 | |||||||||||||||||||
| 9 | Finance::Robinhood::Tag - Represents a Single Categorized List of Equity | ||||||||||||||||||
| 10 | Instruments | ||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | use Finance::Robinhood; | ||||||||||||||||||
| 15 | my $rh = Finance::Robinhood->new; | ||||||||||||||||||
| 16 | my $oil = $rh->tags('oil')->next; | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | CORE::say sprintf '%d members of the tag named %s', $oil->membership_count, $oil->name; | ||||||||||||||||||
| 19 | CORE::say join ', ', map { $_->symbol } $oil->instruments; | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | =head1 METHODS | ||||||||||||||||||
| 22 | |||||||||||||||||||
| 23 | =cut | ||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | 1 | our $VERSION = '0.92_003'; | |||||||||||||||||
| 26 | 1 | ▶ | use Mojo::Base-base, -signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 27 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 28 | 1 | ▶ | use Time::Moment; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 29 | 1 | ▶ | use Finance::Robinhood::Equity::PriceMovement; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 30 | |||||||||||||||||||
| 31 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=3.5
| |||||||||||||||||||
| 32 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 33 | 0 | my $tag = $rh->tags('food')->current; | |||||||||||||||||
| 34 | 0 | isa_ok($tag, __PACKAGE__); | |||||||||||||||||
| 35 | 0 | t::Utility::stash('TAG', $tag); # Store it for later | |||||||||||||||||
| 36 | } | ||||||||||||||||||
| 37 | 0 | ▶ | use overload '""' => sub ($s, @) { $s->{slug} }, 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('TAG') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("TAG") // skip_all()
MC/DC0%0/2
t::Utility::stash("TAG") // skip_all()
t::Utility::stash("TAG")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("TAG")B= skip_all()
| |||||||||||||||||||
| 41 | 0 | like(+t::Utility::stash('TAG'), 'food',); | |||||||||||||||||
| 42 | } | ||||||||||||||||||
| 43 | # | ||||||||||||||||||
| 44 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | =head2 C<canonical_examples( )> | ||||||||||||||||||
| 47 | |||||||||||||||||||
| 48 | If available, this returns a short blurb about what sort of instruments are | ||||||||||||||||||
| 49 | contained in this tag. | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | =head2 C<description( )> | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | If available, this returns a full text description suited for display. | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | =head2 C<membership_count( )> | ||||||||||||||||||
| 56 | |||||||||||||||||||
| 57 | Returns the number of instruments are contained in this tag. | ||||||||||||||||||
| 58 | |||||||||||||||||||
| 59 | =head2 C<name( )> | ||||||||||||||||||
| 60 | |||||||||||||||||||
| 61 | Returns the name of this tag in a format suited for display | ||||||||||||||||||
| 62 | |||||||||||||||||||
| 63 | =head2 C<slug( )> | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | Returns the internal string used to locate this tag. | ||||||||||||||||||
| 66 | |||||||||||||||||||
| 67 | =cut | ||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | 1 | has ['canonical_examples', 'description', 'membership_count', 'name', 'slug']; | |||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | =head2 C<instruments( )> | ||||||||||||||||||
| 72 | |||||||||||||||||||
| 73 | my $instruments = $mover->instruments(); | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | Returns a list of Finance::Robinhood::Equity::Instrument objects. | ||||||||||||||||||
| 76 | |||||||||||||||||||
| 77 | =cut | ||||||||||||||||||
| 78 | |||||||||||||||||||
| 79 | 0 | ▶ | sub instruments ($s) { | ||||||||||||||||
|
Subroutine
instruments: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 80 | $s->_rh->equity_instruments_by_id( | ||||||||||||||||||
| 81 | map { | ||||||||||||||||||
| 82 | 0 | m/([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\/$/i | |||||||||||||||||
| 83 | 0 | } @{$s->{instruments}} | |||||||||||||||||
| 84 | ); | ||||||||||||||||||
| 85 | } | ||||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | 1 | ▶ | sub _test_instruments { | ||||||||||||||||
|
Subroutine
_test_instruments: called CC=2 SCAR=10.5
| |||||||||||||||||||
| 88 | 1 | ▶ | t::Utility::stash('TAG') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("TAG") // skip_all()
MC/DC0%0/2
t::Utility::stash("TAG") // skip_all()
t::Utility::stash("TAG")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("TAG")B= skip_all()
| |||||||||||||||||||
| 89 | 0 | my @instruments = t::Utility::stash('TAG')->instruments(); | |||||||||||||||||
| 90 | 0 | isa_ok($instruments[0], 'Finance::Robinhood::Equity::Instrument'); | |||||||||||||||||
| 91 | } | ||||||||||||||||||
| 92 | |||||||||||||||||||
| 93 | =head1 LEGAL | ||||||||||||||||||
| 94 | |||||||||||||||||||
| 95 | This is a simple wrapper around the API used in the official apps. The author | ||||||||||||||||||
| 96 | provides no investment, legal, or tax advice and is not responsible for any | ||||||||||||||||||
| 97 | damages incurred while using this software. This software is not affiliated | ||||||||||||||||||
| 98 | with Robinhood Financial LLC in any way. | ||||||||||||||||||
| 99 | |||||||||||||||||||
| 100 | For Robinhood's terms and disclosures, please see their website at | ||||||||||||||||||
| 101 | https://robinhood.com/legal/ | ||||||||||||||||||
| 102 | |||||||||||||||||||
| 103 | =head1 LICENSE | ||||||||||||||||||
| 104 | |||||||||||||||||||
| 105 | Copyright (C) Sanko Robinson. | ||||||||||||||||||
| 106 | |||||||||||||||||||
| 107 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 108 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||||||||||||||||||
| 109 | conditions may apply to data transmitted through this module. Please refer to | ||||||||||||||||||
| 110 | the L<LEGAL> section. | ||||||||||||||||||
| 111 | |||||||||||||||||||
| 112 | =head1 AUTHOR | ||||||||||||||||||
| 113 | |||||||||||||||||||
| 114 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 115 | |||||||||||||||||||
| 116 | =cut | ||||||||||||||||||
| 117 | |||||||||||||||||||
| 118 | 1 | 1; | |||||||||||||||||