Class: Vexapion::Poloniex

Inherits:
BaseExchanges show all
Defined in:
lib/vexapion/poloniex.rb

Instance Method Summary collapse

Methods inherited from BaseExchanges

#disconnect, #do_command, #get_nonce, #set_verify_mode

Constructor Details

#initialize(key = nil, secret = nil) ⇒ Poloniex

:stopdoc:



9
10
11
12
13
14
15
# File 'lib/vexapion/poloniex.rb', line 9

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_balancesObject



91
92
93
# File 'lib/vexapion/poloniex.rb', line 91

def 
	post('returnAvailableAccountBalances')
end

#balancesObject



51
52
53
# File 'lib/vexapion/poloniex.rb', line 51

def balances
	post('returnBalances')
end

#buy(pair, rate, amount) ⇒ Object



68
69
70
71
# File 'lib/vexapion/poloniex.rb', line 68

def buy(pair, rate, amount)
	post('buy', 'currencyPair' => pair.upcase, 
		'rate' => rate, 'amount' => amount)
end

#cancel_order(order_number) ⇒ Object



78
79
80
# File 'lib/vexapion/poloniex.rb', line 78

def cancel_order(order_number)
	post('cancelOrder', orderNumber: order_number)
end

#complete_balances(account = 'all') ⇒ Object



55
56
57
# File 'lib/vexapion/poloniex.rb', line 55

def complete_balances(='all')
	post('returnCompleteBalances', 'account' => )
end

#deposit_addressesObject



118
119
120
# File 'lib/vexapion/poloniex.rb', line 118

def deposit_addresses
	post('returnDepositAddresses')
end

#deposits_withdrawals(start_time, end_time, count) ⇒ Object



126
127
128
129
# File 'lib/vexapion/poloniex.rb', line 126

def deposits_withdrawals(start_time, end_time, count)
	post('returnDepositsWithdrawals',
		'start' => start_time, 'end' => end_time, 'count' => count)
end

#fee_infoObject

Trade(Private) API



47
48
49
# File 'lib/vexapion/poloniex.rb', line 47

def fee_info
	post('returnFeeInfo')
end

#generate_new_address(currency) ⇒ Object



122
123
124
# File 'lib/vexapion/poloniex.rb', line 122

def generate_new_address(currency)
	post('generateNewAddress', 'currency' => currency.upcase)
end

#margin_account_summaryObject



104
105
106
# File 'lib/vexapion/poloniex.rb', line 104

def 
	post('returnMarginAccountSummary')
end

#margin_buy(pair, rate, amount) ⇒ Object



108
109
110
111
# File 'lib/vexapion/poloniex.rb', line 108

def margin_buy(pair, rate, amount)
	post('marginBuy', 'currencyPair' => pair.upcase,
	  'rate' => rate, 'amount' => amount)
end

#margin_sell(pair, rate, amount) ⇒ Object



113
114
115
116
# File 'lib/vexapion/poloniex.rb', line 113

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



37
38
39
40
41
42
# File 'lib/vexapion/poloniex.rb', line 37

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



82
83
84
# File 'lib/vexapion/poloniex.rb', line 82

def move_order(order_number, rate)
	post('moveOrder', orderNumber: order_number, 'rate' => rate)
end

#open_orders(pair) ⇒ Object



59
60
61
# File 'lib/vexapion/poloniex.rb', line 59

def open_orders(pair)
	post('returnOpenOrders', currencyPair: pair.upcase)
end

#orderbook(pair, depth) ⇒ Object



33
34
35
# File 'lib/vexapion/poloniex.rb', line 33

def orderbook(pair, depth)
	get('returnOrderBook', currencyPair: pair.upcase, depth: depth)
end

#sell(pair, rate, amount) ⇒ Object



73
74
75
76
# File 'lib/vexapion/poloniex.rb', line 73

def sell(pair, rate, amount)
	post('sell', 'currencyPair' => pair.upcase,
		'rate' => rate, 'amount' => amount)
end

#set_min_interval(sec) ⇒ Object

:startdoc:



18
19
20
# File 'lib/vexapion/poloniex.rb', line 18

def set_min_interval(sec)
	@conn.min_interval = sec
end

#tickerObject



29
30
31
# File 'lib/vexapion/poloniex.rb', line 29

def ticker
	get('returnTicker')
end

#tradable_balancesObject



95
96
97
# File 'lib/vexapion/poloniex.rb', line 95

def tradable_balances
	post('returnTradableBalances')
end

#trade_history(pair, start, end_time) ⇒ Object



63
64
65
66
# File 'lib/vexapion/poloniex.rb', line 63

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



99
100
101
102
# File 'lib/vexapion/poloniex.rb', line 99

def transfer_balance(currency, amount, , )
	post('transferBalance', currency: currency.upcase, amount: amount,
		fromAccount: , toAccount: )
end

#volume_24hoursObject

Public API



25
26
27
# File 'lib/vexapion/poloniex.rb', line 25

def volume_24hours
	get('return24hVolume')
end

#withdraw(currency, amount, address) ⇒ Object



86
87
88
89
# File 'lib/vexapion/poloniex.rb', line 86

def withdraw(currency, amount, address)
	post('widthdraw', currency: currency.upcase,
		'amount' => amount, 'address' => address)
end