Class: Binance::Api::UserDataStream

Inherits:
Object
  • Object
show all
Defined in:
lib/binance/api/user_data_stream.rb

Class Method Summary collapse

Class Method Details

.keepalive!(listen_key: nil, api_key: nil, api_secret_key: nil) ⇒ Object

It’s recommended to send a ping about every 30 minutes.

Raises:



6
7
8
9
10
11
# File 'lib/binance/api/user_data_stream.rb', line 6

def keepalive!(listen_key: nil, api_key: nil, api_secret_key: nil)
  raise Error.new(message: "listen_key is required") if listen_key.nil?
  Request.send!(api_key_type: :none, method: :put, path: "/api/v1/userDataStream",
                params: { listenKey: listen_key }, security_type: :user_stream,
                api_key: api_key, api_secret_key: api_secret_key)
end

.start!(api_key: nil, api_secret_key: nil) ⇒ Object



13
14
15
16
# File 'lib/binance/api/user_data_stream.rb', line 13

def start!(api_key: nil, api_secret_key: nil)
  Request.send!(api_key_type: :none, method: :post, path: "/api/v1/userDataStream",
                security_type: :user_stream, api_key: api_key, api_secret_key: api_secret_key)[:listenKey]
end

.stop!(listen_key: nil, api_key: nil, api_secret_key: nil) ⇒ Object

Raises:



18
19
20
21
22
23
# File 'lib/binance/api/user_data_stream.rb', line 18

def stop!(listen_key: nil, api_key: nil, api_secret_key: nil)
  raise Error.new(message: "listen_key is required") if listen_key.nil?
  Request.send!(api_key_type: :none, method: :delete, path: "/api/v1/userDataStream",
                params: { listenKey: listen_key }, security_type: :user_stream,
                api_key: api_key, api_secret_key: api_secret_key)
end