iron_warbler 2.0.7.29 → 2.0.7.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.txt +2 -5
- data/app/controllers/iro/application_controller.rb +36 -1
- data/app/models/iro/alert.rb +5 -1
- data/app/views/iro/_main_header.haml +1 -0
- data/config/routes.rb +2 -0
- data/lib/iron_warbler.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60966c7bde0f338255d7ab0ce24ebca3311dfcba820b9b0fe5409d4b8eb985bf
|
4
|
+
data.tar.gz: 16c6761d9302739e6a28f283bfd2471d27aa1cdf620c82f0c4dcd455b20e7f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ff908d7efc4e141159b0494b600cb8074fd231f384600e19f8b4b9208609667db517d89c950a0da787579f070339dcb7020c9c560159c62f010f957049bc71f
|
7
|
+
data.tar.gz: 0431c721ac017e981ee375aba955b41a0e360e380431d6c22635189bfbeeaa80ab0443296a0425532e32eed68cd947fbff84f4e3370a92a1e381f67f214fea9c
|
data/README.txt
CHANGED
@@ -11,9 +11,6 @@ calculator: https://www.omnicalculator.com/finance/black-scholes
|
|
11
11
|
|
12
12
|
From: https://pythoninoffice.com/calculate-black-scholes-option-price-in-python/
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
https://api.tdameritrade.com/v1/accounts/232718838/orders/13597943085
|
18
|
-
|
14
|
+
= swagger =
|
19
15
|
|
16
|
+
* https://developer.schwab.com/products/trader-api--individual
|
@@ -5,15 +5,50 @@ Po ||= Iro::Position
|
|
5
5
|
O ||= Iro::Option
|
6
6
|
Sto ||= Iro::Stock
|
7
7
|
|
8
|
+
class Schwab
|
9
|
+
include HTTParty
|
10
|
+
debug_output $stdout
|
11
|
+
end
|
12
|
+
|
8
13
|
class Iro::ApplicationController < Wco::ApplicationController
|
9
14
|
layout 'iro/application'
|
10
15
|
|
11
|
-
before_action :set_lists
|
16
|
+
before_action :set_lists, except: %i| schwab_sync |
|
12
17
|
|
13
18
|
def home
|
14
19
|
authorize! :home, Iro
|
15
20
|
end
|
16
21
|
|
22
|
+
def schwab_sync
|
23
|
+
authorize! :shwab_sync, Iro
|
24
|
+
profile = Wco::Profile.find_by email: 'piousbox@gmail.com'
|
25
|
+
|
26
|
+
out = Schwab.post( "https://api.schwabapi.com/v1/oauth/token", {
|
27
|
+
headers: {
|
28
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
29
|
+
},
|
30
|
+
basic_auth: { username: SCHWAB_DATA[:key], password: SCHWAB_DATA[:secret] },
|
31
|
+
body: {
|
32
|
+
grant_type: 'refresh_token',
|
33
|
+
refresh_token: profile.schwab_refresh_token
|
34
|
+
},
|
35
|
+
})
|
36
|
+
out = out.parsed_response
|
37
|
+
puts! out, 'out'
|
38
|
+
|
39
|
+
attrs = {
|
40
|
+
schwab_access_token: out['access_token'],
|
41
|
+
schwab_refresh_token: out['refresh_token'],
|
42
|
+
schwab_id_token: out['id_token'],
|
43
|
+
}
|
44
|
+
puts! attrs, 'attrs'
|
45
|
+
|
46
|
+
# profile.update(attrs)
|
47
|
+
# profile.save!
|
48
|
+
|
49
|
+
render json: { status: :ok }
|
50
|
+
end
|
51
|
+
|
17
52
|
##
|
18
53
|
## private
|
19
54
|
##
|
data/app/models/iro/alert.rb
CHANGED
@@ -42,7 +42,11 @@ class Iro::Alert
|
|
42
42
|
if ( alert.direction == alert.class::DIRECTION_ABOVE && price >= alert.strike ) ||
|
43
43
|
( alert.direction == alert.class::DIRECTION_BELOW && price <= alert.strike )
|
44
44
|
|
45
|
-
|
45
|
+
if Rails.env.production?
|
46
|
+
Iro::AlertMailer.stock_alert( alert.id.to_s ).deliver_later
|
47
|
+
else
|
48
|
+
Iro::AlertMailer.stock_alert( alert.id.to_s ).deliver_now
|
49
|
+
end
|
46
50
|
alert.update({ status: alert.class::STATUS_INACTIVE })
|
47
51
|
print '^'
|
48
52
|
|
@@ -9,6 +9,7 @@
|
|
9
9
|
%ul
|
10
10
|
%li
|
11
11
|
= link_to "Schwab Login", "https://api.schwabapi.com/v1/oauth/authorize?client_id=#{SCHWAB_DATA[:key]}&redirect_uri=#{SCHWAB_DATA[:redirect_url]}"
|
12
|
+
= link_to '[sync]', schwab_sync_path
|
12
13
|
%li
|
13
14
|
= link_to "Stocks (#{Iro::Stock.all.length})", stocks_path
|
14
15
|
= link_to '[sync]', sync_stocks_path
|
data/config/routes.rb
CHANGED
@@ -24,6 +24,8 @@ Iro::Engine.routes.draw do
|
|
24
24
|
get 'purses/:id', to: 'purses#show', as: :purse, defaults: { template: 'show' }
|
25
25
|
resources :purses
|
26
26
|
|
27
|
+
get 'schwab/sync', to: 'application#schwab_sync', as: :schwab_sync
|
28
|
+
|
27
29
|
get 'stocks/sync', to: 'stocks#sync', as: :sync_stocks
|
28
30
|
resources :stocks
|
29
31
|
|
data/lib/iron_warbler.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: business_time
|