App/Chart/Suffix/NYM.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod n/a totaltotal 0.0% 0 / 50 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # New York Mercantile Exchange setups.
2  
3 # Copyright 2006, 2007, 2008, 2009 Kevin Ryde
4  
5 # This file is part of Chart.
6 #
7 # Chart is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3, or (at your option) any later version.
10 #
11 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Chart. If not, see <http://www.gnu.org/licenses/>.
18  
19 package App::Chart::Suffix::NYM;
20 use 5.006;
21 use strict;
22 use warnings;
23 use Locale::TextDomain 'App-Chart';
24  
25 use App::Chart;
26 use App::Chart::Barchart;
27 use App::Chart::Sympred;
28 use App::Chart::TZ;
29 use App::Chart::Weblink;
30 use App::Chart::Yahoo;
31  
32  
33 my $pred = App::Chart::Sympred::Regexp->new (qr/\.(NYM|CMX)$/);
34 App::Chart::TZ->newyork->setup_for_symbol ($pred);
35  
36 $App::Chart::Yahoo::latest_pred->add ($pred);
37 $App::Chart::Barchart::intraday_pred->add ($pred);
38 $App::Chart::Barchart::fiveday_pred->add ($pred);
39  
40  
41 #------------------------------------------------------------------------------
42 # weblink - contract specs
43  
44 App::Chart::Weblink->new
45 (pred => $pred,
46 name => __('NYMEX _Contract Specifications'),
47 desc => __('Open web browser at the NYMEX/COMEX contract specifications for this commodity'),
48 proc => sub {
49 my ($symbol) = @_;
50 return 'http://www.nymex.com/'
51 . URI::Escape::uri_escape (App::Chart::symbol_commodity ($symbol))
52 . '_spec.aspx';
53 });
54  
55 #------------------------------------------------------------------------------
56 # barchart
57  
58 App::Chart::Barchart::commodity_mung
59 ($pred,
60 # COMEX - no transforms
61 # "HG" high grade copper
62 # "GC" gold
63 # "SI" silver
64 # "AL" aluminium
65 'QS' => 'AM', # asian gold
66  
67 # NYMEX - no transformations
68 # "CL" light sweet crude
69 # "HU" gasoline
70 # "HO" heating oil
71 # "NG" henry hub natural gas
72 # "PA" palladium
73 # "PL" platinum
74 # "PN" propane
75 # "QG" e-miNY henry hub natural gas
76 # "QL" CAPP central appalacian coal
77 # "QM" e-miNY light sweet crude
78 # "SC" brent crude - dublin
79 #
80 # "GR" north west gasoil - dublin
81 # "SA" brent calendar swap futures - clearport new york
82 #
83 # don't know what barchart "F0" heating oil / crude and "F5"
84 # unleaded / crude are really
85 );
86  
87 # (set! barchart-suffix-delay-alist (cons* '(".CMX" . 30)
88 # '(".NYM" . 30)
89 # barchart-suffix-delay-alist))
90  
91  
92 # This was some bits to make the timezone come out as London (and
93 # previously Dublin) for some relevant symbols. But www.nymex.com doesn't
94 # make it clear (as of March 2007) what's where, so leave it all as New
95 # York for now.
96  
97 # NYMEX symbols trading in London
98 #
99 # http://www.nymex.com/press_releas.aspx?id=pr20050825c
100 # Aug 05 press release - brent crude + northwest gasoil
101 #
102 # (define (nymex-london-symbol? symbol)
103 # (and (nymex-symbol? symbol)
104 # (member (chart-symbol-commodity symbol)
105 # '("GR" # gasoil
106 # "BB" # brent crude
107 # ))))
108 # (symbol-timezone! nymex-london-symbol? (_ "London") timezone-london)
109  
110 # Contracts trading open-outcry in London (currently Brent Crude @samp{SC} and
111 # Northwest Europe Gasoil @samp{GR}) have that as their home timezone for the
112 # watchlist etc, everything else is New York.
113 # @c xSYMBOL: SC.NYM
114 # @c xSYMBOL: GR.NYM
115  
116  
117  
118  
119 1;
120 __END__