Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FoxBitClient

Hierarchy

  • FoxBitClient

Index

Constructors

constructor

Accessors

isConnected

  • get isConnected(): boolean
  • Discover if websocket connection is open

    readonly
    type

    {boolean}

    memberof

    FoxBitClient

    Returns boolean

Methods

authenticate2FA

  • Completes the second part of a two-factor authentication by sending the authentication token from the non-AlphaPoint authentication system to the Order Management System. The call returns a verification that the user logging in has been authenticated, and a token. Here is how the two-factor authentication process works:

    1. Call WebAuthenticateUser. The response includes values for TwoFAType and TwoFAToken. For example, TwoFAType may return “Google,” and the TwoFAToken then returns a Google-appropriate token (which in this case would be a QR code).
    2. Enter the TwoFAToken into the two-factor authentication program, for example, Google Authenticator. The authentication program returns a different token.
    3. Call Authenticate2FA with the token you received from the two-factor authentication program (shown as YourCode in the request example below).
    memberof

    FoxBitClient

    Parameters

    • code: string

      Code holds the token obtained from the other authentication source.

    • Optional sessionToken: string

    Returns Observable<AuthenticateResponse>

cancelAllOrders

  • cancelAllOrders(omsId: number, accountId?: number, userId?: number, instrumentId?: number): Observable<GenericResponse>
  • Cancels all open matching orders for the specified instrument, account, user (subject to permission level) or a combination of them on a specific Order Management System. User and account permissions govern cancellation actions.

    UserId 37 AccId 14 Instr 25 Result
    X X X Account #14 belonging to user #37 for instrument #25.
    X X            Account #14 belonging to user #37 for all instruments.
    X            X All accounts belonging to user #37 for instrument #25.
    X                       All accounts belonging to user #37 for all instruments.
                X X All users of account #14 for instrument #25.
                X            All users of account #14 for all instruments.
                           X All accounts of all users for instrument #25. (requires special permission)
                                      All accounts of all users for all instruments (requires special permission)
    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The Order Management System under which the account operates.Required

    • Optional accountId: number
    • Optional userId: number
    • Optional instrumentId: number

    Returns Observable<GenericResponse>

cancelOrder

  • cancelOrder(omsId: number, accountId?: number, orderId?: number, clientOrderId?: number): Observable<GenericResponse>
  • Cancels an open order that has been placed but has not yet been executed. Only a trading venue operator can cancel orders for another user or account

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The Order Management System on which the order exists. Required

    • Optional accountId: number
    • Optional orderId: number
    • Default value clientOrderId: number = null

    Returns Observable<GenericResponse>

cancelQuote

  • cancelQuote(omsId: number, bidQuoteId: number, askQuoteId: number, accountId?: number, instrumentId?: number): Observable<GenericResponse>
  • Cancels a quote that has not been executed yet. Quoting is not enabled for the retail end user of the AlphaPoint software. Only registered market participants or market makers may quote. Only a trading venue operator can cancel quotes for another user.

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System where the quote was requested. Required

    • bidQuoteId: number

      The ID of the bid quote. Required.

    • askQuoteId: number

      The ID of the ask quote. Required

    • Optional accountId: number
    • Optional instrumentId: number

    Returns Observable<GenericResponse>

cancelReplaceOrder

  • CancelReplaceOrder is single API call that both cancels an existing order and replaces it with a new order. Canceling one order and replacing it with another also cancels the order’s priority in the order book. You can use ModifyOrder to preserve priority in the book; but ModifyOrder only allows a reduction in order quantity. Note: CancelReplaceOrder sacrifices the order’s priority in the order book.

    memberof

    FoxBitClient

    Parameters

    Returns Observable<CancelReplaceOrderResult>

connect

  • connect(url?: string): Observable<boolean>
  • Connect to FoxBit websocket endpoint

    memberof

    FoxBitClient

    Parameters

    • Default value url: string = "wss://api.foxbit.com.br/WSGateway/"

    Returns Observable<boolean>

disconnect

  • disconnect(): void
  • Disconnect from FoxBit websocket connection

    memberof

    FoxBitClient

    Returns void

getAccountFees

  • Retrieves Fee structure for specific Account


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the account for which information was requested.

    • omsId: number

      The ID of the Order Management System that includes the product.

    Returns Observable<AccountFeesResponse[]>

getAccountInfo

  • getAccountInfo(omsId: number, accountId: number, accountHandle: string): Observable<AccountInfoResult>
  • Returns detailed information about one specific account belonging to the authenticated user and existing on a specific Order Management System

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the account exists

    • accountId: number

      The ID of the account on the Order Management System for which information will be returned.

    • accountHandle: string

      AccountHandle is a unique user-assigned name that is checked at create time by the Order Management System. Alternate to Account ID.

    Returns Observable<AccountInfoResult>

getAccountPositions

  • Retrieves a list of positions (balances) for a specific user account running under a specific Order Management System. The trading day runs from UTC Midnight to UTC Midnight.

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the authenticated user’s account on the Order Management System for which positions will be returned.

    • omsId: number

      The ID of the Order Management System to which the user belongs. A user will belong only to one OMS.

    Returns Observable<AccountPositionResult[]>

getAccountTrades

  • getAccountTrades(accountId: number, omsId: number, startIndex: number, count: number): Observable<AccountTradesResult[]>
  • Requests the details on up to 200 past trade executions for a single specific user account and its Order Management System, starting at index i, where i is an integer identifying a specific execution in reverse order; that is, the most recent execution has an index of 0, and increments by one as trade executions recede into the past. The operator of the trading venue determines how long to retain an accessible trading history before archiving.

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the authenticated user’s account.

    • omsId: number

      The ID of the Order Management System to which the user belongs. A user will belong only to one OMS.

    • startIndex: number

      The starting index into the history of trades, from 0 (the most recent trade).

    • count: number

      The number of trades to return. The system can return up to 200 trades.

    Returns Observable<AccountTradesResult[]>

getAccountTransactions

  • getAccountTransactions(accountId: number, omsId: number, depth: number): Observable<AccountTradesResult[]>
  • Returns a list of transactions for a specific account on an Order Management System. The owner of the trading venue determines how long to retain order history before archiving.

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the account for which transactions will be returned. If not specified, the call returns transactions for the default account for the logged-in user

    • omsId: number

      The ID of the Order Management System from which the account’s transactions will be returned.

    • depth: number

      The number of transactions that will be returned, starting with the most recent transaction.

    Returns Observable<AccountTradesResult[]>

getAllDepositTickets

  • Returns all deposit tickets that match the string/value pairs included in the request, starting at a specific ticket, and returning up to a total number that can be specified in the request.

    memberof

    FoxBitClient

    Parameters

    • allDepositTicketsRequest: AllDepositOrWithdrawTicketsRequest

      OMSId and OperatorId are required; other string/value pairs are optional. AmountOperator must be included if an Amount value is included.

    Returns Observable<AllDepositTicketsResult[]>

getAllWithdrawTickets

getDepositTicket

  • getDepositTicket(omsId: number, operatorId: number, requestCode: string, accountId: number): Observable<AllDepositTicketsResult>
  • Returns a single deposit ticket by matching its request code to one already in the database.


    Only admin-level users can issue this call.

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System where the withdrawal was made.

    • operatorId: number

      The ID of the trading venue operator on the system where the withdraw was made.

    • requestCode: string

      A GUID (globally unique ID) that identifies the specific withdrawal ticket you want to return. Obtain the RequestCode from CreateWithdrawTicket or GetAllWithdrawTickets.

    • accountId: number

      The ID of the account from which the withdrawal was made.

    Returns Observable<AllDepositTicketsResult>

getInstrument

  • Retrieves the details of a specific instrument from the Order Management System of the trading venue. An instrument is a pair of exchanged products (or fractions of them) such as US dollars and ounces of gold.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System from where the instrument is traded.

    • instrumentId: number

      The ID of the instrument.

    Returns Observable<InstrumentResponse>

getInstruments

  • Retrieves the details of a specific instrument from the Order Management System of the trading venue. An instrument is a pair of exchanged products (or fractions of them) such as US dollars and ounces of gold.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the instruments are available.

    Returns Observable<InstrumentResponse[]>

