ishapi 0.1.8.265 → 0.1.8.266

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a31b2c1c59195d40beaf2848baab7c6d12d8f87e392c1519d5fc48110ea4b50
4
- data.tar.gz: 29b9d3bbf71997d4be3482bdf05b63ac97c7c68410878baff1a8bd64275f8147
3
+ metadata.gz: 833283278eccda017d3d8af0fcaff21a3b89d5f408f3640d85a061a4cc79753b
4
+ data.tar.gz: 39ba1400e727a379f9811ef1baaedc3baf6976cebe79f248fb7f4b9c52b62b6e
5
5
  SHA512:
6
- metadata.gz: 00044fe45a41a9725338383f7e24877b74c683cb77a16b926532953c363d0b57937607444b3da062ec75cf3cab8a5d2ea6dd2d923852f685bd469af8cefb48a4
7
- data.tar.gz: 896b906e06de86b0223624c27b796d1302c9706d10d43614879619fd001a9efab24b3a4c5c3bda249561088c13a18e4165e845da83e622c8efe2556a989c5eef
6
+ metadata.gz: 85f0662bf4c7f5adf0518dae52a41c11585d2cbecc1fd27553c823fa23b0f6d30b246d52e512cb54eb5c0b1f598c836bf8f40d267986080ffde1d9d857f37ae9
7
+ data.tar.gz: 853e067daaed10e499a8a1aaaa582216c7ed1a24eb478b7014467cf6db2bc6a5dd91e823a471d4aa915582c9747d88f81ffc5e4016ccef7f4a66e9cb877db8bc
@@ -8,41 +8,37 @@ module Ishapi
8
8
 
9
9
  ## params: symbol, begin_at, end_at
10
10
  def view
11
- authorize! :view_chain, ::Iro::OptionPriceItem.new
11
+ authorize! :view_chain, ::Iro::OptionPriceItem
12
12
  @opis = ::Iro::OptionPriceItem.where({ ticker: params[:symbol]
13
13
  }).where( "timestamp BETWEEN ? and ? ", params[:begin_at], params[:end_at]
14
14
  ).limit(100)
15
15
  end
16
16
 
17
17
  def view_by_symbol
18
- authorize! :view_chain, ::Iro::OptionPriceItem.new
18
+ authorize! :view_chain, ::Iro::OptionPriceItem
19
19
  @opis = ::Iro::OptionPriceItem.where({ symbol: params[:symbol]
20
20
  }).limit(100)
21
21
  render 'view'
22
22
  end
23
23
 
24
+ # kind-1, always
25
+ def index
26
+ authorize! :view_chain, ::Iro::OptionPriceItem
27
+ @opis = Iro::OptionPriceItem.where({
28
+ expirationDate: '1676062800000',
29
+ timestamp: '2023-02-06 14:46:48',
30
+ })
31
+ @outs = {}
32
+ @opis.map do |opi|
33
+ r = @outs[opi.strikePrice] || {}
34
+ r[opi.putCall] = ((opi.bid + opi.ask)/2).round(3)
35
+ @outs[opi.strikePrice] = r
36
+ end
37
+ render json: @outs
38
+ return
39
+ end
40
+
24
41
  end
25
42
  end
26
43
 
27
- ## this is in scratchpadjs / done
28
- =begin
29
-
30
- SELECT symbol, bid, ask, MAX(`timestamp`) as a
31
- FROM iwa_option_price_items
32
- where symbol = "GME_021023P20"
33
- GROUP BY symbol, bid, ask, DATE(`timestamp`), HOUR(`timestamp`), Minute(`timestamp`)
34
- order by a desc;
35
-
36
- SELECT symbol, MAX(`timestamp`) as a
37
- FROM iwa_option_price_items
38
- where symbol = "GME_021023P20"
39
- GROUP BY symbol, DATE(`timestamp`), HOUR(`timestamp`), Minute(`timestamp`)
40
- order by a desc;
41
-
42
- select timestamp as a FROM iwa_option_price_items
43
- where symbol = "GME_021023P20"
44
- order by a desc;
45
-
46
- =end
47
-
48
44
 
@@ -13,10 +13,15 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
13
13
  queue_as :default
14
14
 
15
15
  ## For recursive parts of type `related`.
