Module: PoloniexRuby

Defined in:
lib/configuration.rb,
lib/poloniex_ruby.rb,
lib/poloniex_ruby/version.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



3
4
5
# File 'lib/configuration.rb', line 3

def configuration
  @configuration
end

Class Method Details

.active_loansObject



31
32
33
34
# File 'lib/poloniex_ruby.rb', line 31

def self.active_loans
  res = post 'returnActiveLoans'
  res_hash res
end

.available_account_balancesObject



91
92
93
94
# File 'lib/poloniex_ruby.rb', line 91

def self.
  res = post 'returnAvailableAccountBalances'
  res_hash res
end

.balancesObject



36
37
38
39
# File 'lib/poloniex_ruby.rb', line 36

def self.balances
  res = post 'returnBalances'
  res_hash res
end

.buy(currency_pair, rate, amount) ⇒ Object



66
67
68
69
# File 'lib/poloniex_ruby.rb', line 66

def self.buy( currency_pair, rate, amount )
  res = post 'buy', currencyPair: currency_pair, rate: rate, amount: amount
  res_hash res
end

.cancel_order(currency_pair, order_number) ⇒ Object



76
77
78
79
# File 'lib/poloniex_ruby.rb', line 76

def self.cancel_order( currency_pair, order_number )
  res = post 'cancelOrder', currencyPair: currency_pair, orderNumber: order_number
  res_hash res
end

.complete_balancesObject



51
52
53
54
# File 'lib/poloniex_ruby.rb', line 51

def self.complete_balances
  res = post 'returnCompleteBalances'
  res_hash res
end

.currenciesObject



46
47
48
49
# File 'lib/poloniex_ruby.rb', line 46

def self.currencies
  res = get 'returnCurrencies'
  res_hash res
end

.deposit_addressesObject



121
122
123
124
# File 'lib/poloniex_ruby.rb', line 121

def self.deposit_addresses
  res = post 'returnDepositAddresses'
  res_hash res
end

.deposits_withdrawls(start = 0, end_time = Time.now.to_i) ⇒ Object



131
132
133
134
# File 'lib/poloniex_ruby.rb', line 131

def self.deposits_withdrawls( start = 0, end_time = Time.now.to_i )
  res = post 'returnDepositsWithdrawals', start: start, :end => end_time
  res_hash res
end

.generate_new_address(currency) ⇒ Object



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

def self.generate_new_address( currency )
  res = post 'generateNewAddress', currency: currency
  res_hash res
end

.get_all_daily_exchange_rates(currency_pair) ⇒ Object



11
12
13
14
# File 'lib/poloniex_ruby.rb', line 11

def self.get_all_daily_exchange_rates( currency_pair )
  res = get 'returnChartData', currencyPair: currency_pair, period: 86400,  start: 0, :end => Time.now.to_i
  res_hash res
end

.lending_history(start = 0, end_time = Time.now.to_i) ⇒ Object



41
42
43
44
# File 'lib/poloniex_ruby.rb', line 41

def self.lending_history( start = 0, end_time = Time.now.to_i )
  res = post 'returnLendingHistory', start: start, :end => end_time
  res_hash res
end

.margin_account_summaryObject



106
107
108
109
# File 'lib/poloniex_ruby.rb', line 106

def self.
  res = post 'returnMarginAccountSummary'
  res_hash res
end

.margin_buy(currency_pair, rate, amount) ⇒ Object



111
112
113
114
# File 'lib/poloniex_ruby.rb', line 111

def self.margin_buy(currency_pair, rate, amount)
  res = post 'marginBuy', currencyPair: currency_pair, rate: rate, amount: amount
  res_hash res
end

.margin_sell(currency_pair, rate, amount) ⇒ Object



116
117
118
119
# File 'lib/poloniex_ruby.rb', line 116

def self.margin_sell(currency_pair, rate, amount)
  res = post 'marginSell', currencyPair: currency_pair, rate: rate, amount: amount
  res_hash res
end

.move_order(order_number, rate) ⇒ Object



81
82
83
84
# File 'lib/poloniex_ruby.rb', line 81

def self.move_order( order_number, rate )
  res = post 'moveOrder', orderNumber: order_number, rate: rate
  res_hash res
end

.open_orders(currency_pair) ⇒ Object



56
57
58
59
# File 'lib/poloniex_ruby.rb', line 56

def self.open_orders( currency_pair )
  res = post 'returnOpenOrders', currencyPair: currency_pair
  res_hash res
end

.order_book(currency_pair) ⇒ Object



26
27
28
29
# File 'lib/poloniex_ruby.rb', line 26

def self.order_book( currency_pair )
  res = get 'returnOrderBook', currencyPair: currency_pair
  res_hash res
end

.sell(currency_pair, rate, amount) ⇒ Object



71
72
73
74
# File 'lib/poloniex_ruby.rb', line 71

def self.sell( currency_pair, rate, amount )
  res = post 'sell', currencyPair: currency_pair, rate: rate, amount: amount
  res_hash res
end

.setup {|configuration| ... } ⇒ Object

Yields:



6
7
8
9
# File 'lib/configuration.rb', line 6

def self.setup
  @configuration ||= Configuration.new
  yield( configuration )
end

.tickerObject



16
17
18
19
# File 'lib/poloniex_ruby.rb', line 16

def self.ticker
  res = get 'returnTicker'
  res_hash res
end

.tradable_balancesObject



96
97
98
99
# File 'lib/poloniex_ruby.rb', line 96

def self.tradable_balances
  res = post 'returnTradableBalances'
  res_hash res
end

.trade_history(currency_pair, start = 0, end_time = Time.now.to_i) ⇒ Object



61
62
63
64
# File 'lib/poloniex_ruby.rb', line 61

def self.trade_history( currency_pair, start = 0, end_time = Time.now.to_i )
  res = post 'returnTradeHistory', currencyPair: currency_pair, start: start, :end => end_time
  res_hash res
end

.transfer_balance(currency, amount, from_ccount, to_account) ⇒ Object



101
102
103
104
# File 'lib/poloniex_ruby.rb', line 101

def self.transfer_balance( currency, amount, from_ccount,  )
  res = post 'transferBalance', currency: currency, amount: amount, fromAccount: from_ccount, toAccount: 
  res_hash res
end

.volumeObject



21
22
23
24
# File 'lib/poloniex_ruby.rb', line 21

def self.volume
  res = get 'return24hVolume'
  res_hash res
end

.withdraw(currency, amount, address) ⇒ Object



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

def self.withdraw( currency, amount, address )
  res = post 'widthdraw', currency: currency, amount: amount, address: address
  res_hash res
end