getL2Snapshot

  • getL2Snapshot(omsId: number, instrumentId: number, depth?: number): Observable<L2SnapshotResponse[]>
  • Provides a current Level 2 snapshot of a specific instrument trading on an Order Management System to a user-determined market depth


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System where the instrument is traded.

    • instrumentId: number

      The ID of the instrument that is the subject of the snapshot.

    • Default value depth: number = 100

    Returns Observable<L2SnapshotResponse[]>

getOpenOrders

  • getOpenOrders(accountId: number, omsId: number): Observable<OpenOrdersResult[]>
  • Returns an array of 0 or more orders that have not yet been filled (open orders) for a single account for a given user on a specific Order Management System. The call returns an empty array if a user has no open orders.

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the authenticated user’s account

    • omsId: number

      The ID of the Order Management System to which the user belongs. A user will belong only to one OMS.

    Returns Observable<OpenOrdersResult[]>

getOrderFee

  • Returns an estimate of the fee for a specific order and order type. Fees are set and calculated by the operator of the trading venue.

    memberof

    FoxBitClient

    Parameters

    Returns Observable<OrderFeeResult>

getOrderHistory

  • Returns a complete list of all orders, both open and executed, for a specific account on the specified Order Management System.

    memberof

    FoxBitClient

    Parameters

    • accountId: number

      The ID of the Order Management System where the orders were placed

    • omsId: number

      The ID of the account whose orders will be returned

    Returns Observable<OrderHistoryResult>

getProduct

  • getProduct(omsId: number, productId: number): Observable<ProductResponse>
  • Retrieves the details about a specific product on the trading venue. A product is an asset that is tradable or paid out.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System that includes the product

    • productId: number

      The ID of the product (often a currency) on the specified Order Management System.

    Returns Observable<ProductResponse>

getProducts

  • Returns an array of products available on the trading venue. A product is an asset that is tradable or paid out


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System that includes the product

    Returns Observable<ProductResponse[]>

getTickerHistory

  • getTickerHistory(omsId: number, instrumentId: number, fromDate: Date, toDate?: Date, interval?: number): Observable<SubscriptionTickerResponse[]>
  • Requests a ticker history (high, low, open, close, volume, bid, ask, ID) of a specific instrument from a given date forward to the present. You will need to format the returned data per your requirements.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System.

    • instrumentId: number

      The ID of a specific instrument. The Order Management System and the default Account ID of the logged-in user are assumed.

    • fromDate: Date

      Oldest date from which the ticker history will start, in 'yyyy-MM-ddThh:mm:ssZ' format. The report moves toward the present from this point.

    • Default value toDate: Date = new Date()
    • Default value interval: number = 60

    Returns Observable<SubscriptionTickerResponse[]>

getUserConfig

  • getUserConfig(): Observable<Array<object>>
  • GetUserConfig returns the list of key/value pairs set by the SetUserConfig call and associated with a user record. A trading venue can use Config strings to store custom information or compliance information with a user record.

    memberof

    FoxBitClient

    Returns Observable<Array<object>>

    }

getUserInfo

  • Retrieves basic information about a user from the Order Management System. A user may only see information about himself; an administrator (or superuser) may see, enter, or change information about other users

    memberof

    FoxBitClient

    Returns Observable<UserInfoResponse>

getUserPermissions

  • getUserPermissions(userId: number): Observable<string[]>
  • Retrieves an array of permissions for the logged-in user. Permissions can be set only by an administrator or superuser. An administrator or superuser can set permissions for each user on an API-call by API-call basis, to allow for highly granular control. Common permission sets include Trading, Deposit, and Withdrawal (which allow trading, deposit of funds, and account withdrawals, respectively); or AdminUI, UserOperator, and AccountOperator (which allow control of the Order Management System, set of users, or an account)

    memberof

    FoxBitClient

    Parameters

    • userId: number

      The ID of the user whose permission information will be returned. A user can only retrieve his own permissions; an administrator can retrieve information about the permissions of others.

    Returns Observable<string[]>