16
+ ## Content dispositions:
17
+ # "inline; creation-date=\"Tue, 11 Apr 2023 19:39:42 GMT\"; filename=image005.png; modification-date=\"Tue, 11 Apr 2023 19:47:53 GMT\"; size=14916",
18
+ #
16
19
  ## Content Types:
17
- # "text/html; charset=utf-8"
18
20
  # "application/pdf; name=\"Securities Forward Agreement -- HaulHub Inc -- Victor Pudeyev -- 2021-10-26.docx.pdf\""
19
21
  # "image/jpeg; name=TX_DL_2.jpg"
22
+ # "image/png; name=image005.png"
23
+ # "multipart/alternative; boundary=_000_BL0PR10MB2913C560ADE059F0AB3A6D11829A9BL0PR10MB2913namp_",
24
+ # "text/html; charset=utf-8"
20
25
  # "text/plain; charset=UTF-8"
21
26
  def churn_subpart message, part
22
27
  if part.content_disposition&.include?('attachment')
@@ -89,11 +94,28 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
89
94
  ccs: the_mail.cc,
90
95
  bccs: the_mail.bcc,
91
96
  })
97
+ if the_mail.body.preamble.present?
98
+ @message.preamble = the_mail.body.preamble
99
+ end
100
+ if the_mail.body.epilogue.present?
101
+ @message.epilogue = the_mail.body.epilogue
102
+ end
92
103
 
93
104
  the_mail.parts.each do |part|
94
105
  churn_subpart( @message, part )
95
106
  end
96
107
 
108
+ the_mail.attachments.each do |att|
109
+ photo = Photo.new({
110
+ content_type: att.content_type.split(';')[0],
111
+ original_filename: att.content_type_parameters[:name],
112
+ image_data: att.body.encoded,
113
+ email_message_id: @message.id,
114
+ })
115
+ photo.decode_base64_image
116
+ photo.save
117
+ end
118
+
97
119
  if the_mail.parts.length == 0
98
120
  body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
99
121
  if the_mail.content_type.include?('text/html')
@@ -0,0 +1,17 @@
1
+ #
2
+ # ishapi / option_price_items / index
3
+ #
4
+
5
+ json.array! @outs do |out|
6
+ json.strikePrice opi.strikePrice
7
+ json.symbol opi.symbol
8
+ json.bid opi.bid
9
+ json.ask opi.ask
10
+ json.natural ((opi.bid + opi.ask )/2).round(3)
11
+ json.last opi.last
12
+ # json.lastPrice opi.lastPrice
13
+ # json.open opi.openPrice
14
+ json.timestamp opi.timestamp.strftime('%H:%M:%S')
15
+ json.seconds opi.timestamp.to_i
16
+ end
17
+
@@ -5,7 +5,8 @@
5
5
 
6
6
  json.array! @opis do |opi|
7
7
  json.ticker opi.ticker
8
- # json.putCall opi.putCall
8
+ json.putCall opi.putCall
9
+ json.strikePrice opi.strikePrice
9
10
  json.symbol opi.symbol
10
11
  json.bid opi.bid
11
12
  json.ask opi.ask
data/config/routes.rb CHANGED
@@ -55,6 +55,7 @@ Ishapi::Engine.routes.draw do
55
55
 
56
56
  # resources :option_price_items
57
57
  get 'option_price_items/view-by/symbol/:symbol', to: 'option_price_items#view_by_symbol', :constraints => { :symbol => /[^\/]+/ } ## the symbol is detailed eg 'GME_011924P30'
58
+ get 'option_price_items/index1', to: 'option_price_items#index', defaults: { kind: 'kind-1' }
58
59
  get 'option_price_items/view/:symbol/from/:begin_at/to/:end_at', to: 'option_price_items#view'
59
60
 
60
61
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.265
4
+ version: 0.1.8.266
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-07 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -266,6 +266,7 @@ files:
266
266
  - app/views/ishapi/my/videos/index.jbuilder
267
267
  - app/views/ishapi/newsitems/_index.jbuilder
268
268
  - app/views/ishapi/newsitems/index.jbuilder
269
+ - app/views/ishapi/option_price_items/index.jbuilder
269
270
  - app/views/ishapi/option_price_items/view.jbuilder
270
271
  - app/views/ishapi/orders/_item.jbuilder
271
272
  - app/views/ishapi/orders/_show.jbuilder