App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/Barchart.pm  view on Meta::CPAN

  my $commodity = App::Chart::symbol_commodity ($symbol);
  my $suffix    = App::Chart::symbol_suffix    ($symbol);
  my $barchart_commodity = symbol_to_barchart ("$commodity$suffix");

  App::Chart::Download::status
      (__x('Barchart quote {symbol} ({barchart_commodity})',
           symbol => "$commodity$suffix",
           barchart_commodity => $barchart_commodity));

  my $url = 'http://www2.barchart.com/ifutpage.asp?code=BSTK&sym='
    . URI::Escape::uri_escape ($barchart_commodity);

  my $resp = App::Chart::Download->get ($url,
                                       cookie_jar => cookie_jar(),
                                       referer => $url);
  my $h = ifutpage_parse ($commodity, $suffix, $resp);
  App::Chart::Download::write_latest_group ($h);
}

sub ifutpage_parse {
  my ($commodity, $suffix, $resp) = @_;

lib/App/Chart/Barchart.pm  view on Meta::CPAN

    App::Chart::Download::status
        (__x('Barchart five day {symbol}',
             symbol => $symbol));
  } else {
    App::Chart::Download::status
        (__x('Barchart five day {symbol} ({barchart_symbol})',
             symbol => $symbol,
             barchart_symbol => $barchart_symbol));
  }

  my $url = FIVEDAY_URL_BASE . URI::Escape::uri_escape ($barchart_symbol);

  my $resp = App::Chart::Download->get ($url,
                                       cookie_jar => cookie_jar(),
                                       referer => $url);
  my $h = fiveday_parse ($symbol, $resp);
  App::Chart::Download::write_daily_group ($h);
}

sub fiveday_parse {
  my ($symbol, $resp) = @_;

lib/App/Chart/Barchart.pm  view on Meta::CPAN

#                              'daily' => '&data=A');

sub intraday_url {
  my ($self, $symbol, $mode) = @_;

  App::Chart::Download::status
      (__x('Barchart intraday page {symbol} {mode}',
           symbol => $symbol,
           mode   => $mode));
  my $url = 'http://www.barchart.com/chart.php?sym='
    . URI::Escape::uri_escape (symbol_to_barchart ($symbol))
      . $intraday_mode_to_data{$mode};
  App::Chart::Download::verbose_message ("Intraday page", $url);

  my $jar = cookie_jar();
  my $resp = App::Chart::Download->get ($url,
                                        cookie_jar => $jar,
                                        referer => $url);
  return (intraday_resp_to_url ($resp, $symbol),
          cookie_jar => $jar,
          referer => $url);

lib/App/Chart/Google.pm  view on Meta::CPAN

     my ($symbol) = @_;

     my $suffix = App::Chart::symbol_suffix ($symbol);
     if ($suffix eq '.AX') {
       $symbol = 'ASX:' . App::Chart::symbol_sans_suffix($symbol);
     } elsif ($suffix eq '.NZ') {
       $symbol = 'NZE:' . App::Chart::symbol_sans_suffix($symbol);
     }

     return ('http://www.google.com/finance?q=' 
             . URI::Escape::uri_escape($symbol));
   });


#-----------------------------------------------------------------------------
# download
#
# This uses the historical prices page like
#
#     http://www.google.com/finance/historical?q=AAPL
#

lib/App/Chart/Google.pm  view on Meta::CPAN


