Class: Bitmex::Trade
Overview
Individual and bucketed trades
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(filters = {}) {|Hash| ... } ⇒ Array
Get all trades.
-
#bucketed(bin_size = '1h', filters = {}) {|trade| ... } ⇒ Array
Get previous trades in time buckets.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Bitmex::Base
Instance Method Details
#all(filters = {}) {|Hash| ... } ⇒ Array
Get all trades
15 16 17 18 19 20 21 |
# File 'lib/bitmex/trade.rb', line 15 def all(filters = {}, &ablock) if block_given? websocket.listen trade: filters[:symbol], &ablock else rest.get trade_path, params: filters end end |
#bucketed(bin_size = '1h', filters = {}) {|trade| ... } ⇒ Array
Get previous trades in time buckets
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bitmex/trade.rb', line 34 def bucketed(bin_size = '1h', filters = {}, &ablock) check_binsize bin_size if block_given? topic = { "tradeBin#{bin_size}": filters[:symbol] } websocket.listen topic, &ablock else params = filters.merge binSize: bin_size rest.get trade_path(:bucketed), params: params end end |