Class: Bitmart::API::V1::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmart/api_account.rb

Constant Summary collapse

API_ENDPOINT =
'https://api-cloud.bitmart.com/account/v1'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil, api_sign = nil, api_memo = nil) ⇒ Account

Returns a new instance of Account.



13
14
15
16
17
# File 'lib/bitmart/api_account.rb', line 13

def initialize(api_key = nil, api_sign = nil, api_memo = nil)
    @api_key = api_key
    @api_sign = api_sign
    @api_memo = api_memo
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



7
8
9
# File 'lib/bitmart/api_account.rb', line 7

def api_key
  @api_key
end

#api_memoObject (readonly)

Returns the value of attribute api_memo.



9
10
11
# File 'lib/bitmart/api_account.rb', line 9

def api_memo
  @api_memo
end

#api_signObject (readonly)

Returns the value of attribute api_sign.



8
9
10
# File 'lib/bitmart/api_account.rb', line 8

def api_sign
  @api_sign
end

#signatureObject (readonly)

Returns the value of attribute signature.



11
12
13
# File 'lib/bitmart/api_account.rb', line 11

def signature
  @signature
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



10
11
12
# File 'lib/bitmart/api_account.rb', line 10

def timestamp
  @timestamp
end

Instance Method Details

#get_currenciesObject



20
21
22
23
24
25
# File 'lib/bitmart/api_account.rb', line 20

def get_currencies
    request(
        http_method: :get,
        endpoint: "currencies"
    )
end

#get_deposit_address(currency) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/bitmart/api_account.rb', line 40

def get_deposit_address(currency)
    params = {
        'currency': currency
    }
    request(
        http_method: :get,
        endpoint: "wallet",
        params: params
    )
end

#get_deposit_withdraw_detail(id) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/bitmart/api_account.rb', line 95

def get_deposit_withdraw_detail(id)
    params = {
        'id': id
    }
    request(
        http_method: :get,
        endpoint: "deposit-withdraw/detail",
        params: params
    )
end

#get_deposit_withdraw_history(currency, operationType, offset, limit) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/bitmart/api_account.rb', line 80

def get_deposit_withdraw_history(currency, operationType, offset, limit)
    params = {
        'currency': currency,
        'limit': limit,
        'offset': offset,
        'operation_type': operationType,
    }
    request(
        http_method: :get,
        endpoint: "deposit-withdraw/history",
        params: params
    )
end

#get_wallet(accountType) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/bitmart/api_account.rb', line 28

def get_wallet(accountType)
    params = {
        'account_type': accountType
    }
    request(
        http_method: :get,
        endpoint: "wallet",
        params: params
    )
end

#get_withdraw_charge(currency) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/bitmart/api_account.rb', line 52

def get_withdraw_charge(currency)
    params = {
        'currency': currency
    }
    request(
        http_method: :get,
        endpoint: "withdraw/charge",
        params: params
    )
end

#post_withdraw_apply(currency, amount, destination, address, address_memo) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bitmart/api_account.rb', line 64

def post_withdraw_apply(currency, amount, destination, address, address_memo)
    params = {
        'address': address,
        'address_memo': address_memo,
        'amount': amount,
        'currency': currency,
        'destination': destination,
    }
    request(
        http_method: :post,
        endpoint: "withdraw/apply",
        params: params
    )
end