UNPKG

@drift-labs/common

Version:

Common functions for Drift

44 lines (43 loc) 2.06 kB
import { DriftEnv } from '@drift-labs/sdk'; import { PnlSnapshotOrderOption, SnapshotEpochResolution } from '../types'; export type DownloadFile = { key: string; requestParams: DownloadRequestParams; lastModifiedTs: number; downloadUrl?: string; }; export type DownloadRequestParams = { fileType: DownloadRecordType; requestedDate: string; fromDate: string; toDate: string; user: string; programId: string; authority: string; isEmulationMode: boolean; marketSymbol?: string; }; export type DownloadRecordType = 'trades' | 'market-trades' | 'funding-rates' | 'funding-payments' | 'deposits' | 'liquidations' | 'settle-pnl-records' | 'lp-records' | 'if-stake-records' | 'swap-records' | 'rewards'; export type DownloadPeriod = 'week' | 'month' | '3mo' | 'ytd' | 'year' | 'custom'; export declare const getFileRedisKeyFromParams: (downloadRequestParams: DownloadRequestParams) => string; export declare const dateToS3DateString: (date: Date) => string; export declare const s3DateStringToDate: (dateStr: string) => Date; export declare const getDateRangeFromSelection: (downloadPeriod: DownloadPeriod, customOpts?: { day?: number; month?: number; year: number; }) => { from: string; to: string; }; export declare const S3_LEADERBOARD_CLIENT: { getFileName: (orderBy: PnlSnapshotOrderOption, resolution: SnapshotEpochResolution) => string; getLeaderboardValue: (env: DriftEnv, leaderboardBucketName: string, orderBy: PnlSnapshotOrderOption, resolution: SnapshotEpochResolution) => Promise<import("../serializableTypes").UISerializableLeaderboardResult>; }; declare const S3_BUCKET_UTILS: { S3_LEADERBOARD_CLIENT: { getFileName: (orderBy: PnlSnapshotOrderOption, resolution: SnapshotEpochResolution) => string; getLeaderboardValue: (env: DriftEnv, leaderboardBucketName: string, orderBy: PnlSnapshotOrderOption, resolution: SnapshotEpochResolution) => Promise<import("../serializableTypes").UISerializableLeaderboardResult>; }; }; export default S3_BUCKET_UTILS;