UNPKG

poloniex-exchange-api

Version:

Simple typescript interface to the Poloniex cryptoexchange.

185 lines (184 loc) 6.65 kB
import { AxiosRequestConfig, AxiosResponse } from 'axios'; export interface IPostBody { command: string; nonce: number; } export declare const signMessage: (postBody: IPostBody, privateKey: string) => string; export declare const generateNonce: () => number; export interface IApiAuth { publicKey: string; privateKey: string; } export interface IQueryParams { command: string; } export interface IRawAgent { auth?: IApiAuth; isUpgraded(): boolean; getPublicEndpoint(queryParams?: IQueryParams, configOverride?: IPoloniexRequestConfig): Promise<AxiosResponse>; postToPrivateEndpoint(data: IPostBody, configOverride?: IPoloniexRequestConfig): Promise<AxiosResponse>; signMessage(postBody: IPostBody, privateKey: string): string; upgrade(newAuth: IApiAuth): void; } export declare type IReturnOrderBookParams = { currencyPair: string; depth?: string; }; export declare type IReturnPublicTradeHistoryParams = { currencyPair: string; start?: string; end?: string; }; export declare type IReturnChartDataParams = { currencyPair: string; start: string; end: string; period: string; }; export declare type IReturnLoanOrdersParams = { currency?: string; }; export declare type IReturnCompleteBalancesParams = { account: string; }; export declare type IGenerateNewAddressParams = { currency: string; }; export declare type IReturnDepositsWithdrawalsParams = { start: string; end: string; }; export declare type IReturnOpenOrdersParams = { currencyPair: string; }; export declare type IReturnPrivateTradeHistoryParams = { currencyPair: string; start?: string; end?: string; limit?: string; }; export declare type IReturnOrderTradesParams = { orderNumber: string; }; export declare type IBuyParams = { currencyPair: string; rate: number; amount: number; fillOrKill: string; immediateOrCancel: string; postOnly: string; }; export declare type ISellParams = { currencyPair: string; rate: number; amount: number; fillOrKill: string; immediateOrCancel: string; postOnly: string; }; export declare type ICancelOrderParams = { orderNumber: string; }; export declare type IMoveOrderParams = { orderNumber: string; rate: number; amount?: number; immediateOrCancel: string; postOnly: string; }; export declare type IWithdrawParams = { currency: string; amount: number; address: string; paymentId?: string; }; export declare type IAvailableBalancesParams = { account: string; }; export declare type ITransferBalanceParams = { currency: string; amount: number; fromAddress: string; toAddress: string; }; export declare type IMarginBuyParams = { currencyPair: string; rate: number; amount: number; lendingRate?: number; }; export declare type IMarginSellParams = { currencyPair: string; rate: number; amount: number; lendingRate?: number; }; export declare type IGetMarginPositionParams = { currencyPair: string; }; export declare type ICloseMarginPositionParams = { currencyPair: string; }; export declare type ICreateLoanOfferParams = { currency: string; amount: number; duration: number; autoRenew: number; lendingRate: number; }; export declare type ICancelLoanOfferParams = { orderNumber: string; }; export declare type IReturnLendingHistoryParams = { start: string; end: string; limit?: number; }; export declare type IToggleAutoRenvewParams = { orderNumber: string; }; export interface IPoloniexClient { rawAgent: IRawAgent; isUpgraded(): boolean; upgrade(newAuth: IApiAuth): void; returnTicker(): Promise<IPoloniexResponse>; return24Volume(): Promise<IPoloniexResponse>; returnOrderBook(queryParams?: IReturnOrderBookParams): Promise<IPoloniexResponse>; returnPublicTradeHistory(queryParams: IReturnPublicTradeHistoryParams): Promise<IPoloniexResponse>; returnChartData(queryParams: IReturnChartDataParams): Promise<IPoloniexResponse>; returnCurrencies(): Promise<IPoloniexResponse>; returnLoanOrders(queryParams: IReturnLoanOrdersParams): Promise<IPoloniexResponse>; returnBalances(): Promise<IPoloniexResponse>; returnCompleteBalances(queryParams?: IReturnCompleteBalancesParams): Promise<IPoloniexResponse>; returnDepositAddress(): Promise<IPoloniexResponse>; generateNewAddress(queryParams: IGenerateNewAddressParams): Promise<IPoloniexResponse>; returnDepositsWithdrawals(queryParams: IReturnDepositsWithdrawalsParams): Promise<IPoloniexResponse>; returnOpenOrders(queryParams?: IReturnOpenOrdersParams): Promise<IPoloniexResponse>; returnPrivateTradeHistory(queryParams?: IReturnPrivateTradeHistoryParams): Promise<IPoloniexResponse>; returnOrderTrades(queryParams?: IReturnOrderTradesParams): Promise<IPoloniexResponse>; buy(queryParams: IBuyParams): Promise<IPoloniexResponse>; sell(queryParams: ISellParams): Promise<IPoloniexResponse>; cancelOrder(queryParams: ICancelOrderParams): Promise<IPoloniexResponse>; moveOrder(queryParams: IMoveOrderParams): Promise<IPoloniexResponse>; withdraw(queryParams: IWithdrawParams): Promise<IPoloniexResponse>; returnFeeInfo(): Promise<IPoloniexResponse>; returnAvailableAccountBalances(queryParams?: IAvailableBalancesParams): Promise<IPoloniexResponse>; returnTradableBalances(): Promise<IPoloniexResponse>; transferBalance(queryParams: ITransferBalanceParams): Promise<IPoloniexResponse>; returnMarginAccountSummary(): Promise<IPoloniexResponse>; marginBuy(queryParams: IMarginBuyParams): Promise<IPoloniexResponse>; marginSell(queryParams: IMarginSellParams): Promise<IPoloniexResponse>; getMarginPosition(queryParams?: IGetMarginPositionParams): Promise<IPoloniexResponse>; closeMarginPosition(queryParams: ICloseMarginPositionParams): Promise<IPoloniexResponse>; createLoanOffer(queryParams: ICreateLoanOfferParams): Promise<IPoloniexResponse>; cancelLoanOffer(queryParams: ICancelLoanOfferParams): Promise<IPoloniexResponse>; returnOpenLoanOffers(): Promise<IPoloniexResponse>; returnActiveLoans(): Promise<IPoloniexResponse>; returnLendingHistory(queryParams: IReturnLendingHistoryParams): Promise<IPoloniexResponse>; toggleAutoRenew(queryParams: IToggleAutoRenvewParams): Promise<IPoloniexResponse>; } export declare const getClient: (auth?: IApiAuth, requestConfig?: IPoloniexRequestConfig) => IPoloniexClient; export interface IPoloniexRequestConfig extends AxiosRequestConfig { } export interface IPoloniexResponse extends AxiosResponse { }