getWithdrawTicket

  • getWithdrawTicket(omsId: number, operatorId: number, requestCode: string, accountId: number): Observable<AllWithdrawTicketsResult>
  • Returns a single withdraw ticket from the Order Management System, trading venue operator, and account that matches the GUID (globally unique identifier) in RequestCode. Obtain the GUID from the call CreateWithdrawTicket when the ticket is first created, or from GetAllWithdrawTickets, another admin-level-only call. An administrator can use GetWithdrawTicket to return any single withdrawal ticket in the system.

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System where the withdrawal was made.

    • operatorId: number

      The ID of the trading venue operator on the system where the withdraw was made.

    • requestCode: string

      A GUID (globally unique ID) that identifies the specific withdrawal ticket you want to return. Obtain the RequestCode from CreateWithdrawTicket or GetAllWithdrawTickets.

    • accountId: number

      The ID of the account from which the withdrawal was made.

    Returns Observable<AllWithdrawTicketsResult>

logOut

  • logOut(): Observable<boolean>
  • Logout ends the current websocket session


    Endpoint Type: Public

    memberof

    FoxBitClient

    Returns Observable<boolean>

removeUserConfig

  • removeUserConfig(userId: number, userName: string, key: string): Observable<GenericResponse>
  • RemoveUserConfig deletes a single key/value Config pair from a user record. A trading venue uses onfig strings to store custom information or compliance information with a user’s record.

    memberof

    FoxBitClient

    Parameters

    • userId: number

      The ID of the user from whose record you’re deleting the custom key/value pair

    • userName: string

      The name of the user from whose record you’re deleting the custom key/value pair

    • key: string

      The name of the key/value pair to delete

    Returns Observable<GenericResponse>

resetPassword

  • ResetPassword is a two-step process. The first step calls ResetPassword with the user’s username. The Order Management System then sends an email to the user’s registered email address. The email contains a reset link. Clicking the link sends the user to a web page where he can enter a new password.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • username: string

      The name of the user, for example, jsmith.

    Returns Observable<GenericResponse>

sendOrder

  • Creates an order. Anyone submitting an order should also subscribe to the various market data and event feeds, or call GetOpenOrders or GetOrderStatus to monitor the status of the order. If the order is not in a state to be executed, GetOpenOrders will not return it.

    memberof

    FoxBitClient

    Parameters

    Returns Observable<SendOrderResult>

setUserConfig

  • setUserConfig(userId: number, userName: string, config: Array<object>): Observable<GenericResponse>
  • SetUserConfig adds an array of one or more arbitrary key/value pairs to a user record. A trading venue can use Config strings to store custom information or compliance information with a user’s record.

    memberof

    FoxBitClient

    Parameters

    • userId: number

      The ID of the user to whose record you’re adding the custom key/value pairs.

    • userName: string

      The name of the user to whose record you’re adding the custom key/value pairs.

    • config: Array<object>

      array of key/value pairs. “Key” is always a string; but the associated Value of Key can be of any data type.

    Returns Observable<GenericResponse>

setUserInfo

  • setUserInfo(userId: number, userName: string, password: string, email: string, emailVerified: boolean, accountId: number, use2FA: boolean): Observable<UserInfoResponse>
  • Enters basic information about a user into the Order Management System. A user may only enter or change information about himself; an administrator (or superuser) may enter or change information about other users.

    memberof

    FoxBitClient

    Parameters

    • userId: number

      The ID of the user; set by the system when the user registers.

    • userName: string

      User’s name; “John Smith.”

    • password: string

      User’s password.

    • email: string

      User’s email address.

    • emailVerified: boolean

      Send true if you have verified the user’s email; send false if you have not verified the email address. Default is false.

    • accountId: number

      The ID of the default account with which the user is associated. A user may be associated with more than one account, and more than one user may be associated with a single account. An admin or superuser can specify additional accounts

    • use2FA: boolean

      Set to true if this user must use two-factor authentication; set to false if this user does not need to user two-factor authentication. Default is false.

    Returns Observable<UserInfoResponse>

subscribeLevel1

  • Retrieves the latest Level 1 Ticker information and then subscribes the user to ongoing Level 1 market data event updates for one specific instrument. For more information about Level 1 and Level 2. The SubscribeLevel1 call responds with the Level 1 response shown below. The OMS then periodically sends Leve1UpdateEvent information when best bid/best offer issues in the same format as this response, until you send the UnsubscribeLevel1 call.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the instrument trades.

    • instrumentIdOrSymbol: number | string

      The ID of the instrument you’re tracking. or The symbol of the instrument you’re tracking.

    Returns Observable<SubscriptionLevel1Response>

