Class: IGMarkets::CLI::Stream

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

Overview

Implements the ‘ig_markets stream` command.

Instance Method Summary collapse

Instance Method Details

#dashboardObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ig_markets/cli/commands/stream_command.rb', line 9

def dashboard
  Main.begin_session(options) do |dealing_platform|
    dealing_platform.streaming.connect
    dealing_platform.streaming.on_error { |error| @error = error }

    window = CursesWindow.new

     = Streaming::AccountState.new dealing_platform
    .start

     , window until @error

    raise @error
  end
end

#rawObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ig_markets/cli/commands/stream_command.rb', line 34

def raw
  Main.begin_session(options) do |dealing_platform|
    @dealing_platform = dealing_platform
    @queue = Queue.new

    @dealing_platform.streaming.on_error { |error| on_error error }
    @dealing_platform.streaming.connect
    start_raw_subscriptions

    main_loop
  end
end