UNPKG

crypto-janitor

Version:

The Crypto Janitor provides a simple interface for fetching and cleaning crypto account data.

114 lines (113 loc) 2.81 kB
export interface Transaction { id: string; timestamp: Date; type: string; baseCurrency: string; baseQuantity: number; baseUsdPrice: number; feeCurrency: string; feeQuantity: number; feeUsdPrice: number; feeTotal: number; subTotal: number; total: number; } export interface Order { id: string; timestamp: Date; type: string; baseCurrency: string; baseQuantity: number; baseUsdPrice: number; quoteCurrency: string; quoteQuantity: number; quotePrice: number; quoteUsdPrice: number; feeCurrency: string; feeQuantity: number; feeUsdPrice: number; feeTotal: number; subTotal: number; total: number; } /** * A base class to support general connection operations */ export default class BaseConnection { name: string; type: string; connection: any; credentials?: any; balances: any; symbols: Array<any>; initialized: boolean; requireSymbols: boolean; requireUsdValuation: boolean; stableCoins: Array<string>; fiatCurrencies: Array<string>; stableCurrencies: Array<string>; /** * Create BaseConnection instance * @param {string} name - Name of connection (Ex: coinbase) * @param {string} type - Type of connection (Ex: api) * @param {any} params - (Optional) Additional paramaters */ constructor(name: string, type: string, params?: any); /** * JSON object representing connection * @return {any} */ toJSON(): any; /** * HELPER: Convert buy/sell to swap if no fiat is involved in order * * @param {any} order - Order instance * @return {Order} Reformatted Order */ _attemptedSwapConversion(order: Order): Order; /** * Initialize exchange by fetching balances and loading markets * @return {void} */ initialize(): void; /** * Fetch Account Balances * @return {void} */ getBalances(): void; /** * Fetch Account Withdrawals * @return {void} */ getWithdrawals(): void; /** * Fetch Account Deposits * @return {void} */ getDeposits(): void; /** * Fetch Account Orders * @return {void} */ getOrders(): void; /** * Fetch all account ledger (withdrawals, deposits, and orders) * @return {void} */ getLedger(): void; /** * Fetch account transactions (withdrawals, deposits, and orders) * @return {void} */ getTransactions(): void; /** * Fetch all account transactions (withdrawals, deposits, and orders) * @return {void} */ getAllTransactions(): void; /** * Fetch all account transactions (withdrawals, deposits, and orders) * @return {void} */ getTxUsdVal(): void; }