lib/bitflyer_api/methods/private/trade.rb in bitflyer_api-0.1.0 vs lib/bitflyer_api/methods/private/trade.rb in bitflyer_api-0.1.1
- old
+ new
@@ -74,28 +74,32 @@
res = conn.get("/v1/me/getchildorders", query)
res.body
end
def my_send_parent_order(
- order_method: "SIMPLE",
+ order_method:,
minute_to_expire: 43200,
time_in_force: "GTC",
product_code:,
first_condition_type:,
- second_condition_type:,
- third_condition_type: nil,
first_side:,
- second_side:,
- third_side: nil,
- size:,
first_price: nil,
- second_price: nil,
- third_price: nil,
+ first_size:,
first_trigger_price: nil,
+ first_offset: nil,
+ second_condition_type: nil,
+ second_price: nil,
+ second_side: nil,
+ second_size: nil,
second_trigger_price: nil,
+ second_offset: nil,
+ third_condition_type: nil,
+ third_side: nil,
+ third_price: nil,
+ third_size: nil,
third_trigger_price: nil,
- offset: nil
+ third_offset: nil
)
body =
case order_method
when "IFD"
@@ -105,21 +109,23 @@
'time_in_force': \"#{time_in_force}\",
'parameters': [{
'product_code': \"#{product_code}\",
'condition_type': \"#{first_condition_type}\",
'side': \"#{first_side}\",
+ 'size': #{first_size},
'price': #{first_price},
'trigger_price': #{first_trigger_price},
- 'size': #{size}
+ 'offset': #{first_offset},
},
{
'product_code': \"#{product_code}\",
'condition_type': \"#{second_condition_type}\",
+ 'size': #{second_size},
'side': \"#{second_side}\",
'price': #{second_price},
'trigger_price': #{second_trigger_price},
- 'size': #{size}
+ 'offset': #{second_offset},
}]
}"
when "OCO"
"{
'order_method': \"#{order_method}\",
@@ -127,21 +133,23 @@
'time_in_force': \"#{time_in_force}\",
'parameters': [{
'product_code': \"#{product_code}\",
'condition_type': \"#{first_condition_type}\",
'side': \"#{first_side}\",
+ 'size': #{first_size},
'price': #{first_price},
'trigger_price': #{first_trigger_price},
- 'size': #{size}
+ 'offset': #{first_offset},
},
{
- 'product_code': \"#{order_method}\",
+ 'product_code': \"#{product_code}\",
'condition_type': \"#{second_condition_type}\",
+ 'size': #{second_size},
'side': \"#{second_side}\",
'price': #{second_price},
'trigger_price': #{second_trigger_price},
- 'size': #{size}
+ 'offset': #{second_offset},
}]
}"
when "IFDOCO"
"{
'order_method': \'#{order_method}\',
@@ -149,32 +157,37 @@
'time_in_force': \"#{time_in_force}\",
'parameters': [{
'product_code': \"#{product_code}\",
'condition_type': \"#{first_condition_type}\",
'side': \"#{first_side}\",
+ 'size': #{first_size},
'price': #{first_price},
'trigger_price': #{first_trigger_price},
- 'size': #{size}
+ 'offset': #{first_offset},
},
{
'product_code': \"#{product_code}\",
'condition_type': \"#{second_condition_type}\",
'side': \"#{second_side}\",
+ 'size': #{second_size},
'price': #{second_price},
'trigger_price': #{second_trigger_price},
- 'size': #{size}
+ 'offset': #{second_offset},
},
{
'product_code': \"#{product_code}\",
'condition_type': \"#{third_condition_type}\",
'side': \"#{third_side}\",
+ 'size': #{third_size},
'price': #{third_price},
'trigger_price': #{third_trigger_price},
- 'size': #{size}
+ 'offset': #{third_offset},
}]
}"
-
- else # SIMPLE
+ when "SIMPLE"
+ raise "Use my_send_child_order method!"
+ else
+ raise "Specify order_method!"
end
res = conn.post do |req|
req.url "/v1/me/sendparentorder"
req.body = body