Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Edit Order #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/kraken_ruby_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,27 @@ def spread(pair = nil, opts = {})
#
def add_order(opts = {})
missing_args = add_order_required_args - opts.keys.map(&:to_s)
raise ArgumentError, add_order_err_msg(missing_args) if missing_args.any?
raise ArgumentError, order_err_msg(missing_args) if missing_args.any?

post_private 'AddOrder', opts
end

def add_order_required_args
%w(pair type volume ordertype).freeze
end

def edit_order(opts = {})
missing_args = edit_order_required_args - opts.keys.map(&:to_s)
raise ArgumentError, order_err_msg(missing_args) if missing_args.any?

def add_order_err_msg(missing_args)
post_private 'EditOrder', opts
end

def edit_order_required_args
%w(txid pair).freeze
end

def order_err_msg(missing_args)
"the following required arguments are missing: #{missing_args.join(', ')}"
end

Expand Down