Class: Bitmex::Chat
Overview
Trollbox Data
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#channels ⇒ Array
Get available channels.
-
#messages(options = { count: 100, reverse: true }) {|Hash| ... } ⇒ Array
Get chat messages.
-
#send(message, options = { channelID: 1 }) ⇒ Object
Send a chat message.
-
#stats {|Hash| ... } ⇒ Bitmex::Mash
Get connected users.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Bitmex::Base
Instance Method Details
#channels ⇒ Array
Get available channels
25 26 27 |
# File 'lib/bitmex/chat.rb', line 25 def channels rest.get chat_path(:channels) end |
#messages(options = { count: 100, reverse: true }) {|Hash| ... } ⇒ Array
Get chat messages
15 16 17 18 19 20 21 |
# File 'lib/bitmex/chat.rb', line 15 def ( = { count: 100, reverse: true }, &ablock) if block_given? websocket.listen chat: [:channelID], &ablock else rest.get chat_path, params: end end |
#send(message, options = { channelID: 1 }) ⇒ Object
Send a chat message
44 45 46 47 |
# File 'lib/bitmex/chat.rb', line 44 def send(, = { channelID: 1 }) params = { message: , channelID: [:channelID] } rest.post chat_path, params: params end |
#stats {|Hash| ... } ⇒ Bitmex::Mash
Get connected users
32 33 34 35 36 37 38 |
# File 'lib/bitmex/chat.rb', line 32 def stats(&ablock) if block_given? websocket.listen connected: nil, &ablock else rest.get chat_path(:connected) end end |