robinhood-api 0.3 → 0.4
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 +4 -4
- data/lib/robinhood.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d0fbdabc887db5596ff5ce6a66e3f6aaddbb8a8
|
4
|
+
data.tar.gz: 014f791c53faf20d4fa38c2d87d7c146eab52d42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 659bc03021db7b109943d7e5609d1e2c2532de5467ff0acc8326afb290a6d9e9598d579926036772b7ba2b15664e20238a6f4f324ede1ebfce088beed640d2c1
|
7
|
+
data.tar.gz: 98859191ed7a72292196d8a5cd95bcd95c45b0101cd4cb00ecc0112734ac29167154217b1fd4380225765e74e7d736c69c37ad9423476b8e4a7ff539b1393b0a
|
data/lib/robinhood.rb
CHANGED
@@ -64,7 +64,12 @@ module RobinhoodModule
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def instruments(symbol)
|
67
|
-
|
67
|
+
if symbol.include?('-')
|
68
|
+
raw_response = HTTParty.get("#{endpoints[:instruments]}#{symbol}/", headers: headers)
|
69
|
+
else
|
70
|
+
raw_response = HTTParty.get(endpoints[:instruments], query: {'query' => symbol.upcase}, headers: headers)
|
71
|
+
end
|
72
|
+
|
68
73
|
JSON.parse(raw_response.body)
|
69
74
|
end
|
70
75
|
|
@@ -168,7 +173,7 @@ module RobinhoodModule
|
|
168
173
|
raw_response.code == 200
|
169
174
|
end
|
170
175
|
|
171
|
-
def positions(account_number, instrument_id=nil)
|
176
|
+
def positions(account_number, instrument_id = nil)
|
172
177
|
url = "https://api.robinhood.com/accounts/#{account_number}/positions"
|
173
178
|
if instrument_id
|
174
179
|
url = "#{url}/#{instrument_id}/"
|