lib/kaesen/btcbox.rb in kaesen-0.1.1 vs lib/kaesen/btcbox.rb in kaesen-0.2.0

- old
+ new

@@ -188,9 +188,37 @@ "order_type" => "sell", "ltimestamp" => Time.now.to_i, } end + # Cancel an open order + # @abstract + # @param [int or string] order id + # @return [hash] + # success: [bool] status + def cancel(id) + have_key? + address = @url_private + "/trade_cancel/" + params = { + "id" => id, + } + h = post_ssl_with_sign(address, params) + { + "success" => h["result"], + } + end + + # Cancel all open orders + # @abstract + # @return [array] + # success: [bool] status + def cancel_all + have_key? + opens.collect{|h| + cancel(h["id"]) + } + end + private def initialize_https(uri) https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true