gmtech-xyz / safe-cex

An OpenSource TypeScript library to create rich trading cryptocurrencies interfaces
https://tuleep.trade
77 stars 23 forks source link

timeframe undefined #13

Open maddrid opened 12 months ago

maddrid commented 12 months ago

[LOG] Loaded 249 Bybit markets [LOG] Ready to trade on Bybit [LOG] Loaded Bybit orders [LOG] Switched to [BTCUSDT:undefined]

async function initializeExchange() {
    try {
        const exchange = createExchange('bybit', {
            key: API_KEY,
            secret: API_SECRET,
            testnet: false,
            // ... other required options
        });

       // Listen for general logs or errors from the library (if provided)
        exchange.on('log', (message, severity) => {
            if (severity === 'error') {
                console.error(`[ERROR] ${message}`);
            } else {
                console.log(`[LOG] ${message}`);
            }
        });

        // Start the exchange synchronization
        await exchange.start();

        // Safe listen to OHLCV updates
        try {
            // Start listening to OHLCV updates for BTC/USDT with 1-minute intervals
            exchange.listenOHLCV({ symbol: "BTCUSDT", timeframe: "1m" }, (ohlcvUpdate) => {
                console.log('OHLCV Update:', ohlcvUpdate);
            });
        } catch (ohlcvError) {
            console.error('Error while listening to OHLCV updates:', ohlcvError.message);
        }

    } catch (error) {
        console.error('An error occurred:', error.message);
    }
}

initializeExchange()
iam4x commented 6 months ago

That is pretty weird, is it still occurring?