my @month_to_Mmm = qw(0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

# making: http://www.google.com/finance/historical?cid=22144&startdate=Feb+13%2C+2008&enddate=Oct+6%2C+2008&output=csv
sub daily_url {
  my ($symbol, $lo_tdate, $hi_tdate) = @_;
  my ($lo_year, $lo_month, $lo_day) = App::Chart::tdate_to_ymd ($lo_tdate);
  my ($hi_year, $hi_month, $hi_day) = App::Chart::tdate_to_ymd ($hi_tdate);

  return 'http://www.google.com/finance/historical?q='
    . URI::Escape::uri_escape($symbol)
      . '&startdate='
        . $month_to_Mmm[$lo_month] . '+' . $lo_day . '%2C+' . $lo_year
          . '&enddate='
            . $month_to_Mmm[$hi_month] . '+' . $hi_day . '%2C+' . $hi_year
              . '&output=csv';
}

sub daily_parse {
  my ($symbol, $resp) = @_;
  my @data = ();

lib/App/Chart/Gtk2/AnnDrag.pm  view on Meta::CPAN

  #                                                $event, $self)) {
  #     return Gtk2::EVENT_STOP; # since handled
  #   }

  my $keyval = $event->keyval;
  my $modifiers = $event->state;
  $modifiers = $modifiers & Gtk2::Accelerator->get_default_mod_mask;
  my $key = lc (Gtk2::Gdk->keyval_name ($keyval));
  if (DEBUG) { print "keypress $key\n"; }

  if ($key eq 'escape') {
    abort ();

  } elsif ($key eq 'a') {
    toggle_alert ();

  } elsif ($key eq 'space') {
    swap_ends ();

  } elsif ($key eq 'd') {
    delete_elem ();

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  App::Chart::Gtk2::GUI::browser_open ($url);
}
sub _do_weblink_row_url {
  my ($treeview, $path) = @_;
  my $store = $treeview->get_model;
  my $iter = $store->get_iter ($path);
  return $store->get_value ($iter, 1);
}
sub mnemonic_to_markup {
  my ($str) = @_;
  $str = Glib::Markup::escape_text($str);
  $str =~ s{_(.)}{$1 eq '_' ? '' : "<u>$1</u>"}eg;
  return $str;
}
# 'button-press-event' on the weblink TreeView
sub _do_weblink_button_press {
  my ($treeview, $event) = @_;
  my ($path, $column) = $treeview->get_path_at_pos ($event->x, $event->y);
  if (!$path) { return; }
  if (my $func = $column->{'menu_func'}) {
    $func->($treeview, $event, $path);

lib/App/Chart/Gtk2/WatchlistModel.pm  view on Meta::CPAN

                  last_time => $last_time);
      $str .= "\n";
    }

    require App::Chart::TZ;
    my $timezone = App::Chart::TZ->for_symbol($symbol);
    $str .= __x("{location} time; source {source}",
                location => $timezone->name,
                source   => $latest->{'source'});
    # tip is markup format, though that's not actually documented as of 2.12
    $str = Glib::Markup::escape_text ($str);
  }

  return ($cache->[$col] = $str);
}

sub format_price {
  my ($str) = @_;
  if (! defined $str) { return ''; }
  my $nf = App::Chart::number_formatter();
  return eval { $nf->format_number ($str, App::Chart::count_decimals($str), 1) }

lib/App/Chart/Gtk2/WeblinkMenu.pm  view on Meta::CPAN

  my $weblink = $model->get_value ($iter, 0);
  if (! $item) {
    $item = Gtk2::MenuItem->new_with_label ('');
    $item->show;
  }
  $item->get_child->set_text_with_mnemonic ($weblink->name);
  set_property_maybe
    ($item,
     sensitive      => $weblink->sensitive($self->get('symbol')),
     # tooltip-markup new in 2.12
     tooltip_markup => Glib::Markup::escape_text($weblink->{'desc'} || ''));
  return $item;
}

# 'activate' class closure
sub _do_activate {
  my ($self, $item, $model, $path, $iter) = @_;
  my $weblink = $model->get_value ($iter, 0);
  my $symbol = $self->get('symbol');
  $weblink->open ($symbol);
}

lib/App/Chart/IntradayHandler.pm  view on Meta::CPAN

# 
# Create and register a new intraday image handler.  The return is a new
# C<App::Chart::IntradayHandler> object, though usually this is not of interest
# (only all the handlers later with C<handlers_for_symbol> below).
# 
#     my $pred = App::Chart::Sympred::Suffix->new ('.NZ');
# 
#     sub intraday_url {
#       my ($self, $symbol, $mode) = @_;
#       return 'http://ichart.finance.yahoo.com/z?s='
#         . URI::Escape::uri_escape ($symbol)
#         . '&t=' . $mode
#         . '&l=off&z=m&q=l&a=v';
#     }
# 
#     App::Chart::IntradayHandler->new
#       (pred => $pred,
#        proc => \&intraday_url,
#        mode => '1d',
#        name => '1 Day');
# 

