The start of a btcchina library. The btcchina api is currently very basic so don't expect any magic.
If you are feeling generous, throw me some btc: 13rhHcFx8AWej5F1VYAudHc1SupJMTJKZU
Usage
require 'chinashop'
ChinaShop.configure do |config|
config.key = 'your-key-here'
config.secret = 'your-secret-here'
end
puts ChinaShop.ticker.high
puts ChinaShop.account.balance.btcConfiguration
Apply a key and secret to use the account and trading features.
ChinaShop.configure do |config|
config.key = 'your-key-here'
config.secret = 'your-secret-here'
endTicker
Returns the ticker information. Accessed via ChinaShop.ticker. The following methods are available:
allhighlowbuyselllastvol
puts ChinaShop.ticker.highAccount
Returns the user account information. Configuration is required. Accessed via ChinaShop.account. The following methods are available:
allusernamebalancefrozendeposit_address
puts ChinaShop.account.balance.btcMarket Depth
Returns the Market Depth. Accessed via ChinaShop.market_depth. The following methods are available:
allbidsasks
ChinaShop.market_depth.bidsBuy
Places a Bid order for the btcchina exchange. Accessed via ChinaShop.buy. The following methods are available:
allresult
b = ChinaShop.buy(:price => 6030, :amount => 0.009)
puts b.resultSell
Places a Ask order for the btcchina exchange. Accessed via ChinaShop.sell. The following methods are available:
allresult
s = ChinaShop.sell(:price => 6030, :amount => 0.009)
puts s.resultOrders
Lists all the open orders. Accessed via ChinaShop.orders. The following methods are available:
all
puts ChinaShop.orders.allOrder
Get a single order. Accessed via ChinaShop.order. The following methods are available:
allidtypepricecurrencyamountamount_originaldatestatus
puts ChinaShop.order(823841).statusTransactions
Lists recent transactions. Accessed via ChinaShop.transactions. The following methods are available:
all
puts ChinaShop.transactions.allDeposits
Lists recent deposits. Accessed via ChinaShop.deposits. The following methods are available:
all
puts ChinaShop.deposits.allTrades
Returns the last 24 hours of trades. Accessed via ChinaShop.trades. Please beware that excessive use could lead to btcchina IP blocking you.
puts ChinaShop.tradesTrade History
Passing in no value will return the last 100 trades. Passing in a trade id will return 100 trades starting from that id. Accessed via ChinaShop.trade_history. Please beware that excessive use could lead to btcchina IP blocking you.
puts ChinaShop.trade_history
puts ChinaShop.trade_history(50000)Order Book
Returns the current order book. Accessed via ChinaShop.order_book. Please beware that excessive use could lead to btcchina IP blocking you.
puts ChinaShop.order_bookLicense and Author
Author:: Bryan Brandau agent462@gmail.com
Copyright:: 2013, Bryan Brandau
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.