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
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.btc
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'
end
Returns the ticker information. Accessed via ChinaShop.ticker
. The following methods are available:
all
high
low
buy
sell
last
vol
puts ChinaShop.ticker.high
Returns the user account information. Configuration is required. Accessed via ChinaShop.account
. The following methods are available:
all
username
balance
frozen
deposit_address
puts ChinaShop.account.balance.btc
Returns the Market Depth. Accessed via ChinaShop.market_depth
. The following methods are available:
all
bids
asks
ChinaShop.market_depth.bids
Places a Bid order for the btcchina exchange. Accessed via ChinaShop.buy
. The following methods are available:
all
result
b = ChinaShop.buy(:price => 6030, :amount => 0.009)
puts b.result
Places a Ask order for the btcchina exchange. Accessed via ChinaShop.sell
. The following methods are available:
all
result
s = ChinaShop.sell(:price => 6030, :amount => 0.009)
puts s.result
Lists all the open orders. Accessed via ChinaShop.orders
. The following methods are available:
all
puts ChinaShop.orders.all
Get a single order. Accessed via ChinaShop.order
. The following methods are available:
all
id
type
price
currency
amount
amount_original
date
status
puts ChinaShop.order(823841).status
Lists recent transactions. Accessed via ChinaShop.transactions
. The following methods are available:
all
puts ChinaShop.transactions.all
Lists recent deposits. Accessed via ChinaShop.deposits
. The following methods are available:
all
puts ChinaShop.deposits.all
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.trades
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)
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_book
Author:: Bryan Brandau [email protected]
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.