iron_warbler 2.0.7.29 → 2.0.7.31
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: 77291471aceb0397f44a18ac2432d5441f775253b208943fcfe2209e17f8ef97
|
4
|
+
data.tar.gz: ec2092f62fd8f44ae03cf56224d4e1cc3d1d06ca8b5bc19b3e504d4e588517e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 888704ebb26753c43c23e0097a218b3107633409e2d36cf2797bc07f88baaa86e40a114683b1609162abae1bef315956528239af588fc2b3df1996da96cd7b2a
|
7
|
+
data.tar.gz: c33c87cdd2059215626a470e561e3ed501f10c0e3d1bac33e18a033a198a13f6693e663eed3bd0f75521893c0e61b1dc8ec424bfa19bd495977b2046b4b66706
|
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.31
|
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
|