Skip to content

Commit

Permalink
some fixes for bybit order mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed Nov 26, 2022
1 parent 6fb4667 commit 86fcb94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/dict/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ module.exports = class Order {
amount,
Order.TYPE_LIMIT,
_.merge(options, {
post_only: true
post_only: true,
})
);
}
Expand All @@ -155,7 +155,7 @@ module.exports = class Order {
this.TYPE_LIMIT,
{
post_only: true,
close: true
close: true,
}
);
}
Expand All @@ -167,7 +167,7 @@ module.exports = class Order {
undefined,
amount,
_.merge(options, {
adjust_price: true
adjust_price: true,
})
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/exchange/bybit.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,12 @@ module.exports = class Bybit {

// new format
if (!price || price === 0.0) {
price = parseFloat(order.trigger_price);
price = parseFloat(order?.trigger_price);
}
}

const options = {};
if (order.ext_fields && order.ext_fields.reduce_only === true) {
if (order.reduce_only === true || order.ext_fields?.reduce_only === true) {
options.reduce_only = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/exchange/bybit_linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ module.exports = class BybitLinear {
delete parameters['order_link_id'];

parameters.reduce_only = order.isReduceOnly();
parameters.close_on_trigger = false;
parameters.close_on_trigger = order.isReduceOnly();

// limit and stops have different api endpoints
const isConditionalOrder = this.isConditionalExchangeOrder(order);
Expand Down

0 comments on commit 86fcb94

Please sign in to comment.