| 1 | package Finance::Robinhood::Forex::Halt; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | =encoding utf-8 | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | =for stopwords watchlist watchlists untradable urls | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||
| 8 | |||||||||||||||||||
| 9 | Finance::Robinhood::Forex::Halt - Represents a Single Forex/Crypto Trade Halt | ||||||||||||||||||
| 10 | |||||||||||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||||||||||
| 12 | |||||||||||||||||||
| 13 | use Finance::Robinhood; | ||||||||||||||||||
| 14 | my $rh = Finance::Robinhood->new; | ||||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | # TODO | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | =cut | ||||||||||||||||||
| 19 | |||||||||||||||||||
| 20 | 1 | our $VERSION = '0.92_003'; | |||||||||||||||||
| 21 | 1 | ▶ | use Mojo::Base-base, -signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 22 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 23 | 1 | ▶ | use Time::Moment; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=3.5
| |||||||||||||||||||
| 26 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 27 | 0 | my $halt = $rh->forex_halts->current; | |||||||||||||||||
| 28 | 0 | isa_ok($halt, __PACKAGE__); | |||||||||||||||||
| 29 | 0 | t::Utility::stash('HALT', $halt); # Store it for later | |||||||||||||||||
| 30 | } | ||||||||||||||||||
| 31 | 0 | ▶ | use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||
| 32 | |||||||||||||||||||
| 33 | 1 | ▶ | sub _test_stringify { | ||||||||||||||||
|
Subroutine
_test_stringify: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 34 | 1 | ▶ | t::Utility::stash('HALT') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("HALT") // skip_all()
MC/DC0%0/2
t::Utility::stash("HALT") // skip_all()
t::Utility::stash("HALT")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("HALT")B= skip_all()
| |||||||||||||||||||
| 35 | 0 | like(+t::Utility::stash('HALT'), | |||||||||||||||||
| 36 | qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i | ||||||||||||||||||
| 37 | ); | ||||||||||||||||||
| 38 | } | ||||||||||||||||||
| 39 | # | ||||||||||||||||||
| 40 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 41 | |||||||||||||||||||
| 42 | =head1 METHODS | ||||||||||||||||||
| 43 | |||||||||||||||||||
| 44 | =head2 C<active( )> | ||||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | Returns a boolean value which indicates whether or not this halt is currently | ||||||||||||||||||
| 47 | active. | ||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | =head2 C<pair_id( )> | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | =head2 C<end_at( )> | ||||||||||||||||||
| 53 | |||||||||||||||||||
| 54 | Returns a Time::Moment object if defined. | ||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | =head2 C<id( )> | ||||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | Returns a UUID. | ||||||||||||||||||
| 59 | |||||||||||||||||||
| 60 | =head2 C<reason( )> | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | If defined, this returns a text string suited for display. | ||||||||||||||||||
| 63 | |||||||||||||||||||
| 64 | =head2 C<reason_code( )> | ||||||||||||||||||
| 65 | |||||||||||||||||||
| 66 | One of the following: C<outage>, C<scheduled_maintenance>, or C<other>. | ||||||||||||||||||
| 67 | |||||||||||||||||||
| 68 | =head2 C<start_at( )> | ||||||||||||||||||
| 69 | |||||||||||||||||||
| 70 | Returns a Time::Moment object. | ||||||||||||||||||
| 71 | |||||||||||||||||||
| 72 | =head2 C<state( )> | ||||||||||||||||||
| 73 | |||||||||||||||||||
| 74 | One of the following: C<queued>, C<full>, C<sell_only>, and C<buy_only>. | ||||||||||||||||||
| 75 | |||||||||||||||||||
| 76 | =cut | ||||||||||||||||||
| 77 | |||||||||||||||||||
| 78 | 1 | has ['active', 'pair_id', 'id', 'reason', 'reason_code', 'state']; | |||||||||||||||||
| 79 | |||||||||||||||||||
| 80 | 0 | ▶ | sub start_at ($s) { | ||||||||||||||||
|
Subroutine
start_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 81 | 0 | Time::Moment->from_string($s->{start_at}); | |||||||||||||||||
| 82 | } | ||||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | 1 | ▶ | sub _test_start_at { | ||||||||||||||||
|
Subroutine
_test_start_at: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 85 | 1 | ▶ | t::Utility::stash('HALT') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("HALT") // skip_all()
MC/DC0%0/2
t::Utility::stash("HALT") // skip_all()
t::Utility::stash("HALT")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("HALT")B= skip_all()
| |||||||||||||||||||
| 86 | 0 | isa_ok(t::Utility::stash('HALT')->start_at, 'Time::Moment'); | |||||||||||||||||
| 87 | } | ||||||||||||||||||
| 88 | |||||||||||||||||||
| 89 | 0 | ▶ | sub end_at ($s) { | ||||||||||||||||
|
Subroutine
end_at: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 90 | 0 | ▶ | $s->{end_at} // return (); | ||||||||||||||||
|
Condition0%0/2
$s->{"end_at"} // (return ())
MC/DC0%0/1
$s->{"end_at"} // (return ())
$s->{"end_at"}
Truth table0%0/2
A
A= $s->{"end_at"}
| |||||||||||||||||||
| 91 | 0 | Time::Moment->from_string($s->{end_at}); | |||||||||||||||||
| 92 | } | ||||||||||||||||||
| 93 | |||||||||||||||||||
| 94 | 1 | ▶ | sub _test_end_at { | ||||||||||||||||
|
Subroutine
_test_end_at: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 95 | 1 | ▶ | t::Utility::stash('HALT') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("HALT") // skip_all()
MC/DC0%0/2
t::Utility::stash("HALT") // skip_all()
t::Utility::stash("HALT")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("HALT")B= skip_all()
| |||||||||||||||||||
| 96 | 0 | isa_ok(t::Utility::stash('HALT')->end_at, 'Time::Moment'); | |||||||||||||||||
| 97 | } | ||||||||||||||||||
| 98 | |||||||||||||||||||
| 99 | =head1 LEGAL | ||||||||||||||||||
| 100 | |||||||||||||||||||
| 101 | This is a simple wrapper around the API used in the official apps. The author | ||||||||||||||||||
| 102 | provides no investment, legal, or tax advice and is not responsible for any | ||||||||||||||||||
| 103 | damages incurred while using this software. This software is not affiliated | ||||||||||||||||||
| 104 | with Robinhood Financial LLC in any way. | ||||||||||||||||||
| 105 | |||||||||||||||||||
| 106 | For Robinhood's terms and disclosures, please see their website at | ||||||||||||||||||
| 107 | https://robinhood.com/legal/ | ||||||||||||||||||
| 108 | |||||||||||||||||||
| 109 | =head1 LICENSE | ||||||||||||||||||
| 110 | |||||||||||||||||||
| 111 | Copyright (C) Sanko Robinson. | ||||||||||||||||||
| 112 | |||||||||||||||||||
| 113 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 114 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||||||||||||||||||
| 115 | conditions may apply to data transmitted through this module. Please refer to | ||||||||||||||||||
| 116 | the L<LEGAL> section. | ||||||||||||||||||
| 117 | |||||||||||||||||||
| 118 | =head1 AUTHOR | ||||||||||||||||||
| 119 | |||||||||||||||||||
| 120 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 121 | |||||||||||||||||||
| 122 | =cut | ||||||||||||||||||
| 123 | |||||||||||||||||||
| 124 | 1 | 1; | |||||||||||||||||