Module: Ish::Ameritrade
- Defined in:
- lib/ish/ameritrade.rb
Defined Under Namespace
Classes: Api
Constant Summary collapse
- CONFIG =
{ underlying_downprice_tolerance: 0.14, }
Class Method Summary collapse
-
.main_fvrr_2 ⇒ Object
AKA stop loss.
Class Method Details
.main_fvrr_2 ⇒ Object
AKA stop loss
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ish/ameritrade.rb', line 34 def self.main_fvrr_2 # response = ::Ish::Ameritrade::Api.get_quote({ symbol: 'FVRR_082021P200' }) # @TODO: pass the info on the position in here. strike_price = 200 # What is my risk tolerance here? 14% down movement of the underlying response = ::Ish::Ameritrade::Api.get_quote({ symbol: 'FVRR' }) last_price = response[:lastPrice] tolerable_price = ( strike_price * (1-CONFIG[:underlying_downprice_tolerance]) ) if last_price < tolerable_price puts! 'LIMIT TRIGGERED, LETS EXIT' # @TODO: send an email end end |