Module: Cryptomarket::Utils

Included in:
Client, Websocket::AccountClient, Websocket::PublicClient, Websocket::TradingClient
Defined in:
lib/cryptomarket/utils.rb

Instance Method Summary collapse

Instance Method Details

#extend_hash_with_order_params!(hash, symbol: nil, side: nil, quantity: nil, type: nil, timeInForce: nil, price: nil, stopPrice: nil, expireTime: nil, strictValidate: nil, postOnly: nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cryptomarket/utils.rb', line 24

def extend_hash_with_order_params! hash, symbol:nil, side:nil, quantity:nil, type:nil, timeInForce:nil, price:nil, stopPrice:nil, expireTime:nil, strictValidate:nil, postOnly:nil
    if not symbol.nil?
        hash['symbol'] = symbol
    end
    if not side.nil?
        hash['side'] = side
    end
    if not quantity.nil?
        hash['quantity'] = quantity
    end
    if not type.nil?
        hash['type'] = type
    end
    if not timeInForce.nil?
        hash['timeInForce'] = timeInForce
    end
    if not price.nil?
        hash['price'] = price
    end
    if not stopPrice.nil?
        hash['stopPrice'] = stopPrice
    end
    if not expireTime.nil?
        hash['expireTime'] = expireTime
    end
    if not strictValidate.nil?
        hash['strictValidate'] = strictValidate
    end
    if not postOnly.nil?
        hash['postOnly'] = postOnly
    end
end

#extend_hash_with_pagination!(hash, sort: nil, by: nil, from: nil, till: nil, limit: nil, offset: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cryptomarket/utils.rb', line 3

def extend_hash_with_pagination!(hash, sort: nil, by:nil, from: nil, till: nil, limit: nil, offset: nil)
    if not sort.nil?
        hash['sort'] = sort
    end
    if not by.nil?
        hash['by'] = by
    end
    if not from.nil?
        hash['from'] = from
    end
    if not till.nil?
        hash['till'] = till
    end
    if not limit.nil?
        hash['limit'] = limit
    end
    if not offset.nil?
        hash['offset'] = offset
    end
end