lib/App/Chart/Suffix/ATH.pm  view on Meta::CPAN

# The greek pages "/gr/" need greek symbols, the english doesn't work, hence
# only an english link here, for now.

App::Chart::Weblink->new
  (pred => $pred,
   name => __('ATHEX _Company Information'),
   desc => __('Open web browser at the Athens Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.ase.gr/content/en/Companies/ListedCo/Profiles/Profile.asp?name='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });


#------------------------------------------------------------------------------
# 8859-7 transliteration
#
# The 8859-7 bytes here in the source are for ease of seeing what they're
# supposed to be, but they're only in the comments, the code is all-ascii.
#
# $translit is a Regexp::Tr mapping Perl wide-chars which are certain greek

lib/App/Chart/Suffix/ATH.pm  view on Meta::CPAN

       0xFE => 'o', # FE þ GREEK SMALL LETTER OMEGA WITH TONOS
       #            # FF
      );

  require Encode;
  my $tr_from = join ('',
                      map { Encode::decode ('iso-8859-7', chr($_)) }
                      keys %table);
  my $tr_to = join ('', values %table);

  $tr_to   =~ s/-/\\-/g; # escape "tr" dash as range
  $tr_from =~ s/-/\\-/g;

  require Regexp::Tr;
  $translit = Regexp::Tr->new ($tr_from, $tr_to);
  Regexp::Tr->flush;
  ### $translit
}

#-----------------------------------------------------------------------------
# download - last 30 days by symbol

lib/App/Chart/Suffix/ATH.pm  view on Meta::CPAN

          '18:00:00');
}

sub last30_download {
  my ($symbol_list) = @_;

  foreach my $symbol (@$symbol_list) {
    App::Chart::Download::status (__x ('ATHEX 30 days data {symbol}',
                                      symbol => $symbol));
    my $url = 'http://www.ase.gr/content/en/marketdata/stocks/prices/Share_SearchResults.asp?share='
      . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
    my $resp = App::Chart::Download->get ($url);
    App::Chart::Download::write_daily_group (last30_parse ($resp));
  }
}

sub last30_parse {
  my ($resp) = @_;
  my $content = $resp->decoded_content (raise_error => 1);

  my @data = ();

lib/App/Chart/Suffix/AX.pm  view on Meta::CPAN

     my ($symbol) = @_;
     $symbol = App::Chart::symbol_sans_suffix($symbol);

     # As of Feb 2009 the info search doesn't accept a pref or convertible
     # note symbol like "NABHA", only the issuing company "NAB", so prune
     # accordingly.
     $symbol = substr($symbol,0,3);

     return 
       'http://www.asx.com.au/asx/research/companyInfo.do?by=asxCode&asxCode='
       . URI::Escape::uri_escape($symbol);
   });

#------------------------------------------------------------------------------
# weblink - S&P index info

my %sandp_table
  = ('^AORD' => 'asxallo',
     '^ATLI' => 'asx20',
     '^AFLI' => 'asx50',
     '^ATOI' => 'asx100',

lib/App/Chart/Suffix/BO.pm  view on Meta::CPAN

#

App::Chart::Weblink->new
  (pred => $pred_shares,
   name => __('BSE _Company Information'),
   desc => __('Open web browser at the Bombay Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     # there's links on this page to results, announcements, quote, etc
     return 'http://www.bseindia.com/qresann/comp_info.asp?scrip_cd='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });

1;
__END__

lib/App/Chart/Suffix/CAS.pm  view on Meta::CPAN

# French or English
#  http://www.casablanca-bourse.com/cgi/ASP/Fiches/fiche.asp?TICKER=NEJ
#  http://www.casablanca-bourse.com/cgi/ASP/Fiches/anglais/fiche.asp?TICKER=NEJ

App::Chart::Weblink->new
  (pred => $pred,
   name => __('Casablanca _Company Information'),
   desc => __('Open web browser at the Casablanca Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
     my $lang = App::Chart::Glib::Ex::MoreUtils::lang_select (fr => '',
                                                  en => '/anglais');
     return "http://www.casablanca-bourse.com/cgi/ASP/Fiches$lang/fiche.asp?TICKER=$symbol";
   });


#-----------------------------------------------------------------------------
# latest quotes, using Finance::Quote::Casablanca

App::Chart::FinanceQuote->setup (pred => $pred,

lib/App/Chart/Suffix/CAS.pm  view on Meta::CPAN

   recheck_key  => 'CAS-dividends',
   recheck_days => 7,
   # low priority to get prices first
   priority     => -10);

sub dividends_download {
  my ($symbol_list) = @_;
  my $symbol = $symbol_list->[0];

  my $url = 'http://www.casablanca-bourse.com/fiches/valeurs/'
    . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol))
      . '/fr/ost.html';
  App::Chart::Download::status (__x('Casablanca dividends {symbol}',
                                   symbol => $symbol));
  my $resp = App::Chart::Download->get ($url,
                                       symbol => $symbol,
                                       url_tags_key => 'CAS-dividends');
  my $h = dividends_parse ($symbol, $resp);

  App::Chart::Download::write_daily_group ($h);
}

