Skip to content

Instantly share code, notes, and snippets.

@nmarley
Created November 15, 2015 01:57
Show Gist options
  • Select an option

  • Save nmarley/e03d332576dcc3a30bda to your computer and use it in GitHub Desktop.

Select an option

Save nmarley/e03d332576dcc3a30bda to your computer and use it in GitHub Desktop.
Poloniex examples in Ruby with 'poloniex' gem.
# do the thing
require 'dotenv'
require 'poloniex'
require 'active_support'
require 'bigdecimal'
require 'bigdecimal/util'
require 'pp'
Dotenv.load
polo = %w[
POLONIEX_TRADE_KEY
POLONIEX_TRADE_SECRET
POLONIEX_WDRAW_KEY
POLONIEX_WDRAW_SECRET
]
# pp ENV.to_h.slice(*polo)
Poloniex.setup do | config |
config.key = ENV['POLONIEX_TRADE_KEY']
config.secret = ENV['POLONIEX_TRADE_SECRET']
end
bal = JSON.parse( Poloniex.balances )
bal.reject! { |k,v| 0 === v.to_d }
pp bal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment