update
This commit is contained in:
parent
272ba19977
commit
2c432b3fd3
1 changed files with 41 additions and 41 deletions
|
|
@ -68,47 +68,47 @@ export const eventHandlerFuture: EventHandler = {
|
|||
{ candle, analysis }: { candle: Candle; analysis: Analysis }
|
||||
) => {
|
||||
if (eventType === "HighVolatility") {
|
||||
const positions = await bybitService.listPositions({
|
||||
category: "linear",
|
||||
symbol: analysis.symbol,
|
||||
});
|
||||
if (positions.length > 0) {
|
||||
const position = positions[0];
|
||||
if (position.side === "Buy" && analysis.isOverBbUpper && candle.close > candle.open) {
|
||||
const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||
await bybitService.submitOrder({
|
||||
category: "linear",
|
||||
symbol: analysis.symbol,
|
||||
side: "Sell",
|
||||
orderType: "Limit",
|
||||
price:
|
||||
candle.close > analysis.currentBB.upper
|
||||
? Number(candle.close).toFixed(2)
|
||||
: Number(analysis.currentBB.upper).toFixed(2),
|
||||
qty: halfSize,
|
||||
});
|
||||
sendMessage(
|
||||
`Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.upper} ${halfSize}`
|
||||
);
|
||||
}
|
||||
if (position.side === "Sell" && analysis.isUnderBbLower && candle.close < candle.open) {
|
||||
const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||
await bybitService.submitOrder({
|
||||
category: "linear",
|
||||
symbol: analysis.symbol,
|
||||
side: "Buy",
|
||||
orderType: "Limit",
|
||||
price:
|
||||
candle.close < analysis.currentBB.lower
|
||||
? Number(candle.close).toFixed(2)
|
||||
: Number(analysis.currentBB.lower).toFixed(2),
|
||||
qty: halfSize,
|
||||
});
|
||||
sendMessage(
|
||||
`Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.lower} ${halfSize}`
|
||||
);
|
||||
}
|
||||
}
|
||||
// const positions = await bybitService.listPositions({
|
||||
// category: "linear",
|
||||
// symbol: analysis.symbol,
|
||||
// });
|
||||
// if (positions.length > 0) {
|
||||
// const position = positions[0];
|
||||
// if (position.side === "Buy" && analysis.isOverBbUpper && candle.close > candle.open) {
|
||||
// const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||
// await bybitService.submitOrder({
|
||||
// category: "linear",
|
||||
// symbol: analysis.symbol,
|
||||
// side: "Sell",
|
||||
// orderType: "Limit",
|
||||
// price:
|
||||
// candle.close > analysis.currentBB.upper
|
||||
// ? Number(candle.close).toFixed(2)
|
||||
// : Number(analysis.currentBB.upper).toFixed(2),
|
||||
// qty: halfSize,
|
||||
// });
|
||||
// sendMessage(
|
||||
// `Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.upper} ${halfSize}`
|
||||
// );
|
||||
// }
|
||||
// if (position.side === "Sell" && analysis.isUnderBbLower && candle.close < candle.open) {
|
||||
// const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||
// await bybitService.submitOrder({
|
||||
// category: "linear",
|
||||
// symbol: analysis.symbol,
|
||||
// side: "Buy",
|
||||
// orderType: "Limit",
|
||||
// price:
|
||||
// candle.close < analysis.currentBB.lower
|
||||
// ? Number(candle.close).toFixed(2)
|
||||
// : Number(analysis.currentBB.lower).toFixed(2),
|
||||
// qty: halfSize,
|
||||
// });
|
||||
// sendMessage(
|
||||
// `Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.lower} ${halfSize}`
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue