26 lines
755 B
TypeScript
26 lines
755 B
TypeScript
import "dotenv/config";
|
|
import { BybitService } from "./src/services/bybitService";
|
|
import * as indicatorService from "./src/services/indicatorService";
|
|
import {
|
|
analyzeCandleSequence,
|
|
isHighVolatilityCandle,
|
|
} from "./src/helpers/candles";
|
|
|
|
const bybitService = new BybitService(
|
|
process.env.BYBIT_API_KEY!,
|
|
process.env.BYBIT_API_SECRET!,
|
|
false
|
|
);
|
|
(async () => {
|
|
const candles = await bybitService.getCandles({
|
|
symbol: "BTCUSDT",
|
|
interval: "240",
|
|
category: "linear",
|
|
limit: 500,
|
|
});
|
|
console.log(candles[0], candles[1]);
|
|
const cA = analyzeCandleSequence([candles[2], candles[1], candles[0]]);
|
|
const isH = isHighVolatilityCandle(candles.reverse());
|
|
console.log(cA);
|
|
console.log("isHighVolatilityCandle", isH);
|
|
})();
|