Firstrade API Node - v1.0.2
    Preparing search index...

    Class FTSession

    Class creating a session for Firstrade.

    This class handles the creation and management of a session for logging into the Firstrade platform. It supports multi-factor authentication (MFA) and can save session cookies for persistent logins.

    Index

    Constructors

    Properties

    cookieJar: CookieJar
    debug: boolean
    email?: string
    loginJson: any = {}
    mfaSecret?: string
    otpOptions?: any[]
    password?: string
    phone?: string
    pin?: string
    profilePath?: string
    saveSession: boolean
    session: AxiosInstance
    tToken?: string
    username: string

    Methods

    • Builds the session headers and cookies from provided tokens.

      Parameters

      • tokens: Record<string, any>

      Returns Promise<void>

    • Deletes the session cookies.

      Returns void

    • Returns the current session tokens (access_token, ftat, sid and cookies).

      Returns Promise<Record<string, any>>

    • Validate and log into the Firstrade platform.

      Returns Promise<boolean>

      True if further MFA action is required, otherwise false.

      If the login request fails.

      If the API returns an error.

    • Finish the login process to the Firstrade platform when using email or phone MFA.

      Parameters

      • code: string

        The MFA code provided by the user.

      Returns Promise<void>

    • HTTP requests wrapper to the API.

      Parameters

      • method: string
      • url: string
      • Optionalconfig: AxiosRequestConfig<any>

      Returns Promise<AxiosResponse<any, any, {}>>

    • Masks the email for use in the API.

      Parameters

      • email: string

        The email address to be masked.

      Returns string

      The masked email address.