penfold 1.0.2 → 1.0.3

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.
Files changed (3) hide show
  1. data/lib/market.rb +0 -37
  2. data/lib/penfold.rb +1 -1
  3. metadata +3 -3
data/lib/market.rb CHANGED
@@ -118,43 +118,6 @@ class Market
118
118
  quote
119
119
  end
120
120
 
121
- require 'json'
122
- def gchain(ticker, expiry)
123
- url = "http://www.google.com/finance/option_chain?q=%s&expd=%s&expm=%s&expy=%s&output=json"
124
- url = url % [ticker.gsub(/-/, "."), expiry.day, expiry.month, expiry.year]
125
-
126
- puts "Fetching #{url}..." if $VERBOSE
127
- doc = with_retry do
128
- JSON.parse(
129
- open(url).read.
130
- gsub(/(\:"\w+):/, '\1'). # Remove extra colon that appears inside strings
131
- gsub('\\', ""). # Remove slashes
132
- gsub(/(['"])?(\w+)(['"])?:/m, '"\2":'), # Quote each key
133
- :symbolize_names => true)
134
- end
135
-
136
- doc[:calls].map do |call|
137
- quote = Quote.new(
138
- :symbol => call[:s],
139
- :last => call[:p].to_f * 100,
140
- :bid => call[:b].to_f * 100,
141
- :ask => call[:a].to_f * 100
142
- )
143
-
144
- unless quote.symbol =~ /^\w+\d+[CP]\d+$/
145
- puts "Dropping bad option #{quote.symbol.inspect}"
146
- next
147
- end
148
-
149
- unless quote.bid > 0 and quote.ask > 0
150
- puts "Option #{quote.symbol.inspect} has no bid or ask"
151
- next
152
- end
153
-
154
- [call[:strike].to_f * 100, quote]
155
- end.compact
156
- end
157
-
158
121
  def chain(ticker, expiry)
159
122
  url = "http://finance.yahoo.com/q/op?s=%s&m=%s" % [ticker, expiry.strftime("%Y-%m")]
160
123
  puts "Fetching #{url}..." if $VERBOSE
data/lib/penfold.rb CHANGED
@@ -16,5 +16,5 @@ require 'covered_call_expiry_otm_exit'
16
16
  require 'black_scholes'
17
17
 
18
18
  module Penfold
19
- VERSION = '1.0.2'
19
+ VERSION = '1.0.3'
20
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: penfold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew A. Smith