lib/App/Chart/Suffix/CME.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# weblink - contract specs

App::Chart::Weblink->new
  (pred => $pred,
   name => __('CME _Contract Specifications'),
   desc => __('Open web browser at the Chicago Mercantile Exchange contract specifications for this commodity'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.cme.com/clearing/clr/spec/contract_specifications_cl.html?product='
       . URI::Escape::uri_escape (App::Chart::symbol_commodity ($symbol));
   });


#------------------------------------------------------------------------------

# (set! barchart-suffix-delay-alist (acons ".CME" 10
# 					 barchart-suffix-delay-alist))


App::Chart::Barchart::commodity_mung

lib/App/Chart/Suffix/GHA.pm  view on Meta::CPAN

#
# Eg. http://www.gse.com.gh/index1.php?linkid=46&scd=CAL

App::Chart::Weblink->new
  (pred => $pred,
   name => __('GSE _Company Information'),
   desc => __('Open web browser at the Ghana Stock Exchange information page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.gse.com.gh/index1.php?linkid=46&scd='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });


#-----------------------------------------------------------------------------
# daily data page
#
# This uses the daily data page,
#
use constant GSE_DAILY_URL =>
  'http://www.gse.com.gh/index1.php?linkid=5&sublinkid=12';

lib/App/Chart/Suffix/GHA.pm  view on Meta::CPAN

#   (name     => __('GSE names'),
#    key      => 'GHA-names',
#    pred     => $pred,
#    url_func => \&name_url,
#    parse    => \&name_parse,
#    recheck_days => 10);
# 
# sub name_url {
#   my ($symbol) = @_;
#   return 'http://www.gse.com.gh/marketstat/officiallist_details.asp?Symbol='
#     . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
# }
# 
# sub name_parse {
#   my ($symbol, $resp) = @_;
# 
#   # eg. "    <td><strong> <span class="just">2241 <strong>&nbsp;Trading Session </strong></span>for:<font color="#D98713"> Accra Brewery Company Ltd.</font></strong></td>"
# 
#   my $body = $resp->decoded_content (raise_error => 1);
#   $body =~ s/<[^>]*>//g;  # no html
#   $body =~ /Trading Session.*for:([^\n]*)/

lib/App/Chart/Suffix/HK.pm  view on Meta::CPAN

#

App::Chart::Weblink->new
  (pred => $pred_shares,
   name => __('HKEX _Company Information'),
   desc => __('Open web browser at the Hong Kong Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     # extra "0" in the ID for the web page over what Yahoo uses
     return 'http://www.hkex.com.hk/invest/index.asp?id=company/profile_page_e.asp?WidCoID=0'
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol))
         . '&WidCoAbbName=&Month=&langcode=e';
   });

1;
__END__

lib/App/Chart/Suffix/KQ.pm  view on Meta::CPAN

# but it's enough to give
#     http://english.kosdaq.com/enterprise/center/center.jsp?code=052300
#

App::Chart::Weblink->new
  (pred => $pred,
   name => __('KOSDAQ _Company Information'),
   desc => __('Open web browser at the KOSDAQ Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
     my $lang = App::Chart::Glib::Ex::MoreUtils::lang_select (ko => 'www',
                                                              en => 'english');
     return
       "http://$lang.kosdaq.com/enterprise/center/center.jsp?code=$symbol";
   });

