app/models/iro/purse.rb in iron_warbler-2.0.7.26 vs app/models/iro/purse.rb in iron_warbler-2.0.7.27

- old
+ new

@@ -28,20 +28,27 @@ field :mark_every_n_usd, type: :float, default: 1 field :n_next_positions, type: :integer, default: 5 field :available_amount, type: :float + def available + available_amount + end + def balance + 0.01 + end + def delta_wt_avg( begin_end, long_short, inner_outer ) max_loss_total = 0 out = positions.send( long_short ).map do |pos| max_loss_total += pos.max_loss * pos.q pos.max_loss * pos.q * pos.send( inner_outer ).send( "#{begin_end}_delta" ) end - puts! out, 'delta_wt_avg 1' + # puts! out, 'delta_wt_avg 1' out = out.reduce( &:+ ) / max_loss_total rescue 0 - puts! out, 'delta_wt_avg 2' + # puts! out, 'delta_wt_avg 2' return out end ## delta to plot percentage ## convert to normal between 0 and 3 std def delta_to_plot_p( *args )