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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 817fe321c59fe077810b34daaf097462c339ccbf7a2944845f1f460f3bff72cc
4
- data.tar.gz: 10a0379b148bd595b730d63ab5b63cf624c4c3039c5586309981f840ad0869bd
3
+ metadata.gz: b7ca7e6c0657dbafd3a3e9149fbf05f7a0e0aa275b39d183e145d8802cadc175
4
+ data.tar.gz: c67d4ee07b9646761ed2de0d1291e68d36d7a794ed6b4db58a2d7f2428d72944
5
5
  SHA512:
6
- metadata.gz: 015ce7410f643ea640082ccfc7f231009d527b287a24206eb5b3340a1571b477c95f2da9a9eaed8e7b2f0a1d0162a59f553029a57746a324be560083cbf92f5a
7
- data.tar.gz: cabc439b34662c94886d6893138a51c4be2ace1b8a97fdc7a8fa0859bbea4178fca944043c50365a5b04093269688a95d1d8ce3e1e3c8d52293dac12d3f345c0
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::PriceItem.where({
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
@@ -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
- path = "/v1/marketdata/chains"
104
- out = self.get path, { query: query }
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
@@ -3,7 +3,7 @@ require 'httparty'
3
3
 
4
4
  class Tda::Stock
5
5
  include ::HTTParty
6
- base_uri 'https://api.tdameritrade.com'
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 = "/v1/marketdata/quotes"
17
- inns = self.get path, { query: { apikey: ::TD_AMERITRADE[:apiKey], symbol: tickers } }
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, obj|
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
- quoteTimeInLong: obj[:quoteTimeInLong],
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],
@@ -1,5 +1,5 @@
1
1
 
2
- .stocks--index.maxwidth
2
+ .stocks-index.maxwidth
3
3
  .maxwidth
4
4
  %h5 Stocks
5
5
 
@@ -0,0 +1,5 @@
1
+
2
+ .stocks-show.maxwidth
3
+ %h4= @stock
4
+
5
+ %h5 Max Pain
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.27
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-06-07 00:00:00.000000000 Z
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