1;
__END__

lib/App/Chart/Suffix/L.pm  view on Meta::CPAN

#    http://www.londonstockexchange.com/en-gb/pricesnews/prices/system/detailedprices.htm?ti=TPSD
#

App::Chart::Weblink->new
  (pred => $pred_shares,
   name => __('LSE _Company Information'),
   desc => __('Open web browser at the London Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.londonstockexchange.com/en-gb/pricesnews/prices/system/detailedprices.htm?ti='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });

1;
__END__

lib/App/Chart/Suffix/LJ.pm  view on Meta::CPAN

# Slovenian: http://www.ljse.si/cgi-bin/jve.cgi?SecurityID=DRKR&doc=818
# English:   http://www.ljse.si/cgi-bin/jve.cgi?SecurityID=DRKR&doc=3131
#

App::Chart::Weblink->new
  (pred => $pred,
   name => __('LJSE _Company Information'),
   desc => __('Open web browser at the Ljubljana Stock Exchange information page for this company'),
   proc => sub {
     my ($symbol) = @_;
     $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
     my $lang = App::Chart::Glib::Ex::MoreUtils::lang_select (en => '3131',
                                                  sl => '818');
     return "http://www.ljse.si/cgi-bin/jve.cgi?SecurityID=$symbol&doc=$lang";
   });


#-----------------------------------------------------------------------------
# latest
#
# This uses the text file at

