Created
November 15, 2015 01:57
-
-
Save nmarley/e03d332576dcc3a30bda to your computer and use it in GitHub Desktop.
Poloniex examples in Ruby with 'poloniex' gem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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