subscribeLevel2

  • subscribeLevel2(omsId: number, instrumentIdOrSymbol: number | string, depth?: number): Observable<SubscriptionL2Response[]>
  • Retrieves the latest Level 2 Ticker information and then subscribes the user to Level 2 market data event updates for one specific instrument. Level 2 allows the user to specify the level of market depth information on either side of the bid and ask. The SubscribeLevel2 call responds with the Level 2 response shown below. The OMS then periodically sends Level2UpdateEvent information in the same format as this response until you send the UnsubscribeLevel2 call.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the instrument trades.

    • instrumentIdOrSymbol: number | string

      The ID of the instrument you’re tracking or The symbol of the instrument you’re tracking

    • Default value depth: number = 300

      Depth in this call is “depth of market”, the number of buyers and sellers at greater or lesser prices in the order book for the instrument.

    Returns Observable<SubscriptionL2Response[]>

subscribeTicker

  • subscribeTicker(omsId: number, instrumentId: number, interval?: number, includeLastCount?: number): Observable<SubscriptionTickerResponse[]>
  • Subscribes a user to a Ticker Market Data Feed for a specific instrument and interval. SubscribeTicker sends a response object as described below, and then periodically returns a TickerDataUpdateEvent that matches the content of the response object.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System

    • instrumentId: number

      The ID of the instrument whose information you want to track.

    • Default value interval: number = 60
    • Default value includeLastCount: number = 100

    Returns Observable<SubscriptionTickerResponse[]>

subscribeTrades

  • Retrieves the latest public market trades and Subscribes User to Trade updates for the specified Instrument.


    When subscribed to Trades, you will receive TradeDataUpdateEvent messages from the server

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      Order Management System ID

    • instrumentId: number

      Instrument's Identifier

    • Default value includeLastCount: number = 100

    Returns Observable<SubscriptionTradesResponse[]>

unsubscribeLevel1

  • unsubscribeLevel1(omsId: number, instrumentId: number): Observable<GenericResponse>
  • Unsubscribes the user from a Level 1 Market Data Feed subscription..


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the user has subscribed to a Level 1 market data feed.

    • instrumentId: number

      The ID of the instrument being tracked by the Level 1 market data feed.

    Returns Observable<GenericResponse>

unsubscribeLevel2

  • unsubscribeLevel2(omsId: number, instrumentId: number): Observable<GenericResponse>
  • Unsubscribes the user from a Level 2 Market Data Feed subscription.


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the user has subscribed to a Level 2 market data feed.

    • instrumentId: number

      The ID of the instrument being tracked by the Level 2 market data feed.

    Returns Observable<GenericResponse>

unsubscribeTicker

  • unsubscribeTicker(omsId: number, instrumentId: number): Observable<GenericResponse>
  • Unsubscribes a user from a Ticker Market Data Feed


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the user has subscribed to a ticker market data feed.

    • instrumentId: number

      The ID of the instrument being tracked by the ticker market data feed.

    Returns Observable<GenericResponse>

unsubscribeTrades

  • unsubscribeTrades(omsId: number, instrumentId: number): Observable<GenericResponse>
  • Unsubscribes a user from the Trades Market Data Feed.

    memberof

    FoxBitClient

    Parameters

    • omsId: number

      The ID of the Order Management System on which the user has subscribed to a trades market data feed.

    • instrumentId: number

      The ID of the instrument being tracked by the trades market data feed.

    Returns Observable<GenericResponse>

webAuthenticateUser

  • WebAuthenticateUser authenticates a user (logs in a user) for the current websocket session. You must call WebAuthenticateUser in order to use the calls in this document not otherwise shown as "No authentication required."


    Endpoint Type: Public

    memberof

    FoxBitClient

    Parameters

    • username: string

      The name of the user, for example, jsmith.

    • password: string

      The user password. The user logs into a specific Order Management System via Secure Socket Layer (SSL and HTTPS).

    Returns Observable<AuthenticateResponse>

Generated using TypeDoc