UNPKG

astro-perp-ccxt-dev

Version:

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

387 lines (386 loc) 22.9 kB
import Exchange from './abstract/astros.js'; import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, OrderRequest, Balances, Str, Ticker, OrderBook, Tickers, Market, Strings, Position, Num, MarginModification, Dict, int, FundingRate, Leverage } from './base/types.js'; /** * @class astros * @augments Exchange */ export default class astros extends Exchange { describe(): any; /** * @method * @name astros#fetchStatus * @description the latest known information on the availability of the exchange API * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @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 astros#fetchMarkets * @description retrieves data on all markets for astros * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @param {object} [params] extra parameters specific to the exchange api endpoint * @returns {object[]} an array of objects representing market data */ fetchMarkets(params?: {}): Promise<Market[]>; /** * @method * @name astros#fetchLeverage * @description fetch the set leverage for a market * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @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>; /** * @method * @name astros#setLeverage * @description set the level of leverage for a market * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @param {Int} leverage the rate of leverage * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.marginMode] required isolated | cross * @returns {object} response from the exchange */ setLeverage(leverage?: Int, symbol?: Str, params?: {}): Promise<{ status: string; }>; parseMarket(market: Dict): Market; /** * @method * @name astros#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @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 astros#fetchOHLCV * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market * @see https://dex-aggregator-front-git-perp-navi-fd9a1df6.vercel.app/ * @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 {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 {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 astros#fetchOrderBook * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data * @see https://www.astros.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2 * @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 astros#fetchMarkPrice * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market * @see https://www.astros.com/docs/rest/futures-trading/market-data/get-current-mark-price * @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} */ fetchMarkPrice(symbol: string, params?: {}): Promise<Ticker>; /** * @method * @name astros#fetchTickers * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market * @see https://www.astros.com/docs/rest/futures-trading/market-data/get-symbols-list * @param {string[]} [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 * @param {string} [params.method] the method to use, futuresPublicGetAllTickers or publicGetInfoPairs * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure} */ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>; parseTicker(ticker: Dict, market?: Market): Ticker; /** * @method * @name astros#fetchTrades * @description get the list of most recent trades for a particular symbol * @see https://www.astros.com/docs/rest/futures-trading/market-data/get-transaction-history * @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 * @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; parseSide(side: any): string; /** * @method * @name astros#fetchFundingRate * @description fetch the current funding rate * @see https://www.astros.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure} */ fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>; /** * @method * @name astros#fetchFundingInterval * @description fetch the current funding rate interval * @see https://www.astros.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure} */ fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>; parseFundingRate(data: any, market?: Market): FundingRate; parseFundingInterval(interval: any): string; /** * @method * @name astros#fetchFundingRateHistory * @see https://www.astros.com/docs/rest/futures-trading/funding-fees/get-public-funding-history#request-url * @description fetches historical funding rate prices * @param {string} symbol unified symbol of the market to fetch the funding rate history for * @param {int} [since] not used by kucuoinfutures * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.endTime] end time in ms (optional) * @param {int} [params.idLe] requests the content on the page before this ID (older data, optional) * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} */ fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingRateHistory[]>; parseFundingRateHistory(info: any, market?: Market): { info: any; symbol: string; fundingRate: number; timestamp: number; datetime: string; }; /** * @method * @name astros#fetchBalance * @description query for balance and get the amount of funds available for trading or funds locked in orders * @see https://www.astros.com/docs/rest/funding/funding-overview/get-account-detail-futures * @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 astros#createOrder * @description Create an order on the exchange * @see https://www.astros.com/docs/rest/futures-trading/orders/place-order * @see https://www.astros.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request * @param {string} symbol Unified CCXT market symbol * @param {string} type 'limit' or 'market' * @param {string} side 'buy' or 'sell' * @param {float} amount the amount of currency to trade * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.clientOrderId] - Client-specified order ID * @param {number} [params.leverage] - Leverage used for the order, defalut is 1 * @param {string} [params.positionType] - 'isolated' maps to 3, 'cross' maps to 4, defalut is 3 * @param {string} [params.matchType] - Time in force: GTC: 1, IOC: 2, FOK: 3, POST_ONLY: 4, defalut is 2 * @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 astros#createOrders * @description create a list of trade orders * @see https://www.astros.com/docs/rest/futures-trading/orders/place-multiple-orders * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>; createContractOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Dict; handleTriggerPrices(params: any): any[]; /** * @method * @name astros#closePosition * @description closes open positions for a market * @see https://www.astros.com/docs/rest/futures-trading/orders/place-order * @param {string} symbol Unified CCXT market symbol * @param {string} side not used by astros closePositions * @param {object} [params] extra parameters specific to the okx api endpoint * @param {string} params.contractPositionId - Position ID of the contract to close (required) * @param {string} params.price - Price at which to close (required if isMarket is false; ignored if type is market) * @param {string} params.type - Order type: 'market' or 'limit' * @param {string} params.amount - Amount to close (i.e. position size) * @param {string} [params.timestamp] - Optional; defaults to current system time in ms * @param {string} [params.clientOrderId] - client order ID; if not provided, will not be sent * @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure} */ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>; /** * @method * @name astros#cancelOrder * @description cancels an open order * @see https://www.astros.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid * @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 {int} [params.clientOrderId] cancel order by client order id * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ cancelOrder(id: string, symbol: string, params?: {}): Promise<Order>; /** * @method * @name astros#cancelOrders * @description cancel multiple orders * @see https://www.astros.com/docs/rest/futures-trading/orders/batch-cancel-orders * @param {string[]} ids order ids * @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.clientOrderIds] client order ids * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>; /** * @method * @name astros#cancelAllOrders * @description cancel all open orders * @see https://www.astros.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders * @see https://www.astros.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {object} [params.trigger] When true, all the trigger orders will be cancelled * @returns Response from the exchange */ cancelAllOrders(symbol: string, params?: {}): Promise<Order[]>; /** * @method * @name astros#addMargin * @description add margin * @see https://www.astros.com/docs/rest/futures-trading/positions/add-margin-manually * @param {string} symbol unified market symbol * @param {float} amount amount of margin to add * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.positionId] position id * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure} */ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>; /** * @method * @name astros#reduceMargin * @description reduce margin * @see https://www.astros.com/docs/rest/futures-trading/positions/reduce-margin-manually * @param {string} symbol unified market symbol * @param {float} amount amount of margin to add * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {int} [params.positionId] position id * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure} */ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>; /** * @method * @name astros#setMarginMode * @description set margin mode to 'cross' or 'isolated' * @see https://www.astros.com/docs/rest/futures-trading/positions/reduce-margin-manually * @param {string} symbol unified market symbol * @param {string} marginMode 'cross' or 'isolated' * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} response from the exchange{@link https://docs.ccxt.com/#/?id=add-margin-structure} */ setMarginMode(symbol: string, marginMode: string, params?: {}): Promise<Dict>; parseMarginModification(info: any, market?: Market): MarginModification; /** * @method * @name astros#fetchOpenOrders * @description fetches information on multiple open orders made by the user * @see https://docs.astros.com/futures/#get-order-list * @see https://docs.astros.com/futures/#get-untriggered-stop-order-list * @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 {int} [params.until] end time in ms * @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 astros#fetchClosedOrders * @description fetches information on multiple open orders made by the user * @see https://docs.astros.com/futures/#get-order-list * @see https://docs.astros.com/futures/#get-untriggered-stop-order-list * @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 {int} [params.until] end time in ms * @param {int} [params.orderId] order id * @param {int} [params.clientOrderId] client order id * @param {boolean} [params.sortByAsc] Whether to sort in ascending order by orderid * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>; /** * @method * @name astros#fetchPositions * @description fetch all open positions * @see https://docs.astros.com/futures/#get-position-list * @param {string[]|undefined} 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 astros#fetchMyTrades * @see https://docs.astros.com/futures/#get-fills * @description fetch all trades made by the user * @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 {int} [params.until] End time in ms * @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 {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 binance#fetchOrder * @description fetches information on an order made by the user * @see https://docs.astros.com/futures/#fetchOrder * @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 * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>; urlencodeRaw(params: Dict): string; sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): { url: any; method: string; body: any; headers: any; }; handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any; parseOrder(order: Dict, market?: Market): Order; parseOrderSide(isLong: boolean): "buy" | "sell" | ""; parseTimeInForce(matchType: number): string; parseOrderStatus(status: Str, dealQuantity?: string, quantity?: string): any; parseOrderType(isMarket: boolean): "limit" | "market" | ""; parseDirectionSide(direction: string): string; parseTakerOrMaker(isTaker: boolean): "taker" | "maker"; parseOrderTypeForTrade(typeRaw: number): string; convert2MarketSymbol(remoteSymbol: string): string; }