lib/App/Chart/Suffix/MGEX.pm  view on Meta::CPAN

  # my $mdate = latest_symbol_mdate ($symbol, ($tdate_time_proc->())[0]);
  # mdate_to_MYY ($mdate);

  App::Chart::Download::status
      (__x('Intraday page {symbol} {mode}',
           symbol => $symbol,
           mode   => $mode));

  my $url = $self->{'base_url'}
    . '&sly=N&sym='
      . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol))
        . $intraday_mode_to_data{$mode};
  App::Chart::Download::verbose_message ("Intraday page", $url);

  my $resp = App::Chart::Download->get ($url);
  return barchart_customer_resp_to_url ($resp, $symbol);
}
# separate func for offline testing ...
sub barchart_customer_resp_to_url {
  my ($resp, $symbol) = @_;
  my $content = $resp->decoded_content (raise_error => 1);

lib/App/Chart/Suffix/MLC.pm  view on Meta::CPAN

#
# In the past it was plain http:
# http://www.mlc.com.au/masterkeyWeb/execute/UnitPricesWQO?openAgent&reporttype=HistoricalDateRange&product=MasterKey%20Superannuation%20%28Gold%20Star%29&fund=Property%20Securities%20Fund&begindate=19/07/2003&enddate=19/07/2004&
#
sub url_func {
  my ($symbol, $lo, $hi) = @_;
  my ($lo_year, $lo_month, $lo_day) = App::Chart::tdate_to_ymd ($lo);
  my ($hi_year, $hi_month, $hi_day) = App::Chart::tdate_to_ymd ($hi);
  my ($fund, $product) = split /,/, App::Chart::symbol_sans_suffix ($symbol);
  return sprintf ('https://www.mlc.com.au/masterkeyWeb/execute/UnitPricesWQO?openAgent&reporttype=HistoricalDateRange&product=%s&fund=%s&begindate=%02d/%02d/%04d&enddate=%02d/%02d/%04d&',
                  URI::Escape::uri_escape ($product),
                  URI::Escape::uri_escape ($fund),
                  $lo_day, $lo_month, $lo_year,
                  $hi_day, $hi_month, $hi_year);
}

# Lines like:
# historicalProduct1funds[1]="MLC Property Securities Fund,MasterKey Superannuation (Gold Star),29 March 2007,64.71567,0.00000";
#
sub parse {
  my ($symbol, $resp) = @_;
  my $content = $resp->decoded_content(raise_error=>1);

lib/App/Chart/Suffix/NS.pm  view on Meta::CPAN

# http://www.nseindia.com/marketinfo/companyinfo/eod/address.jsp?symbol=SESAGOA

App::Chart::Weblink->new
  (pred => $pred,
   name => __('NSE _Company Information'),
   desc => __('Open web browser at the National Stock Exchange of India page for this company'),
   proc => sub {
     my ($symbol) = @_;
     # there's links on this page to other info, including a current quote
     return 'http://www.nseindia.com/marketinfo/companyinfo/eod/address.jsp?symbol='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });

1;
__END__

lib/App/Chart/Suffix/NYB.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# weblink - contract specs

App::Chart::Weblink->new
  (pred => $pred,
   name => __('NYBOT _Contract Specifications'),
   desc => __('Open web browser at the NYBEX/COMEX contract specifications for this commodity'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.nymex.com/'
       . URI::Escape::uri_escape (App::Chart::symbol_commodity ($symbol))
         . '_spec.aspx';
   });


#------------------------------------------------------------------------------

# (set! barchart-suffix-delay-alist (acons ".NYBOT" 30
# 					 barchart-suffix-delay-alist))

App::Chart::Barchart::commodity_mung

lib/App/Chart/Suffix/NYM.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# weblink - contract specs

App::Chart::Weblink->new
  (pred => $pred,
   name => __('NYMEX _Contract Specifications'),
   desc => __('Open web browser at the NYMEX/COMEX contract specifications for this commodity'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.nymex.com/'
       . URI::Escape::uri_escape (App::Chart::symbol_commodity ($symbol))
         . '_spec.aspx';
   });

#------------------------------------------------------------------------------
# barchart

App::Chart::Barchart::commodity_mung
  ($pred,
   # COMEX - no transforms
   # "HG" high grade copper

lib/App/Chart/Suffix/NZ.pm  view on Meta::CPAN

# cf top by value traded,
# https://www.nzx.com/markets/NZSX/securities/values

App::Chart::Weblink->new
  (pred => $pred_shares,
   name => __('NZX _Company Information'),
   desc => __('Open web browser at the New Zealand Stock Exchange page for this stock'),
   proc => sub {
     my ($symbol) = @_;
     return 'https://www.nzx.com/markets/NZSX/securities/'
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });


#------------------------------------------------------------------------------
# Dividends
#
# This uses the dividend page at
# 
#     https://www.nzx.com/markets/NZSX/dividends
#     

lib/App/Chart/Suffix/NZ.pm  view on Meta::CPAN

                            'r' => "\r",
                            't' => "\t",   # tab
                            'v' => "\013", # vertical tab
                           );
sub javascript_string_unquote {
  my ($str) = @_;
  $str =~ s{\\(?:
              ((?:[0-3]?[0-7])?[0-7]) # $1 \377 octal latin-1
            |x([0-9a-fA-F]{2})        # $2 \xFF hex latin-1
            |u([0-9a-fA-F]{4})        # $3 \uFFFF hex unicode
            |(.)                      # $4 \n etc escapes
            )
         }{
           (defined $1 ? chr(oct($1))
            : defined $4 ? ($javascript_backslash{$4} || $4)
            : chr(hex($2||$3)))   # \x,\u hex
         }egx;
  return $str;
}


lib/App/Chart/Suffix/NoSuffix.pm  view on Meta::CPAN

     return ($exchange =~ /^Nasdaq/i);
   });

App::Chart::Weblink->new
  (pred => $pred_nyse,
   name => __('NYSE _Company Information'),
   desc => __('Open web browser at the New York Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.nyse.com/about/listed/'
       . URI::Escape::uri_escape($symbol) . '.html';
   });
App::Chart::Weblink->new
  (pred => $pred_amex,
   name => __('AMEX _Company Information'),
   desc => __('Open web browser at the American Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.amex.com/?href=/equities/listCmp/EqLCCmpDesc.jsp?Product_Symbol=' . URI::Escape::uri_escape ($symbol);
   });
App::Chart::Weblink->new
  (pred => $pred_nasdaq,
   name => __('NASDAQ _Company Information'),
   desc => __('Open web browser at the NASDAQ page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://quotes.nasdaq.com/asp/summaryquote.asp?symbol='
       . URI::Escape::uri_escape ($symbol);
   });

