
maaday
755 posts



Kraken SDK / API ile Crawler (ExplorePi) Etkileşimi const axios = require('axios'); const crypto = require('crypto'); const pool = require('../database'); const FirestoreService = require('./firestore'); class KrakenService { constructor() { this.baseURL = 'api.kraken.com'; this.apiKey = process.env.KRAKEN_API_KEY; this.apiSecret = process.env.KRAKEN_API_SECRET; } // Public Endpoints (API Key gerekmez) async getTicker() { try { const res = await axios.get(`${this.baseURL}/0/public/Ticker?pair=PIUSD`); const data = res.data.result.PIUSD; return { pair: 'PIUSD', last: parseFloat(data.c[0]), volume: parseFloat(data.v[1]), // 24h volume high: parseFloat(data.h[1]), low: parseFloat(data.l[1]), timestamp: new Date() }; } catch (err) { console.error('Kraken Ticker Error:', err.message); return null; } } async getOrderBook(depth = 100) { const res = await axios.get(`\( {this.baseURL}/0/public/Depth?pair=PIUSD&count= \){depth}`); return res.data.result.PIUSD; } // Private (gerekirse bakiyen, trade history vs.) _getSignature(path, nonce, postData = '') { const message = nonce + path + postData; const hmac = crypto.createHmac('sha512', Buffer.from(this.apiSecret, 'base64')); hmac.update(message); return hmac.digest('base64'); } // Örnek: Son trades async getRecentTrades() { const res = await axios.get(`${this.baseURL}/0/public/Trades?pair=PIUSD&count=1000`); return res.data.result.PIUSD; } } // Analytics için periyodik çalıştırma (getdata.js ile entegre et) async function updatePiMarketData() { const kraken = new KrakenService(); const ticker = await kraken.getTicker(); if (ticker) { // MySQL’e kaydet await pool.ex_sql(` INSERT INTO market_data (pair, last_price, volume_24h, high, low, updated_at) VALUES ('PIUSD', ${ticker.last}, ${ticker.volume}, ${ticker.high}, ${ticker.low}, NOW()) ON DUPLICATE KEY UPDATE last_price=VALUES(last_price), volume_24h=VALUES(volume_24h), high=VALUES(high), low=VALUES(low), updated_at=NOW() `); // Firestore’a push (website dashboard için) await FirestoreService.updateStatistic('pi_market', ticker); } } module.exports = { KrakenService, updatePiMarketData }; @nkokkalis @inanjaccuse @Gerek_yokkikiki @mehmetozal @erdincdincer13 @incegorbaskan @tekin63081 @Chengdiao @DrChengdiaoFan @PiCoreTeam @krakenfx #PiNetwork #CiDiGames #Web3Gaming #web3 #Cryptocurrency #BlockchainAdoption #Gaming #DeFi #PiNetwork2025 #Binance #BlockchainRoadmap #Testnet2v23 #Mainnetv24 #CryptoEducation #MICACompliance









🇺🇸 LATEST: US Treasury's FinCEN proposes a major overhaul of bank anti-money laundering programs, aiming to refocus compliance on stopping illicit finance.

The Pis on the CEX are unidentified. Anyone can buy them to launder money or finance illegal activities, without ever having mined them. This is unlike our secure internal ecosystem. The outside world is a haven for scammers. Outside the #PiNetwork ecosystem, control disappears.




soon





