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 }
|
{ candle, analysis }: { candle: Candle; analysis: Analysis }
|
||||||
) => {
|
) => {
|
||||||
if (eventType === "HighVolatility") {
|
if (eventType === "HighVolatility") {
|
||||||
const positions = await bybitService.listPositions({
|
// const positions = await bybitService.listPositions({
|
||||||
category: "linear",
|
// category: "linear",
|
||||||
symbol: analysis.symbol,
|
// symbol: analysis.symbol,
|
||||||
});
|
// });
|
||||||
if (positions.length > 0) {
|
// if (positions.length > 0) {
|
||||||
const position = positions[0];
|
// const position = positions[0];
|
||||||
if (position.side === "Buy" && analysis.isOverBbUpper && candle.close > candle.open) {
|
// if (position.side === "Buy" && analysis.isOverBbUpper && candle.close > candle.open) {
|
||||||
const halfSize = (Number(position.size) / 2).toFixed(2);
|
// const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||||
await bybitService.submitOrder({
|
// await bybitService.submitOrder({
|
||||||
category: "linear",
|
// category: "linear",
|
||||||
symbol: analysis.symbol,
|
// symbol: analysis.symbol,
|
||||||
side: "Sell",
|
// side: "Sell",
|
||||||
orderType: "Limit",
|
// orderType: "Limit",
|
||||||
price:
|
// price:
|
||||||
candle.close > analysis.currentBB.upper
|
// candle.close > analysis.currentBB.upper
|
||||||
? Number(candle.close).toFixed(2)
|
// ? Number(candle.close).toFixed(2)
|
||||||
: Number(analysis.currentBB.upper).toFixed(2),
|
// : Number(analysis.currentBB.upper).toFixed(2),
|
||||||
qty: halfSize,
|
// qty: halfSize,
|
||||||
});
|
// });
|
||||||
sendMessage(
|
// sendMessage(
|
||||||
`Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.upper} ${halfSize}`
|
// `Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.upper} ${halfSize}`
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
if (position.side === "Sell" && analysis.isUnderBbLower && candle.close < candle.open) {
|
// if (position.side === "Sell" && analysis.isUnderBbLower && candle.close < candle.open) {
|
||||||
const halfSize = (Number(position.size) / 2).toFixed(2);
|
// const halfSize = (Number(position.size) / 2).toFixed(2);
|
||||||
await bybitService.submitOrder({
|
// await bybitService.submitOrder({
|
||||||
category: "linear",
|
// category: "linear",
|
||||||
symbol: analysis.symbol,
|
// symbol: analysis.symbol,
|
||||||
side: "Buy",
|
// side: "Buy",
|
||||||
orderType: "Limit",
|
// orderType: "Limit",
|
||||||
price:
|
// price:
|
||||||
candle.close < analysis.currentBB.lower
|
// candle.close < analysis.currentBB.lower
|
||||||
? Number(candle.close).toFixed(2)
|
// ? Number(candle.close).toFixed(2)
|
||||||
: Number(analysis.currentBB.lower).toFixed(2),
|
// : Number(analysis.currentBB.lower).toFixed(2),
|
||||||
qty: halfSize,
|
// qty: halfSize,
|
||||||
});
|
// });
|
||||||
sendMessage(
|
// sendMessage(
|
||||||
`Future Căt nửa ${analysis.symbol} ${analysis.interval}M ${analysis.currentBB.lower} ${halfSize}`
|
// `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