# return exchange name string, or undef if not known
sub symbol_exchange {
  my ($symbol) = @_;
  require App::Chart::DBI;
  return (App::Chart::DBI->read_single
          ('SELECT exchange FROM info WHERE symbol=?', $symbol)
          //
          App::Chart::DBI->read_single

lib/App/Chart/Suffix/OB.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# weblink - OTC BB company info

App::Chart::Weblink->new
  (pred => $pred,
   name => __('OTC BB _Company Information'),
   desc => __('Open web browser at the OTC bulletin board page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.otcbb.com/asp/info_center.asp?symbol='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });



1;
__END__

lib/App/Chart/Suffix/OL.pm  view on Meta::CPAN

#
#     http://www.oslobors.no/ob/aksje_selskapsinfo?languageID=1&p_instrid=ticker.ose.PLUG&p_period=1D&menu2show=1.1.2.4.
#

App::Chart::Weblink->new
  (pred => $pred_shares,
   name => __('Oslo Bors _Company Information'),
   desc => __('Open web browser at the Oslo Stock Exchange page for this company'),
   proc => sub {
     my ($symbol) = @_;
     $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
     my $lang = App::Chart::Glib::Ex::MoreUtils::lang_select (no => 0,
                                                              en => 1);
     return "http://www.oslobors.no/ob/aksje_selskapsinfo?languageID=$lang&p_instrid=ticker.ose.$symbol&p_period=1D&menu2show=1.1.2.4.";
   });

1;
__END__

lib/App/Chart/Suffix/PK.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# weblink - Pink Sheets web site

App::Chart::Weblink->new
  (pred => $pred,
   name => __('Pink Sheets _Company Information'),
   desc => __('Open web browser at the Pink Sheets page for this company'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.pinksheets.com/quote/company_profile.jsp?symbol='
       . URI::Escape::uri_escape (App::Chart::symbol_sans_suffix ($symbol));
   });


1;
__END__

lib/App/Chart/Suffix/SS.pm  view on Meta::CPAN


# not sure about this, but think all indices begin with 0
my $index_pred = App::Chart::Sympred::Regexp->new (qr/^0.*\.SS$/);

App::Chart::Weblink->new
  (pred => $index_pred,
   name => __('SSE _Index Information'),
   desc => __('Open web browser at the Shanghai Stock Exchange page for this index'),
   proc => sub {
     my ($symbol) = @_;
     $symbol = URI::Escape::uri_escape(App::Chart::symbol_sans_suffix($symbol));
     return "http://www.sse.com.cn/sseportal/en_us/ps/ggxx/zsjbxx.jsp?indexName=&indexCode=$symbol";
   });

1;
__END__

lib/App/Chart/Suffix/TGE.pm  view on Meta::CPAN

  my $commodity = App::Chart::symbol_commodity ($symbol_list->[0]);
  my $avail_tdate = available_tdate();
  my $start_tdate = App::Chart::Download::start_tdate_for_update(@$symbol_list);

  # use csv if all of $symbol_list just wanting $avail_tdate
  if ($start_tdate < $avail_tdate) {
    return 0;
  }
  my $filename = "\L$commodity\E01.csv";
  my $url = 'http://www.tge.or.jp/data/down_load/'
    . URI::Escape::uri_escape ($filename);

  App::Chart::Download::status (__x('TGE data {filename}',
                                   filename => $filename));
  my $resp = App::Chart::Download->get ($url,
                                       url_tags_key => 'TGE-day');
  if (! $resp->is_success) {
    # not modified, no new data
    return 1;
  }
  my $got_tdate = csv_tdate ($resp);

lib/App/Chart/Suffix/WCE.pm  view on Meta::CPAN

#   http://www.wce.ca/ContractsMarketInfo.aspx?first=contractspecifications
#

App::Chart::Weblink->new
  (pred => $pred,
   name => __('WCE _Contract Specifications'),
   desc => __('Open web browser at the Winnipeg Commodity Exchange contract specifications for this commodity'),
   proc => sub {
     my ($symbol) = @_;
     return 'http://www.wce.ca/ContractsMarketInfo.aspx?first=contractspecifications&Commodity='
       . URI::Escape::uri_escape (App::Chart::symbol_commodity ($symbol));
   });


1;
__END__



( run in 1.295 second using v1.01-cache-2.11-cpan-c21f80fb71c )