Class: Vexapion::Poloniex

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

Instance Method Summary collapse

Methods inherited from BaseExchanges

#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_balancesObject



89
90
91
# File 'lib/vexapion/poloniex.rb', line 89

def 
  post('returnAvailableAccountBalances')
end

#balancesObject



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(='all')
  post('returnCompleteBalances', 'account' => )
end

#deposit_addressesObject



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_infoObject

Trade(Private) API



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_summaryObject



102
103
104
# File 'lib/vexapion/poloniex.rb', line 102

def 
  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

#tickerObject



27
28
29
# File 'lib/vexapion/poloniex.rb', line 27

def ticker
  get('returnTicker')
end

#tradable_balancesObject



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, , )
  post('transferBalance', currency: currency.upcase, amount: amount,
    fromAccount: , toAccount: )
end

#volume_24hoursObject

Public API



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