gera 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +674 -0
- data/README.md +67 -0
- data/Rakefile +43 -0
- data/app/assets/config/gera_manifest.js +2 -0
- data/app/assets/javascripts/gera/application.js +14 -0
- data/app/assets/stylesheets/gera/application.css +15 -0
- data/app/authorizers/gera/application_authorizer.rb +6 -0
- data/app/authorizers/gera/currency_rate_authorizer.rb +9 -0
- data/app/authorizers/gera/currency_rate_mode_authorizer.rb +7 -0
- data/app/authorizers/gera/direction_rate_authorizer.rb +8 -0
- data/app/authorizers/gera/exchange_rate_authorizer.rb +8 -0
- data/app/authorizers/gera/payment_system_authorizer.rb +13 -0
- data/app/authorizers/gera/rate_source_authorizer.rb +7 -0
- data/app/controllers/gera/application_controller.rb +30 -0
- data/app/controllers/gera/currencies_controller.rb +8 -0
- data/app/controllers/gera/currency_rate_history_intervals_controller.rb +53 -0
- data/app/controllers/gera/currency_rate_mode_snapshots_controller.rb +83 -0
- data/app/controllers/gera/currency_rate_modes_controller.rb +60 -0
- data/app/controllers/gera/currency_rates_controller.rb +70 -0
- data/app/controllers/gera/direction_rate_history_intervals_controller.rb +62 -0
- data/app/controllers/gera/direction_rates_controller.rb +28 -0
- data/app/controllers/gera/exchange_rates_controller.rb +25 -0
- data/app/controllers/gera/external_rate_snapshots_controller.rb +35 -0
- data/app/controllers/gera/external_rates_controller.rb +28 -0
- data/app/controllers/gera/payment_systems_controller.rb +78 -0
- data/app/controllers/gera/rate_sources_controller.rb +8 -0
- data/app/decorators/gera/currency_rate_decorator.rb +148 -0
- data/app/decorators/gera/direction_rate_decorator.rb +47 -0
- data/app/decorators/gera/payment_system_decorator.rb +19 -0
- data/app/helpers/gera/application_helper.rb +110 -0
- data/app/helpers/gera/currency_rate_helper.rb +19 -0
- data/app/helpers/gera/currency_rate_modes_helper.rb +73 -0
- data/app/helpers/gera/direction_rate_helper.rb +36 -0
- data/app/helpers/gera/exchange_rates_helper.rb +21 -0
- data/app/jobs/gera/application_job.rb +6 -0
- data/app/models/concerns/gera/currency_pair_generator.rb +14 -0
- data/app/models/concerns/gera/currency_pair_support.rb +42 -0
- data/app/models/concerns/gera/currency_rate_mode_builder_support.rb +35 -0
- data/app/models/concerns/gera/direction_support.rb +14 -0
- data/app/models/concerns/gera/history_interval_concern.rb +46 -0
- data/app/models/gera/application_record.rb +8 -0
- data/app/models/gera/cbr_external_rate.rb +13 -0
- data/app/models/gera/cross_rate_mode.rb +13 -0
- data/app/models/gera/currency_rate.rb +78 -0
- data/app/models/gera/currency_rate_history_interval.rb +25 -0
- data/app/models/gera/currency_rate_history_interval_filter.rb +30 -0
- data/app/models/gera/currency_rate_mode.rb +20 -0
- data/app/models/gera/currency_rate_mode_snapshot.rb +26 -0
- data/app/models/gera/currency_rate_snapshot.rb +12 -0
- data/app/models/gera/direction.rb +44 -0
- data/app/models/gera/direction_rate.rb +136 -0
- data/app/models/gera/direction_rate_history_interval.rb +33 -0
- data/app/models/gera/direction_rate_history_interval_filter.rb +30 -0
- data/app/models/gera/direction_rate_snapshot.rb +7 -0
- data/app/models/gera/exchange_rate.rb +130 -0
- data/app/models/gera/external_rate.rb +38 -0
- data/app/models/gera/external_rate_snapshot.rb +20 -0
- data/app/models/gera/payment_system.rb +98 -0
- data/app/models/gera/rate_source.rb +77 -0
- data/app/models/gera/rate_source_auto.rb +25 -0
- data/app/models/gera/rate_source_bitfinex.rb +9 -0
- data/app/models/gera/rate_source_cbr.rb +13 -0
- data/app/models/gera/rate_source_cbr_avg.rb +6 -0
- data/app/models/gera/rate_source_exmo.rb +9 -0
- data/app/models/gera/rate_source_manual.rb +13 -0
- data/app/views/application/_exchange_rate_monitor.slim +1 -0
- data/app/views/gera/application/_attributes_table.slim +5 -0
- data/app/views/gera/application/_currencies_table.slim +18 -0
- data/app/views/gera/application/_currency_rate_mode_snapshots.slim +6 -0
- data/app/views/gera/application/_direction_rate.slim +6 -0
- data/app/views/gera/application/_directions_submenu.slim +11 -0
- data/app/views/gera/application/_directions_table.slim +15 -0
- data/app/views/gera/application/_exchange_rate.slim +6 -0
- data/app/views/gera/application/_external_rate.slim +6 -0
- data/app/views/gera/application/_header.slim +12 -0
- data/app/views/gera/application/_table.slim +28 -0
- data/app/views/gera/application/_topnav.slim +21 -0
- data/app/views/gera/application/direction_details.slim +75 -0
- data/app/views/gera/application/page.html.slim +1 -0
- data/app/views/gera/currencies/index.html.slim +20 -0
- data/app/views/gera/currency_rate_history_intervals/_filter.slim +11 -0
- data/app/views/gera/currency_rate_history_intervals/index.slim +39 -0
- data/app/views/gera/currency_rate_mode_snapshots/_snapshot.slim +20 -0
- data/app/views/gera/currency_rate_mode_snapshots/edit.html.slim +30 -0
- data/app/views/gera/currency_rate_modes/_cross_rate_mode_fields.slim +21 -0
- data/app/views/gera/currency_rate_modes/_currency_rate_mode.slim +7 -0
- data/app/views/gera/currency_rate_modes/_form.slim +29 -0
- data/app/views/gera/currency_rate_modes/edit.slim +11 -0
- data/app/views/gera/currency_rate_modes/index.html.slim +12 -0
- data/app/views/gera/currency_rates/_currency_rate.slim +22 -0
- data/app/views/gera/currency_rates/_currency_rate_humanized.slim +35 -0
- data/app/views/gera/currency_rates/diff.slim +12 -0
- data/app/views/gera/currency_rates/index.slim +27 -0
- data/app/views/gera/currency_rates/modes.slim +14 -0
- data/app/views/gera/currency_rates/show.slim +4 -0
- data/app/views/gera/direction_rate_history_intervals/_filter.slim +11 -0
- data/app/views/gera/direction_rate_history_intervals/index.slim +41 -0
- data/app/views/gera/direction_rates/_direction_rate_example_calculator.slim +28 -0
- data/app/views/gera/direction_rates/diff.slim +19 -0
- data/app/views/gera/direction_rates/index.slim +26 -0
- data/app/views/gera/direction_rates/legacy.html.slim +5 -0
- data/app/views/gera/direction_rates/minimals.slim +5 -0
- data/app/views/gera/direction_rates/show.slim +14 -0
- data/app/views/gera/external_rate_snapshots/index.slim +25 -0
- data/app/views/gera/external_rate_snapshots/show.slim +22 -0
- data/app/views/gera/external_rates/_flat_list.slim +22 -0
- data/app/views/gera/external_rates/index.html.slim +28 -0
- data/app/views/gera/external_rates/show.slim +1 -0
- data/app/views/gera/payment_systems/_fields.slim +4 -0
- data/app/views/gera/payment_systems/_fields_table.slim +18 -0
- data/app/views/gera/payment_systems/_form.slim +9 -0
- data/app/views/gera/payment_systems/edit.slim +7 -0
- data/app/views/gera/payment_systems/index.slim +3 -0
- data/app/views/gera/payment_systems/new.slim +9 -0
- data/app/views/gera/payment_systems/show.slim +1 -0
- data/app/views/gera/rate_sources/_list.slim +13 -0
- data/app/views/gera/rate_sources/_rate_source.slim +23 -0
- data/app/views/gera/rate_sources/index.html.slim +6 -0
- data/app/views/layouts/application.html.slim +15 -0
- data/app/views/layouts/gera/blank.html.slim +10 -0
- data/app/workers/concerns/gera/rates_worker.rb +87 -0
- data/app/workers/gera/bitfinex_rates_worker.rb +65 -0
- data/app/workers/gera/cbr_avg_rates_worker.rb +42 -0
- data/app/workers/gera/cbr_rates_worker.rb +192 -0
- data/app/workers/gera/create_history_intervals_worker.rb +38 -0
- data/app/workers/gera/currency_rates_worker.rb +64 -0
- data/app/workers/gera/directions_rates_worker.rb +51 -0
- data/app/workers/gera/exmo_rates_worker.rb +62 -0
- data/app/workers/gera/purge_currency_rates_worker.rb +21 -0
- data/app/workers/gera/purge_direction_rates_worker.rb +30 -0
- data/config/currencies.yml +559 -0
- data/config/routes.rb +30 -0
- data/db/migrate/20180912130000_setup.rb +228 -0
- data/db/migrate/20190314114844_add_is_available_to_payment_systems.rb +7 -0
- data/db/migrate/20190315113046_add_icon_url_to_payment_systems.rb +7 -0
- data/db/migrate/20190315132137_add_commission_to_payment_systems.rb +7 -0
- data/lib/banks/currency_exchange.rb +12 -0
- data/lib/builders/currency_rate_auto_builder.rb +38 -0
- data/lib/builders/currency_rate_builder.rb +60 -0
- data/lib/builders/currency_rate_cross_builder.rb +70 -0
- data/lib/builders/currency_rate_direct_builder.rb +26 -0
- data/lib/gera.rb +32 -0
- data/lib/gera/bitfinex_fetcher.rb +36 -0
- data/lib/gera/configuration.rb +47 -0
- data/lib/gera/currencies_purger.rb +28 -0
- data/lib/gera/currency_pair.rb +93 -0
- data/lib/gera/engine.rb +14 -0
- data/lib/gera/mathematic.rb +156 -0
- data/lib/gera/money_support.rb +89 -0
- data/lib/gera/numeric.rb +25 -0
- data/lib/gera/railtie.rb +8 -0
- data/lib/gera/rate.rb +22 -0
- data/lib/gera/rate_from_multiplicator.rb +54 -0
- data/lib/gera/repositories/currency_rate_modes_repository.rb +37 -0
- data/lib/gera/repositories/currency_rates_repository.rb +25 -0
- data/lib/gera/repositories/direction_rates_repository.rb +46 -0
- data/lib/gera/repositories/exchange_rates_repository.rb +23 -0
- data/lib/gera/repositories/payment_systems_repository.rb +21 -0
- data/lib/gera/repositories/universe.rb +47 -0
- data/lib/gera/version.rb +3 -0
- data/lib/tasks/auto_generate_diagram.rake +6 -0
- data/lib/tasks/gera_tasks.rake +4 -0
- metadata +765 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
= simple_form_for currency_rate_mode do |f|
|
2
|
+
= back_field
|
3
|
+
= f.input :currency_rate_mode_snapshot_id, as: :hidden
|
4
|
+
.row
|
5
|
+
.col-md-3
|
6
|
+
= f.input :cur_from, as: :hidden
|
7
|
+
= f.input :cur_to, as: :hidden
|
8
|
+
|
9
|
+
- key = f.object.currency_pair.to_a.join('-').downcase
|
10
|
+
|
11
|
+
= f.input :mode,
|
12
|
+
label: 'Режим',
|
13
|
+
collection: currency_rate_modes_enum,
|
14
|
+
include_blank: false,
|
15
|
+
wrapper_html: { data: { autoshow: key } }
|
16
|
+
|
17
|
+
.col-md-6
|
18
|
+
- cc_data = {}
|
19
|
+
- cc_data["autoshow-#{key}"] = :cross
|
20
|
+
div data=cc_data style=currency_rate_mode_autoshow_style(currency_rate_mode)
|
21
|
+
= f.simple_fields_for :cross_rate_modes do |crm|
|
22
|
+
= render 'cross_rate_mode_fields', f: crm
|
23
|
+
.links
|
24
|
+
= link_to_add_association 'Добавить кросс-курс', f, :cross_rate_modes, class: 'btn btn-sm btn-primary'
|
25
|
+
|
26
|
+
.row
|
27
|
+
.col-md-6
|
28
|
+
= f.button :submit, value: 'Сохранить', class: 'btn btn-primary'
|
29
|
+
.col-md-6
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= link_to "← Назад в матрицу '#{currency_rate_mode.snapshot.title}'".html_safe, success_url
|
2
|
+
|
3
|
+
h2.m-b-md Изменяем метод расчета для #{currency_rate_mode.currency_pair}
|
4
|
+
hr
|
5
|
+
|
6
|
+
.row
|
7
|
+
.col-md-9
|
8
|
+
= render 'form', currency_rate_mode: currency_rate_mode, success_url: success_url
|
9
|
+
.col-md-3
|
10
|
+
.alert class=(currency_rate_mode.build_result.error? ? 'alert-danger' : 'alert-success')
|
11
|
+
= currency_rate_mode_build_result_details currency_rate_mode.build_result
|
@@ -0,0 +1,12 @@
|
|
1
|
+
h2 Методы расчета (#{snapshot.status})
|
2
|
+
|
3
|
+
h3= l snapshot.created_at, format: :long
|
4
|
+
|
5
|
+
.row
|
6
|
+
.col-md-9
|
7
|
+
= render 'currency_rate_mode_snapshots/snapshot', snapshot: snapshot
|
8
|
+
.col-md-3
|
9
|
+
= render 'currency_rate_mode_snapshots', current_snapshot: snapshot
|
10
|
+
hr
|
11
|
+
p
|
12
|
+
= link_to 'Методы расчетов курсов', 'https://docs.google.com/spreadsheets/d/1ySSUNaQRO5Fthg1QUTnnrfBFreWErH3585HalFBlONI/edit?usp=sharing', target: '_blank'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
- object = Gera::CurrencyRateDecorator.decorate currency_rate
|
2
|
+
h3
|
3
|
+
= t '.title', title: object.title
|
4
|
+
hr
|
5
|
+
.row
|
6
|
+
.col-md-6
|
7
|
+
= render 'attributes_table', object: object, columns: currency_rate_columns(currency_rate)
|
8
|
+
|
9
|
+
- if currency_rate.direction_rates.any?
|
10
|
+
h4= t '.used_direction_rates', count: currency_rate.direction_rates.count
|
11
|
+
- currency_rate.direction_rates.each do |direction_rate|
|
12
|
+
- object = Gera::DirectionRateDecorator.decorate (direction_rate)
|
13
|
+
|
14
|
+
- columns = %i(created_at rate_percent ps_comission rate_value )
|
15
|
+
|
16
|
+
= render 'attributes_table', object: object, columns: columns
|
17
|
+
- else
|
18
|
+
h4= t '.not_used_in_direction_rates'
|
19
|
+
.col-md-6
|
20
|
+
.panel.panel-default
|
21
|
+
.panel-heading Calculation
|
22
|
+
.panel-body= currency_rate_mode_detailed currency_rate
|
@@ -0,0 +1,35 @@
|
|
1
|
+
tr
|
2
|
+
th= cur.to_s
|
3
|
+
- cp1 = Gera::CurrencyPair.new cur, cur2
|
4
|
+
- cr1 = Gera::Universe.currency_rates_repository.get_currency_rate_by_pair cp1
|
5
|
+
- r1 = cr1.rate_value
|
6
|
+
|
7
|
+
- cp2 = Gera::CurrencyPair.new cur2, cur
|
8
|
+
- cr2 = Gera::Universe.currency_rates_repository.get_currency_rate_by_pair cp2
|
9
|
+
- r2 = cr2.rate_value
|
10
|
+
|
11
|
+
td.text-right title=r1
|
12
|
+
- if cr1.persisted?
|
13
|
+
= link_to currency_rate_path(cr1) do
|
14
|
+
= humanized_currency_rate r1, cp1, cur2
|
15
|
+
br
|
16
|
+
- else
|
17
|
+
p.text-small Значение не найдено
|
18
|
+
.text-muted.text-small покупка
|
19
|
+
|
20
|
+
- if cr1.persisted? && cr2.persisted?
|
21
|
+
- if r1 < 1.0 / r2
|
22
|
+
td.bg-success= ' < '
|
23
|
+
- elsif r1 == 1.0 / r2
|
24
|
+
td.bg-warning= '='
|
25
|
+
- else
|
26
|
+
td.bg-danger= '>'
|
27
|
+
- else
|
28
|
+
td
|
29
|
+
td.text-right title=r2
|
30
|
+
- if cr2.persisted?
|
31
|
+
= link_to currency_rate_path(cr2) do
|
32
|
+
= humanized_currency_rate 1.0 / r2, cp2, cur2
|
33
|
+
- else
|
34
|
+
p.text-small Значение не найдено
|
35
|
+
.text-muted.text-small продажа
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= render 'menu'
|
2
|
+
|
3
|
+
= render layout: 'currencies_table' do |pair|
|
4
|
+
- rate_value2 = rates1.find_by_currency_pair(pair)
|
5
|
+
- rate_value1 = rates2.find_by_currency_pair(pair).rate_value
|
6
|
+
td.text-nowrap.text-right.v-middle
|
7
|
+
- if pair.same?
|
8
|
+
.text-muted ·
|
9
|
+
- else
|
10
|
+
= rate_diff rate_value1, rate_value2
|
11
|
+
|
12
|
+
p.text-muted От текущего отнимаем курсы Gera
|
@@ -0,0 +1,27 @@
|
|
1
|
+
= link_to 'История', currency_rate_history_intervals_path
|
2
|
+
.container-fluid
|
3
|
+
= "Курс актуален на #{l created_at, format: :long}"
|
4
|
+
.row
|
5
|
+
.col-md-12
|
6
|
+
.text-small= render layout: 'currencies_table' do |pair|
|
7
|
+
- rate = rates.find_by_currency_pair pair
|
8
|
+
- rate_d = Gera::CurrencyRateDecorator.decorate rate
|
9
|
+
- if rate.present?
|
10
|
+
td.text-nowrap.text-right.v-middle.rate-popover class=currency_rate_class(rate) data=currency_rate_cell_data_attr(rate) title=rate_d.title
|
11
|
+
- if pair.same?
|
12
|
+
.text-muted ·
|
13
|
+
- else
|
14
|
+
= link_to currency_rate_path(rate) do
|
15
|
+
= humanized_rate rate.rate_value, rate.currency_to
|
16
|
+
- else
|
17
|
+
td.text-nowrap.text-right.v-middle data-toggle=:tooltip data-container=:body data-html='true' title='курс отсутсвует'
|
18
|
+
.text-muted ·
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
.panel.panel-default.m-t-md
|
23
|
+
.panel-body
|
24
|
+
p
|
25
|
+
span.text-success Зеленым
|
26
|
+
span.m-l-md отмечены кросс-курсы
|
27
|
+
p Наведите или нажмите чтобы увидеть метод расчета
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- currencies = Money::Currency.all
|
2
|
+
|
3
|
+
h2 Методы расчета
|
4
|
+
|
5
|
+
= render layout: 'currencies_table' do |pair|
|
6
|
+
- rate = snapshot.rates.find_by_currency_pair pair
|
7
|
+
- if rate.present?
|
8
|
+
- rate_d = Gera::CurrencyRateDecorator.decorate rate
|
9
|
+
td.v-middle data-toggle=:tooltip data-container=:body data-html='true' title=rate_d.tooltip data-href=currency_rate_path(rate)
|
10
|
+
- unless pair.same?
|
11
|
+
.text-small
|
12
|
+
= rate_d.detailed
|
13
|
+
- else
|
14
|
+
td.text-muted ·
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= simple_form_for filter, url: direction_rate_history_intervals_path, method: :GET do |f|
|
2
|
+
.row
|
3
|
+
.col-md-3
|
4
|
+
= f.input :payment_system_from_id, collection: Gera::PaymentSystem.ordered, include_blank: false, label: false, hint: 'Входящая ПС'
|
5
|
+
.col-md-3
|
6
|
+
= f.input :payment_system_to_id, collection: Gera::PaymentSystem.ordered, include_blank: false, label: false, hint: 'Исходящая ПС'
|
7
|
+
.col-md-3
|
8
|
+
= f.input :value_type, collection: [['Значение курса','rate'],['Комиссия','comission']], include_blank: false, label: false, hint: 'Что смотрим?'
|
9
|
+
.col-md-3
|
10
|
+
= f.button :submit, 'Обновить', class: 'btn btn-primary'
|
11
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
= render 'filter'
|
2
|
+
|
3
|
+
#container style="height: 400px; min-width: 310px"
|
4
|
+
|
5
|
+
= javascript_include_tag 'https://code.highcharts.com/stock/highstock.js'
|
6
|
+
= javascript_include_tag 'https://code.highcharts.com/stock/modules/exporting.js'
|
7
|
+
|
8
|
+
javascript:
|
9
|
+
$.getJSON('#{direction_rate_history_intervals_path(format: :json, direction_rate_history_interval_filter: filter.to_param)}', function (data) {
|
10
|
+
// create the chart
|
11
|
+
Highcharts.stockChart('container', {
|
12
|
+
rangeSelector: {
|
13
|
+
buttons: [{
|
14
|
+
type: 'hour',
|
15
|
+
count: 1,
|
16
|
+
text: '1ч'
|
17
|
+
}, {
|
18
|
+
type: 'day',
|
19
|
+
count: 1,
|
20
|
+
text: '1д'
|
21
|
+
}, {
|
22
|
+
type: 'all',
|
23
|
+
count: 1,
|
24
|
+
text: 'Всё'
|
25
|
+
}],
|
26
|
+
selected: 1,
|
27
|
+
inputEnabled: false
|
28
|
+
},
|
29
|
+
|
30
|
+
series: [{
|
31
|
+
name: 'Конечный курс',
|
32
|
+
type: 'candlestick',
|
33
|
+
data: data,
|
34
|
+
tooltip: {
|
35
|
+
valueDecimals: #{value_decimals}
|
36
|
+
}
|
37
|
+
}]
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- income_amount = direction_rate.rate_value.to_rate.in_amount
|
2
|
+
- profit = direction_rate.get_profit_result income_amount
|
3
|
+
table.table.table-narrow
|
4
|
+
thead
|
5
|
+
tr
|
6
|
+
th Базовый курс
|
7
|
+
th Комиссия обменника
|
8
|
+
th Конечный курс
|
9
|
+
th Сумма на входе
|
10
|
+
th Сумма на выходе (клиент получит на счете, сумма к отправке)
|
11
|
+
th Комиссия ПС (%)
|
12
|
+
th Комиссия ПС (абс.)
|
13
|
+
th Сумма которая уйдет с выходящего кошелька (что получит клиент + комиссия ПС)
|
14
|
+
th Чистая прибыль системы
|
15
|
+
tbody
|
16
|
+
tr
|
17
|
+
td= profit.base_rate.to_rate.format direction_rate.payment_system_from.currency, direction_rate.payment_system_to.currency
|
18
|
+
td= profit.comission.to_percent
|
19
|
+
td= profit.finite_rate.to_rate.format direction_rate.payment_system_from.currency, direction_rate.payment_system_to.currency
|
20
|
+
|
21
|
+
td= humanized_money_with_currency Money.from_amount(profit.income_amount, direction_rate.payment_system_from.currency)
|
22
|
+
td= humanized_money_with_currency Money.from_amount(profit.finite_amount, direction_rate.payment_system_to.currency)
|
23
|
+
|
24
|
+
td= profit.ps_interest.to_percent
|
25
|
+
td= humanized_money_with_currency Money.from_amount(profit.ps_amount, direction_rate.payment_system_to.currency)
|
26
|
+
|
27
|
+
td= humanized_money_with_currency Money.from_amount(profit.outcome_amount, direction_rate.payment_system_to.currency)
|
28
|
+
td= humanized_money_with_currency Money.from_amount(profit.profit_amount, direction_rate.payment_system_from.currency)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= render 'directions_submenu'
|
2
|
+
|
3
|
+
= render layout: 'directions_table' do |direction|
|
4
|
+
- dr = Gera::Universe.direction_rates_repository.get_by_direction direction
|
5
|
+
- ps_from = direction.ps_from; ps_to = direction.ps_to
|
6
|
+
- drl = (legacy_direction_rates[ps_from.id] || {})[ps_to.id]
|
7
|
+
td.text-nowrap.text-right.rate-popover.v-middle data=direction_rate_cell_data_attr(dr, ps_from, ps_to, drl)
|
8
|
+
- if dr.present? && dr.exchange_rate.available?
|
9
|
+
- if drl.present?
|
10
|
+
- diff = dr.rate_value - drl
|
11
|
+
- res = (diff * 100.0 / dr.rate_value).round(2)
|
12
|
+
= "#{res}%"
|
13
|
+
- else
|
14
|
+
.text-danger Нет в PHP
|
15
|
+
- else
|
16
|
+
- if drl.present?
|
17
|
+
.text-danger Нет в Gera
|
18
|
+
- else
|
19
|
+
.text-muted= ion_icon 'ios-close-empty'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= link_to 'history', direction_rate_history_intervals_path
|
2
|
+
.container-fluid
|
3
|
+
.row
|
4
|
+
.col-md-12
|
5
|
+
- snapshot = Gera::Universe.direction_rates_repository.snapshot
|
6
|
+
= "Дата расчета матрицы (##{snapshot.id}) #{l snapshot.created_at, format: :long}"
|
7
|
+
|
8
|
+
= render layout: 'directions_table' do |direction|
|
9
|
+
- dr = Gera::Universe.direction_rates_repository.find_by_direction direction
|
10
|
+
- er = Gera::Universe.exchange_rates_repository.find_by_direction direction
|
11
|
+
td.text-nowrap.cell-small.text-center.rate-popover.v-middle data=direction_rate_cell_data_attr(direction)
|
12
|
+
- if dr.nil?
|
13
|
+
- if er.nil?
|
14
|
+
.text-muted title='no direction and exchange rates'
|
15
|
+
= ion_icon 'ios-close-empty'
|
16
|
+
- else
|
17
|
+
= link_to exchange_rate_path(er) do
|
18
|
+
.text-muted title='direction rate is unknown'
|
19
|
+
= ion_icon 'ios-close-empty'
|
20
|
+
- elsif !er.available?
|
21
|
+
= link_to exchange_rate_path(er) do
|
22
|
+
.text-muted title='exchange rate is unavailable'
|
23
|
+
= ion_icon 'ios-close-empty'
|
24
|
+
- else
|
25
|
+
= link_to direction_rate_path(dr.id) do
|
26
|
+
= humanized_rate dr.rate_value
|
@@ -0,0 +1,14 @@
|
|
1
|
+
= link_to 'refresh', last_direction_rate_path(direction_rate), class: 'btn btn-success'
|
2
|
+
.row
|
3
|
+
.col-md-6
|
4
|
+
= render 'direction_rate', direction_rate: direction_rate
|
5
|
+
.col-md-6
|
6
|
+
= render 'exchange_rate_monitor', exchange_rate: direction_rate.exchange_rate
|
7
|
+
|
8
|
+
.m-t-lg
|
9
|
+
hr
|
10
|
+
= render 'direction_rate_example_calculator', direction_rate: direction_rate
|
11
|
+
|
12
|
+
.m-t-lg
|
13
|
+
hr
|
14
|
+
= render 'currency_rate', currency_rate: direction_rate.currency_rate
|
@@ -0,0 +1,25 @@
|
|
1
|
+
h2 Журнал курсов #{rate_source}
|
2
|
+
|
3
|
+
.table-sticky-container
|
4
|
+
table.table-condensed.table-comission.table-cross.text-small
|
5
|
+
thead.bg-white
|
6
|
+
tr
|
7
|
+
th Дата съема
|
8
|
+
- rate_source.available_pairs.each do |cp|
|
9
|
+
th.text-right style="font-size: 125%"= cp
|
10
|
+
|
11
|
+
tbody
|
12
|
+
- snapshots.each do |s|
|
13
|
+
tr
|
14
|
+
th.text-nowrap
|
15
|
+
= link_to external_rate_snapshot_path(s) do
|
16
|
+
= l s.created_at, format: :long
|
17
|
+
- rate_source.available_pairs.each do |cp|
|
18
|
+
- rate = s.external_rates.find_by_currency_pair(cp)
|
19
|
+
- if rate
|
20
|
+
td.text-right
|
21
|
+
= humanized_rate_detailed rate.rate_value, '<br/>'
|
22
|
+
- else
|
23
|
+
td
|
24
|
+
|
25
|
+
= paginate snapshots
|
@@ -0,0 +1,22 @@
|
|
1
|
+
h1 Снимок внешних курсов (#{snapshot.rate_source}) от #{l snapshot.created_at, format: :long}
|
2
|
+
|
3
|
+
table.table.table-condensed.table-striped.table-narrow
|
4
|
+
thead
|
5
|
+
tr
|
6
|
+
th Вход
|
7
|
+
th Выход
|
8
|
+
th Значение курса источника
|
9
|
+
th Человеческое значение
|
10
|
+
th Расшифровочка
|
11
|
+
tbody
|
12
|
+
- snapshot.external_rates.ordered.each do |er|
|
13
|
+
tr
|
14
|
+
th= er.cur_from
|
15
|
+
th= er.cur_to
|
16
|
+
th= er.rate_value
|
17
|
+
th= humanized_rate er.rate_value
|
18
|
+
th
|
19
|
+
- if er.rate_value < 1
|
20
|
+
span Продаем #{er.cur_to} за #{1.0/er.rate_value} #{er.cur_from}
|
21
|
+
- else
|
22
|
+
span Покупаем #{er.cur_from} за #{er.rate_value} #{er.cur_to}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
table.table.table-condensed.table-hover.table-striped.table-narrow
|
2
|
+
thead
|
3
|
+
tr
|
4
|
+
th Источник
|
5
|
+
th Дата курса
|
6
|
+
th Валютная пара
|
7
|
+
th Курс продажи
|
8
|
+
th Курс средний
|
9
|
+
th Курс покупки
|
10
|
+
th Время загрузки
|
11
|
+
tbody
|
12
|
+
- external_rates.each do |er|
|
13
|
+
tr
|
14
|
+
td= er.source
|
15
|
+
td= l er.actual_for
|
16
|
+
td
|
17
|
+
= currency_rate_pair er.cur_from, er.cur_to
|
18
|
+
td.text-right= er.sell_price || '-'
|
19
|
+
td.text-right= er.rate || '-'
|
20
|
+
td.text-right= er.buy_price || '-'
|
21
|
+
td
|
22
|
+
.text-muted= l er.created_at
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.page-header
|
2
|
+
h1 Журнал приема курсов
|
3
|
+
|
4
|
+
table.table.table-condensed.table-hover.table-striped.table-narrow
|
5
|
+
thead
|
6
|
+
tr
|
7
|
+
th Источник
|
8
|
+
th Дата курса
|
9
|
+
- available_pairs.each do |pair|
|
10
|
+
th= pair.to_s
|
11
|
+
tbody
|
12
|
+
- timestamps.each do |ts|
|
13
|
+
tr
|
14
|
+
td= ts[:source]
|
15
|
+
td.text-nowrap= l ts[:snapshot].actual_for, format: :long
|
16
|
+
- available_pairs.each do |pair|
|
17
|
+
td
|
18
|
+
- er = ts[:rates][pair.key]
|
19
|
+
- if er.present?
|
20
|
+
- if er.same_rates?
|
21
|
+
.text-nowrap= er.rate
|
22
|
+
- else
|
23
|
+
.text-nowrap= er.sell_price
|
24
|
+
.text-nowrap.text-muted= er.rate
|
25
|
+
.text-nowrap= er.buy_price
|
26
|
+
- else
|
27
|
+
= '-'
|
28
|
+
|