robinhood_rails 0.0.3 → 0.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_rails/robinhood.rb +18 -0
- data/lib/robinhood_rails/version.rb +1 -1
- 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: 6058301b5f615b03859ec6560c3f75616a8bba3c
|
4
|
+
data.tar.gz: df048490be906619de8ce2662404fec10327b8b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70cfe1dc42b20274ef48bddedc6e2fc852165831d55a7dd769891fc27fc429a7102a86e4c899fcef0c05451f9caaf1a111189cb5e0632eff1cff47236b0012c6
|
7
|
+
data.tar.gz: 61f9a3ab86711036ab2ecc12092947a07a46c3348d042bb1848c21bbbc0574a587a575cabefb9900d01224a3a1ab652a96dc4a2360c423bb593cc24c704e933d
|
@@ -141,6 +141,24 @@ class Robinhood
|
|
141
141
|
)
|
142
142
|
end
|
143
143
|
|
144
|
+
def stop_loss_sell(symbol, instrument_id, price, quantity)
|
145
|
+
raw_response = HTTParty.post(
|
146
|
+
endpoints[:orders],
|
147
|
+
body: {
|
148
|
+
'account' => "https://api.robinhood.com/accounts/#{ENV['ROBINHOOD_ACCOUNT_NUMBER']}/",
|
149
|
+
'instrument' => "https://api.robinhood.com/instruments/#{instrument_id}/",
|
150
|
+
'stop_price' => price,
|
151
|
+
'quantity' => quantity,
|
152
|
+
'side' => "sell",
|
153
|
+
'symbol' => symbol,
|
154
|
+
'time_in_force' => 'gfd',
|
155
|
+
'trigger' => 'stop',
|
156
|
+
'type' => 'market'
|
157
|
+
}.as_json,
|
158
|
+
headers: headers
|
159
|
+
)
|
160
|
+
end
|
161
|
+
|
144
162
|
def cancel_order(order_id)
|
145
163
|
raw_response = HTTParty.post("https://api.robinhood.com/orders/#{order_id}/cancel/", headers: headers)
|
146
164
|
raw_response.code == 200
|