iron_warbler 2.0.7.27 → 2.0.7.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/iro/stocks_controller.rb +2 -1
- data/app/models/tda/option.rb +9 -3
- data/app/models/tda/stock.rb +12 -6
- data/app/views/iro/stocks/index.haml +1 -1
- data/app/views/iro/stocks/show.haml +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ca7e6c0657dbafd3a3e9149fbf05f7a0e0aa275b39d183e145d8802cadc175
|
4
|
+
data.tar.gz: c67d4ee07b9646761ed2de0d1291e68d36d7a794ed6b4db58a2d7f2428d72944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad587c8488a2a3a1f7a269c32129ba879c3fde5fb54e2a32a7e2a2f45132995e7d2566a492e002c9ee72d83cfb40fdbc1c81dc5f7a536cd5b368cdb95bb2a038
|
7
|
+
data.tar.gz: 4c08a09952620d5339e9f76e5b29ebf5d1134fe0fd20b774f3b7123cd6fe28683b7f517388ac08f1af6142df4edda686d36ab304ff8816c954ce368bdf5a22db
|
@@ -54,11 +54,12 @@ class Iro::StocksController < Iro::ApplicationController
|
|
54
54
|
def show
|
55
55
|
authorize! :show, @stock
|
56
56
|
|
57
|
-
@priceitems = Iro::
|
57
|
+
@priceitems = ::Iro::Priceitem.where({
|
58
58
|
ticker: @stock.ticker,
|
59
59
|
})
|
60
60
|
|
61
61
|
respond_to do |format|
|
62
|
+
format.html
|
62
63
|
format.json do
|
63
64
|
render layout: false
|
64
65
|
end
|
data/app/models/tda/option.rb
CHANGED
@@ -4,7 +4,8 @@ require 'httparty'
|
|
4
4
|
class Tda::Option
|
5
5
|
|
6
6
|
include ::HTTParty
|
7
|
-
base_uri 'https://api.tdameritrade.com'
|
7
|
+
# base_uri 'https://api.tdameritrade.com'
|
8
|
+
base_uri 'https://api.schwabapi.com/marketdata/v1'
|
8
9
|
|
9
10
|
|
10
11
|
##
|
@@ -100,8 +101,13 @@ class Tda::Option
|
|
100
101
|
query = { apikey: ::TD_AMERITRADE[:apiKey] }.merge opts
|
101
102
|
# puts! query, 'input opts'
|
102
103
|
|
103
|
-
|
104
|
-
|
104
|
+
headers = {
|
105
|
+
Authorize: "Bearer #{::TD_AMERITRADE[:access_token]}",
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
path = "/chains"
|
110
|
+
out = self.get path, { headers: headers, query: query }
|
105
111
|
timestamp = DateTime.parse out.headers['date']
|
106
112
|
## out = HTTParty.get "https://api.tdameritrade.com#{path}", { query: query }
|
107
113
|
out = out.parsed_response.deep_symbolize_keys
|
data/app/models/tda/stock.rb
CHANGED
@@ -3,7 +3,7 @@ require 'httparty'
|
|
3
3
|
|
4
4
|
class Tda::Stock
|
5
5
|
include ::HTTParty
|
6
|
-
base_uri 'https://api.
|
6
|
+
base_uri 'https://api.schwabapi.com/marketdata/v1'
|
7
7
|
|
8
8
|
## alias
|
9
9
|
def self.get_quote which
|
@@ -13,9 +13,15 @@ class Tda::Stock
|
|
13
13
|
## tickers = "GME"
|
14
14
|
## tickers = "NVDA,GME"
|
15
15
|
def self.get_quotes tickers
|
16
|
-
path = "/
|
17
|
-
|
16
|
+
path = "/quotes"
|
17
|
+
headers = {
|
18
|
+
accept: 'application/json',
|
19
|
+
Authorization: "Bearer #{::SCHWAB_DATA[:access_token]}",
|
20
|
+
}
|
21
|
+
inns = self.get path, { headers: headers, query: { symbols: tickers } }
|
18
22
|
inns = inns.parsed_response
|
23
|
+
# puts! inns, 'parsed response'
|
24
|
+
|
19
25
|
if [ NilClass, String ].include?( inns.class )
|
20
26
|
return []
|
21
27
|
end
|
@@ -23,7 +29,8 @@ class Tda::Stock
|
|
23
29
|
inns[k] = v.deep_symbolize_keys
|
24
30
|
end
|
25
31
|
outs = []
|
26
|
-
inns.each do |symbol,
|
32
|
+
inns.each do |symbol, _obj|
|
33
|
+
obj = _obj[:quote]
|
27
34
|
outs.push ::Iro::Priceitem.create!({
|
28
35
|
putCall: 'STOCK',
|
29
36
|
symbol: symbol,
|
@@ -37,8 +44,7 @@ class Tda::Stock
|
|
37
44
|
closePrice: obj[:closePrice],
|
38
45
|
highPrice: obj[:highPrice],
|
39
46
|
lowPrice: obj[:lowPrice],
|
40
|
-
|
41
|
-
timestamp: Time.at( obj[:quoteTimeInLong]/1000 ),
|
47
|
+
timestamp: Time.at( obj[:quoteTime]/1000 ),
|
42
48
|
totalVolume: obj[:totalVolume],
|
43
49
|
mark: obj[:mark],
|
44
50
|
exchangeName: obj[:exchangeName],
|
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.28
|
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-
|
11
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: business_time
|
@@ -304,6 +304,7 @@ files:
|
|
304
304
|
- app/views/iro/stocks/_grid_is_short.haml
|
305
305
|
- app/views/iro/stocks/edit.haml
|
306
306
|
- app/views/iro/stocks/index.haml
|
307
|
+
- app/views/iro/stocks/show.haml
|
307
308
|
- app/views/iro/strategies/_form.haml
|
308
309
|
- app/views/iro/strategies/_header.haml
|
309
310
|
- app/views/iro/strategies/_show.haml
|