manage bookmarks, bugfixes
[smr.git] / gui / app / views / quoterecords / index.html.erb
blobe2168cb2d85981b97e04d3cc91ed901ca348ee77
1 <h1>
2  Quote Records
3  <% if @selected_security %><em>on <%=@selected_security%></em><% end %>
4 </h1>
6 <%= render :partial=>'portrait/smart_links', locals: { :item_to_portrait=>@selected_security, :shown_is=>:quoterecords } %>
8 <% if @quote %>
9     <%= render :partial=>'asset/quote_form', locals: { :quote=>@quote, :securities=>@securities, :selected_security=>@selected_security.id } %>
10 <% end %>
12 <%= form_tag({:action=>'index'}, :method=>:get, :id=>'controller_filter') do %>
13     <p>
14      <%= select_tag 'id_security', options_from_collection_for_select(@securities, :id, :to_s_with_symbol, @selected_security.id), prompt: '-- Select Security --' %>
15      <%= button_tag 'show', :name=>'show', :value=>'this' %>
16      <%= button_tag '<= previous', :name=>'show', :value=>'previous' %>
17      <%= button_tag 'next =>', :name=>'show', :value=>'next' %>
18     </p>
19 <% end %>
21 <% if not @intraday_quotes.empty? and @quoterecords.empty? or not (@quoterecords.empty? ? false : @quoterecords.first.Quote.time_last.between?(smr_browse_date.beginning_of_day, smr_browse_date.end_of_day))  %>
22 <h2>Observations
23 <em>intraday quotes in contrast to previous records</em></h2>
24 <table id='quoterecord_observations'>
25   <% @intraday_quotes.each do |q| %>
26     <tr>
27         <td>
28             <b><%=q.last%></b> at <%=q.time_last.strftime('%H:%M')%>
29             <%if q.volume%>, <%= smr_humanize(q.volume, :shortword=>true) %> shares traded<%end%>
30         </td>
31         <td>
32           <% # build new Quoterecord as suggestion
33             msg, newqr = @quoterecords.inspect_quote(q)
34             newqr.id_quote = q.id
35             newqr.column = @quoterecords.get_last_recorded_column
36           %>
37           <% if not msg.empty? %>
38             <span><%= msg %></span>
39           <% end %>
40           <%= render :partial=>'form', locals: { :quoterecord=>newqr, :skip_fieldset=>true } %>
41         </td>
42     </tr>
43   <% end %>
44 </table>
45 <% end %>
47 <% unless @quoterecords.empty? %>
48 <h2>Previous Records</h2>
50 <% if @quoterecord %>
51     <%= render :partial=>'form', locals: { :quoterecord=>@quoterecord } %>
52 <% end %>
54 <table id='quoterecords'>
55     <thead>
56         <tr><th colspan="7"><%= smr_paginate @page, @total_pages, quoterecords_path %></th></tr>
57         <tr>
58             <th/>
59           <% Smr::Quoterecords.get_columns.each do |c| %>
60             <th><%= Smr::Quoterecords.translate_column(c) %></th>
61           <% end %>
62         </tr>
63         <tr>
64             <td/>
65           <% Smr::Quoterecords.get_columns.each do |c| %>
66             <th><%= @quoterecords.get_pivot_point(c) %></th>
67           <% end %>
68         </tr>
69     </thead>
70     <tbody>
71      <% @quoterecords.each do |qr| %>
72         <tr>
73             <td>
74                 <%=link_to '+', qr if qr.time_created > 90.days.ago %>
75                 <%=smr_humanize(qr.Quote.time_last)%>
76                 <% if not qr.comment.empty? %><span class="comment_text"><%=qr.comment%></span><% end %>
77             </td>
78           <% Smr::Quoterecords.get_columns.each do |c| %>
79             <td class="<%= make_css_class(qr, c) %>">
80                 <%if qr.is_column?(c) %>
81                     <%= qr.Quote.last %>
82                     <%if qr.Quote.volume%><span><%=smr_humanize(qr.Quote.volume, :shortword=>true)%> shares traded</span><%end%>
83                 <%end%>
84             </td>
85           <% end %>
86         </tr>
87      <% end %>
88     </tbody>
89 </table>
90 <% end %>
92 <h2>Sensitivity Settings</h2>
93 <%= form_for @sensitivity, :url=>{controller: :quoterecord_threshold, action: :create}, :method=>:POST do |f| %>
94 <fieldset id='quoterecord_sensitivity'>
95   <legend>adjust when UP/DOWN or Pivot Point hits are triggered</legend>
96     <%= hidden_field_tag :id, @sensitivity.id %>
97     <%= f.hidden_field :id_security %>
98     <%= f.number_field :quote_sensitivity, :step=>0.01, :min=>0.01 %> <%= f.label :quote_sensitivity, 'UP/DOWN hit sensitivity' %><br/>
99     <%= f.number_field :hit_sensitivity, :step=>0.01, :min=>0.01 %> <%= f.label :hit_sensitivity, 'Pivot Point hit sensitivity' %><br/>
100     <%= f.submit 'save' %>
101 </fieldset>
102 <% end %>
104 <br/>