Class: IGMarkets::CLI::Sprints

Inherits:
Thor
  • Object
show all
Defined in:
lib/ig_markets/cli/commands/sprints_command.rb

Overview

Implements the ‘ig_markets sprints` command.

Instance Method Summary collapse

Instance Method Details

#createObject



28
29
30
31
32
33
34
# File 'lib/ig_markets/cli/commands/sprints_command.rb', line 28

def create
  Main.begin_session(options) do |dealing_platform|
    deal_reference = dealing_platform.sprint_market_positions.create sprint_market_position_attributes

    Main.report_deal_confirmation deal_reference
  end
end

#listObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ig_markets/cli/commands/sprints_command.rb', line 7

def list
  Main.begin_session(options) do |dealing_platform|
    sprints = dealing_platform.sprint_market_positions.all

    markets = dealing_platform.markets.find sprints.map(&:epic).uniq

    table = Tables::SprintMarketPositionsTable.new sprints, markets: markets

    puts table
  end
end