{"action":"created","comment":{"url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/comments/29817903","id":29817903,"diff_hunk":"@@ -3,14 +3,62 @@ module PrivateApi\n   class BitXError < StandardError\n   end\n \n+\n+  # <----- BALANCE .\n+\n+  #Balance\n+  def balance_for(asset='XBT', opt={})\n+    # ---\n+    # - Deprecated\n+    # ---\n+    puts \"BitX.balance_for will be deprecated. please use BitX.balance to get a list of account balances\"\n+    opt.merge!({asset: asset})\n+    path = '/api/1/balance'\n+    j = authed_request(path, {params: opt})\n+    balance = BigDecimal(j[:balance][0][:balance])\n+    reserved = BigDecimal(j[:balance][0][:reserved])\n+    {\n+      asset:      asset,\n+      balance:    balance,\n+      reserved:   reserved,\n+      available:  balance - reserved\n+    }\n+  end\n+\n+  def balance(opt={})\n+    path = '/api/1/balance'\n+    j = authed_request(path, opt)\n+\n+    balances = []\n+    if j[:balance]\n+      j[:balance].each do |b|\n+        balance     = BigDecimal(b[:balance])\n+        reserved    = BigDecimal(b[:reserved])\n+         bal = {\n+          account_id:  b[:account_id],\n+          asset:       b[:asset],\n+          balance:     balance,\n+          reserved:    reserved,\n+          available:   balance - reserved,\n+          unconfirmed: BigDecimal(b[:unconfirmed])\n+        }\n+        bal[:name] = b[:name] if b[:name]\n+        balances << bal\n+      end\n+    end\n+    balances\n+  end\n+\n+  # BALANCE -----/>\n+\n   # <----- ORDERS .\n \n   #List Orders\n   def list_orders(pair, opt={})\n+    #opt can include state: 'PENDING', pair: 'XBTZAR'","path":"lib/private_api.rb","position":56,"original_position":56,"commit_id":"9cfb7a743d0a4d6253f2eedf827eab1c8b87640b","original_commit_id":"9cfb7a743d0a4d6253f2eedf827eab1c8b87640b","user":{"login":"tstranex","id":1934223,"avatar_url":"https://avatars.githubusercontent.com/u/1934223?v=3","gravatar_id":"","url":"https://api.github.com/users/tstranex","html_url":"https://github.com/tstranex","followers_url":"https://api.github.com/users/tstranex/followers","following_url":"https://api.github.com/users/tstranex/following{/other_user}","gists_url":"https://api.github.com/users/tstranex/gists{/gist_id}","starred_url":"https://api.github.com/users/tstranex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstranex/subscriptions","organizations_url":"https://api.github.com/users/tstranex/orgs","repos_url":"https://api.github.com/users/tstranex/repos","events_url":"https://api.github.com/users/tstranex/events{/privacy}","received_events_url":"https://api.github.com/users/tstranex/received_events","type":"User","site_admin":false},"body":"This comment should probably go into the function description comment?","created_at":"2015-05-07T01:15:37Z","updated_at":"2015-05-07T01:15:37Z","html_url":"https://github.com/bitx/bitx-ruby/pull/3#discussion_r29817903","pull_request_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/comments/29817903"},"html":{"href":"https://github.com/bitx/bitx-ruby/pull/3#discussion_r29817903"},"pull_request":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3","id":34813611,"html_url":"https://github.com/bitx/bitx-ruby/pull/3","diff_url":"https://github.com/bitx/bitx-ruby/pull/3.diff","patch_url":"https://github.com/bitx/bitx-ruby/pull/3.patch","issue_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/3","number":3,"state":"open","locked":false,"title":"get up to date with documented api","user":{"login":"franc","id":507,"avatar_url":"https://avatars.githubusercontent.com/u/507?v=3","gravatar_id":"","url":"https://api.github.com/users/franc","html_url":"https://github.com/franc","followers_url":"https://api.github.com/users/franc/followers","following_url":"https://api.github.com/users/franc/following{/other_user}","gists_url":"https://api.github.com/users/franc/gists{/gist_id}","starred_url":"https://api.github.com/users/franc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franc/subscriptions","organizations_url":"https://api.github.com/users/franc/orgs","repos_url":"https://api.github.com/users/franc/repos","events_url":"https://api.github.com/users/franc/events{/privacy}","received_events_url":"https://api.github.com/users/franc/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-06T12:56:45Z","updated_at":"2015-05-07T01:15:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7a16b94df3fc5c86b475476e684b78016e91ade","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3/commits","review_comments_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3/comments","review_comment_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/3/comments","statuses_url":"https://api.github.com/repos/bitx/bitx-ruby/statuses/9cfb7a743d0a4d6253f2eedf827eab1c8b87640b","head":{"label":"bitx:add_transactions","ref":"add_transactions","sha":"9cfb7a743d0a4d6253f2eedf827eab1c8b87640b","user":{"login":"bitx","id":10500837,"avatar_url":"https://avatars.githubusercontent.com/u/10500837?v=3","gravatar_id":"","url":"https://api.github.com/users/bitx","html_url":"https://github.com/bitx","followers_url":"https://api.github.com/users/bitx/followers","following_url":"https://api.github.com/users/bitx/following{/other_user}","gists_url":"https://api.github.com/users/bitx/gists{/gist_id}","starred_url":"https://api.github.com/users/bitx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitx/subscriptions","organizations_url":"https://api.github.com/users/bitx/orgs","repos_url":"https://api.github.com/users/bitx/repos","events_url":"https://api.github.com/users/bitx/events{/privacy}","received_events_url":"https://api.github.com/users/bitx/received_events","type":"Organization","site_admin":false},"repo":{"id":16235279,"name":"bitx-ruby","full_name":"bitx/bitx-ruby","owner":{"login":"bitx","id":10500837,"avatar_url":"https://avatars.githubusercontent.com/u/10500837?v=3","gravatar_id":"","url":"https://api.github.com/users/bitx","html_url":"https://github.com/bitx","followers_url":"https://api.github.com/users/bitx/followers","following_url":"https://api.github.com/users/bitx/following{/other_user}","gists_url":"https://api.github.com/users/bitx/gists{/gist_id}","starred_url":"https://api.github.com/users/bitx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitx/subscriptions","organizations_url":"https://api.github.com/users/bitx/orgs","repos_url":"https://api.github.com/users/bitx/repos","events_url":"https://api.github.com/users/bitx/events{/privacy}","received_events_url":"https://api.github.com/users/bitx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitx/bitx-ruby","description":"Ruby wrapper for the BitX API","fork":false,"url":"https://api.github.com/repos/bitx/bitx-ruby","forks_url":"https://api.github.com/repos/bitx/bitx-ruby/forks","keys_url":"https://api.github.com/repos/bitx/bitx-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitx/bitx-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitx/bitx-ruby/teams","hooks_url":"https://api.github.com/repos/bitx/bitx-ruby/hooks","issue_events_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/bitx/bitx-ruby/events","assignees_url":"https://api.github.com/repos/bitx/bitx-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/bitx/bitx-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/bitx/bitx-ruby/tags","blobs_url":"https://api.github.com/repos/bitx/bitx-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitx/bitx-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitx/bitx-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitx/bitx-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitx/bitx-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/bitx/bitx-ruby/languages","stargazers_url":"https://api.github.com/repos/bitx/bitx-ruby/stargazers","contributors_url":"https://api.github.com/repos/bitx/bitx-ruby/contributors","subscribers_url":"https://api.github.com/repos/bitx/bitx-ruby/subscribers","subscription_url":"https://api.github.com/repos/bitx/bitx-ruby/subscription","commits_url":"https://api.github.com/repos/bitx/bitx-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitx/bitx-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitx/bitx-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitx/bitx-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/bitx/bitx-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitx/bitx-ruby/merges","archive_url":"https://api.github.com/repos/bitx/bitx-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitx/bitx-ruby/downloads","issues_url":"https://api.github.com/repos/bitx/bitx-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/bitx/bitx-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/bitx/bitx-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitx/bitx-ruby/labels{/name}","releases_url":"https://api.github.com/repos/bitx/bitx-ruby/releases{/id}","created_at":"2014-01-25T17:04:17Z","updated_at":"2015-02-17T09:11:42Z","pushed_at":"2015-05-06T13:20:40Z","git_url":"git://github.com/bitx/bitx-ruby.git","ssh_url":"git@github.com:bitx/bitx-ruby.git","clone_url":"https://github.com/bitx/bitx-ruby.git","svn_url":"https://github.com/bitx/bitx-ruby","homepage":null,"size":376,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"bitx:master","ref":"master","sha":"af66c3c1d534f82e3247d568c2f670be2ff624f1","user":{"login":"bitx","id":10500837,"avatar_url":"https://avatars.githubusercontent.com/u/10500837?v=3","gravatar_id":"","url":"https://api.github.com/users/bitx","html_url":"https://github.com/bitx","followers_url":"https://api.github.com/users/bitx/followers","following_url":"https://api.github.com/users/bitx/following{/other_user}","gists_url":"https://api.github.com/users/bitx/gists{/gist_id}","starred_url":"https://api.github.com/users/bitx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitx/subscriptions","organizations_url":"https://api.github.com/users/bitx/orgs","repos_url":"https://api.github.com/users/bitx/repos","events_url":"https://api.github.com/users/bitx/events{/privacy}","received_events_url":"https://api.github.com/users/bitx/received_events","type":"Organization","site_admin":false},"repo":{"id":16235279,"name":"bitx-ruby","full_name":"bitx/bitx-ruby","owner":{"login":"bitx","id":10500837,"avatar_url":"https://avatars.githubusercontent.com/u/10500837?v=3","gravatar_id":"","url":"https://api.github.com/users/bitx","html_url":"https://github.com/bitx","followers_url":"https://api.github.com/users/bitx/followers","following_url":"https://api.github.com/users/bitx/following{/other_user}","gists_url":"https://api.github.com/users/bitx/gists{/gist_id}","starred_url":"https://api.github.com/users/bitx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitx/subscriptions","organizations_url":"https://api.github.com/users/bitx/orgs","repos_url":"https://api.github.com/users/bitx/repos","events_url":"https://api.github.com/users/bitx/events{/privacy}","received_events_url":"https://api.github.com/users/bitx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitx/bitx-ruby","description":"Ruby wrapper for the BitX API","fork":false,"url":"https://api.github.com/repos/bitx/bitx-ruby","forks_url":"https://api.github.com/repos/bitx/bitx-ruby/forks","keys_url":"https://api.github.com/repos/bitx/bitx-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitx/bitx-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitx/bitx-ruby/teams","hooks_url":"https://api.github.com/repos/bitx/bitx-ruby/hooks","issue_events_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/bitx/bitx-ruby/events","assignees_url":"https://api.github.com/repos/bitx/bitx-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/bitx/bitx-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/bitx/bitx-ruby/tags","blobs_url":"https://api.github.com/repos/bitx/bitx-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitx/bitx-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitx/bitx-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitx/bitx-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitx/bitx-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/bitx/bitx-ruby/languages","stargazers_url":"https://api.github.com/repos/bitx/bitx-ruby/stargazers","contributors_url":"https://api.github.com/repos/bitx/bitx-ruby/contributors","subscribers_url":"https://api.github.com/repos/bitx/bitx-ruby/subscribers","subscription_url":"https://api.github.com/repos/bitx/bitx-ruby/subscription","commits_url":"https://api.github.com/repos/bitx/bitx-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitx/bitx-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitx/bitx-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitx/bitx-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitx/bitx-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/bitx/bitx-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitx/bitx-ruby/merges","archive_url":"https://api.github.com/repos/bitx/bitx-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitx/bitx-ruby/downloads","issues_url":"https://api.github.com/repos/bitx/bitx-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/bitx/bitx-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/bitx/bitx-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/bitx/bitx-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitx/bitx-ruby/labels{/name}","releases_url":"https://api.github.com/repos/bitx/bitx-ruby/releases{/id}","created_at":"2014-01-25T17:04:17Z","updated_at":"2015-02-17T09:11:42Z","pushed_at":"2015-05-06T13:20:40Z","git_url":"git://github.com/bitx/bitx-ruby.git","ssh_url":"git@github.com:bitx/bitx-ruby.git","clone_url":"https://github.com/bitx/bitx-ruby.git","svn_url":"https://github.com/bitx/bitx-ruby","homepage":null,"size":376,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3"},"html":{"href":"https://github.com/bitx/bitx-ruby/pull/3"},"issue":{"href":"https://api.github.com/repos/bitx/bitx-ruby/issues/3"},"comments":{"href":"https://api.github.com/repos/bitx/bitx-ruby/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitx/bitx-ruby/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/bitx/bitx-ruby/statuses/9cfb7a743d0a4d6253f2eedf827eab1c8b87640b"}}}}