UNPKG

@arkane_absolute/sdk

Version:

Arkane SDK for interacting with Arkane API

195 lines (165 loc) 4.14 kB
# Arkane SDK A simple TypeScript SDK for interacting with the Arkane prediction API. ## Installation Install via npm: ```bash npm install @arkane_absolute/sdk ``` Or via yarn: ```bash yarn add @arkane_absolute/sdk ``` ## Usage ```ts import { ArkaneSDK, PredictRequest } from "@arkane_absolute/sdk"; const sdk = new ArkaneSDK({ apiKey: "your_api_key_here" }); const request: PredictRequest = { pair: { addr: "0xc7bBeC68d12a0d1830360F8Ec58fA599bA1b0e9b", name: "WETH / USDT Wrapped Ether", symbol: "WETH/USDT", exchange: { name: "Uniswap V3", }, network: { chainId: "1", name: "Ethereum", }, pairAge: 1672029486, price: 4229.657350340005, base: { name: "Wrapped Ether", symbol: "WETH", addr: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", expLink: "https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", hldLink: "https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#balances", reserve: { amount: 12666.812072155944, usd: 53563666.75798483, }, }, quote: { name: "Tether USD", symbol: "USDT", addr: "0xdAC17F958D2ee523a2206206994597C13D831ec7", expLink: "https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7", hldLink: "https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7#balances", reserve: { amount: 53567189.684217, usd: 53581210.10086005, }, }, stats_24h: { max_price: 5606.331974032582, max_price_time: "2025-08-10T01:48:23+02:00", min_price: 3651.9380233125235, min_price_time: "2025-08-10T09:46:59+02:00", total_base_volume: 156125967.26761177, total_quote_volume: 658113082124.5591, }, liquidity: { base_liquidity: 12666.812072155944, quote_liquidity: 53567189.684217, total_liquidity_usd: 2870873325883373.0, }, }, timeframe: "1h", bars: [ { open: 1000, high: 1100, low: 950, close: 1050, volume: 1234, timestamp: 1680000000, }, // ... more bars ], price: 3884, externalTxVolume: { "5m": { makers: { buy: 30, sell: 2 }, txns: { buy: 33, sell: 2 }, volume: { buy: 63360, sell: 1010 } }, "1h": { makers: { buy: 328, sell: 7 }, txns: { buy: 494, sell: 7 }, volume: { buy: 90000, sell: 5000 } }, "6h": { makers: { buy: 1741, sell: 32 }, txns: { buy: 3323, sell: 40 }, volume: { buy: 200000, sell: 30000 }, }, "1d": { makers: { buy: 5956, sell: 168 }, txns: { buy: 14031, sell: 240 }, volume: { buy: 1000000, sell: 200000 }, }, }, }; async function runPrediction() { try { const response = await sdk.predict(request); console.log("Prediction response:", response); } catch (error) { console.error("Prediction error:", error); } } runPrediction(); ``` ## API ### `new ArkaneSDK(options: ArkaneSDKOptions)` Create a new SDK instance. - `apiKey` (string, required) Your API key. - `timeoutMs` (number, optional) Request timeout in milliseconds (default: 10000). ### `predict(data: PredictRequest): Promise<PredictResponse>` Send a prediction request with market data and receive a prediction response. ## Types - **Bar** ```ts { open: number; high: number; low: number; close: number; volume: number; timestamp: number; } ``` - **TxVolumeData** ```ts { makers: { buy: number; sell: number; } txns: { buy: number; sell: number; } volume: { buy: number; sell: number; } } ``` - **ExternalTxVolume** ```ts { "5m": TxVolumeData; "1h": TxVolumeData; "6h": TxVolumeData; "1d": TxVolumeData; } ``` - **PredictResponse** ```ts { symbol: string; timeframe: string; signal: string; strategyReason: string; sma10?: number | null; rsi14?: number | null; macdLine?: number | null; signalLine?: number | null; histogram?: number | null; fibonacciLevels: number[]; } ``` ## License MIT