module Ish::Ameritrade

Constants

CONFIG

Public Class Methods

main_fvrr_2() click to toggle source

AKA stop loss

# 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