Class: Vexapion::Poloniex
Instance Method Summary
collapse
-
#available_account_balances ⇒ Object
-
#balances ⇒ Object
-
#buy(pair, rate, amount) ⇒ Object
-
#cancel_order(order_number) ⇒ Object
-
#complete_balances(account = 'all') ⇒ Object
-
#deposit_addresses ⇒ Object
-
#deposits_withdrawals(start_time, end_time, count) ⇒ Object
-
#fee_info ⇒ Object
-
#generate_new_address(currency) ⇒ Object
-
#initialize(key = nil, secret = nil) ⇒ Poloniex
constructor
A new instance of Poloniex.
-
#margin_account_summary ⇒ Object
-
#margin_buy(pair, rate, amount) ⇒ Object
-
#margin_sell(pair, rate, amount) ⇒ Object
-
#market_trade_history(pair, start_time = '', end_time = '') ⇒ Object
-
#move_order(order_number, rate) ⇒ Object
-
#open_orders(pair) ⇒ Object
-
#orderbook(pair, depth) ⇒ Object
-
#sell(pair, rate, amount) ⇒ Object
-
#set_min_interval(sec) ⇒ Object
-
#ticker ⇒ Object
-
#tradable_balances ⇒ Object
-
#trade_history(pair, start, end_time) ⇒ Object
-
#transfer_balance(currency, amount, from_account, to_account) ⇒ Object
-
#volume_24hours ⇒ Object
-
#withdraw(currency, amount, address) ⇒ Object
#do_command, #error_check, #get_nonce, #set_verify_mode
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Poloniex
8
9
10
11
12
13
14
|
# File 'lib/vexapion/poloniex.rb', line 8
def initialize(key = nil, secret = nil)
super(key, secret)
@public_url = 'https://poloniex.com/public?'
@private_url = 'https://poloniex.com/tradingApi'
set_min_interval(0.5)
end
|
Instance Method Details
#available_account_balances ⇒ Object
89
90
91
|
# File 'lib/vexapion/poloniex.rb', line 89
def available_account_balances
post('returnAvailableAccountBalances')
end
|
#balances ⇒ Object
49
50
51
|
# File 'lib/vexapion/poloniex.rb', line 49
def balances
post('returnBalances')
end
|
#buy(pair, rate, amount) ⇒ Object
66
67
68
69
|
# File 'lib/vexapion/poloniex.rb', line 66
def buy(pair, rate, amount)
post('buy', 'currencyPair' => pair.upcase,
'rate' => rate, 'amount' => amount)
end
|
#cancel_order(order_number) ⇒ Object
76
77
78
|
# File 'lib/vexapion/poloniex.rb', line 76
def cancel_order(order_number)
post('cancelOrder', orderNumber: order_number)
end
|
#complete_balances(account = 'all') ⇒ Object
53
54
55
|
# File 'lib/vexapion/poloniex.rb', line 53
def complete_balances(account='all')
post('returnCompleteBalances', 'account' => account)
end
|
#deposit_addresses ⇒ Object
116
117
118
|
# File 'lib/vexapion/poloniex.rb', line 116
def deposit_addresses
post('returnDepositAddresses')
end
|
#deposits_withdrawals(start_time, end_time, count) ⇒ Object
124
125
126
127
|
# File 'lib/vexapion/poloniex.rb', line 124
def deposits_withdrawals(start_time, end_time, count)
post('returnDepositsWithdrawals',
'start' => start_time, 'end' => end_time, 'count' => count)
end
|
#fee_info ⇒ Object
45
46
47
|
# File 'lib/vexapion/poloniex.rb', line 45
def fee_info
post('returnFeeInfo')
end
|
#generate_new_address(currency) ⇒ Object
120
121
122
|
# File 'lib/vexapion/poloniex.rb', line 120
def generate_new_address(currency)
post('generateNewAddress', 'currency' => currency.upcase)
end
|
#margin_account_summary ⇒ Object
102
103
104
|
# File 'lib/vexapion/poloniex.rb', line 102
def margin_account_summary
post('returnMarginAccountSummary')
end
|
#margin_buy(pair, rate, amount) ⇒ Object
106
107
108
109
|
# File 'lib/vexapion/poloniex.rb', line 106
def margin_buy(pair, rate, amount)
post('marginBuy', 'currencyPair' => pair.upcase,
'rate' => rate, 'amount' => amount)
end
|
#margin_sell(pair, rate, amount) ⇒ Object
111
112
113
114
|
# File 'lib/vexapion/poloniex.rb', line 111
def margin_sell(pair, rate, amount)
post('marginSell', 'currencyPair' => pair.upcase,
'rate' => rate, 'amount' => amount)
end
|
#market_trade_history(pair, start_time = '', end_time = '') ⇒ Object
35
36
37
38
39
40
|
# File 'lib/vexapion/poloniex.rb', line 35
def market_trade_history(pair, start_time='', end_time='')
params = { currencyPair: pair.upcase }
params[:start] = start_time if start_time != ''
params[:end] = end_time if end_time != ''
get('returnTradeHistory', params)
end
|
#move_order(order_number, rate) ⇒ Object
80
81
82
|
# File 'lib/vexapion/poloniex.rb', line 80
def move_order(order_number, rate)
post('moveOrder', orderNumber: order_number, 'rate' => rate)
end
|
#open_orders(pair) ⇒ Object
57
58
59
|
# File 'lib/vexapion/poloniex.rb', line 57
def open_orders(pair)
post('returnOpenOrders', currencyPair: pair.upcase)
end
|
#orderbook(pair, depth) ⇒ Object
31
32
33
|
# File 'lib/vexapion/poloniex.rb', line 31
def orderbook(pair, depth)
get('returnOrderBook', currencyPair: pair.upcase, depth: depth)
end
|
#sell(pair, rate, amount) ⇒ Object
71
72
73
74
|
# File 'lib/vexapion/poloniex.rb', line 71
def sell(pair, rate, amount)
post('sell', 'currencyPair' => pair.upcase,
'rate' => rate, 'amount' => amount)
end
|
#set_min_interval(sec) ⇒ Object
16
17
18
|
# File 'lib/vexapion/poloniex.rb', line 16
def set_min_interval(sec)
@conn.min_interval = sec
end
|
#ticker ⇒ Object
27
28
29
|
# File 'lib/vexapion/poloniex.rb', line 27
def ticker
get('returnTicker')
end
|
#tradable_balances ⇒ Object
93
94
95
|
# File 'lib/vexapion/poloniex.rb', line 93
def tradable_balances
post('returnTradableBalances')
end
|
#trade_history(pair, start, end_time) ⇒ Object
61
62
63
64
|
# File 'lib/vexapion/poloniex.rb', line 61
def trade_history(pair, start, end_time)
post('returnTradeHistory', 'currencyPair' => pair.upcase,
'start' => start, 'end' => end_time)
end
|
#transfer_balance(currency, amount, from_account, to_account) ⇒ Object
97
98
99
100
|
# File 'lib/vexapion/poloniex.rb', line 97
def transfer_balance(currency, amount, from_account, to_account)
post('transferBalance', currency: currency.upcase, amount: amount,
fromAccount: from_account, toAccount: to_account)
end
|
#volume_24hours ⇒ Object
23
24
25
|
# File 'lib/vexapion/poloniex.rb', line 23
def volume_24hours
get('return24hVolume')
end
|
#withdraw(currency, amount, address) ⇒ Object
84
85
86
87
|
# File 'lib/vexapion/poloniex.rb', line 84
def withdraw(currency, amount, address)
post('widthdraw', currency: currency.upcase,
'amount' => amount, 'address' => address)
end
|