UNPKG

ccxt

Version:

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges

390 lines (389 loc) • 22.9 kB
import Exchange from './abstract/paradex.js'; import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int, MarginMode, Leverage, Greeks } from './base/types.js'; /** * @class paradex * @description Paradex is a decentralized exchange built on the StarkWare layer 2 scaling solution. To access private methods you can either use the ETH public key and private key by setting (exchange.privateKey and exchange.walletAddress) * or alternatively you can provide the startknet private key and public key by setting exchange.options['paradexAccount'] with add {"privateKey": A, "publicKey": B, "address": C} * @augments Exchange */ export default class paradex extends Exchange { describe(): any; /** * @method * @name paradex#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @see https://docs.api.testnet.paradex.trade/#get-system-time-unix-milliseconds * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int} the current integer timestamp in milliseconds from the exchange server */ fetchTime(params?: {}): Promise<Int>; /** * @method * @name paradex#fetchStatus * @description the latest known information on the availability of the exchange API * @see https://docs.api.testnet.paradex.trade/#get-system-state * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure} */ fetchStatus(params?: {}): Promise<{ status: string; updated: any; eta: any; url: any; info: any; }>; /** * @method * @name paradex#fetchMarkets * @description retrieves data on all markets for bitget * @see https://docs.api.testnet.paradex.trade/#list-available-markets * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} an array of objects representing market data */ fetchMarkets(params?: {}): Promise<Market[]>; parseMarket(market: Dict): Market; /** * @method * @name paradex#fetchOHLCV * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market * @see https://docs.api.testnet.paradex.trade/#ohlcv-for-a-symbol * @param {string} symbol unified symbol of the market to fetch OHLCV data for * @param {string} timeframe the length of time each candle represents * @param {int} [since] timestamp in ms of the earliest candle to fetch * @param {int} [limit] the maximum amount of candles to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] timestamp in ms of the latest candle to fetch * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>; parseOHLCV(ohlcv: any, market?: Market): OHLCV; /** * @method * @name paradex#fetchTickers * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure} */ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>; /** * @method * @name paradex#fetchTicker * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary * @param {string} symbol unified symbol of the market to fetch the ticker for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure} */ fetchTicker(symbol: string, params?: {}): Promise<Ticker>; parseTicker(ticker: Dict, market?: Market): Ticker; /** * @method * @name paradex#fetchOrderBook * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data * @see https://docs.api.testnet.paradex.trade/#get-market-orderbook * @param {string} symbol unified symbol of the market to fetch the order book for * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols */ fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>; /** * @method * @name paradex#fetchTrades * @description get the list of most recent trades for a particular symbol * @see https://docs.api.testnet.paradex.trade/#trade-tape * @param {string} symbol unified symbol of the market to fetch trades for * @param {int} [since] timestamp in ms of the earliest trade to fetch * @param {int} [limit] the maximum amount of trades to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] the latest time in ms to fetch trades for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades} */ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>; parseTrade(trade: Dict, market?: Market): Trade; /** * @method * @name paradex#fetchOpenInterest * @description retrieves the open interest of a contract trading pair * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary * @param {string} symbol unified CCXT market symbol * @param {object} [params] exchange specific parameters * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure} */ fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>; parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest; hashMessage(message: any): string; signHash(hash: any, privateKey: any): string; signMessage(message: any, privateKey: any): string; getSystemConfig(): Promise<any>; prepareParadexDomain(l1?: boolean): Promise<{ name: string; chainId: any; version: string; } | { name: string; chainId: any; version: number; }>; retrieveAccount(): Promise<Dict>; onboarding(params?: {}): Promise<any>; authenticateRest(params?: {}): Promise<string>; parseOrder(order: Dict, market?: Market): Order; parseTimeInForce(timeInForce: Str): string; parseOrderStatus(status: Str): string; parseOrderType(type: Str): string; convertShortString(str: string): string; scaleNumber(num: string): string; /** * @method * @name paradex#createOrder * @description create a trade order * @see https://docs.api.prod.paradex.trade/#create-order * @param {string} symbol unified symbol of the market to create an order in * @param {string} type 'market' or 'limit' * @param {string} side 'buy' or 'sell' * @param {float} amount how much of currency you want to trade in units of base currency * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {float} [params.stopPrice] alias for triggerPrice * @param {float} [params.triggerPrice] The price a trigger order is triggered at * @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at * @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at * @param {string} [params.timeInForce] "GTC", "IOC", or "POST_ONLY" * @param {bool} [params.postOnly] true or false * @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position. * @param {string} [params.clientOrderId] a unique id for the order * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>; /** * @method * @name paradex#cancelOrder * @description cancels an open order * @see https://docs.api.prod.paradex.trade/#cancel-order * @see https://docs.api.prod.paradex.trade/#cancel-open-order-by-client-order-id * @param {string} id order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] a unique id for the order * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name paradex#cancelAllOrders * @description cancel all open orders in a market * @see https://docs.api.prod.paradex.trade/#cancel-all-open-orders * @param {string} symbol unified market symbol of the market to cancel orders in * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ cancelAllOrders(symbol?: Str, params?: {}): Promise<any>; /** * @method * @name paradex#fetchOrder * @description fetches information on an order made by the user * @see https://docs.api.prod.paradex.trade/#get-order * @see https://docs.api.prod.paradex.trade/#get-order-by-client-id * @param {string} id the order id * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] a unique id for the order * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; /** * @method * @name paradex#fetchOrders * @description fetches information on multiple orders made by the user * @see https://docs.api.prod.paradex.trade/#get-orders * @param {string} symbol unified market symbol of the market orders were made in * @param {int} [since] the earliest time in ms to fetch orders for * @param {int} [limit] the maximum number of order structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.side] 'buy' or 'sell' * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination * @param {int} params.until timestamp in ms of the latest order to fetch * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>; /** * @method * @name paradex#fetchOpenOrders * @description fetches information on multiple orders made by the user * @see https://docs.api.prod.paradex.trade/#paradex-rest-api-orders * @param {string} symbol unified market symbol of the market orders were made in * @param {int} [since] the earliest time in ms to fetch orders for * @param {int} [limit] the maximum number of order structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>; /** * @method * @name paradex#fetchBalance * @description query for balance and get the amount of funds available for trading or funds locked in orders * @see https://docs.api.prod.paradex.trade/#list-balances * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure} */ fetchBalance(params?: {}): Promise<Balances>; parseBalance(response: any): Balances; /** * @method * @name paradex#fetchMyTrades * @description fetch all trades made by the user * @see https://docs.api.prod.paradex.trade/#list-fills * @param {string} symbol unified market symbol * @param {int} [since] the earliest time in ms to fetch trades for * @param {int} [limit] the maximum number of trades structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @param {int} [params.until] the latest time in ms to fetch entries for * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>; /** * @method * @name paradex#fetchPosition * @description fetch data on an open position * @see https://docs.api.prod.paradex.trade/#list-open-positions * @param {string} symbol unified market symbol of the market the position is held in * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} */ fetchPosition(symbol: string, params?: {}): Promise<Position>; /** * @method * @name paradex#fetchPositions * @description fetch all open positions * @see https://docs.api.prod.paradex.trade/#list-open-positions * @param {string[]} [symbols] list of unified market symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} */ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>; parsePosition(position: Dict, market?: Market): Position; /** * @method * @name paradex#fetchLiquidations * @description retrieves the public liquidations of a trading pair * @see https://docs.api.prod.paradex.trade/#list-liquidations * @param {string} symbol unified CCXT market symbol * @param {int} [since] the earliest time in ms to fetch liquidations for * @param {int} [limit] the maximum number of liquidation structures to retrieve * @param {object} [params] exchange specific parameters for the huobi api endpoint * @param {int} [params.until] timestamp in ms of the latest liquidation * @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure} */ fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>; parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation; /** * @method * @name paradex#fetchTransfers * @description fetch all deposits made to an account * @see https://docs.api.prod.paradex.trade/#paradex-rest-api-transfers * @param {string} code unified currency code * @param {int} [since] the earliest time in ms to fetch deposits for * @param {int} [limit] the maximum number of deposits structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] the latest time in ms to fetch entries for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>; /** * @method * @name paradex#fetchWithdrawals * @description fetch all withdrawals made from an account * @see https://docs.api.prod.paradex.trade/#paradex-rest-api-transfers * @param {string} code unified currency code * @param {int} [since] the earliest time in ms to fetch withdrawals for * @param {int} [limit] the maximum number of withdrawals structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.until] the latest time in ms to fetch withdrawals for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>; parseTransaction(transaction: Dict, currency?: Currency): Transaction; parseTransactionStatus(status: Str): string; /** * @method * @name paradex#fetchMarginMode * @description fetches the margin mode of a specific symbol * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration * @param {string} symbol unified symbol of the market the order was made in * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure} */ fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>; parseMarginMode(rawMarginMode: Dict, market?: any): MarginMode; /** * @method * @name paradex#setMarginMode * @description set margin mode to 'cross' or 'isolated' * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration * @param {string} marginMode 'cross' or 'isolated' * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {float} [params.leverage] the rate of leverage * @returns {object} response from the exchange */ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>; /** * @method * @name paradex#fetchLeverage * @description fetch the set leverage for a market * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure} */ fetchLeverage(symbol: string, params?: {}): Promise<Leverage>; parseLeverage(leverage: Dict, market?: Market): Leverage; encodeMarginMode(mode: any): string; /** * @method * @name paradex#setLeverage * @description set the level of leverage for a market * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration * @param {float} leverage the rate of leverage * @param {string} [symbol] unified market symbol (is mandatory for swap markets) * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.marginMode] 'cross' or 'isolated' * @returns {object} response from the exchange */ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>; /** * @method * @name paradex#fetchGreeks * @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary * @param {string} symbol unified symbol of the market to fetch greeks for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} */ fetchGreeks(symbol: string, params?: {}): Promise<Greeks>; /** * @method * @name paradex#fetchAllGreeks * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure} */ fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>; parseGreeks(greeks: Dict, market?: Market): Greeks; sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): { url: string; method: string; body: any; headers: any; }; handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any; }