iron_warbler 2.0.7.7 → 2.0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -16
- data/app/assets/javascript/iron_warbler/application.js +3 -0
- data/app/controllers/iro/application_controller.rb +3 -2
- data/app/controllers/iro/stocks_controller.rb +1 -0
- data/app/models/iro/alert.rb +15 -4
- data/app/models/iro/datapoint.rb +108 -3
- data/app/models/iro/date.rb +10 -0
- data/app/models/iro/option.rb +20 -5
- data/app/models/iro/price_item.rb +5 -2
- data/app/models/iro/stock.rb +9 -8
- data/app/views/iro/_analytics.erb +16 -0
- data/app/views/iro/_main_header.haml +13 -0
- data/app/views/layouts/iro/application.haml +48 -13
- data/config/initializers/assets.rb +10 -0
- data/lib/iron_warbler.rb +1 -2
- data/lib/tasks/db_tasks.rake +54 -1
- data/lib/tasks/iro_tasks.rake-old +128 -0
- metadata +82 -29
- data/app/models/iro/application_record.rb +0 -4
- data/app/models/iro/profile.rb +0 -4
- data/db/migrate/20231210204830_create_iro_profiles.rb +0 -12
- data/db/migrate/20231210205837_create_iro_alerts.rb +0 -16
- data/db/migrate/20231219204329_create_dates.rb +0 -13
- data/db/migrate/20231219205644_create_datapoint.rb +0 -15
- data/db/migrate/20231220193201_create_stocks.rb +0 -11
- data/db/migrate/20231220194903_add_alert_status.rb +0 -5
- data/db/migrate/20231220223730_create_iro_price_item.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ee2560d39aa4a4a279294e7611cc5e5564712c59931e0ae5f1d7ea91140aba5
|
4
|
+
data.tar.gz: cf46d95a353f1097a78aa1009a9ffe17d6b305810def2cb440782fa46e59ac8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ebc5bf69e74d48abd1cdcc2c097a5c59aea38c971bd0298850920e217576a90ea0d3520d423648af9df20591ccfa4f9cc637a280863b49ba48acd1cdd9aa78a
|
7
|
+
data.tar.gz: 84c43a18c988669e34f19ecd961cebfe971795e1cc3ca628405d8a1c487b7805c8e443a38dd4a1b05f1c37c2cab304e8e412c98604cb6ff0e27d296deaa9c539
|
data/Rakefile
CHANGED
@@ -1,18 +1,5 @@
|
|
1
|
-
require "bundler/setup"
|
2
1
|
|
3
|
-
|
4
|
-
load "rails/tasks/engine.rake"
|
2
|
+
require_relative 'test/dummy/config/application'
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
require "bundler/gem_tasks"
|
9
|
-
|
10
|
-
require "rake/testtask"
|
11
|
-
|
12
|
-
Rake::TestTask.new(:test) do |t|
|
13
|
-
t.libs << 'test'
|
14
|
-
t.pattern = 'test/**/*_test.rb'
|
15
|
-
t.verbose = false
|
16
|
-
end
|
17
|
-
|
18
|
-
task default: :test
|
4
|
+
# Rails.application.initialize!
|
5
|
+
Rails.application.load_tasks
|
data/app/models/iro/alert.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
|
-
class Iro::Alert
|
3
|
-
|
2
|
+
class Iro::Alert
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
store_in collection: 'iro_alerts'
|
4
6
|
|
5
7
|
SLEEP_TIME_SECONDS = Rails.env.production? ? 60 : 15
|
6
8
|
|
@@ -13,11 +15,20 @@ class Iro::Alert < Iro::ApplicationRecord
|
|
13
15
|
STATUS_ACTIVE = 'active'
|
14
16
|
STATUS_INACTIVE = 'inactive'
|
15
17
|
STATUSES = [ 'active', 'inactive' ]
|
16
|
-
|
17
|
-
|
18
18
|
def self.active
|
19
19
|
where( status: STATUS_ACTIVE )
|
20
20
|
end
|
21
21
|
|
22
|
+
field :class_name
|
23
|
+
validates :class_name, presence: true
|
24
|
+
|
25
|
+
field :symbol
|
26
|
+
validates :symbol, presence: true
|
27
|
+
|
28
|
+
field :direction
|
29
|
+
validates :direction, presence: true
|
30
|
+
|
31
|
+
field :strike
|
32
|
+
validates :strike, presence: true
|
22
33
|
|
23
34
|
end
|
data/app/models/iro/datapoint.rb
CHANGED
@@ -1,5 +1,110 @@
|
|
1
1
|
|
2
|
-
class Iro::Datapoint < Iro::ApplicationRecord
|
3
|
-
self.table_name = "iro_datapoints"
|
4
2
|
|
5
|
-
|
3
|
+
class Iro::Datapoint
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
store_in collection: 'iro_datapoints'
|
7
|
+
|
8
|
+
field :date
|
9
|
+
field :value, type: Float
|
10
|
+
field :kind
|
11
|
+
|
12
|
+
def self.test_0trash
|
13
|
+
add_fields = { '$addFields': {
|
14
|
+
'date_string': {
|
15
|
+
'$dateToString': { 'format': "%Y-%m-%d", 'date': "$created_at" }
|
16
|
+
}
|
17
|
+
} }
|
18
|
+
group = { '$group': {
|
19
|
+
'_id': "$date_string",
|
20
|
+
'my_doc': { '$first': "$$ROOT" }
|
21
|
+
} }
|
22
|
+
group = { '$group': {
|
23
|
+
'_id': "$date",
|
24
|
+
'my_doc': { '$first': "$$ROOT" }
|
25
|
+
} }
|
26
|
+
lookup = { '$lookup': {
|
27
|
+
'from': 'iro_dates',
|
28
|
+
'localField': 'date_string',
|
29
|
+
'foreignField': 'date',
|
30
|
+
'as': 'dates',
|
31
|
+
} }
|
32
|
+
lookup_merge = { '$replaceRoot': {
|
33
|
+
'newRoot': { '$mergeObjects': [
|
34
|
+
{ '$arrayElemAt': [ "$dates", 0 ] }, "$$ROOT"
|
35
|
+
] }
|
36
|
+
} }
|
37
|
+
match = { '$match': {
|
38
|
+
'kind': 'some-type',
|
39
|
+
'created_at': {
|
40
|
+
'$gte': '2023-12-01'.to_datetime,
|
41
|
+
'$lte': '2023-12-31'.to_datetime,
|
42
|
+
}
|
43
|
+
} }
|
44
|
+
|
45
|
+
outs = Iro::Datapoint.collection.aggregate([
|
46
|
+
add_fields,
|
47
|
+
lookup, lookup_merge,
|
48
|
+
match,
|
49
|
+
|
50
|
+
{ '$sort': { 'date_string': 1 } },
|
51
|
+
group,
|
52
|
+
# { '$replaceRoot': { 'newRoot': "$my_doc" } },
|
53
|
+
# { '$project': { '_id': 0, 'date_string': 1, 'value': 1 } },
|
54
|
+
])
|
55
|
+
|
56
|
+
puts! 'result'
|
57
|
+
pp outs.to_a
|
58
|
+
# puts! outs.to_a, 'result'
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.test
|
62
|
+
lookup = { '$lookup': {
|
63
|
+
'from': 'iro_datapoints',
|
64
|
+
'localField': 'date',
|
65
|
+
'foreignField': 'date',
|
66
|
+
'pipeline': [
|
67
|
+
{ '$sort': { 'value': -1 } },
|
68
|
+
],
|
69
|
+
'as': 'datapoints',
|
70
|
+
} }
|
71
|
+
lookup_merge = { '$replaceRoot': {
|
72
|
+
'newRoot': { '$mergeObjects': [
|
73
|
+
{ '$arrayElemAt': [ "$datapoints", 0 ] }, "$$ROOT"
|
74
|
+
] }
|
75
|
+
} }
|
76
|
+
|
77
|
+
|
78
|
+
match = { '$match': {
|
79
|
+
'date': {
|
80
|
+
'$gte': '2023-12-25',
|
81
|
+
'$lte': '2023-12-31',
|
82
|
+
}
|
83
|
+
} }
|
84
|
+
|
85
|
+
group = { '$group': {
|
86
|
+
'_id': "$date",
|
87
|
+
'my_doc': { '$first': "$$ROOT" }
|
88
|
+
} }
|
89
|
+
|
90
|
+
outs = Iro::Date.collection.aggregate([
|
91
|
+
match,
|
92
|
+
|
93
|
+
lookup,
|
94
|
+
lookup_merge,
|
95
|
+
|
96
|
+
group,
|
97
|
+
{ '$replaceRoot': { 'newRoot': "$my_doc" } },
|
98
|
+
# { '$replaceRoot': { 'newRoot': "$my_doc" } },
|
99
|
+
|
100
|
+
|
101
|
+
{ '$project': { '_id': 0, 'date': 1, 'value': 1 } },
|
102
|
+
{ '$sort': { 'date': 1 } },
|
103
|
+
])
|
104
|
+
|
105
|
+
puts! 'result'
|
106
|
+
pp outs.to_a
|
107
|
+
# puts! outs.to_a, 'result'
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
data/app/models/iro/option.rb
CHANGED
@@ -1,7 +1,22 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
|
3
|
+
class Iro::Option
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
store_in collection: 'iro_options'
|
7
|
+
|
8
|
+
# STATUS_ACTIVE = 'active'
|
9
|
+
# STATUS_INACTIVE = 'inactive'
|
10
|
+
# STATUSES = [ 'active', 'inactive' ]
|
11
|
+
# def self.active
|
12
|
+
# where( status: STATUS_ACTIVE )
|
13
|
+
# end
|
14
|
+
|
15
|
+
# field :ticker
|
16
|
+
# validates :ticker, uniqueness: true, presence: true
|
17
|
+
|
18
|
+
field :symbol
|
19
|
+
validates :symbol, uniqueness: true, presence: true
|
20
|
+
|
21
|
+
|
7
22
|
end
|
data/app/models/iro/stock.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
|
3
|
+
class Iro::Stock
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
store_in collection: 'iro_stocks'
|
7
7
|
|
8
8
|
STATUS_ACTIVE = 'active'
|
9
9
|
STATUS_INACTIVE = 'inactive'
|
10
10
|
STATUSES = [ 'active', 'inactive' ]
|
11
|
-
|
12
|
-
validates :ticker, uniqueness: true, presence: true
|
13
|
-
|
14
11
|
def self.active
|
15
12
|
where( status: STATUS_ACTIVE )
|
16
13
|
end
|
17
14
|
|
15
|
+
field :ticker
|
16
|
+
validates :ticker, uniqueness: true, presence: true
|
17
|
+
|
18
|
+
|
18
19
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
<!-- Matomo -->
|
3
|
+
<script>
|
4
|
+
var _paq = window._paq = window._paq || [];
|
5
|
+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
6
|
+
_paq.push(['trackPageView']);
|
7
|
+
_paq.push(['enableLinkTracking']);
|
8
|
+
(function() {
|
9
|
+
var u="//analytics.wasya.co/";
|
10
|
+
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
11
|
+
_paq.push(['setSiteId', '13']); /* 13 :: email.wasya.co */
|
12
|
+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
13
|
+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
14
|
+
})();
|
15
|
+
</script>
|
16
|
+
<!-- End Matomo Code -->
|
@@ -1,18 +1,53 @@
|
|
1
1
|
!!!
|
2
2
|
%html
|
3
3
|
%head
|
4
|
-
%
|
5
|
-
%
|
4
|
+
%title #{@page_title} | Iron Warbler
|
5
|
+
%link{ :rel => 'icon', :href => "/favicon_#{ENV['RAILS_ENV']}.gif" }
|
6
|
+
%meta{ :name => :viewport, :content => 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=2' }
|
7
|
+
%meta{ :charset => 'UTF-8' }
|
8
|
+
%meta{ :description => @page_description }
|
9
|
+
|
10
|
+
= javascript_include_tag "//code.jquery.com/jquery-3.3.1.min.js"
|
11
|
+
|
12
|
+
%script{ :src => "//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js" }
|
13
|
+
= stylesheet_link_tag "//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"
|
14
|
+
|
15
|
+
= stylesheet_link_tag "//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css", :media => 'all'
|
16
|
+
= stylesheet_link_tag "//fonts.googleapis.com/icon?family=Material+Icons"
|
17
|
+
|
18
|
+
= stylesheet_link_tag "//cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"
|
19
|
+
= javascript_include_tag "//cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js"
|
20
|
+
= javascript_include_tag "//cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js"
|
21
|
+
|
22
|
+
= stylesheet_link_tag "//cdn.jsdelivr.net/npm/select2@4.0.0/dist/css/select2.min.css"
|
23
|
+
= javascript_include_tag "//cdn.jsdelivr.net/npm/select2@4.0.0/dist/js/select2.min.js"
|
24
|
+
|
25
|
+
= stylesheet_link_tag "//cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css"
|
26
|
+
= javascript_include_tag "//cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"
|
27
|
+
|
28
|
+
= javascript_include_tag "wco/application"
|
29
|
+
= stylesheet_link_tag "wco/application", media: "all"
|
30
|
+
|
31
|
+
= javascript_include_tag "iron_warbler/application"
|
32
|
+
= stylesheet_link_tag "iron_warbler/application", media: "all"
|
33
|
+
|
34
|
+
-# %script{crossorigin: "", src: "https://unpkg.com/react@18/umd/react.development.js"}
|
35
|
+
-# %script{crossorigin: "", src: "https://unpkg.com/react-dom@18/umd/react-dom.development.js"}
|
36
|
+
-# %script{src: "https://unpkg.com/prop-types@15.6/prop-types.min.js"}
|
37
|
+
-# %script{src: "https://unpkg.com/axios/dist/axios.min.js"}
|
38
|
+
-# %script{src: "https://unpkg.com/recharts/umd/Recharts.js"}
|
39
|
+
|
6
40
|
= csrf_meta_tags
|
7
41
|
= csp_meta_tag
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
=
|
42
|
+
%body{ class: [ params[:controller].gsub("wco_email/",""), "#{params[:controller].gsub("wco_email/","")}-#{params[:action]}", params[:action], "application-fullwidth" ] }
|
43
|
+
|
44
|
+
= render "/wco/main_header"
|
45
|
+
= render "/iro/main_header"
|
46
|
+
= render '/wco/alerts_notices' if notice || alert
|
47
|
+
%hr
|
48
|
+
|
49
|
+
%span.absolute.collapse-expand#mainW
|
50
|
+
= yield
|
51
|
+
|
52
|
+
= render '/wco/main_footer'
|
53
|
+
= render '/iro/analytics' if Rails.env.production?
|
data/lib/iron_warbler.rb
CHANGED
data/lib/tasks/db_tasks.rake
CHANGED
@@ -1,9 +1,33 @@
|
|
1
1
|
|
2
2
|
namespace :db do
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'test'
|
5
|
+
task test: :environment do
|
6
|
+
Iro::Datapoint.test
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'create calendar mdb'
|
5
10
|
task create_calendar: :environment do
|
6
11
|
|
12
|
+
year = 2023
|
13
|
+
d = "#{year}-01-01".to_date
|
14
|
+
out = ""
|
15
|
+
368.times do
|
16
|
+
if d.strftime('%Y').to_i == year+1
|
17
|
+
break
|
18
|
+
end
|
19
|
+
|
20
|
+
Iro::Date.create({ date: d.strftime('%Y-%m-%d') })
|
21
|
+
print '.'
|
22
|
+
|
23
|
+
d = d + 1.day
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'create calendar sql'
|
29
|
+
task create_calendar_sql: :environment do
|
30
|
+
|
7
31
|
year = 2023
|
8
32
|
d = "#{year}-01-01".to_date
|
9
33
|
out = ""
|
@@ -24,4 +48,33 @@ namespace :db do
|
|
24
48
|
`mv /opt/tmp/#{year}_calendar.sql doc/`
|
25
49
|
|
26
50
|
end
|
51
|
+
|
52
|
+
desc 'test datapoints'
|
53
|
+
task create_test_datapoints: :environment do
|
54
|
+
datapoint = Iro::Datapoint.create({
|
55
|
+
date: '2023-12-28',
|
56
|
+
created_at: '2023-12-28 01:00:00',
|
57
|
+
kind: 'some-type',
|
58
|
+
value: 115,
|
59
|
+
})
|
60
|
+
datapoint = Iro::Datapoint.create({
|
61
|
+
date: '2023-12-28',
|
62
|
+
created_at: '2023-12-28 02:00:00',
|
63
|
+
kind: 'some-type',
|
64
|
+
value: 116,
|
65
|
+
})
|
66
|
+
datapoint = Iro::Datapoint.create({
|
67
|
+
date: '2023-12-30',
|
68
|
+
created_at: '2023-12-30 01:00:00',
|
69
|
+
kind: 'some-type',
|
70
|
+
value: 117,
|
71
|
+
})
|
72
|
+
datapoint = Iro::Datapoint.create({
|
73
|
+
date: '2023-12-30',
|
74
|
+
created_at: '2023-12-30 02:00:00',
|
75
|
+
kind: 'some-type',
|
76
|
+
value: 118,
|
77
|
+
})
|
78
|
+
end
|
79
|
+
|
27
80
|
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
namespace :iro do
|
3
|
+
|
4
|
+
## 2023-03-31 _vp_ Continue.
|
5
|
+
# if Time.now.in_time_zone > Time.now.in_time_zone.beginning_of_day + 8.5.hours &&
|
6
|
+
# Time.now.in_time_zone < Time.now.in_time_zone.beginning_of_day + 15.hours
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
desc 'alert on stock price action'
|
10
|
+
task alert_stocks: :environment do
|
11
|
+
while true
|
12
|
+
|
13
|
+
::Iro::Iro.alert_stocks
|
14
|
+
|
15
|
+
print '.'
|
16
|
+
sleep 45 # seconds
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
## 2023-03-31 _vp_ Done, unused.
|
21
|
+
desc 'alert stocks test'
|
22
|
+
task alert_stocks_test: :environment do
|
23
|
+
tickers_str = Iro::OptionWatch.active.where( kind: ::Iro::OptionWatch::KIND_STOCK ).map(&:ticker).join(',')
|
24
|
+
if tickers_str.present?
|
25
|
+
|
26
|
+
out = Tda::Stock.get_quotes( tickers_str )
|
27
|
+
Iro::OptionWatch.active.where( kind: ::Iro::OptionWatch::KIND_STOCK ).each do |watch|
|
28
|
+
|
29
|
+
if watch.direction == Iro::OptionWatch::DIRECTION_ABOVE && out[watch.ticker][:mark] >= watch.mark ||
|
30
|
+
watch.direction == Iro::OptionWatch::DIRECTION_BELOW && out[watch.ticker][:mark] <= watch.mark
|
31
|
+
|
32
|
+
IshManager::ApplicationMailer.stock_alert( watch.id.to_s ).deliver_later
|
33
|
+
watch.update_attributes({ state: Iro::OptionWatch::STATE_INACTIVE })
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
## 2023-02-04 _vp_ :: Continue
|
42
|
+
## 2023-02-06 _vp_ :: LFG
|
43
|
+
desc 'The runner that populates the db for graphing'
|
44
|
+
task :get_chains => :environment do
|
45
|
+
while true
|
46
|
+
|
47
|
+
::Iro::Iro.get_chains
|
48
|
+
|
49
|
+
print '.'
|
50
|
+
# sleep 5 * 60 # 5 minutes
|
51
|
+
sleep 55 * 60 # 1 hr
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Get BTC, ETH price from coinmarketcap'
|
56
|
+
task :get_coins => :environment do
|
57
|
+
while true
|
58
|
+
|
59
|
+
::Iro::Iro.get_coins
|
60
|
+
|
61
|
+
print '.'
|
62
|
+
# sleep 5 * 60 # 5 minutes
|
63
|
+
sleep 55 * 60 # 1 hr
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'Get COP from currencyfreaks, cron'
|
68
|
+
task :get_currencies => :environment do
|
69
|
+
::Iro::Iro.get_currencies
|
70
|
+
puts 'ok'
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'get gme short %'
|
74
|
+
task :get_gme_short_availability_and_fee => :environment do
|
75
|
+
errors = ::Iro::Iro.get_gme_short_availability_and_fee
|
76
|
+
puts errors.presence || '.'
|
77
|
+
end
|
78
|
+
|
79
|
+
## 2023-03-10 _vp_ Continue.
|
80
|
+
desc 'get stocks'
|
81
|
+
task get_stocks: :environment do
|
82
|
+
while true
|
83
|
+
|
84
|
+
::Iro::Iro.get_stocks
|
85
|
+
|
86
|
+
print '.'
|
87
|
+
# sleep 45 # seconds
|
88
|
+
sleep 55 * 60 # 1 hr
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
## 2023-02-06 _vp_ :: Continue
|
93
|
+
## 2023-02-08 _vp_ :: Continue
|
94
|
+
## 2023-03-18 _vp_ :: Continue
|
95
|
+
## 2023-03-19 _vp_ :: Continue, it's intense
|
96
|
+
desc 'watch positions'
|
97
|
+
task watch_positions: :environment do
|
98
|
+
while true
|
99
|
+
|
100
|
+
::Iro::CoveredCall.active.each do |position|
|
101
|
+
position.refresh
|
102
|
+
if position.should_roll?
|
103
|
+
|
104
|
+
position.update({
|
105
|
+
next_delta: position.next_position[:delta],
|
106
|
+
next_outcome: position.next_outcome,
|
107
|
+
next_symbol: position.next_symbol,
|
108
|
+
status: Iro::Position::STATE_PROPOSED,
|
109
|
+
})
|
110
|
+
|
111
|
+
out = IroMailer.should_roll({
|
112
|
+
next_symbol: position.next_symbol,
|
113
|
+
prev_symbol: position.prev_symbol,
|
114
|
+
})
|
115
|
+
Rails.env.production? ? out.deliver_later : out.deliver_now
|
116
|
+
|
117
|
+
print '+'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
print '.'
|
122
|
+
sleep 15 * 60 # 15 min
|
123
|
+
# sleep 60 * 60 # 1 hr
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_warbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.7.
|
4
|
+
version: 2.0.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: cancancan
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: devise
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.9.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.9.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: exception_notification
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.5.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: haml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 6.3.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 6.3.0
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: httparty
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,75 +95,89 @@ dependencies:
|
|
53
95
|
- !ruby/object:Gem::Version
|
54
96
|
version: 2.11.0
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
98
|
+
name: mongoid
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
101
|
- - "~>"
|
60
102
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
103
|
+
version: 7.3.0
|
62
104
|
type: :runtime
|
63
105
|
prerelease: false
|
64
106
|
version_requirements: !ruby/object:Gem::Requirement
|
65
107
|
requirements:
|
66
108
|
- - "~>"
|
67
109
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
110
|
+
version: 7.3.0
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
112
|
+
name: rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 6.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 6.1.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: wco_models
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
129
|
- - "~>"
|
74
130
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.
|
131
|
+
version: 3.1.0
|
76
132
|
type: :runtime
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.
|
138
|
+
version: 3.1.0
|
83
139
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
140
|
+
name: omniauth
|
85
141
|
requirement: !ruby/object:Gem::Requirement
|
86
142
|
requirements:
|
87
143
|
- - "~>"
|
88
144
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
145
|
+
version: 2.1.1
|
90
146
|
type: :runtime
|
91
147
|
prerelease: false
|
92
148
|
version_requirements: !ruby/object:Gem::Requirement
|
93
149
|
requirements:
|
94
150
|
- - "~>"
|
95
151
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
152
|
+
version: 2.1.1
|
97
153
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
154
|
+
name: omniauth-keycloak
|
99
155
|
requirement: !ruby/object:Gem::Requirement
|
100
156
|
requirements:
|
101
157
|
- - "~>"
|
102
158
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
159
|
+
version: 1.5.1
|
104
160
|
type: :runtime
|
105
161
|
prerelease: false
|
106
162
|
version_requirements: !ruby/object:Gem::Requirement
|
107
163
|
requirements:
|
108
164
|
- - "~>"
|
109
165
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
166
|
+
version: 1.5.1
|
111
167
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
168
|
+
name: omniauth-rails_csrf_protection
|
113
169
|
requirement: !ruby/object:Gem::Requirement
|
114
170
|
requirements:
|
115
171
|
- - "~>"
|
116
172
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
173
|
+
version: 1.0.1
|
118
174
|
type: :runtime
|
119
175
|
prerelease: false
|
120
176
|
version_requirements: !ruby/object:Gem::Requirement
|
121
177
|
requirements:
|
122
178
|
- - "~>"
|
123
179
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
180
|
+
version: 1.0.1
|
125
181
|
description: A stocks and Options Trading Bot.
|
126
182
|
email: victor@wasya.co
|
127
183
|
executables: []
|
@@ -130,6 +186,7 @@ extra_rdoc_files: []
|
|
130
186
|
files:
|
131
187
|
- Rakefile
|
132
188
|
- app/assets/config/iron_warbler_manifest.js
|
189
|
+
- app/assets/javascript/iron_warbler/application.js
|
133
190
|
- app/assets/stylesheets/iron_warbler/alerts.css
|
134
191
|
- app/assets/stylesheets/iron_warbler/application.css
|
135
192
|
- app/assets/stylesheets/iron_warbler/datapoints.css
|
@@ -146,13 +203,14 @@ files:
|
|
146
203
|
- app/mailers/iro/alert_mailer.rb
|
147
204
|
- app/mailers/iro/application_mailer.rb
|
148
205
|
- app/models/iro/alert.rb
|
149
|
-
- app/models/iro/application_record.rb
|
150
206
|
- app/models/iro/datapoint.rb
|
207
|
+
- app/models/iro/date.rb
|
151
208
|
- app/models/iro/option.rb
|
152
209
|
- app/models/iro/price_item.rb
|
153
|
-
- app/models/iro/profile.rb
|
154
210
|
- app/models/iro/stock.rb
|
155
211
|
- app/models/tda/api.rb
|
212
|
+
- app/views/iro/_analytics.erb
|
213
|
+
- app/views/iro/_main_header.haml
|
156
214
|
- app/views/iro/alert_mailer/stock_alert.haml
|
157
215
|
- app/views/iro/alerts/_form.haml
|
158
216
|
- app/views/iro/alerts/edit.html.erb
|
@@ -168,18 +226,13 @@ files:
|
|
168
226
|
- app/views/iro/stocks/_form.haml
|
169
227
|
- app/views/iro/stocks/index.haml
|
170
228
|
- app/views/layouts/iro/application.haml
|
229
|
+
- config/initializers/assets.rb
|
171
230
|
- config/routes.rb
|
172
|
-
- db/migrate/20231210204830_create_iro_profiles.rb
|
173
|
-
- db/migrate/20231210205837_create_iro_alerts.rb
|
174
|
-
- db/migrate/20231219204329_create_dates.rb
|
175
|
-
- db/migrate/20231219205644_create_datapoint.rb
|
176
|
-
- db/migrate/20231220193201_create_stocks.rb
|
177
|
-
- db/migrate/20231220194903_add_alert_status.rb
|
178
|
-
- db/migrate/20231220223730_create_iro_price_item.rb
|
179
231
|
- lib/iro/engine.rb
|
180
232
|
- lib/iron_warbler.rb
|
181
233
|
- lib/tasks/db_tasks.rake
|
182
234
|
- lib/tasks/iro_tasks.rake
|
235
|
+
- lib/tasks/iro_tasks.rake-old
|
183
236
|
homepage: https://wasya.co
|
184
237
|
licenses:
|
185
238
|
- Proprietary
|
data/app/models/iro/profile.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
class CreateIroAlerts < ActiveRecord::Migration[6.1]
|
3
|
-
def change
|
4
|
-
create_table :iro_alerts do |t|
|
5
|
-
|
6
|
-
t.string :class_name
|
7
|
-
t.string :kind
|
8
|
-
t.string :symbol
|
9
|
-
t.string :direction
|
10
|
-
t.float :strike
|
11
|
-
t.integer :profile_id
|
12
|
-
|
13
|
-
t.timestamps
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
class CreateIroPriceItem < ActiveRecord::Migration[6.1]
|
2
|
-
def change
|
3
|
-
create_table :iro_price_items do |t|
|
4
|
-
|
5
|
-
t.string "putCall", index: true
|
6
|
-
t.string "symbol", index: true
|
7
|
-
t.string "description"
|
8
|
-
t.string "exchangeName"
|
9
|
-
t.string "bidAskSize"
|
10
|
-
t.string "expirationType"
|
11
|
-
t.float "bid"
|
12
|
-
t.float "ask"
|
13
|
-
t.float "last"
|
14
|
-
t.float "mark"
|
15
|
-
t.float "lastPrice"
|
16
|
-
t.float "highPrice"
|
17
|
-
t.float "lowPrice"
|
18
|
-
t.float "openPrice"
|
19
|
-
t.float "closePrice"
|
20
|
-
t.float "netChange"
|
21
|
-
t.float "volatility"
|
22
|
-
t.float "delta"
|
23
|
-
t.float "gamma"
|
24
|
-
t.float "theta"
|
25
|
-
t.float "vega"
|
26
|
-
t.float "rho"
|
27
|
-
t.float "timeValue"
|
28
|
-
t.float "theoreticalOptionValue"
|
29
|
-
t.float "theoreticalVolatility"
|
30
|
-
t.float "strikePrice"
|
31
|
-
t.float "percentChange"
|
32
|
-
t.float "markChange"
|
33
|
-
t.float "markPercentChange"
|
34
|
-
t.float "intrinsicValue"
|
35
|
-
t.float "multiplier"
|
36
|
-
t.integer "bidSize"
|
37
|
-
t.integer "askSize"
|
38
|
-
t.bigint "totalVolume"
|
39
|
-
t.integer "openInterest"
|
40
|
-
t.integer "daysToExpiration"
|
41
|
-
t.bigint "tradeTimeInLong"
|
42
|
-
t.bigint "quoteTimeInLong"
|
43
|
-
t.bigint "expirationDate", index: true
|
44
|
-
t.bigint "lastTradingDay"
|
45
|
-
t.boolean "inTheMoney"
|
46
|
-
t.boolean "nonStandard"
|
47
|
-
t.boolean "isIndexOption"
|
48
|
-
t.date "tradeDate"
|
49
|
-
t.string "interval"
|
50
|
-
t.string "ticker", limit: 32, index: true
|
51
|
-
t.timestamp "timestamp"
|
52
|
-
|
53
|
-
t.timestamps
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|