iron_warbler 2.0.7.38 → 2.0.7.39

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: c3d26b42528adce8dcac715a0dc3296c6a7dfe8aa69deae868baa38f207d9140
4
- data.tar.gz: c947418c85ee93024ff05d64207ae159b852db6746b3104d5b14174d83dfd575
3
+ metadata.gz: 706bc42f34e116f0071a21611468365ac0a6a2b76fc722c812a9d0158380898b
4
+ data.tar.gz: 670933ff9f081f0c7d31a32a1a99e4af6b933e4d1b019c51b5923d3efd244395
5
5
  SHA512:
6
- metadata.gz: b5b4e030572f6781add522f5fb1b8bebdfdeffdc871153b8b408882f998de6be0069544eecfa58e14b4e8357877fd5a84ab2d153ffa8a463bda86fdab2783633
7
- data.tar.gz: 707028e50d3b1aa4a5522765226ea09b5e5e81e397c1b1541432d46231355ab462569295d5375db958d8c41e6bf475340b073591a18b5a547a5488b0db1039b5
6
+ metadata.gz: 7e3039883ab46c0a8231500f29fffba931f2ba8fb45529ea139464246c1657940d97279f1b4f61f9d8a563640384874096c87949cb617c0e96aa34c6e978d946
7
+ data.tar.gz: b0b80caa5be42c0062836150043e89ef719df3caac02b4535887b17ea8e6b7d180073b2585db7195f83b0adec264ab4421f7f3fcc830fcf2394657081d2fde40
data/README.txt CHANGED
@@ -10,3 +10,8 @@ From: https://docs.galpy.org/en/latest/installation.html
10
10
  calculator: https://www.omnicalculator.com/finance/black-scholes
11
11
 
12
12
  From: https://pythoninoffice.com/calculate-black-scholes-option-price-in-python/
13
+
14
+ = schwab =
15
+ == swagger ==
16
+
17
+ * https://developer.schwab.com/products/trader-api--individual
@@ -34,7 +34,7 @@ class Iro::ApplicationController < Wco::ApplicationController
34
34
  },
35
35
  })
36
36
  out = out.parsed_response
37
- puts! out, 'out'
37
+ # puts! out, 'out'
38
38
 
39
39
  attrs = {
40
40
  schwab_access_token: out['access_token'],
@@ -43,10 +43,12 @@ class Iro::ApplicationController < Wco::ApplicationController
43
43
  }
44
44
  # puts! attrs, 'attrs'
45
45
 
46
- profile.update(attrs)
47
- profile.save!
46
+ if attrs[:schwab_refresh_token]
47
+ profile.update(attrs)
48
+ profile.save!
49
+ end
48
50
 
49
- render json: { status: :ok }
51
+ render json: { attrs: attrs, out: out }
50
52
  end
51
53
 
52
54
  ##
@@ -33,6 +33,8 @@ class Iro::Priceitem
33
33
  field :exchangeName, type: String
34
34
  field :volatility, type: Float
35
35
 
36
+ field :expires_on, type: :date
37
+
36
38
  def self.my_find props={}
37
39
  lookup = { '$lookup': {
38
40
  'from': 'iro_price_items',
@@ -18,18 +18,30 @@ class Tda::Option
18
18
 
19
19
 
20
20
  ##
21
- ## 2023-02-05 _vp_ :: Gets the entire chain
21
+ ## Get entire chains for a ticker
22
+ ## params: { ticker, }
22
23
  ##
23
- def self.get_chain params
24
- opts = { symbol: params[:ticker] } ## use 'GME' as symbol here even though a symbol is eg 'GME_021023P2.5'
25
- query = { apikey: ::TD_AMERITRADE[:apiKey] }.merge opts
26
- puts! query, 'input opts'
24
+ ## 2024-08-09 :: Continue
25
+ ##
26
+ def self.get_chains params
27
+ profile = Wco::Profile.find_by email: 'piousbox@gmail.com'
27
28
 
28
- path = "/v1/marketdata/chains"
29
- out = self.get path, { query: query }
29
+ query = { symbol: params[:ticker] } ## use 'GME' as symbol here even though a symbol is eg 'GME_021023P2.5'
30
+ puts! query, 'query'
31
+
32
+ headers = {
33
+ accept: 'application/json',
34
+ Authorization: "Bearer #{profile[:schwab_access_token]}",
35
+ }
36
+ path = "/chains"
37
+ out = self.get path, {
38
+ basic_auth: { username: SCHWAB_DATA[:key], password: SCHWAB_DATA[:secret] },
39
+ headers: headers,
40
+ query: query }
30
41
  timestamp = DateTime.parse out.headers['date']
31
42
  out = out.parsed_response.deep_symbolize_keys
32
43
 
44
+ byebug
33
45
 
34
46
  outs = []
35
47
  %w| put call |.each do |contractType|
@@ -53,8 +65,8 @@ class Tda::Option
53
65
  end
54
66
  end
55
67
 
56
- outs.each do |x|
57
- opi = ::Iro::OptionPriceItem.create( x )
68
+ outs.each do |out|
69
+ opi = ::Iro::PriceItem.create( out )
58
70
  if !opi.persisted?
59
71
  puts! opi.errors.full_messages, "Cannot create OptionPriceItem"
60
72
  end
@@ -125,7 +137,6 @@ class Tda::Option
125
137
  }
126
138
  puts! out, 'out'
127
139
  timestamp = DateTime.parse out.headers['date']
128
- # out = HTTParty.get "https://api.tdameritrade.com#{path}", { query: query }
129
140
  out = out.parsed_response.deep_symbolize_keys
130
141
 
131
142
 
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.38
4
+ version: 2.0.7.39
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-08-08 00:00:00.000000000 Z
11
+ date: 2024-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: business_time