class OrderByTWAPCommand

Public Instance Methods

run(options) click to toggle source
# File lib/bitflyer/cli/command/order_by_twap_command.rb, line 6
def run(options)
  type = options.type
  amount = options.amount
  number = options.number_of_times
  interval = options.interval

  number.to_i.times do |_|
    order(type, amount)
    sleep interval
  end
end

Private Instance Methods

order(type, amount) click to toggle source
# File lib/bitflyer/cli/command/order_by_twap_command.rb, line 20
def order(type, amount)
  response = http_private_client.send_child_order(
      product_code: 'FX_BTC_JPY',
      child_order_type: 'MARKET',
      side: type.upcase,
      size: amount
  )

  if response['child_order_acceptance_id'].nil?
    puts "An error has occurred\n" + response.to_s
  else
    puts response.to_s
  end
end