Background Information
This section provides important information about the Coinext Exchange API.
Websocket vs HTTP
Coinext APIs offers a lot of flexibility as most of them can be invoked in both Websockets and HTTP protocol. All Coinext APIs can be invoked in Websockets while some of them cannot be invoked in HTTP, specifically the APIs which supplies live data, the Subscription APIs like SubscribeLevel1. The API is available at wss://api.coinext.com.br/WSGateway/.
The major difference between Websockets and HTTP is the data transmission mode. HTTP starts sending data as responses when a request is received, whereas Websockets send and receives data based on data availability.
Deciding whether to use Websockets or HTTP can be tricky, several factors needs to be considered. One very important factor is the frequency of data update you need. Websockets are the best choice to handle real-time communication as they support bi-directional communication. In this model, both the client and server can push or pull data. They do not have to wait of each other and can work simultaneously. HTTP on the other hand is preferable in applications that deal with static data and are not updated regularly.
Websocket Message Frame
A JSON-formatted frame object.
{
"m": 0,
"i": 0,
"n": "function name",
"o": "payload"
}
Wrap all calls in a JSON-formatted frame object. Responses from the server are similarly wrapped. The API calls are documented as payloads by function name.
| Key | Value |
|---|---|
| m message type | integer. The type of the message. One of: 0 request 1 reply 2 subscribe-to event 3 event 4 unsubscribe-from event 5 error |
| i sequence number | long integer. The sequence number identifies an individual request or request-and-response pair, to your application. The system requires a non-zero sequence number, but the numbering scheme you use is up to you. No arbitrary sequence numbering scheme is enforced by AlphaPoint. Best Practices: A client-generated API call (of message types 0, 2, and 4) should: Carry an even sequence number Begin at the start of each user session Be unique within each user session. Begin with 2 (as in 2, 4, 6, 8) Message types 1 (reply), 3 (event), and 5 (error) are generated by the server. These messages echo the sequence number of the message to which they respond. See the example, following. |
| n function name | string. The function name is the name of the function being called or that the server is responding to. The server echoes your call. See the example, following. |
| o payload | Payload is a JSON-formatted string containing the data being sent with the message. Payload may consist of request parameters (key-value pairs) or response parameters. |
Example 1
Example 1
var frame = {
m: 0,
i: 0,
n: "function name",
o: "",
};
var requestPayload = {
parameter1: "value",
parameter2: 0,
};
frame.o = json.Stringify(requestPayload);
// Stringify escapes the payload's quotation marks automatically.
WS.Send(json.Stringtify(frame)); // WS.Send escapes the frame
When sending a request in the frame to the software using JavaScript, a call looks like Example 1.
Example 2
Example 2
var frame = json.Parse(wsMessage);
if (frame.m == 1) {
// message of type reply
//This is a reply
if (frame.n == "WebAuthenticateUser") {
var LoginReply = json.Parse(frame.o);
if (loginReply.Authenticated) {
var user = LoginReplay.User;
}
}
}
When receiving a frame from the software, use the frame to determine the context, and then unwrap the content, as in Example 2.
Standard response objects and common error codes
A response to an API call usually consists of a specific response, but both successful and unsuccessful responses may consist of a generic response object that verifies only that the call was received, and not that the action requested by the call took place. A generic response to an unsuccessful call provides an error code. A generic response looks like Example 3.
Example 3
Example 3
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. If the call has been successfully received by the OMS, result is true; otherwise it is false. |
| errormsg | string. A successful receipt of the call returns null. The errormsg key for an unsuccessful call returns one of the following messages: Not Authorized (errorcode 20) Invalid Response (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the call returns 0. An unsuccessful receipt of the call returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. The content of this key is usually null. |
Modules
The AlphaPoint software consists of several modules that include the OMS (OMS), the matching engine, and the Asset Manager. During installation, each is assigned an ID.
The OMS is the mechanism that manages access to the trading venue. The OMS controls permissions, accounts, and users. The OMS must be specified in many calls.
The order book resides on the AlphaPoint matching engine.
A trading venue is a combination of OMS and matching engine that creates a place to access the market and trade. A venue maintains its order book and matching engine, and may access several Order Management Systems.
The Asset Manager controls the deposit and withdrawal of funds belonging to an account. These funds can be denominated in any product that the trading venue allows.
Users, Accounts, and Permissions
The AlphaPoint software differentiates between user and account. A user is the person who logs in; an account represents the funds and trading that the user does — much like a bank account represents funds and checks.
As with a bank account, an individual user may have multiple Exchange accounts. Similarly, multiple users may trade through a single account. There may be users who have trading access to one set of accounts that overlap (but do not duplicate) the set of accounts that another user can access. There may be a many-to-many relationship where two or more users have access to a set of accounts.
The use case for this kind of "joint tenancy" is an active trading desk where a specific individual may not always be present. If User A will not be present, User B can monitor and trade on the market. User A may wish to cancel his pending trades for a specific account or instrument, but not those of his trading partner under the same account or for the same instrument.
Permissions handle the rules that determine what a user can access and do with orders, cancellations, and the other tasks of a trading venue. Most permissions encompass tasks such as trading, depositing, or withdrawing funds. Permissions in APEX is granular, each permissioned API has a specific minimum permission required which is the same name as the API, for instance, API SendOrder will require the permission SendOrder at the very least, so, very specific permission/s can be set for each individual/user in the venue.
| API ENDPOINT | MINIMUM PERMISSION REQUIRED |
|---|---|
| SendOrder | SendOrder |
| CreateWithdrawTicket | CreateWithdrawTicket |
| TransferFunds | TransferFunds |
An administrator with Operator permission sets up a user's permissions on the OMS when the user joins the trading venue, and only an administrator with Operator permission or above can change them. A full discussion of permissions is not part of this API documentation.
Products and Instruments
In Coinext, a product is an asset that is tradable or paid out. A product might be a national currency, a crypto-currency, or something else such as a commodity. For example, a product might be the Brazilian Real (BRL) or a Bitcoin (BTC) or an Ethereum (ETH). Transaction and withdrawal fees are denominated in products. (Products may be referred to as assets in some API calls.) The main product IDs on Coinext are: BTC: 1, LTC: 2, ETH: 3, XRP: 4, BRL: 5.
An instrument is a pair of exchanged products (or fractions of them). For example, Brazilian Real (BRL) for Bitcoin (BTC). In conventional investment parlance, a stock or a bond is called an instrument, but implicit in that is the potential exchange of one product for another (stock for currency). Coinext API treats that exchange as explicit, and separates product from instrument. The main instrument IDs on Coinext are: BTCBRL: 1, LTCBRL: 2, ETHBRL: 4, XRPBRL: 6.
Quotes and Orders
The Coinext API includes calls related to both quotes and orders. Quoting is not enabled for the retail end user of Coinext. Only registered market participants or marketmakers may quote. Coinext offers orders for all users.
- A quote expresses a willingness to buy or sell at a given price.
- An order is a directive to buy or sell.
In Coinext's matching engine, quotes and orders are synonymous. They both can buy or sell. This is because the matching engine requires a "firm quote" — a guaranteed bid or ask.
For both quotes and orders, trading priority is the same, and no preference is given one over the other. In code, the matching engine flags a quote for eventual regulatory and compliance rules, but for current software operation and trade execution, quotes and orders behave equivalently.
Best Practices/Quotes and Orders
Use the order-related API calls in preference to quote-related calls unless you specifically require quote-related calls.
Time– and Date-Stamp Formats
Coinext API uses two different time– and date-stamp formats, POSIX and Microsoft Ticks. Where the value of a time field key is an integer or long, the value is in POSIX format; when the value of a time field key is a string, it is in Microsoft Ticks format (also called datetime).
- POSIX stores date/time values as the number of seconds since 1 January 1970 (long integer). Coinext API often multiples this number by 1000 for the number of milliseconds since 1 January 1970. Recognize POSIX format: POSIX format is a long integer. It is usually formatted like this:
1501603632000 - Microsoft Ticks (datetime) format represents the number of ticks that have elapsed since 00:00:00 UTC, 1 January 0001, in the Gregorian calendar. A single tick represents one hundred nanoseconds (one ten-millionth of a second). There are 10,000 ticks in a millisecond; ten million ticks in a second. Ticks format does not include the number of ticks attributable to leap-seconds. Recognize Ticks format: Ticks format is a string. In Coinext API, it is usually formatted like this:
"2018-08-17T17:57:56Z"Note that a T (for time) separates the initial date from the time. The trailing Z represents the time zone, in all cases in Coinext API, this is UTC (also called Zulu time).
The Trading Day
Coinext operates a 24-hour computer-based trading venue. The trading day runs from UTC Midnight to UTC Midnight (which corresponds to 21:00 to 21:00 in Brasília time during standard time and 22:00 to 22:00 during daylight saving time). Values such as open or close are those values as of UTC Midnight. Values for day, month, or annual periods run from UTC Midnight to UTC Midnight.
Account
GetAccountTransactions
Permissions: Trading, AccountReadOnly
Call Type: Synchronous
Gets a list of transactions for an account.
Results can be filtered using different search parameters such as TransactionType and ProductId, other optional fields that can serve as search parameter are defined in the request key value table below.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountTransactions", {
OMSId: 1,
AccountId: 7,
TransactionReferenceTypes: ["Deposit", "Withdraw"],
ProductId: 3,
});
POST /AP/GetAccountTransactions HTTP/1.1
Host: hostname goes here...
aptoken: 15a9b337-94c4-4e11-a051-287725519a45
Content-Type: application/json
Content-Length: 91
{
"OMSId": 1,
"AccountId": 7,
"TransactionReferenceTypes": ["Deposit", "Withdraw"],
"ProductId": 3
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS from which the account’s transactions will be returned. |
| AccountId | integer. The ID of the account for which transactions will be returned. If the authenticated user has elevated permission like Operator or AccountOperator, account id is not required, results to be returned will be the transactions of the authenticated user's account/s.conditionally required. |
| Depth | integer. The number of transactions that will be returned, starting with the most recent transaction. If not defined, all transactions of the account will be returned(assuming not other search parameters are defined). optional. |
| ProductId | integer. Can be used to filter results, if set, only transactions for the specific product id specified will be returned, else, all transactions regardless of the product will be returned(assuming not other search parameters are defined). optional. |
| TransactionId | integer. Can be used to filter results, if set, only transaction with the specific id specified will be returned, else, all transactions regardless of the transaction id will be returned(assuming not other search parameters are defined). optional. |
| ReferenceId | integer. Can be used to filter results, if set, only transaction with the specific id specified will be returned, else, all transactions regardless of the reference id will be returned(assuming not other search parameters are defined). optional. |
| TransactionTypes | array of string or integer type. Can be used to filter results according to transaction type/s(can filter with either just 1 or more). If not set, transactions with any transaction type will be returned. optional. |
| TransactionReferenceTypes | array of string or integer type. Can be used to filter results according to transaction reference type/s(can filter with either just 1 or more). If not set, transactions with any transaction reference type will be returned. optional. |
| StartTimestamp | long integer. Can be used to filter results based on timestamp the transaction has happened. This filter will return transactions that happened on or after(earliest possible time) the specified timestamp value, if not set, transactions that happened any time will be returned. optional. |
| EndTimeStamp | long integer. Can be used to filter results based on timestamp the transaction has happened. This filter will return transactions that happened on or before(latest possible time) the specified timestamp value, if not set, transactions that happened any time will be returned. optional. |
TransactionTypes Enums
1 Fee
2 Trade
3 Other
4 Reverse
5 Hold
6 Rebate
7 MarginAcquisition
8 MarginRelinquishByTrade
9 MarginInterestTransfer
10 MarginOperatorTransferToMarginAccount
11 MarginOperatorTransferToAssetAccount
12 MarginUserTransfer
13 MarginRelinquishByTransfer
14 MarginRelinquishByReverseTrade
15 Distribution
16 Payment
21 OperatorLend
22 OperatorReceived
23 Rebalance
24 Commission
25 AirDrop
TransactionReferenceTypes Enums
1 Trade
2 Deposit
3 Withdraw
4 Transfer
5 OrderHold
6 WithdrawHold
7 DepositHold
8 MarginHold
9 ManualHold
10 ManualEntry
11 MarginAcquisition
12 MarginRelinquish
13 MarginInterestNetting
14 MarginOperatorTransferToMarginAccount
15 MarginOperatorTransferToAssetAccount
16 MarginUserTransfer
17 MarginPositionReverseTrade
18 AffiliateRebate
19 DistributionEntry
20 TransferHold
21 AirDrop
Response
[
{
"TransactionId": 24214,
"ReferenceId": 294,
"OMSId": 1,
"AccountId": 7,
"CR": 0.01247667,
"DR": 0.0,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Deposit",
"ProductId": 3,
"Balance": 1.138154399436,
"TimeStamp": 1678904016338
},
{
"TransactionId": 24021,
"ReferenceId": 293,
"OMSId": 1,
"AccountId": 7,
"CR": 0.01247667,
"DR": 0.0,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Deposit",
"ProductId": 3,
"Balance": 1.125677729436,
"TimeStamp": 1678706804112
},
{
"TransactionId": 23403,
"ReferenceId": 292,
"OMSId": 1,
"AccountId": 7,
"CR": 0.01311447,
"DR": 0.0,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Deposit",
"ProductId": 3,
"Balance": 1.122515996076,
"TimeStamp": 1677575188002
},
{
"TransactionId": 22693,
"ReferenceId": 286,
"OMSId": 1,
"AccountId": 7,
"CR": 0.0,
"DR": 0.00001,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Withdraw",
"ProductId": 3,
"Balance": 1.11033172,
"TimeStamp": 1676348233473
}
]
Returns an array of objects as a response, each object represents a transaction.
| Key | Value |
|---|---|
| TransactionId | Integer. The ID of the transaction. |
| OMSId | Integer. The ID of the OMS under which the requested transactions took place. |
| AccountId | Integer. The single account under which the transactions took place. |
| CR | decimal. Credit entry for the account on the order book. Funds entering an account. |
| DR | decimal. Debit entry for the account on the order book. Funds leaving an account. |
| Counterparty | long integer. The corresponding party in a trade. |
| TransactionType | string. The type of transaction: 1 Fee 2 Trade 3 Other 4 Reverse 5 Hold 6 Rebate 7 MarginAcquisition 8 MarginRelinquish |
| ReferenceId | long integer. The ID of the action or event that triggered this transaction. |
| ReferenceType | integer. The type of action or event that triggered this transaction. One of: 1 Trade 2 Deposit 3 Withdraw 4 Transfer 5 OrderHold 6 WithdrawHold 7 DepositHold 8 MarginHold 9 ManualHold 10 ManualEntry 11 MarginAcquisition 12 MarginRelinquish 13 MarginQuoteHold |
| ProductId | integer. The ID of the product on this account’s side of the transaction. For example, in a dollars-for-Bitcoin transaction, one side will have the product Dollar and the other side will have the product Bitcoin. Use GetProduct to return information about a product based on its ID. |
| Balance | decimal. The balance in the account after the transaction. |
| TimeStamp | long integer. Time at which the transaction took place, in POSIX format. |
GetAccountPositions
Permissions: Operator,Trading,AccountReadOnly,Manual Trader
Call Type: Synchronous
Retrieves a list of Positions(Balances) on a specific account. Starting APEX version 4.2, a new field in the request payload was added: IncludePending.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountPositions", {
OMSId: 1,
AccountId: 1,
IncludePending: true,
});
POST /AP/GetAccountPositions HTTP/1.1
Host: hostname goes here...
aptoken: b59915f0-06c5-4d41-8fbf-fd157af7ea30
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 1,
"IncludePending": true
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account on the OMS for which positions will be returned for. required. |
| IncludePending | boolean. If true, pending deposit and withdraw amounts will be included in the response, else they will not be included. Defaults to false if not defined. optional. |
Response
[
{
"OMSId": 1,
"AccountId": 1,
"ProductSymbol": "USD",
"ProductId": 1,
"Amount": 100.95,
"Hold": 0,
"PendingDeposits": 0,
"PendingWithdraws": 0,
"TotalDayDeposits": 0,
"TotalMonthDeposits": 0,
"TotalYearDeposits": 0,
"TotalDayDepositNotional": 0,
"TotalMonthDepositNotional": 0,
"TotalYearDepositNotional": 0,
"TotalDayWithdraws": 0,
"TotalMonthWithdraws": 0,
"TotalYearWithdraws": 0,
"TotalDayWithdrawNotional": 0,
"TotalMonthWithdrawNotional": 0,
"TotalYearWithdrawNotional": 0,
"NotionalProductId": 1,
"NotionalProductSymbol": "USD",
"NotionalValue": 100.95,
"NotionalHoldAmount": 0,
"NotionalRate": 1,
"TotalDayTransferNotional": 0
},
{
"OMSId": 1,
"AccountId": 1,
"ProductSymbol": "BTC",
"ProductId": 2,
"Amount": 0,
"Hold": 0,
"PendingDeposits": 0,
"PendingWithdraws": 0,
"TotalDayDeposits": 0,
"TotalMonthDeposits": 0,
"TotalYearDeposits": 0,
"TotalDayDepositNotional": 0,
"TotalMonthDepositNotional": 0,
"TotalYearDepositNotional": 0,
"TotalDayWithdraws": 0,
"TotalMonthWithdraws": 0,
"TotalYearWithdraws": 0,
"TotalDayWithdrawNotional": 0,
"TotalMonthWithdrawNotional": 0,
"TotalYearWithdrawNotional": 0,
"NotionalProductId": 1,
"NotionalProductSymbol": "USD",
"NotionalValue": 0,
"NotionalHoldAmount": 0,
"NotionalRate": 30005,
"TotalDayTransferNotional": 0
}
]
Returns an array of objects as a response.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS to which the account is assigned. |
| AccountId | integer. The ID of the account whose positions/balances were retrieved. |
| ProductSymbol | string. The symbol of a specific product. |
| ProductId | integer. The ID of a specific product. |
| Amount | decimal. The current actual balance of the account for a specific product. |
| Hold | decimal. The current actual hold amount against the current balance of the account for a specific product. A hold amount is part of the total balance or the Amount field value but is not available to be used for other transactions. A trade on working status of 100 units at $1 each will produce a $100 hold. |
| PendingDeposits | decimal. Deposit amount for a specific product that is not yet credited to the account. |
| PendingWithdraws | decimal. Withdraw amount for a specific product that is not yet debited from the account |
| TotalDayDeposits | decimal. Total amount deposited by the account for a specific product in the current day; UTC Midnight and UTC Midnight. |
| TotalMonthDeposits | decimal. Total amount deposited by the account for a specific product in the current month. |
| TotalYearDeposits | decimal. Total amount deposited by the account for a specific product in the current year. |
| TotalDayDepositNotional | decimal. Total amount in notional value deposited by the account for a specific product in the current day. |
| TotalMonthDepositNotional | decimal. Total amount in notional value deposited by the account for a specific product in the current month. |
| TotalYearDepositNotional | decimal. Total amount in notional value deposited by the account for a specific product in the current year. |
| TotalDayWithdraws | decimal. Total amount withdrawn by the account for a specific product in the current day; UTC Midnight and UTC Midnight. |
| TotalMonthWithdraws | decimal. Total amount withdrawn by the account for a specific product in the current month. |
| TotalYearWithdraws | decimal. Total amount withdrawn by the account for a specific product in the current year. |
| TotalDayWithdrawNotional | decimal. Total amount in notional value withdrawn by the account for a specific product in the current day. |
| TotalMonthWithdrawNotional | decimal. Total amount in notional value withdrawn by the account for a specific product in the current month. |
| TotalYearWithdrawNotional | decimal. Total amount in notional value withdrawn by the account for a specific product in the current year. |
| NotionalProductId | integer. The ID of the product set as the BaseNotionalProduct on the OMS. |
| NotionalProductSymbol | string. The symbol of the product set as the BaseNotionalProduct on the OMS. |
| NotionalValue | decimal. The current actual balance in notional value of the account for a specific product. |
| NotionalHoldAmount | decimal. The current actual hold amount in notional value against the current balance of the account for a specific product. |
| NotionalRate | decimal. The current rate of a specific product against the notional product. |
| TotalDayTransferNotional | decimal. Total amount in notional value transfered by the account for a specific product in the current day. |
GetAccountInstrumentStatistics
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Retrieves a list of Instrument Statistics of a specific account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountInstrumentStatistics", {
AccountId: 7,
OMSId: 1,
});
POST /AP/GetAccountInstrumentStatistics HTTP/1.1
Host: hostname goes here...
aptoken: b59915f0-06c5-4d41-8fbf-fd157af7ea30
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account on the OMS for which instrument statistics will be returned for. required. |
Response
[
{
"OMSId": 1,
"AccountId": 7,
"InstrumentId": 1,
"InstrumentSymbol": "BTCUSD",
"QuantityBought": 0,
"QuantitySold": 0,
"NotionalBought": 0,
"NotionalSold": 0,
"MonthlyQuantityBought": 0.1602,
"MonthlyQuantitySold": 0.3202,
"MonthlyNotionalBought": 3754.96,
"MonthlyNotionalSold": 8315.0,
"TradeVolume": 0,
"MonthlyTradeVolume": 12069.96,
"TotalDayBuys": 0,
"TotalDaySells": 0,
"TotalMonthBuys": 10,
"TotalMonthSells": 7,
"NotionalConversionRate": 0,
"NotionalConversionSymbol": "USD",
"RollingMonthlyStartDate": 0,
"LastTradeId": 910,
"NotionalProductId": 1,
"DailyNotionalTradeVolume": 0,
"MonthlyNotionalTradeVolume": 12069.96,
"YearlyNotionalTradeVolume": 12069.96
},
{
"OMSId": 1,
"AccountId": 7,
"InstrumentId": 2,
"InstrumentSymbol": "ETHUSD",
"QuantityBought": 0,
"QuantitySold": 0,
"NotionalBought": 0,
"NotionalSold": 0,
"MonthlyQuantityBought": 0.08,
"MonthlyQuantitySold": 0,
"MonthlyNotionalBought": 1874.88,
"MonthlyNotionalSold": 0,
"TradeVolume": 0,
"MonthlyTradeVolume": 1874.88,
"TotalDayBuys": 0,
"TotalDaySells": 0,
"TotalMonthBuys": 6,
"TotalMonthSells": 0,
"NotionalConversionRate": 0,
"NotionalConversionSymbol": "USD",
"RollingMonthlyStartDate": 0,
"LastTradeId": 916,
"NotionalProductId": 1,
"DailyNotionalTradeVolume": 0,
"MonthlyNotionalTradeVolume": 1874.88,
"YearlyNotionalTradeVolume": 1874.88
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| AccountId | integer. The ID of the account for which the instrument statistics is for. |
| InstrumentId | integer. The ID of the account for which the instrument statistics is for. |
| InstrumentSymbol | string. The symbol of a specific instrument. |
| QuantityBought | decimal. Quantity of the instrument bought by the account at the current trading day. |
| QuantitySold | integer. Quantity of the instrument sold by the account at the current trading day. |
| NotionalBought | integer. Notional value of the instrument bought by the account at the current trading day. |
| NotionalSold | integer. Notional value of the instrument sold by the account at the current trading day. |
| MonthlyQuantityBought | integer. Quantity of the instrument bought by the account for the current month. |
| MonthlyQuantitySold | integer. Quantity of the instrument sold by the account for the current month. |
| MonthlyNotionalBought | integer. Notional value of the instrument bought by the account at the current month. |
| MonthlyNotionalSold | integer. Notional value of the instrument sold by the account at the current month. |
| TradeVolume | integer. Total quantity of the instrument either sold or bought by the account at the current trading day. |
| MonthlyTradeVolume | integer. Total quantity of the instrument either sold or bought by the account at the current month. |
| TotalDayBuys | integer. Total number of times the account bought the instrument at the current trading day. |
| TotalDaySells | integer. Total number of times the account sold the instrument at the current trading day. |
| TotalMonthBuys | integer. Total number of times the account bought the instrument at the current month. |
| TotalMonthSells | integer. Total number of times the account sold the instrument at the current month. |
| NotionalConversionRate | integer. The notional conversion rate. |
| NotionalConversionSymbol | string. The notional conversion symbol. |
| RollingMonthlyStartDate | integer. The rolling monthly start date. |
| LastTradeId | integer. The ID of the most recent trade the account has for the instrument. |
| DailyNotionalTradeVolume | integer. The notional trade volume of the account for the specific instrument at the current trading day. |
| MonthlyNotionalTradeVolume | integer. The notional trade volume of the account for the specific instrument at the current month. |
| YearlyNotionalTradeVolume | integer. The notional trade volume of the account for the specific instrument at the current year. |
GetAccountSettlementPositions
Permissions: Operator,Trading,AccountReadOnly,Manual Trader
Call Type: Synchronous
Retrieves a list of settlement positions of a specific account.
This is specifically for credit risk type accounts which are under a specific credit tier. Credit accounts' balances are allowed to go negative but they should be settled later on. This API is useful for monitoring credit accounts, useful information such as CreditLimit, CreditUtilization, and CreditRemaining of an account for each product are available in the results.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountSettlementPositions", {
AccountId: 7,
OMSId: 1,
});
POST /AP/GetAccountSettlementPositions HTTP/1.1
Host: hostname goes here...
aptoken: b59915f0-06c5-4d41-8fbf-fd157af7ea30
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account on the OMS for which settlement positions will be returned for. required. |
Response
{
"OMSId": 1,
"AccountId": 7,
"AccountName": "sample",
"CreditTier": 0,
"TradingHalted": false,
"BaseProductId": 1,
"BaseProductSymbol": "USD",
"BaseProductAmountFiat": 1020609197.1267146621490396645,
"BaseProductAmountCrypto": 1336495.5472144534654955855389,
"BaseProductNetOwedAmount": 0,
"BaseProductNetOwedLimit": 0,
"BaseProductNetOwedRemaining": 0,
"BaseProductNetOwedAmountFiat": 0,
"BaseProductNetOwedAmountCrypto": 0,
"AccountSettlementPositions": [
{
"OMSId": 1,
"AccountId": 7,
"ProductId": 1,
"ProductSymbol": "USD",
"ProductType": "NationalCurrency",
"Position": 1020603580.2743277184022,
"BaseProductId": 0,
"BaseProductSymbol": null,
"BaseProductNotionalAmount": 0,
"CreditLimit": 0,
"CreditUtilization": 0,
"CreditRemaining": 0,
"CurrentNotionalRate": 1,
"CurrentBaseProductNotionalAmount": 1020603580.2743277184022
},
{
"OMSId": 1,
"AccountId": 7,
"ProductId": 2,
"ProductSymbol": "BTC",
"ProductType": "CryptoCurrency",
"Position": 0.4050939208713710849836927848,
"BaseProductId": 0,
"BaseProductSymbol": null,
"BaseProductNotionalAmount": 0,
"CreditLimit": 0,
"CreditUtilization": 0,
"CreditRemaining": 0,
"CurrentNotionalRate": 30015,
"CurrentBaseProductNotionalAmount": 12158.894034954203115785538936
}
]
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where a specific credit account is assigned. |
| AccountId | integer. The ID of the account which may or may not have settlement obligation. |
| AccountName | string. The name of the account which may or may not have settlement obligation. |
| CreditTier | integer. The credit trier at which the specific account belongs to or is assigned to. |
| TradingHalted | boolean. Identifies if the specific account has been barred from doing any trading activities due to unsettled obligations. |
| BaseProductId | integer. The ID of the product that serves just like a notional product. It is the BaseNotionalProduct set in the OMS. |
| BaseProductSymbol | string. The symbol of the product that serves just like a notional product. It is the BaseNotionalProduct set in the OMS. |
| BaseProductAmountFiat | decimal. The total amount/value of all the fiat positions of the account converted to the BaseProduct. |
| BaseProductAmountCrypto | decimal. The total amount/value of all the crypto positions of the account converted to the BaseProduct. |
| BaseProductNetOwedAmount | decimal. The total amount owed by the specific account in the BaseProduct denomination. This is the total amount that the specific account needs to settle. |
| BaseProductNetOwedLimit | decimal. The total credit limit of the specific account in the BaseProduct denomination. |
| BaseProductNetOwedRemaining | decimal. The total remaining credit limit of the specific account in the BaseProduct denomination. |
| BaseProductNetOwedAmountFiat | decimal. The total fiat net owed of the specific account in the BaseProduct denomination. This amount needs to be settled. |
| BaseProductNetOwedAmountCrypto | decimal. The total crypto net owed of the specific account in the BaseProduct denomination. This amount needs to be settled. |
| AccountSettlementPositions | array of objects. Contains the actual settlement position of the specified account for all products. Each object represents a settlement positions for a specific product. The objects fields are: OMSId integer - the ID of the OMS. AccountId integer - the ID of the account ProductId integer - the ID of the product the settlement position is for. ProductSymbol string - the symbol of the product the settlement position is for. ProductType string - the type of the product the settlement position is for. Either NationalCurrency or CryptoCurrency Position decimal - the current balance of the account for a specific product. BaseProductId integer - the ID of the base notional product. BaseProductSymbol string - the symbol of the base notional product. BaseProductNotionalAmount decimal - the base product notional amount. CreditLimit decimal - the total credit limit, depends on the credit tier. CreditUtilization decimal - the amount of credit utilize/used. CreditRemaining decimal - the amount of credit that can still be used, would be the difference between the CreditLimit and CreditUtilization CurrentNotionalRate decimal - the notional rate of the base notional product. CurrentBaseProductNotionalAmount decimal - the current base notional value of the current position of the account. |
GetAccountInfo
Permissions: Operator, Trading, AccountReadOnly
Call Type: Synchronous
Returns detailed information about one specific account and existing on a specific OMS. If accountId is not defined, the details of the default account of the authenticated user will be retrieved.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountInfo", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetAccountInfo HTTP/1.1
Host: hostname goes here...
aptoken: c91f4010-78db-475a-b3ad-311cc8f45976
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the account exists. required. |
| AccountId | integer. The ID of the account on the OMS for which information will be returned. If not defined, the default of account of the authenticated user will be retrieved. optional. |
Response
{
"OMSID": 1,
"AccountId": 7,
"AccountName": "sample",
"AccountHandle": null,
"FirmId": null,
"FirmName": null,
"AccountType": "Asset",
"FeeGroupId": 0,
"ParentID": 0,
"RiskType": "Normal",
"VerificationLevel": 1,
"VerificationLevelName": null,
"CreditTier": 0,
"FeeProductType": "BaseProduct",
"FeeProduct": 0,
"RefererId": 0,
"LoyaltyProductId": 0,
"LoyaltyEnabled": false,
"PriceTier": 0,
"Frozen": false
}
| Key | Value |
|---|---|
| OMSID | integer. The ID of the OMS on which the account resides. |
| AccountId | integer. The ID of the account for which information was requested. |
| AccountName | string. A non-unique name for the account assigned by the user. |
| AccountHandle | string. accountHandle is a unique user-assigned name that is checked at create time by the OMS to assure its uniqueness. |
| FirmId | string. An arbitrary identifier assigned by a trading venue operator to a trading firm as part of the initial company, user, and account set up process. For example, Smith Financial Partners might have the ID SMFP. |
| FirmName | string. A longer, non-unique version of the trading firm’s name; for example, Smith Financial Partners. |
| AccountType | integer. The account type the specific account is currently set to. One of: Asset (0) Liability (1) . Default is Asset |
| FeeGroupId | integer. Defines account attributes relating to how fees are calculated and assessed. Set by trading venue operator. |
| ParentID | integer. Reserved for future development. |
| RiskType | integer. One of: Unkown (0) (an error condition) Normal (1) NoRiskCheck (2) NoTrading (3) Credit (4) Returns Normal for virtually all market participants. Other types indicate account configurations assignable by the trading venue operator. |
| VerificationLevel | integer. The verification level the account is currently at. Verification level limits the amounts of deposits and withdrawals. It is defined by and set by the trading venue operator for each account and is part of the KYC ("Know Your Customer") process, which may be automated or manual. An account can earn a higher Verification Level over time. |
| VerificationLevelName | string. Name of the verification level, newly added field in version 4.4. |
| CreditTier | integer. The credit tier the account is currently at. Default is 0. applicable to accounts with RiskType Credit |
| FeeProductType | string. One of: BaseProduct SingleProduct Trading fees may be charged by a trading venue operator. (Withdrawal fees may also be charged, but that is a separate setting dependent on product and instrument.) This value shows whether fees for this account’s trades are charged in the product being traded (BaseProduct, for example Bitcoin) or whether the account has a preferred fee-paying product (SingleProduct, for example USD) to use in all cases and regardless of product being traded. |
| FeeProduct | integer. The ID of the preferred fee product, if any. Defaults to 0. |
| RefererId | integer. Captures the ID of the entity who referred this account to the trading venue, usually captured for marketing purposes. |
| LoyaltyProductId | integer. The Loyalty Token is a parallel fee structure that replaces the general set of transaction fees. An exchange can promote activity on a specific cryptocurrency token by offering discounted transaction fees denominated in that token to customers who choose that fee structure. This key is the ID of the loyalty product chosen by the Exchange. There can be one Loyalty Token per OMS. |
| LoyaltyEnabled | boolean. If true, this account has accepted the Loyalty Token fee structure. If false, the account has not accepted it. The default setting is false. |
| PriceTier | integer. The price tier where the account is currently at. Default is 0. |
| Frozen | boolean. If true, account is Frozen and will not be able to perform assets outgoing transactions such as a withdrawal. If false, account is not frozen and can perform any transaction. The default setting is false. |
GetAccountBadges
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves an account's badge/s. An account badge is required in submitting a BlockTrade, it is will be the value of the CounterpartyId.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountBadges", {
OMSId: 1,
AccountId: 9,
});
POST /AP/GetAccountBadges HTTP/1.1
Host: hostname goes here...
aptoken: 7cb8f194-6ee6-4bf3-8e50-b11251eba458
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| AccountId | integer. The ID of the account whose badge/s will be retrieved. required. |
| OMSId | integer. The ID of the OMS. required. |
Response
[
{
"OMSId": 1,
"AccountId": 9,
"BadgeId": 3,
"Badge": "APSecretBadge",
"Active": true
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of OMS. |
| AccountId | integer. The ID of the account who owns the badge. |
| BadgeId | integer. The ID of the account badge. |
| Badge | string. The actual account badge. |
| Active | boolean. If true, means the badge is active and can be used, otherwise, it can't be used. |
GetBadgeAccount
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves account id for a badge.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetBadgeAccount",
{
"OMSId": 1,
"Badge": "APSecretBadge"
}
POST /AP/GetBadgeAccount HTTP/1.1
Host: hostname goes here...
aptoken: 7cb8f194-6ee6-4bf3-8e50-b11251eba458
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"Badge": "APSecretBadge"
}
| Key | Value |
|---|---|
| Badge | string. The badge name. required. |
| OMSId | integer. The ID of the OMS. required. |
Response
{
"OMSId": 1,
"AccountId": 9,
"BadgeId": 0,
"Badge": "APSecretBadge",
"Active": false
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of OMS. |
| AccountId | integer. The ID of the account who owns the badge. |
| BadgeId | integer. The ID of the account badge. |
| Badge | string. The actual account badge. |
| Active | boolean. If true, means the badge is active and can be used, otherwise, it can't be used. |
GetAccountConfig
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves the list of Key/Value pairs of configs for an Account
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountConfig",
{
"OMSId": 1,
"AccountId": 9
}
POST /AP/GetAccountConfig HTTP/1.1
Host: hostname goes here...
aptoken: 7cb8f194-6ee6-4bf3-8e50-b11251eba458
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| AccountId | integer. The ID whose config/s will be retrieved. required. |
| OMSId | integer. The ID of the OMS. required. |
Response
[
{
"Key": "IBAOptedIn",
"Value": "true"
}
]
| Key | Value |
|---|---|
| Key | string. The account config key name. |
| Value | string. The account config key value. |
SetAccountConfig
Permissions: Operator,Trading
Call Type: Synchronous
Sets or updates an account's key/value pair configuration/s.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SetAccountConfig", {
AccountId: 9,
Config: [
{
Key: "VIP",
Value: "true",
},
{
Key: "AnotherAccountConfig",
Value: "AnotherAccountConfigKeyValue",
},
],
});
POST /AP/SetAccountConfig HTTP/1.1
Host: hostname goes here...
aptoken: 9689b493-5bab-4aae-9ac5-059a312d2cf9
Content-Type: application/json
Content-Length: 219
{
"AccountId": 9,
"Config":[
{
"Key": "VIP",
"Value": "true"
},
{
"Key": "AnotherAccountConfig",
"Value": "AnotherAccountConfigKeyValue"
}
]
}
| Key | Value |
|---|---|
| AccountId | integer. The ID of the account for which the config will be added. If not defined, config will be added for the authenticated user. required. |
| Config | array. An array of objects where the actual key-value pair/s are defined. Each element is an object and represents 1 key-value pair. Key - string - the actual key name of the user config. required. Value - string - the actual value to be set for the specific key. required. If key is already existing, value will be updated. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. An additional message that the system may give, usually null. |
GetAllLedgerEntryTickets
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves all ledger entries for a specific account if user invoking the request has the standard permissions only; a user with Trading permission can only retrieve ledger entries for accounts it is associated with(AccountId is required). Can retrieve ledger entries for all accounts if user invoking the request has Operator permission.
Results can also be filtered according to optional search parameters such as ProductId, other optional parameters are defined in the request key-value table below.
It is also possible to filter according to AccountLedgerEntryId.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAllLedgerEntryTickets", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetAllLedgerEntryTickets HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the orders took place. required. |
| AccountId | integer. The account ID for which the ledger entry was executed for, required if user invoking that request has standard permissions. conditionally required. |
| ProductId | integer. The product which was either debited or credited to the account. Can be used to filter results. optional. |
| EnteredBy | integer. The id of the user who submitted the account ledger entry. Can be used to filter results. optional. |
| Limit | integer. The maximum number/count of ledger entries to be retrieved. If not specified, maximum number of results will be according to the MaxApiResponseResultSet Gateway setting. optional. |
| AccountLedgerEntryId | integer. The Id of the actual ledger entry. If value is 0(the same as not putting the filter), results will have all the ledger entries for the specific account, if value is greater than 0 and exactly matches a ledger entry for the specific account, it will result to just one ledger entry being returned as 1 id represents exactly 1 ledger entry, if the id does not match any account ledger entry for the specific account, the result will be an empty array. optional. |
| StartTimestamp | long integer. Can be used to filter results based on timestamp the ledger entry has happened. optional. |
| EndTimeStamp | long integer. Can be used to filter results based on timestamp the ledger entry has happened. optional. |
Response
[
{
"AccountId": 9,
"ProductId": 16,
"CR_Amt": 1000000.0,
"DR_Amt": 0.0,
"EnteredBy": 1,
"Comments": [""],
"OneSidedTransaction": 0,
"AccountLedgerEntryId": 3519,
"TimeStamp": 1676542115034,
"Status": "Accepted",
"RejectReason": 0,
"AccountChangeReason": "Manual",
"CounterPartyId": 3,
"DoNotAffectBalance": false,
"TransactionType": "Other",
"TransactionReferenceType": "ManualEntry"
},
{
"AccountId": 9,
"ProductId": 2,
"CR_Amt": 1.0,
"DR_Amt": 0.0,
"EnteredBy": 1,
"Comments": [""],
"OneSidedTransaction": 0,
"AccountLedgerEntryId": 3509,
"TimeStamp": 1676260561012,
"Status": "Accepted",
"RejectReason": 0,
"AccountChangeReason": "Manual",
"CounterPartyId": 3,
"DoNotAffectBalance": false,
"TransactionType": "Other",
"TransactionReferenceType": "ManualEntry"
}
]
Returns an array of objects, each object represents a ledger entry. Results are arranged according to TimeStamp in descending order, the most recent ledger entry being at the top. The call returns an empty array if there are no ledger entries for the account.
| Key | Value |
|---|---|
| AccountId | integer. The account ID for which the ledger entry was executed for. Or the account which was either debited or credited. |
| ProductId | integer. The product which was either debited or credited to the account. |
| CR_Amt | decimal The amount credited, if value is greater than 0, it means the account was credited. |
| DR_Amt | decimal The amount debited, if value is greater than 0, it means the account was debited. |
| EnteredBy | integer. The id of the user who submitted the account ledger entry. |
| Comments | array. Any note or comment entered for the ledger entry. |
| OneSidedTransaction | integer. Either 0 or 1, if 1 it means the transaction is one sided which would then mean that there will be no counterparty. Only the AccountId specified will have changes in the balance, either credited or debited. |
| AccountLedgerEntryId | integer. The Id of the actual ledger entry. |
| TimeStamp | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone) |
| Status | string. The status of the ledger entry |
| RejectReason | long integer. The reason why the ledger entry was rejected. |
| AccountChangeReason | string. Always Manual since a ledger entry is a ManualEntry TransactionReferenceType. |
| CounterPartyId | integer. The id of the counterparty account. If the accountid was debited, the counterpartyid was credited. Usually has a value of 3, it is the OMS Liability Account. If CounterpartyId was set to a value other than 3, the counterpart transaction either debit or credit will happen to the specific id and it will be the one to reflect as the value of this field. |
| DoNotAffectBalance | boolean. If true, the balance of both the account and the counterparty will not be affected or remain the same(as if there was not ledger entry that happened), otherwise, there will be credit and debit to respective accounts. |
| TransactionType | string. Always Other since a ledger entry is classified as TransactionType Other. |
| TransactionReferenceType | string. Always ManualEntry since a ledger entry is classified as a TransactionReferenceType ManualEntry. |
Authentication
Authenticate
Permissions: Public
CallType: Synchronous
Authenticates a user. Works just like AuthenticateUser except that this particular API is only applicable for HTTP.
If 2FA is enabled, see Authenticate2FA. Authentication using an API key bypasses 2FA.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Authenticate endpoint is only applicable for HTTP
GET /AP/Authenticate HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Authorization: Base64 encoded username:password
GET /AP/Authenticate HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
APIKey: "28c68ac3fcfafc3d4e8d653fe57e5baf",
Signature: "29c15c42e4fabcc9e229421e148e647903927c503ab4578ada55bb13a63a9636",
UserId: "96",
Nonce: "2247733562"
HTTP(API Key - will be included as Headers)
| Key | Value |
|---|---|
| APIKey | string. This is an AlphaPoint-generated key used in user-identification. |
| Signature | string. A long, alphanumeric string generated by AlphaPoint by using the APIKey and Nonce. To generate your own signature with a different nonce, [HMAC-Sha256]9(https://codebeautify.org/hmac-generator)encode your nonce, user ID, and API key, in the format NonceUserIdAPIKey using the secret as your key. |
| UserId | string. The ID of the user, stated as a string. |
| Nonce | string. Any arbitrary number or random string used with the APIKey to generate a signature. |
HTTP
| Header | Value |
|---|---|
| Authorization | string. Base64 encoded value of username and password in the format username:password |
Response
//Response if username and password are used while user's 2FA is enabled
{
"Authenticated": true,
"Requires2FA": true,
"AuthType": "Google",
"AddtlInfo": ""
}
//Response if username and password are used while user's 2FA is not enabled
{
"Authenticated": true,
"SessionToken": "a923322a-5140-4d20-b2a6-e07422bb0e6e",
"User": {
"UserId": 1,
"UserName": "sample",
"Email": "user@example.com",
"EmailVerified": true,
"AccountId": 1,
"OMSId": 1,
"Use2FA": false
},
"Locked": false,
"Requires2FA": false,
"EnforceEnable2FA": false,
"TwoFAType": null,
"TwoFAToken": null,
"errormsg": null
}
//Response if API key is used. 2FA is bypassed.
{
"Authenticated": true,
"SessionToken": "02de4e6d-507d-4e89-8a2c-49a9935d5607",
"User": {
"UserId": 81,
"UserName": "example1",
"Email": "user@example.com",
"EmailVerified": true,
"AccountId": 90,
"OMSId": 1,
"Use2FA": true
},
"Locked": false,
"Requires2FA": false,
"EnforceEnable2FA": false,
"TwoFAType": null,
"TwoFAToken": null,
"errormsg": null
}
| Key | Value |
|---|---|
| Authenticated | boolean. True if the user is authenticated; false otherwise. |
| User | JSON user object (below) |
| Locked | boolean. True if the user is currently locked; false otherwise. A user may be locked by trying to log in too many times in rapid succession. He must be unlocked by an admin. |
| Requires2FA | boolean. True if the user must use two-factor authentication; false otherwise. |
| TwoFAType | string. The type of 2FA this user requires. For example, Google. |
| TwoFAToken | string. Defaults to null. |
| errormsg | string. A successful receipt of the call returns null. |
JSON user object:
| Key | Value |
|---|---|
| UserId | integer. The ID of the user being authenticated on the exchange. |
| UserName | string. The name of the user. |
| string. The email address of the user. | |
| EmailVerified | boolean. Whether the email address has been verified by the registration process or directly by an Admin. |
| AccountId | integer. The ID of the account with which the user is associated (each user has a default account). |
| OMSId | integer. The ID of the OMS with which the user and account are associated. |
| Use2FA | boolean. True if the user must use 2FA to log in; false otherwise. |
AuthenticateUser
Permissions: Public
CallType: Synchronous
Authenticates a user.
If 2FA is enabled, see Authenticate2FA. Authentication using an API key bypasses 2FA.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Username Password authentication
await apex.RPCPromise("AuthenticateUser", {
Username: "username",
Password: "password",
});
//API key authentication
await apex.RPCPromise("AuthenticateUser", {
APIKey: "28c68ac3fcfafc3d4e8d653fe57e5baf",
Signature: "29c15c42e4fabcc9e229421e148e647903927c503ab4578ada55bb13a63a9636",
UserId: "96",
Nonce: "2247733562",
});
GET /AP/AuthenticateUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Authorization: Base64 encoded username:password
GET /AP/AuthenticateUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
APIKey: "28c68ac3fcfafc3d4e8d653fe57e5baf",
Signature: "29c15c42e4fabcc9e229421e148e647903927c503ab4578ada55bb13a63a9636",
UserId: "96",
Nonce: "2247733562"
WebSocket
| Key | Value |
|---|---|
| Username | string. Username of the user. |
| Password | string. Password of the user. |
WebSocket or HTTP(Keys will be included as Headers)
| Key | Value |
|---|---|
| APIKey | string. This is an AlphaPoint-generated key used in user-identification. |
| Signature | string. A long, alphanumeric string generated by AlphaPoint by using the APIKey and Nonce. To generate your own signature with a different nonce, HMAC-Sha256 encode your nonce, user ID, and API key, in the format NonceUserIdAPIKey using the secret as your key. |
| UserId | string. The ID of the user, stated as a string. |
| Nonce | string. Any arbitrary number or random string used with the APIKey to generate a signature. |
HTTP
| Header | Value |
|---|---|
| Authorization | string. Base64 encoded value of username and password in the format username:password |
Response
//Response if username and password are used while user's 2FA is enabled
{
"Authenticated": true,
"Requires2FA": true,
"AuthType": "Google",
"AddtlInfo": ""
}
//Response if username and password are used while user's 2FA is not enabled
{
"Authenticated": true,
"SessionToken": "a923322a-5140-4d20-b2a6-e07422bb0e6e",
"User": {
"UserId": 1,
"UserName": "sample",
"Email": "user@example.com",
"EmailVerified": true,
"AccountId": 1,
"OMSId": 1,
"Use2FA": false
},
"Locked": false,
"Requires2FA": false,
"EnforceEnable2FA": false,
"TwoFAType": null,
"TwoFAToken": null,
"errormsg": null
}
//Response if API key is used. 2FA is bypassed.
{
"Authenticated": true,
"SessionToken": "02de4e6d-507d-4e89-8a2c-49a9935d5607",
"User": {
"UserId": 81,
"UserName": "example1",
"Email": "user@example.com",
"EmailVerified": true,
"AccountId": 90,
"OMSId": 1,
"Use2FA": true
},
"Locked": false,
"Requires2FA": false,
"EnforceEnable2FA": false,
"TwoFAType": null,
"TwoFAToken": null,
"errormsg": null
}
| Key | Value |
|---|---|
| Authenticated | boolean. True if the user is authenticated; false otherwise. |
| User | JSON user object (below) |
| Locked | boolean. True if the user is currently locked; false otherwise. A user may be locked by trying to log in too many times in rapid succession. He must be unlocked by an admin. |
| Requires2FA | boolean. True if the user must use two-factor authentication; false otherwise. |
| TwoFAType | string. The type of 2FA this user requires. For example, Google. |
| TwoFAToken | string. Defaults to null. |
| errormsg | string. A successful receipt of the call returns null. |
JSON user object:
| Key | Value |
|---|---|
| UserId | integer. The ID of the user being authenticated on the exchange. |
| UserName | string. The name of the user. |
| string. The email address of the user. | |
| EmailVerified | boolean. Whether the email address has been verified by the registration process or directly by an Admin. |
| AccountId | integer. The ID of the account with which the user is associated (each user has a default account). |
| OMSId | integer. The ID of the OMS with which the user and account are associated. |
| Use2FA | boolean. True if the user must use 2FA to log in; false otherwise. |
Authenticate2FA
Permissions:
CallType: Synchronous
Complete the 2nd half of two-factor authentication by sending the 2FA code.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Authenticate2FA", {
Code: "235991",
});
POST /AP/Authenticate2FA HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
pending2FaToken: db1f4eeb-1694-4147-bdfd-4cc915e1f5e4
Content-Length: 24
{
"Code": "235991"
}
Completes the second part of a two-factor authentication by sending the authentication token from the non-AlphaPoint authentication system to the OMS. 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:
- In Websockets, if a user's 2FA is enabled, after the initial authentication with WebAuthenticateUser, you will have to call Authenticate2FA providing the 2FA Code in the request payload.
- In HTTP, use Authenticateuser, or Authenticate. The response will include a Pending2FaToken which will then be needed as one of the Headers in the Authenticate2FA HTTP request. The 2FA Code at the Body of the HTTP request.
| Key | Value |
|---|---|
| Code | integer. The usually a 6-digit code(may vary depending on 2FA AuthType), obtained from an authenticator app. |
Response
{
"Authenticated": true,
"UserId": 2,
"SessionToken": "db1f4eeb-1694-4147-bdfd-4cc915e1f5e4"
}
| Key | Value |
|---|---|
| Authenticated | boolean. A successful authentication returns true. Unsuccessful returns false. |
| UserId | integer. The ID of the authenticated user. |
| SessionToken | string. The actual session token that was granted to user after successful authentication. |
WebAuthenticateUser
Permissions: Public
Call Type: Synchronous
Used to Authenticate a user and retrieve a Session Token, or to re-authenticate using an existing session in case of a page refresh or loss of Websocket connection. Also accepts JWT.
Authentication using a username and password triggers Authentication Email notification, re-authentication using an existing session token does not.
Not applicable in HTTP, see AuthenticateUser for HTTP.
If 2FA is enabled, see Authenticate2FA.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Username Password authentication
await apex.RPCPromise("WebAuthenticateUser", {
UserName: "username",
Password: "password",
});
//Session token authentication
await apex.RPCPromise("WebAuthenticateUser", {
SessionToken: "existingsessiontoken",
});
//JWT authentication
await apex.RPCPromise("WebAuthenticateUser", {
JWTToken: "jwttoken",
});
WebAutheticate user is not applicable in HTTP, see Authenticate and AuthenticatUser for HTTP.
| Key | Value |
|---|---|
| Username | string. The user's assigned user name. |
| Password | string. The user's assigned password. |
| SessionToken | string. The user's existing active session token. |
| JWTToken | string. JSON Web Token. Generated using privatekey. For more info about JWT authentication please see here |
Response
//Response if user does not have 2FA enabled.
{
"Authenticated": true,
"SessionToken": "64186cfe-b183-46cc-bb68-9645fd9d9ff1",
"UserId": 1,
"twoFaToken": ""
}
//Response if a user has 2FA enabled. In this case Authenticate2FA needs to be called to complete the authentication
{
"Authenticated": true,
"Requires2FA": true,
"AuthType": "Google",
"AddtlInfo": ""
}
| Key | Value |
|---|---|
| Authenticated | boolean. True if the user is authenticated; false otherwise. |
| SessionToken | string. The actual session token granted to the user after successful login. |
| UserId | string. The ID of the user who got authenticated. |
| twoFAToken | string. Defaults to an empty string. |
| Requires2FA | boolean. True if the user must use two-factor authentication; false otherwise. |
| AuthType | string. The type of 2FA this user requires. For example, Google. |
| errormsg | string. A successful receipt of the call returns null. |
WebAuthenticateUser is not applicable in HTTP, see Authenticate and AuthenticateUser for HTTP.
LogOut
Permissions: Public
Call Type: Synchronous
Logs a user out
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Logout", {});
POST /AP/Logout HTTP/1.1
Host: hostname goes here...
aptoken: 282663b4-1e87-4130-8953-9dc584ae24ee
Content-Type: application/json
No request payload is required for websockets.
For HTTP, the existing session token must be included in the request Headers as aptoken.
Response
{
"result": "true",
"errormsg": "",
"errorcode": 0,
"detail": ""
}
| Key | Value |
|---|---|
| result | boolean. A successful logout request returns true; and unsuccessful (an error condition) returns false. |
| errormsg | string. A successful logout request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SSOEnsureUser
Permissions: Public
Call Type: Synchronous
Creates or updates(if existing) a user and validates the claims in the token. Specifically for JWT implementation.
KeyPairs(Public and Private Keys) is one of the prerequisites. APEX would need the public key used to be configured on server for claims validation to work. https://jwt.io/ - resource for testing the JWT.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SSOEnsureUser", {
data: {
email: "user@example.com",
name: "user@example.com",
},
sig: { algorithm: "RS256", value: "" },
auth: {
Authorization:
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJBUDEiLCJpc3MiOiJVQVQiLCJleHAiOjE2ODEzNzMzNzAsInNjb3BlIjoiYXBfdXNlcnMifQ.vBR6MXWB2NccTf4_pCY4-BOnTWifQThZ9-AsBBjbocRhsgu1joi1p5B9NNuM9USLfHDJCaXzC-QBwBbZ381eUXvmhqz03soKARu4ivmaJr29APl_gwfO_g6D-SSvASsoSCs3Yb2GNfZchmm1itf_dCZaM5q621jjkzyrrEnxDj7qDr1wB_Y4sBqZur4xEfHSzIzqdU22oOlvJBWoMw1Aj5maOtKGzqJE7QD9BfJqid8IzY4LVLe9rdmuyWg-4cXuJ4IYbmeDBpnM8lHrJMarquNWxR0RXte7ilR_Cshzg4dW2smGExmRFA6XyDl_r1TL4MKnM_gtIfpLq2MUugjROcvmrpaId4Km-ZeAiPkMhyTS_qYjFstUMjoYVTuTZQ0aA6WIJdntKYu3pqNa0tB73MVVYKIr9gq2FtLtUjDYaO3Cxb4rdb_d5WEgIuiZeR_1NVY_3ObPBVsFgXEQgvn6SNu_T13sitjRac-yPoYnxlZLzy91hwyQq5HaRYd6RUIxVnzNsdKS0EwjfAxsJR-tPG7zQoaBQo6w_mym-TmoOqvxiuEfPO9ewV2tFVhoz3QvDOv5Dc2fSS8YEzBcBLXOxD9e_XOaGhzQxnHnW_16vE03sn2B3uuDS1veeqi06_tODZOULiuZscII1fl2IfqzzZRGadvBiNgWijfsYTVp8n8",
},
});
POST /AP/SSOEnsureUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 1021
{
"data": {
"email": "user@example.com",
},
"sig": { "algorithm": "RS256", "value": "" },
"auth": {
"Authorization":
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJBUDEiLCJpc3MiOiJVQVQiLCJleHAiOjE2ODEzNzMzNzAsInNjb3BlIjoiYXBfdXNlcnMifQ.vBR6MXWB2NccTf4_pCY4-BOnTWifQThZ9-AsBBjbocRhsgu1joi1p5B9NNuM9USLfHDJCaXzC-QBwBbZ381eUXvmhqz03soKARu4ivmaJr29APl_gwfO_g6D-SSvASsoSCs3Yb2GNfZchmm1itf_dCZaM5q621jjkzyrrEnxDj7qDr1wB_Y4sBqZur4xEfHSzIzqdU22oOlvJBWoMw1Aj5maOtKGzqJE7QD9BfJqid8IzY4LVLe9rdmuyWg-4cXuJ4IYbmeDBpnM8lHrJMarquNWxR0RXte7ilR_Cshzg4dW2smGExmRFA6XyDl_r1TL4MKnM_gtIfpLq2MUugjROcvmrpaId4Km-ZeAiPkMhyTS_qYjFstUMjoYVTuTZQ0aA6WIJdntKYu3pqNa0tB73MVVYKIr9gq2FtLtUjDYaO3Cxb4rdb_d5WEgIuiZeR_1NVY_3ObPBVsFgXEQgvn6SNu_T13sitjRac-yPoYnxlZLzy91hwyQq5HaRYd6RUIxVnzNsdKS0EwjfAxsJR-tPG7zQoaBQo6w_mym-TmoOqvxiuEfPO9ewV2tFVhoz3QvDOv5Dc2fSS8YEzBcBLXOxD9e_XOaGhzQxnHnW_16vE03sn2B3uuDS1veeqi06_tODZOULiuZscII1fl2IfqzzZRGadvBiNgWijfsYTVp8n8"
}
}
| Key | Value |
|---|---|
| data | object. Email string Email address to be validated, if not yet existing in APEX, a new user will be created. required. |
| sig | object. Algorithm string Encryption algorithm used for auth. required. |
| auth | object. Authorization string The actual JWT(JSON Web Token) to be validated against the Public Key configured in the APEX server. required. |
Response
//Successful token validation
{
"result": true,
"errormsg": "",
"errorcode": 0,
"detail": "{\"APUserId\":123456, \"Message\": \"Token Validated\"}"
}
//Token is not validated, public key not matching the private key used to generate the JWT.
{
"result": false,
"errormsg": "Not Authorized",
"errorcode": 401,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. APUserId - the id of the user, possible that the user is newly created. Message - a confirmation that the token is validated, no APUserId will be displayed if token is not validated. |
Disable2FA
Permissions: Operator, Trading
Call Type: Synchronous
Disables Google/XP 2FA for a user. This is just the first half of the actual disabling of 2FA for a user. The next half will need Authenticate2FA which will require the 6-digit code from an authenticator app. 2FA will not be disabled unless the user completes the Authenticate2FA with the correct 6-digit code.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Disable2FA", {});
POST /AP/Disable2FA HTTP/1.1
Host: hostname goes here...
aptoken: 9a5bf62c-234a-48c4-b859-9c239ab3a390
Content-Type: application/json
No request payload required.
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
EnableGoogle2FA
Permissions: Operator, Trading
Call Type: Synchronous
Enables Google 2FA. This is just the first half of the actual enabling of Google2FA for a user. The next half will need Authenticate2FA which will require the 6-digit code from an authenticator app.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("EnableGoogle2FA", {});
POST /AP/EnableGoogle2FA HTTP/1.1
Host: hostname goes here...
aptoken: 9a5bf62c-234a-48c4-b859-9c239ab3a390
Content-Type: application/json
No request payload required.
Response
{
"GoogleQRCode": "Qk1MAAAAAAAAABoAAAAMAAAAxADEAAEAGAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAA==",
"ManualCode": "ME4WEZLDGUYGKZBVGRRTIOBRGZQWENRVGJTDSMLBMU2GMNRYMYZQ"
}
| Key | Value |
|---|---|
| GoogleQRCode | string. The actual QR code which can be scanned and then added to the authenticator app. |
| ManualCode | string. The manual code which can be used if scanning is not possible. |
GetGoogle2FARecoveryKey
Permissions: Operator, Trading
Call Type: Synchronous
Retrieve the recovery key for Google 2FA.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetGoogle2FARecoveryKey", {
Code: 674970,
});
POST /AP/GetGoogle2FARecoveryKey HTTP/1.1
Host: hostname goes here...
aptoken: f6590d49-cee7-460a-afa3-593afb96d439
Content-Type: application/json
Content-Length: 24
{
"Code": 674970
}
| Key | Value |
|---|---|
| Code | integer or string. The 6-digit code from an authenticator app. required. |
Response
{
"Authenticated": true,
"RecoveryKey": "ME4WEZLDGUYGKZBVGRRTIOBRGZQWENRVGJTDSMLBMU2GMNRYMYZQ"
}
| Key | Value |
|---|---|
| Authenticated | boolean If true, user is authenticated, else, user is not authenticated which also means the 6-digit code is incorrect or might not be present in the request payload. |
| RecoveryKey | string The actual recovery key of the 2FA. This ky can be used to re-add the account in authenticator app to be able to generate and get the right 6-digit code. |
EnableYubico2FA
Permissions: Operator, Trading
Call Type: Synchronous
Enables Yubico 2FA
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("EnableYubico2FA", {
OTP: "cccccckrtkrlfkjvrevjdtjdgrvcfvhhuvevdjubfciu",
});
POST /AP/EnableYubico2FA HTTP/1.1
Host: hostname goes here...
aptoken: b5df71fc-6681-4ca8-a9f8-3a4f563f2530
Content-Type: application/json
Content-Length: 36
{
"OTP": "cccccckrtkrlfkjvrevjdtjdgrvcfvhhuvevdjubfciu"
}
| Key | Value |
|---|---|
| OTP | string. The OTP generated by YubiKey. required. |
Response
{
"Enabled2FA": true
}
| Key | Value |
|---|---|
| Enabled2FA | boolean. If true, user successfully enabled 2FA using a YubiKey |
OAuthLogout
Permissions: Public
Call Type: Synchronous
Logs an OAuth user out.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("", {});
POST /AP/OAuthLogout HTTP/1.1
Host: hostname goes here...
aptoken: 60f3c221-7c0c-4f67-b2ca-d2594ee84ccd
Content-Type: application/json
No request payload is required for websockets.
For HTTP, the existing session token must be included in the request Headers as aptoken.
Response
{
"OAuthLogout": true
}
| Key | Value |
|---|---|
| OAuthLogout | boolean. If true, user successfully logged-out. |
OAuthValidateMfa
Permissions: Public
Call Type: Synchronous
Complete the 2nd half of two-factor authentication of an OAuth user by sending the 2FA code.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("OAuthValidateMfa", {
Code: 123456,
});
POST /AP/OAuthValidateMfa HTTP/1.1
Host: hostname goes here...
aptoken: 60f3c221-7c0c-4f67-b2ca-d2594ee84ccd
Content-Type: application/json
Content-Length: 24
{
"Code": 123456
}
| Key | Value |
|---|---|
| Code | integer. The 6-digit code, obtained from the authenticator app. If not defined, OAuthValidateMfa will always be false. required. |
Response
{
"OAuthValidateMfa": false,
"errormsg": "OAuthValidateMfa failed"
}
| Key | Value |
|---|---|
| OAuthValidateMfa | boolean. If true, code is valid else it code is not valid. |
| errormsg | string. The error message. Only appears if no Code is defined in the request. |
OAuthAuthenticateUser
Permissions: Public
Call Type: Synchronous
This API can be used for Single Sign-On functionality. For instance, an existing user in an identity and access management system can authenticate against APEX. There are several Gateway configs that need to set. Please see several OAuth related Gateway configs here.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("OAuthAuthenticateUser", {
AccessCode: "",
Email: "",
});
POST /AP/OAuthAuthenticateUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 113
{
"AccessCode": "",
"Email": "",
}
| Key | Value |
|---|---|
| AccessCode | string. Alphanumeric code. required. |
| string. Email address of the user. required. |
Response
{
"OAuthAuthenticated": true,
"User": "",
"AccessToken": ""
}
| Key | Value |
|---|---|
| OAuthAuthenticated | boolean. If true, user successfully authenticated, otherwise user is not authenticated. |
| User | string. The ID of the user. |
| AccessToken | string. The access token granted. |
GetCaptchaRequiredEndpoints
Permissions: Public
Call Type: Synchronous
Get Captcha Defined Endpoints or API endpoints that requires Captcha. An operator can decide to require Captcha for certain APIs for added security, it is something configurable at the AdminUI, specifically at the Gateway Service Configuration.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetCaptchaRequiredEndpoints", {});
POST /AP/GetCaptchaRequiredEndpoints HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
No request payload required.
Response
["webauthenticateuser"]
Returns an array, each element is an API that requires Captcha.
GetValidate2FARequiredEndpoints
Permissions: Public
Call Type: Synchronous
Get Validate2FARequired Endpoints or API endpoints that requires 2FA. An operator may decide to require 2FA for certain APIs for added security, it is something configurable at the AdminUI, specifically at the Gateway Service Configuration.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetValidate2FARequiredEndpoints", {});
POST /AP/GetValidate2FARequiredEndpoints HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
No request payload required.
Response
["transferfunds"]
Returns an array, each element is an API that requires 2FA.
Deposit
CreateDepositTicket
Permissions: Operator,Trading
Call Type: Synchronous
Creates a new deposit ticket.
Creating a deposit ticket is one way to credit an account with some amount of a product. The deposit amount only get credited to a specific account when the deposit ticket is transitioned to FullyProcessed.
Cryptocurrency deposit tickets are usually created through webhook callbacks as they primarily depend on the blockchain.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Usual CreateDepositTicket request payload for fiat/national currency product
await apex.RPCPromise("CreateDepositTicket", {
OMSId: 1,
OperatorId: 1,
AccountId: 9,
RequestUser: 9,
AssetId: 1,
Amount: 100,
DepositInfo:
'{"ProductSymbol":"USD","fullname":"Sample Only","comments":"Sample only!"}',
Status: "New",
});
POST /AP/CreateDepositTicket HTTP/1.1
Host: hostname goes here...
aptoken: e9440b22-7ef6-4b48-9513-245952ee415e
Content-Type: application/json
Content-Length: 248
//Usual CreateDepositTicket request payload for fiat/national currency product
{
"OMSId": 1,
"OperatorId": 1,
"AccountId": 7,
"RequestUser": 9,
"AssetId": 1,
"Amount": 100,
"DepositInfo": "{\"ProductSymbol\":\"USD\",\"fullname\":\"Sample Only\",\"comments\":\"Sample only!\"}",
"Status": "Pending"
}
| Key | Value |
|---|---|
| OMSId | integer The ID of the OMS where the account belongs to. required. |
| OperatorId | integer The ID of the Operator where the OMS operates. required. |
| AccountId | integer The ID of the account to which the deposit amount of the specific asset/product will be credited. required. |
| RequestUser | integer The ID of the user doing the deposit, can be any user who is related or connected to the account.If not defined, the authenticated user will reflect. optional. |
| AssetId | integer The ID of the asset or product for which the deposit amount will reflect as credit. required. |
| Amount | decimal The actual amount to be deposited. Amount must be greater than 0. required. |
| DepositInfo | string An object serialized as string.Value can be null or empty but it would make sense to put some value that will let you identify the deposit created later on. In HTTP, this should be properly serialized as a string, see example HTTP request. required. |
| Status | string or integer The status of the deposit ticket to be created, a deposit created using CreateDepositTicket always goes to the New status. optional. |
Response
{
"success": true,
"requestcode": "cade9343-0fa6-444f-a67b-15c64f1054cb",
"ticketnumber": 311,
"referenceid": "cade9343"
}
| Key | Value |
|---|---|
| success | boolean If true, means creation of the deposit ticket is successful, else, there is an error. |
| requestcode | string GUID generated by the system that identifies the deposit ticket. |
| ticketnumber | integer The deposit ticket number. |
| referenceid | string A code that uniquely identifies a deposit ticket. |
GetDepositTicket
Permissions: Operator,Trading
Call Type: Synchronous
Get a specific deposit ticket.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositTicket", {
OMSId: 1,
AccountId: 7,
RequestCode: "cade9343-0fa6-444f-a67b-15c64f1054cb",
});
POST /AP/GetDepositTicket HTTP/1.1
Host: hostname goes here...
aptoken: e9440b22-7ef6-4b48-9513-245952ee415e
Content-Type: application/json
Content-Length: 98
{
"OMSId":1,
"AccountId":7,
"RequestCode":"cade9343-0fa6-444f-a67b-15c64f1054cb"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account owning the deposit ticket belongs to. required. |
| AccountId | integer. The ID of the account who owns the deposit ticket. required. |
| RequestCode | string. The GUID that identifies a specific deposit ticket you wish to get details of. If not set, response will be the very first deposit ticket owned(submitted by the user of the account) by the AccountId defined in the request. optional. |
| TicketId | integer. A unique number that identifies a specific deposit ticket. optional. |
Response
{
"AssetManagerId": 1,
"AccountProviderId": 0,
"AccountId": 7,
"AssetId": 1,
"AccountName": "sample",
"AssetName": "US Dollar",
"Amount": 100.0,
"NotionalValue": 100.0,
"NotionalProductId": 1,
"OMSId": 1,
"RequestCode": "cade9343-0fa6-444f-a67b-15c64f1054cb",
"ReferenceId": "cade9343",
"RequestIP": "69.10.61.175",
"RequestUser": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "New",
"FeeAmt": 3.0,
"UpdatedByUser": 5,
"UpdatedByUserName": "sample",
"TicketNumber": 311,
"DepositInfo": "{\"ProductSymbol\":\"USD\",\"fullname\":\"Sample Only\",\"comments\":\"Sample only!\"}",
"RejectReason": null,
"CreatedTimestamp": "2023-04-17T07:10:59.395Z",
"LastUpdateTimeStamp": "2023-04-17T07:10:59.432Z",
"CreatedTimestampTick": 638173122593953528,
"LastUpdateTimeStampTick": 638173122594320790,
"Comments": [],
"Attachments": []
}
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager on which the deposit was made. |
| AccountProviderId | integer. The ID of the Account Provider of the product where the the deposit was made. A product can have multiple account provider. |
| AccountId | integer. The ID of the account into which the deposit was made. |
| AssetId | integer. The ID of the asset (product) that was deposited. |
| AccountName | string. The name of the account that the deposit is for. |
| AssetName | string. The short name of the asset (product) that was deposited, for example BTC for Bitcoin or USD for US Dollars. |
| Amount | decimal. The unit and fractional amount of the asset that was deposited, for example 2.5 Bitcoin or 2018.17 US Dollars. |
| NotionalValue | decimal. The value of the deposit amount in the NotionalProduct set in the verification level of the account for the product deposited. |
| NotionalProductId | integer. The product ID of the NotionalProduct set on the verification level of the account for the product deposited. |
| OMSId | integer. The ID of the OMS. |
| RequestCode | string. A globally unique identifier (GUID) assigned by the system that identifies this specific deposit. |
| ReferenceId | string. A code that uniquely identifies the deposit ticket. |
| RequestIP | string. The IP address from which the deposit request was made. |
| RequestUser | integer. The user ID of the user who made the deposit request. |
| RequestUserName | string. The user name of the user who made the deposit request, for example, jsmith. |
| OperatorId | integer. The ID of the operator where the OMS is operating. |
| Status | integer. The current status of this deposit ticket. Some of these statuses are valid only for cryptocurrency deposits; some are only valid for deposits of fiat (national) currency; others are used by AlphaPoint internally. Any of the statuses may appear on a deposit ticket. Deposit ticket statuses 0 New (new ticket awaiting operator review) 1 AdminProcessing (an admin is looking at the ticket) 2 Accepted (an admin accepts the ticket) 3 Rejected (admin rejects the ticket) 4 SystemProcessing (automatic processing; an unlikely status for a deposit) 5 FullyProcessed (the deposit has concluded) 6 Failed (the deposit has failed for some reason) 7 Pending (Account Provider has set status to pending) 8 Confirmed (Account Provider confirms the deposit) 9 AmlProcessing (anti-money-laundering process underway) 10 AmlAccepted (anti-money-laundering process successful) 11 AmlRejected (deposit did not stand up to anti-money-laundering process) 12 AmlFailed (anti-money-laundering process failed/did not complete) 13 LimitsAccepted (deposit meets limits for fiat or crypto asset) 14 LimitsRejected (deposit does not meet limits for fiat or crypto asset) |
| FeeAmt | decimal. The fee assessed for making the deposit, if any. Deposit fees usually are assessed in the asset/product being deposited. |
| UpdatedByUser | integer. The user ID of the last user to have updated the ticket (status, amount, etc.; this is usually an admin). |
| UpdatedByUserName | string. The user name of the last user to have updated the ticket, for example, jsmith. |
| TicketNumber | long integer. An ID number assigned by the system to identify the ticket (as opposed to identifying the deposit). |
| DepositInfo | string. For fiat deposit, it is the information entered by the user at the deposit form, for cryptocurrency deposits from blockchain, it will contain the TXID, FromAddress, ToAddress, AccountProviderName, and AccountProviderId |
| RejectReason | string. If ticket is in Rejected status, this field will contain the reject reason that was optionally provided by the operator. Defaults to null. |
| CreatedTimeStamp | string. The date and time when the deposit ticket was created, in standard UTC DateTime format. |
| LastUpdateTimeStamp | string. The date and time when the deposit ticket last was updated — usually by an admin changing its status — in standard UTC DateTime format. |
| CreatedTimestampTick | string. The date and time when the deposit ticket was created, in Microsoft Time Ticks format. |
| LastUpdateTimeStampTick | string. The date and time when the deposit ticket last was updated — usually by an admin changing its status — in Microsoft Time Ticks format. |
| Comments | array. Any comment appended to the deposit ticket. |
| Attachments | array. Any attachment to the deposit ticket. |
GetDepositTickets
Permissions: Operator,Trading
Call Type: Synchronous
Get a list of deposit tickets for a specific account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositTickets", {
OMSId: 1,
OperatorId: 1,
AccountId: 7,
Limit: 2, //optional filter field
StartIndex: 0, // value of 0 means it will start at the most recent deposit ticket, value of 1 means it will start from the second most recent deposit ticket
});
POST /AP/GetDepositTickets HTTP/1.1
Host: hostname goes here...
aptoken: 71ce94b5-f17d-49c6-8144-b818f4282229
Content-Type: application/json
Content-Length: 243
{
"OMSId":1,
"OperatorId": 1,
"AccountId":7,
"Limit": 2, //optional filter field, for pagination when used together with the StartIndex field,.
"StartIndex": 0 // value of 0 means it will start at the most recent deposit ticket, value of 1 means it will start from the second most recent deposit ticket
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the account operates whose tickets you wish to return. required. |
| OperatorId | integer. The ID of the operator where the OMS is operating. required. |
| AccountId | integer. The ID of an account whose deposit tickets will be included in the response. required. |
| ProductId | integer. The ID of a product. Filter parameter, response would only include deposit tickets for the specified product. optional. |
| Limit | integer. Filter field to limit number of results. Used for pagination together with the StartIndex field. If not set, all deposit tickets of the specified account will be returned but would still depend on the StartIndex. optional. |
| StartIndex | integer. Pagination field, value of 0 means results will start at the most recent deposit ticket, value of 1 means results start from the second most recent deposit ticket. If not set, results will always start with the most recent deposit ticket of the specified account. optional. |
Response
[
{
"AssetManagerId": 1,
"AccountProviderId": 0,
"AccountId": 7,
"AssetId": 1,
"AccountName": "sample",
"AssetName": "US Dollar",
"Amount": 100.0,
"NotionalValue": 0.00334851326011251004553978,
"NotionalProductId": 2,
"OMSId": 1,
"RequestCode": "42b59732-9667-4e86-9924-32655801e269",
"ReferenceId": "42b59732",
"RequestIP": "69.10.61.175",
"RequestUser": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "New",
"FeeAmt": 3.0,
"UpdatedByUser": 5,
"UpdatedByUserName": "sample",
"TicketNumber": 316,
"DepositInfo": "{\"ProductSymbol\":\"USD\",\"fullname\":\"Sample Only\",\"comments\":\"Sample only!\"}",
"RejectReason": null,
"CreatedTimestamp": "2023-04-17T08:07:44.516Z",
"LastUpdateTimeStamp": "2023-04-17T08:07:44.555Z",
"CreatedTimestampTick": 638173156645164924,
"LastUpdateTimeStampTick": 638173156645553096,
"Comments": [],
"Attachments": []
},
{
"AssetManagerId": 1,
"AccountProviderId": 0,
"AccountId": 7,
"AssetId": 1,
"AccountName": "sample",
"AssetName": "US Dollar",
"Amount": 100.0,
"NotionalValue": 100.0,
"NotionalProductId": 1,
"OMSId": 1,
"RequestCode": "284b92f6-3a0f-411f-801d-1167ccff4a85",
"ReferenceId": "284b92f6",
"RequestIP": "69.10.61.175",
"RequestUser": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "New",
"FeeAmt": 3.0,
"UpdatedByUser": 5,
"UpdatedByUserName": "sample",
"TicketNumber": 315,
"DepositInfo": "{\"ProductSymbol\":\"USD\",\"fullname\":\"Sample Only\",\"comments\":\"Sample only!\"}",
"RejectReason": null,
"CreatedTimestamp": "2023-04-17T08:06:34.274Z",
"LastUpdateTimeStamp": "2023-04-17T08:06:34.311Z",
"CreatedTimestampTick": 638173155942745383,
"LastUpdateTimeStampTick": 638173155943114056,
"Comments": [],
"Attachments": []
}
]
Returns an array of objects, each object represents a deposit ticket with all its details.
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager on which the deposit was made. |
| AccountProviderId | integer. The ID of the Account Provider of the product where the the deposit was made. A product can have multiple account provider. |
| AccountId | integer. The ID of the account into which the deposit was made. |
| AssetId | integer. The ID of the asset (product) that was deposited. |
| AccountName | string. The name of the account that the deposit is for. |
| AssetName | string. The short name of the asset (product) that was deposited, for example BTC for Bitcoin or USD for US Dollars. |
| Amount | decimal. The unit and fractional amount of the asset that was deposited, for example 2.5 Bitcoin or 2018.17 US Dollars. |
| NotionalValue | decimal. The value of the deposit amount in the NotionalProduct set in the verification level of the account for the product deposited. |
| NotionalProductId | integer. The product ID of the NotionalProduct set on the verification level of the account for the product deposited. |
| OMSId | integer. The ID of the OMS. |
| RequestCode | string. A globally unique identifier (GUID) assigned by the system that identifies this specific deposit. |
| ReferenceId | string. A code that uniquely identifies the deposit ticket. |
| RequestIP | string. The IP address from which the deposit request was made. |
| RequestUser | integer. The user ID of the user who made the deposit request. |
| RequestUserName | string. The user name of the user who made the deposit request, for example, jsmith. |
| OperatorId | integer. The ID of the operator where the OMS is operating. |
| Status | integer. The current status of this deposit ticket. Some of these statuses are valid only for cryptocurrency deposits; some are only valid for deposits of fiat (national) currency; others are used by AlphaPoint internally. Any of the statuses may appear on a deposit ticket. Deposit ticket statuses 0 New (new ticket awaiting operator review) 1 AdminProcessing (an admin is looking at the ticket) 2 Accepted (an admin accepts the ticket) 3 Rejected (admin rejects the ticket) 4 SystemProcessing (automatic processing; an unlikely status for a deposit) 5 FullyProcessed (the deposit has concluded) 6 Failed (the deposit has failed for some reason) 7 Pending (Account Provider has set status to pending) 8 Confirmed (Account Provider confirms the deposit) 9 AmlProcessing (anti-money-laundering process underway) 10 AmlAccepted (anti-money-laundering process successful) 11 AmlRejected (deposit did not stand up to anti-money-laundering process) 12 AmlFailed (anti-money-laundering process failed/did not complete) 13 LimitsAccepted (deposit meets limits for fiat or crypto asset) 14 LimitsRejected (deposit does not meet limits for fiat or crypto asset) |
| FeeAmt | decimal. The fee assessed for making the deposit, if any. Deposit fees usually are assessed in the asset/product being deposited. |
| UpdatedByUser | integer. The user ID of the last user to have updated the ticket (status, amount, etc.; this is usually an admin). |
| UpdatedByUserName | string. The user name of the last user to have updated the ticket, for example, jsmith. |
| TicketNumber | long integer. An ID number assigned by the system to identify the ticket (as opposed to identifying the deposit). |
| DepositInfo | string. For fiat deposit, it is the information entered by the user at the deposit form, for cryptocurrency deposits from blockchain, it will contain the TXID, FromAddress, ToAddress, AccountProviderName, and AccountProviderId |
| RejectReason | string. If ticket is in Rejected status, this field will contain the reject reason that was optionally provided by the operator. Defaults to null. |
| CreatedTimeStamp | string. The date and time when the deposit ticket was created, in standard UTC DateTime format. |
| LastUpdateTimeStamp | string. The date and time when the deposit ticket last was updated — usually by an admin changing its status — in standard UTC DateTime format. |
| CreatedTimestampTick | string. The date and time when the deposit ticket was created, in Microsoft Time Ticks format. |
| LastUpdateTimeStampTick | string. The date and time when the deposit ticket last was updated — usually by an admin changing its status — in Microsoft Time Ticks format. |
| Comments | array. Any comment appended to the deposit ticket. |
| Attachments | array. Any attachment to the deposit ticket. |
SubmitDepositTicketComment
Permissions: Operator,Trading
Call Type: Synchronous
Add a comment to a specific deposit ticket.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SubmitDepositTicketComment", {
Comment:
"This is a manual deposit because the deposit was not detected on chain automatically.",
OMSId: 1,
OperatorId: 1,
TicketCode: "17701757-7b30-40b6-af0e-9340a58857d1",
TicketId: 285,
EnteredDateTime: "2023-01-17T13:39:53.413Z",
});
POST /AP/SubmitDepositTicketComment HTTP/1.1
Host: hostname goes here...
aptoken: e426b2e0-6aa9-4bb3-a99e-61d6a5ddef86
Content-Type: application/json
Content-Length: 278
{
"Comment":"This is a manual deposit because the deposit was not detected on chain automatically.",
"OMSId": 1,
"OperatorId": 1,
"TicketCode":"17701757-7b30-40b6-af0e-9340a58857d1",
"TicketId": 285,
"EnteredDateTime":"2023-01-17T13:39:53.413Z"
}
| Key | Value |
|---|---|
| Comment | string. The actual deposit ticket comment. Request will be accepted without this field but it would result to a null comment which won't make any sense. optional. |
| OMSId | integer. The ID of the OMS. optional. |
| OperatorId | integer. The ID of the operator where the OMS is operating. optional. |
| TicketCode | string. The GUID that identifies a specific deposit ticket you wish to add a comment to. required. |
| TicketId | integer. The ID a specific deposit ticket you wish to add a comment to. required. |
| EnteredBy | integer. The ID of the user entering the comment. Not explicitly required but will default to 0 if not defined making it hard to trace who has entered the comment later on. optional. |
| EnteredDateTime | string. The date and time, should be in the standard DateTime format and in UTC. required. |
Response
{
"success": true,
"commentid": 459
}
Returns an object with success and commentid fields.
| Key | Value |
|---|---|
| success | boolean. Either true or false, true if the deposit comment is successfully added, otherwise it is false. |
| commentid | integer. The ID of the newly added deposit ticket comment. |
GetDepositInfo
Permissions: Operator,Deposit
Call Type: Synchronous
Retrieves all the other existing deposit addresses of the specified AccountId for the specified ProductId and AccountProviderId(optional), optionally creates a new deposit address. Always creates a new deposit address if there is no existing one yet.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositInfo", {
OMSId: 1,
AccountId: 7,
ProductId: 3,
GenerateNewKey: true,
});
POST /AP/GetDepositInfo HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 91
{
"OMSId": 1,
"AccountId": 7,
"ProductId": 3,
"GenerateNewKey": true
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account you wish to retrieve deposit info for. required. |
| ProductId | integer. The ID of the product for which the deposit info of the account specified will be retrieved or created. required. |
| AccountProviderId | integer. The ID of the account provider associated with the product where the new deposit key will be created. If not defined it defaults to 0 which then uses the default deposit provider. Need to be set if there are multiple account providers and there is a need to generate a deposit key for non default deposit provider. optional. |
| GenerateNewKey | boolean. If set to true, a new deposit key will be created when API is invoked, else no new deposit key will be created. In the event that there is still no deposit key existing for the account, a new deposit key is guaranteed to be created even if GenerateNewKey is false. If not set, it is considered as false. optional. |
Response
{
"AssetManagerId": 1,
"AccountId": 7,
"AssetId": 3,
"ProviderId": 7,
"DepositInfo": "[\"2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU\",\"2MsZHcpBonQrqPuWhgBPG4h5jQxzn73AmP8\",\"2MuqLiM7VnKnhQ2eQweLVERa8Pmksnp1mYQ\",\"2MyLbBeHQF9jAcSCTdSb9yKN1H98sFCbxDg\",\"2N9T1Rp9Yau3SyuCbu5pZDLyrFNwhBW5oPA\",\"2N7GUbdECukjGxYu5TbnLbjcVwW7LXTa8Di\",\"2N4ujZxj9vqZ9XxnbqmARLfJ1u3SPbYhJL8\",\"2NEfLKAYzhnFySQf2XD9ZurwpTkfTdukGot\",\"2N4yFCCGDk8JiXVshadmdiGUbEuM4JHCZZY\",\"2NCCRN35RY4i2kaSSwcnDq46rWzQ4bUedkP\",\"2NDNoXZ3tZYZgW8jVfWox1NAUY8CRBJzV3w\",\"2MznejkK8VHkVS9YYBA2idHG8oMM1xJTp6X\",\"2NFGQ6DUGrMHpgk6HwcXmjC22ipfHMJoBwL\",\"2N87YF7wAUPvXPd8k9F4KECeMqwpbusntZV\",\"2NC6utszd4dYNXZ17qdQpUBCUzswDD9dSYX\",\"2NFBWPsuBry6bW18GZxwSwAiJ48Atnsaz7f\",\"2Mxb8UhgUob3pxnqRyrxQYcvdH1qQTtUkvd\",\"2N3nGe7Um8nHajsNxbSjbKKLq1XxqZH8nUC\",\"2NFhntitnoR6zsir4mSzqoYPZCB7iexXbmd\",\"2N13WvLn8PmdZxQRbk3PNVRrRSL2EUSWyZP\",\"2MtyKb3zUcRMuaCbYNjiGm2bvdi4WyuuyJz\",\"2NDaJGjzQQrexbCCFv13nZoWkQeV33eT9so\",\"2NDsRtsiFEvMjr1FnmMBNAeunmvaBS7boFy\",\"2Mzx3umCXTyhSXWkFy4quJb5rtRUcB7uNyS\",\"2MuZkwDSr7U5hDHy9wFDvt4Np6yKVvjXhdo\",\"2N6EuEVTfN2xux6yw8jCuiTgGHLjUuPAPQA\",\"2NCugrBugzoYLqcEcPWFwD8NmLSHv2oFmeJ\",\"2NC4k3bhqSowDCAwfzCxSLunvZAd7YskgvG\",\"2MsFGero4mC61kv8c9ef7F9xUgZHQjpXC6u\",\"2N7UoxvAy6425GHqm6HUED6tNHuDBJZzKhH\",\"2Mz64JktZebDEZwiyFs2FMeUxcNTua8Ybey\",\"2N8e9PwYc615mTEVWYLpuRSN75NrxtD89qw\",\"2N7z95qdPgUq68NdPqU66qvCUwvCCPsNzQf\",\"2MtxzMiNWGm4stkFXyksnKse1qG3xxwBfGt\",\"2NDFedzcVH6DvgRath7B6jXCV7sFMbFWrbR\",\"2MuaahU1U5ip3qxTP3QkEahDkk1K3egDwab\",\"2N8jX7Ao4E8HgthDrsisRBDugJTCXkQ8mkg\",\"2N6YUwbMBDQg1LQLLU91LtFxvfpK81mfus6\",\"2N8as8ZE4SJg7hTFPBc2MsxCNktEKQMpb8W\",\"2N7TCd87mGM6XcDKHRKeTXvnfWTNxewKqak\",\"2MxpUBc7iGXgYZBUkmauAA6qdRfHq2KiXPX\",\"2NGZbuy4bmNnS12Q3p66iZaVnrM7R6xG48h\",\"2NG4ieXu37StGmtbaTbZA7jUW42cpWSPrfA\",\"2N4KJWGPVKPJL3fgPDbhnQcymU2kqwApVB2\",\"2N495R1iDKunEGqusQpCJZJiE6gtnRTpTMY\",\"2Mu3hDBsxj35Pc9D2ZW3UGZvC3wsKYQcQ7D\",\"2NBJGzqZo98Ha9frKCpuFrBvr1TLbgKVTQy\",\"2MxqDpwWCeDSjJ4cBFrP9P6hoBR9YDmMAs8\",\"2MykTWNAPgjsTgtd2eLemszYCajVXnVcepZ\",\"2MusLcJTbFu3Vs3effZohhBkh9ZmJSBzh2v\",\"2MxuCEHxC8SXhTroJcEd73g1KLZ4aEqNX5R\",\"2N8Ek16SQpywZyVdxSXtDCHM1TYgo7ooWyk\",\"2N3iGpmq9P5NSss8pRGEgeshXFKW2PnorQ4\",\"2MxMbs7iyTXt81yEzM1SMsQx35xvXGD7GNH\",\"2Mv1jXDKSMcn62Vt3uTr2mCWQB5YsNZ7fSn\"]",
"result": true,
"errormsg": null,
"statuscode": 0
}
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager where the asset or product belongs to. |
| AccountId | integer. The ID of the account for which the deposit info were retrieved. |
| AssetId | integer. The ID of the product the deposit info is/are for. |
| ProviderId | integer. The ID of the account provider setup for the product, a deposit info is directly linked to an account provider. No deposit info can be created without a functional account provider. |
| DepositInfo | string. The actual deposit info or keys, when parsed, it is an array where each element represents a deposit key. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetNewDepositAddress
Permissions: Operator,Deposit
Call Type: Synchronous
Creates a new deposit address and retrieves all the other existing deposit addresses of the specified AccountId for the specified ProductId.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetNewDepositAddress", {
OMSId: 1,
AccountId: 7,
ProductId: 3,
});
POST /AP/GetNewDepositAddress HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 62
{
"OMSId": 1,
"AccountId": 7,
"ProductId": 3
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account you wish to create a new deposit address for. required. |
| ProductId | integer. The ID of the product for which the deposit address of the account specified will be created. required. |
Response
{
"AssetManagerId": 1,
"AccountId": 7,
"AssetId": 3,
"ProviderId": 7,
"DepositInfo": "[\"2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU\",\"2MsZHcpBonQrqPuWhgBPG4h5jQxzn73AmP8\",\"2MuqLiM7VnKnhQ2eQweLVERa8Pmksnp1mYQ\",\"2MyLbBeHQF9jAcSCTdSb9yKN1H98sFCbxDg\",\"2N9T1Rp9Yau3SyuCbu5pZDLyrFNwhBW5oPA\",\"2N7GUbdECukjGxYu5TbnLbjcVwW7LXTa8Di\",\"2N4ujZxj9vqZ9XxnbqmARLfJ1u3SPbYhJL8\",\"2NEfLKAYzhnFySQf2XD9ZurwpTkfTdukGot\",\"2N4yFCCGDk8JiXVshadmdiGUbEuM4JHCZZY\",\"2NCCRN35RY4i2kaSSwcnDq46rWzQ4bUedkP\",\"2NDNoXZ3tZYZgW8jVfWox1NAUY8CRBJzV3w\",\"2MznejkK8VHkVS9YYBA2idHG8oMM1xJTp6X\",\"2NFGQ6DUGrMHpgk6HwcXmjC22ipfHMJoBwL\",\"2N87YF7wAUPvXPd8k9F4KECeMqwpbusntZV\"]",
"result": true,
"errormsg": null,
"statuscode": 0
}
Response is identical to that of GetDepositInfo.
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager where the asset or product belongs to. |
| AccountId | integer. The ID of the account for which the new deposit info was created. |
| AssetId | integer. The ID of the product the deposit info is/are for. |
| ProviderId | integer. The ID of the account provider setup for the product, a deposit info is directly linked to an account provider. No deposit info can be created without a functional account provider. |
| DepositInfo | string. The actual deposit info or keys, when parsed, it is an array where each element represents a deposit key, the newly created deposit key would be the element with the highest index. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetDepositRequestInfoTemplate
Permissions: Operator,Trading
Call Type: Synchronous
Get a JSON object describing a deposit form template for a specific product. Only 1 deposit request info template will be returned for each request.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositRequestInfoTemplate", {
OMSId: 1,
ProductId: 3,
AccountProviderId: 5, //optional
});
POST /AP/GetDepositRequestInfoTemplate HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"ProductId": 3,
"AccountProviderId": 5
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which deposit template info will be retrieved. required. |
| AccountProviderId | integer. The ID of the specific account provider for which deposit template info will be retrieved. If not defined, the default deposit provider will be returned. optional. |
Response
{
"Template": {
"ProviderType": "BitGoRpc",
"Template": "{}",
"ProcessInfo": "",
"UseGetDepositWorkflow": true,
"DepositWorkflow": "CryptoWallet"
},
"result": true,
"errormsg": null,
"statuscode": 0
}
//Custom deposit template form
{
"Template": {
"ProviderType": "InternalAccounting",
"Template": "{\"Type\":null,\"ClearingBank\":null,\"BankCode\":null,\"BankBranchCode\":null,\"BankAccountNumber\":null,\"Remark\":null}",
"ProcessInfo": "",
"UseGetDepositWorkflow": false,
"DepositWorkflow": "Custom"
},
"result": true,
"errormsg": null,
"statuscode": 0
}
| Key | Value |
|---|---|
| Template | object. A JSON object which has several fields that describes the actual deposit template. Field descriptions follow below. |
| ProviderType | string. The account provider type. There are several account provider types in APEX, some of there are: BitgoRPC, Fireblocks, InternalAccounting, EthereumRPC. |
| Template | string. The stringtified template form, usually just an empty object if there are not custom fields defined for a specific account provider. |
| ProcessInfo | string. Defaults to an empty string. |
| UseGetDepositWorkflow | boolean. Either true or false. |
| DepositWorkflow | string. The deposit workflow. There are a few of them: ManualDeposit, CryptoWallet, Custom. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetAllDepositRequestInfoTemplates
Permissions: Operator,Trading
Call Type: Synchronous
Get all the possible deposit templates for describing deposit forms for a specific product.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAllDepositRequestInfoTemplates", {
OMSId: 1,
ProductId: 3,
});
POST /AP/GetAllDepositRequestInfoTemplates HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"ProductId": 3
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which deposit form templates will be retrieved. required. |
Response
{
"Templates": [
{
"providerId": 1,
"providerName": "USD_AccountProvider",
"depositTemplate": {
"ProviderType": "InternalAccounting",
"Template": "{}",
"ProcessInfo": "",
"UseGetDepositWorkflow": false,
"DepositWorkflow": "ManualDeposit"
}
},
{
"providerId": 3,
"providerName": "internal-accounting-test",
"depositTemplate": {
"ProviderType": "InternalAccounting",
"Template": "{}",
"ProcessInfo": "",
"UseGetDepositWorkflow": false,
"DepositWorkflow": "ManualDeposit"
}
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
| Key | Value |
|---|---|
| Templates | array. An array whose elements are objects. Each object in the array represents a deposit info template. Fields are described below. |
| providerId | integer. The account provider ID. |
| providerName | string. The account provider name. |
| depositTemplate | object. A JSON object. The actual deposit template, fields are described below. |
| ProviderType | string. The account provider type. There are several account provider types in APEX, some of there are: BitgoRPC, Fireblocks, InternalAccounting, EthereumRPC. |
| Template | string. The stringtified template form, usually just an empty object if there are not custom fields defined for a specific account provider. |
| ProcessInfo | string. Defaults to an empty string. |
| UseGetDepositWorkflow | boolean. Either true or false. |
| DepositWorkflow | string. The deposit workflow. There are a few of them: ManualDeposit, CryptoWallet, Custom. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetDeposits
Permissions: Operator,Trading
Call Type: Synchronous
Get a list of all FullyProcessed deposits of a specific account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDeposits", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetDeposits HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account for which you wish to retrieve FullyProcessed deposits. required. |
Response
[
{
"OMSId": 1,
"DepositId": 7,
"AccountId": 7,
"SubAccountId": 0,
"ProductId": 1,
"Amount": 1000.0,
"LastUpdateTimeStamp": 637828669390668587,
"ProductType": "NationalCurrency",
"TicketStatus": "FullyProcessed",
"DepositInfo": "{\"ProductSymbol\":\"USD\",\"fullname\":\"sample\"}",
"DepositCode": "e747d432-5ee6-4cc1-a6cc-525f5220b72d",
"TicketNumber": 7,
"NotionalProductId": 0,
"NotionalValue": 0.0,
"FeeAmount": 0.0
},
{
"OMSId": 1,
"DepositId": 15,
"AccountId": 7,
"SubAccountId": 0,
"ProductId": 3,
"Amount": 0.0166333,
"LastUpdateTimeStamp": 637830678103822635,
"ProductType": "CryptoCurrency",
"TicketStatus": "FullyProcessed",
"DepositInfo": "{\"AccountProviderId\":3,\"AccountProviderName\":\"BitgoRPC-BTC\",\"TXId\":\"e9b29c10e53d8a933c0a3a03efc2b30793c7e1924254a46947e50933c033ac5b\",\"FromAddress\":\"tb1q86mtg9q4pn07c3jmwqm7dz3smckumh5xrfzu6u\",\"ToAddress\":\"2MstbdDUxo57ysXvxnYVbgax9JETsXPs6rL\"}",
"DepositCode": "cf066296-3dbc-4223-b0e3-b1d39f984e37",
"TicketNumber": 15,
"NotionalProductId": 1,
"NotionalValue": 0.0166333,
"FeeAmount": 0.0
}
]
Returns an array of objects, each object represents a FullyProcessed deposit. The last element in the array is the most recent deposit.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. |
| DepositId | integer. The ID of the deposit transaction. |
| AccountId | integer. The ID of the account who owns the deposit transaction. |
| DepositId | integer. The ID of the deposit transaction. |
| SubAccountId | integer. Reserved for future use. Defaults to 0. |
| ProductId | integer. The ID of the product the deposit is for. |
| Amount | decimal. The actual amount of the product that was credited to the account. |
| LastUpdateTimeStamp | long integer. The timestamp when the deposit ticket was last updated. |
| ProductType | string. The type of the product for which the deposit was made, usually either NationalCurrency or CryptoCurrency. |
| TicketStatus | string. GetDeposits will only return deposits in FullyProcessed status. If a ticket is in that status, it means that the deposit amount has been credited to the account already except if the operator manually marked the ticket as FullyProcessed. |
| DepositInfo | string. A string that when parsed will be an object with fields containing the relevant info about the deposit transaction such as the TXID on chain, the FromAddress etc. |
| DepositCode | string. The GUID that identifies the deposit transaction. |
| TicketNumber | integer. The deposit ticket number, same value with DepositId. |
| NotionalProductId | integer. The ID of the notional product, based on the account verification level. |
| NotionalValue | decimal. The notional amount of the deposit amount. |
| FeeAmount | decimal. The total fee incurred for the deposit transaction, this amount got debited from the account. |
GetDepositTemplateTypes
Permissions: Operator,Deposit
Call Type: Synchronous
Gets a list of deposit templates for a specific asset or product. Response for cryptocurrency product will usually be an empty array.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositTemplateTypes", {
OMSId: 1,
ProductId: 1,
});
POST /AP/GetDepositTemplateTypes HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 40
{
"OMSId":1,
"ProductId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which deposit template types will be retrieved. required. |
Response
{
"TemplateTypes": [
{
"AccountProviderId": 5,
"TemplateName": "Standard",
"AccountProviderName": "USD AP"
},
{
"AccountProviderId": 8,
"TemplateName": "Standard",
"AccountProviderName": "USD"
},
{
"AccountProviderId": 16,
"TemplateName": "Standard",
"AccountProviderName": "USD 3"
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
//Response for a cryptocurrency asset with a functional account provider.
{
"TemplateTypes": [],
"result": true,
"errormsg": null,
"statuscode": 0
}
Responds with an object, one field is named TemplateTypes which is an array of objects, each object represents an account provider deposit template type whose fields are described below:
| Key | Value |
|---|---|
| AccountProviderId | integer. The ID of the account provider of a specific deposit template type. |
| TemplateName | string. The name of the specific template type. |
| AccountProviderName | string. The name of the account provider for the specific deposit template type. An asset or a product can have multiple account providers. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetAccountDepositTransactions
Permissions: Trading, AccountReadOnly
Call Type: Synchronous
Gets a list of account transactions which are of TransactionReferenceType Deposit.
Users with Trading and AccountReadOnly permission can get deposit transactions only for the account/s with which they are associated. Users with Operator permission can get deposit transactions for any account.
The owner of the trading venue determines how long to retain transaction history before archiving.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountDepositTransactions", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetAccountDepositTransactions HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the account transactions took place. required. |
| AccountId | integer. The ID of the account whose transactions will be returned. required. |
| Depth | integer. The count of deposit transactions to be returned. optional. |
Response
[
{
"TransactionId": 24214,
"ReferenceId": 294,
"OMSId": 1,
"AccountId": 7,
"CR": 0.01247667,
"DR": 0.0,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Deposit",
"ProductId": 3,
"Balance": 1.138154399436,
"TimeStamp": 1678904016338
},
{
"TransactionId": 24021,
"ReferenceId": 293,
"OMSId": 1,
"AccountId": 7,
"CR": 0.01247667,
"DR": 0.0,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Deposit",
"ProductId": 3,
"Balance": 1.125677729436,
"TimeStamp": 1678706804112
}
]
Returns an array of objects as a response, each object represents a deposit transaction.
| Key | Value |
|---|---|
| TransactionId | Integer. The ID of the transaction. |
| OMSId | Integer. The ID of the OMS under which the requested transactions took place. |
| AccountId | Integer. The single account under which the transactions took place. |
| CR | decimal. Credit entry for the account on the order book. Funds entering an account. |
| DR | decimal. Debit entry for the account on the order book. Funds leaving an account. |
| Counterparty | long integer. The corresponding party in a trade. |
| TransacitionType | string. Can either be Other or Fee. |
| ReferenceId | long integer. The ID of the action or event that triggered this transaction. |
| ReferenceType | string. A deposit transaction is always a Deposit ReferenceType |
| ProductId | integer. The ID of the product in which the deposit was made. Use GetProduct to return information about a product based on its ID. |
| Balance | decimal. The balance in the account after the deposit transaction. |
| Timestamp | long integer. Time at which the transaction took place, in POSIX format. |
Fee
GetWithdrawFee
Permissions: Operator, Trading, Withdraw
Call Type: Synchronous
Get a fee estimate for a withdrawal.
Withdraw fee is something that can be set by an exchange operator in the AdminUI, it is set per product. It can also be set programmatically using SetOMSFee.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawFee", {
OMSId: 1,
AccountId: 1,
ProductId: 1,
Amount: 100,
});
POST /AP/GetWithdrawFee HTTP/1.1
Host: hostname goes here...
aptoken: 1287b2b0-76c8-4249-ad22-3204fe4f4028 //valid sessiontoken
Content-Type: application/json
Content-Length: 82
{
"OMSId": 1,
"AccountId": 1,
"ProductId": 1,
"Amount": 100
}
All fields in the table below are required in order to the the correct withdraw fee estimate.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS trading the product. required. |
| AccountId | integer. The ID of the account making the withdrawal. Not explicitly required but needs to be defined to get the accurate estimate of withdraw fee especially if there are fee overrides. Defaults to zero if not defined. required. |
| ProductId | integer. The ID of the product intended to be withdrawn. Fees may vary with product. Not explicitly required but needs to be defined to get the accurate estimate of withdraw fee. Defaults to zero if not defined. required. |
| Amount | decimal. The amount of product intended to be withdrawn, not explicitly required but needs to be defined to get the accurate estimate of withdraw fee. Defaults to zero if not defined. required. |
| AccountProviderId | integer. When there are multiple account providers, an operator may defined varying fees for each. Defining an ID here makes sure the fee is accurate according to the account provider used to withdraw. Defaults to zero if not defined. optional. |
Response
{
"FeeAmount": 1.0,
"TicketAmount": 100
}
| Key | Value |
|---|---|
| FeeAmount | decimal. The estimated amount of the fee for the indicated withdrawal. |
| TicketAmount | decimal. The amount of product intended to be withdrawn. |
GetDepositFee
Permissions: Operator, Trading, Deposit
Call Type: Synchronous
Get a fee estimate for a deposit.
Deposit fee is something that can be set by an exchange operator in the AdminUI, it is set per product. One reason for an exchange to charge a deposit fee is to cover the gas fee during sweeping process just like for ERC-20 tokens.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetDepositFee", {
OMSId: 1,
AccountId: 1,
ProductId: 1,
Amount: 100,
AccountProviderId: 5,
});
POST /AP/GetDepositFee HTTP/1.1
Host: hostname goes here...
aptoken: 1287b2b0-76c8-4249-ad22-3204fe4f4028
Content-Type: application/json
Content-Length: 111
{
"OMSId": 1,
"AccountId": 1,
"ProductId": 1,
"Amount": 100,
"AccountProviderId": 5
}
All fields in the table below are required in order to the the correct deposit fee estimate.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account making the deposit. Not explicitly required but needs to be defined to get the accurate estimate of deposit fee especially if there is/are fee override/s. Defaults to zero if not defined. required. |
| ProductId | integer. The ID of the product intended to be deposited. Fees may vary with product. Not explicitly required but needs to be defined to get the accurate estimate of deposit fee. Defaults to zero if not defined. required. |
| Amount | decimal. The amount of product intended to be deposited. Not explicitly required but needs to be defined to get the accurate estimate of deposit fee. Defaults to zero if not defined. required. |
| AccountProviderId | integer. When there are multiple account providers, an operator may define varying fees for each. Defining an ID here makes sure the fee is accurate according to the account provider used to deposit. Defaults to zero if not defined. required. |
Response
{
"FeeAmount": 1.0,
"TicketAmount": 100
}
| Key | Value |
|---|---|
| FeeAmount | decimal. The estimated amount of the fee for the indicated deposit. |
| TicketAmount | decimal. The amount of product intended to be deposited. |
GetOMSWithdrawFees
Permissions: Operator,Withdraw
Call Type: Synchronous
Gets a list of withdraw fees that are set for products in a specific OMS. Can be filtered per product and account provider.
It is possible to set a withdraw fee specifically for a product and an account provider. Additional feature has been added to withdraw fees starting APEX version 4.2: minimum withdraw fee can already be set.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOMSWithdrawFees")
{
"OMSId": 1,
"ProductId": 1,
"AccountProviderId": 8
}
POST /AP/GetOMSWithdrawFees HTTP/1.1
Host: hostname goes here...
aptoken: 93623083-2594-45ea-b5d3-5d60c92c66ab
Content-Type: application/json
Content-Length: 70
{
"OMSId": 1,
"ProductId": 1,
"AccountProviderId": 8
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product in the OMS you wish to retrieve withdraw fees of. If not defined, all withdraw fees for all products will be returned, will depend if AccountProviderId is defined. optional. |
| AccountProviderId | integer. The ID of account provider in the OMS you wish to retrieve withdraw fees of. If not defined, all withdraw fees for all account providers will be returned, will depend if ProductId is defined. optional. |
Response
[
{
"OMSId": 1,
"AccountId": 2,
"AccountProviderId": 0,
"FeeId": 47,
"FeeAmt": 7.0,
"FeeCalcType": "Percentage",
"IsActive": false,
"ProductId": 1,
"MinimalFeeAmt": 2.0,
"MinimalFeeCalcType": "Percentage"
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| AccountId | integer. The ID of the account to which the fee will apply, if set to 0, fee will apply to any account doing a withdraw of the the specific product defined in the withdraw fee. |
| AccountProviderId | integer. The ID of the account provider to which the fee will apply, if set to 0, fee will apply regardless of the account provider used for the withdraw transaction. |
| FeeId | integer. The ID of the specific withdraw fee. |
| FeeAmt | decimal. The standard withdraw fee amount. |
| FeeCalcType | string. The way to calculate the standard fee amount, either Percentage or Flat. |
| IsActive | boolean. If true, fee will apply, else it will not. |
| ProductId | integer. The ID of the product for which the specific withdraw fee will apply. |
| MinimalFeeAmt | decimal. The minimum withdraw fee amount. |
| MinimalFeeCalcType | string. The way to calculate the minimum withdraw fee, either Percentage or Flat. |
GetOMSDepositFees
Permissions: Operator,Deposit
Call Type: Synchronous
Gets a list of deposit fees that are set for products in a specific OMS. Can be filtered per product and account provider.
It is possible to set a deposit fee specifically for a product and an account provider.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOMSDepositFees", {
OMSId: 1,
ProductId: 1,
AccountProviderId: 5,
});
POST /AP/GetOMSDepositFees HTTP/1.1
Host: hostname goes here...
aptoken: 431ea162-1c16-4401-9f34-110e18983cac
Content-Type: application/json
Content-Length: 70
{
"OMSId": 1,
"ProductId": 1,
"AccountProviderId": 5
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product in the OMS you wish to retrieve deposit fees of. If not defined, all deposit fees for all products will be returned, will depend if AccountProviderId is defined. optional. |
| AccountProviderId | integer. The ID of account provider in the OMS you wish to retrieve deposit fees of. If not defined, all deposit fees for all account providers will be returned, will depend if ProductId is defined. optional. |
Response
[
{
"OMSId": 1,
"AccountId": 0,
"AccountProviderId": 5,
"FeeId": 8,
"FeeAmt": 1.0,
"FeeCalcType": "FlatRate",
"IsActive": true,
"ProductId": 1,
"MinimalFeeAmt": 0,
"MinimalFeeCalcType": "FlatRate"
},
{
"OMSId": 1,
"AccountId": 0,
"AccountProviderId": 5,
"FeeId": 10,
"FeeAmt": 1.0,
"FeeCalcType": "FlatRate",
"IsActive": true,
"ProductId": 1,
"MinimalFeeAmt": 0,
"MinimalFeeCalcType": "FlatRate"
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| AccountId | integer. The ID of the account to which the fee will apply, if set to 0, fee will apply to any account doing a deposit of the the specific product defined in the deposit fee. |
| AccountProviderId | integer. The ID of the account provider to which the fee will apply, if set to 0, fee will apply regardless of the account provider used for the deposit transaction. |
| FeeId | integer. The ID of the specific deposit fee. |
| FeeAmt | decimal. The standard deposit fee amount. |
| FeeCalcType | string. The way to calculate the standard fee amount, either Percentage or Flat. |
| IsActive | boolean. If true, fee will apply, else it will not. |
| ProductId | integer. The ID of the product for which the specific deposit fee will apply. |
| MinimalFeeAmt | decimal. Not yet supported in the current latest APEX version; for future provision. The minimum deposit fee amount. This will be the lowest amount of fee charged for each deposit. |
| MinimalFeeCalcType | string. Not yet supported in the current latest APEX version; for future provision. he way to calculate the minimum withdraw fee, either Percentage or Flat. |
GetAccountFees
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Retrieves a list of Account Level Fee descriptors specified on an account. Basically, this API will respond a list of trading fees that are defined with fee tier the same as the fee tier of the account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountFees", {
OMSId: 1,
AccountId: 9,
});
POST /AP/GetAccountFees HTTP/1.1
Host: hostname goes here...
aptoken: 7cb8f194-6ee6-4bf3-8e50-b11251eba458
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| AccountId | integer. The ID whose fees will be retrieved. required. |
| OMSId | integer. The ID of the OMS. required. |
Response
[
{
"FeeId": 296,
"OMSId": 1,
"FeeTier": 2,
"AccountId": 0,
"FeeAmt": 0.04,
"FeeCalcType": "Percentage",
"FeeType": "Flat",
"LadderThreshold": 0.0,
"LadderSeconds": 0,
"IsActive": true,
"InstrumentId": 2,
"OrderType": "Unknown",
"PeggedProductId": 0
},
{
"FeeId": 335,
"OMSId": 1,
"FeeTier": 2,
"AccountId": 0,
"FeeAmt": 0.002,
"FeeCalcType": "Percentage",
"FeeType": "FlatPegToProduct",
"LadderThreshold": 0.0,
"LadderSeconds": 0,
"IsActive": false,
"InstrumentId": 1,
"OrderType": "Unknown",
"PeggedProductId": 2
}
]
| Key | Value |
|---|---|
| FeeId | integer. The ID of the fee. |
| OMSId | integer. The ID the OMS. |
| FeeTier | integer. The feetier of the fee, the same with the fee tier of the account. |
| AccountId | integer. The ID of the account to which the fee will apply, 0 means it will apply to all accounts with the same fee tier. |
| FeeAmt | decimal. The actual fee amount if FeeCalcType is Flat, otherwise if Percentage, this represents the percentage of the trade value. |
| FeeCalcType | string. Either Flat or Percentage. |
| FeeType | string. Can be one of the following: Flat, MakerFee, TakerFee, PeggedProductFee, AffiliateFee. |
| LadderThreshold | decimal. The ladder threshold of the fee. |
| LadderSeconds | integer. |
| IsActive | boolean. If true, means can apply to a trade, else it will not even if criteria are met. |
| InstrumentId | integer. The ID of the instrument to which the fee will apply. |
| OrderType | integer. The type of order where fee will only apply. Can be one of the following: Market, Limit, StopMarket, StopLimit,TrailingStopMarket, TrailingStopLimit, BlockTrade, Unknown. Unknown means all order types. |
| PeggedProductId | integer. The ID of the pegged product if the FeeType is PeggedProductFee. |
UpdateAccountLoyaltySettings
Permissions: Operator,Trading
Call Type: Synchronous
Updates account loyalty enrollment information. A loyalty enabled account is eligible to fee discounts set by the exchange operator. The fee will also be in the denomination of the loyalty token set by the exchange operator.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("UpdateAccountLoyaltySettings",
{
"OMSId": 1,
"AccountId": 114,
"LoyaltyProductId": 1,
"LoyaltyEnabled": true
});
POST /AP/UpdateAccountLoyaltySettings HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: efd9db59-c06c-46a7-b661-733b9d44ed1a
Authorization: Basic YWRtaW46MTIzNA==
Content-Length: 100
{
"OMSId": 1,
"AccountId": 114,
"LoyaltyProductId": 1,
"LoyaltyEnabled": true
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the specified account is assigned. required. |
| AccountId | integer. The ID of the account whose Loyalty settings will be updated. required. |
| LoyaltyProductId | integer. The ID of the product that will serve as the loyalty token. Defaults to 0 if not defined. optional. |
| LoyaltyEnabled | boolean. Either true or false. Defaults to false if not defined. optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional message details sent by the system. Usually null. |
GetOperatorLoyaltyFeeConfig
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves loyalty fee configuration information for the specified LoyaltyProductId
An exchange operator can promote activity on a specific cryptocurrency token by offering discounted transaction fees denominated in that token to customers who choose this fee structure. The Loyalty Token is a parallel fee structure that replaces the general set of transaction fees.
An OMS is not required to have a Loyalty Token or Fee, and a user may opt to use it but not required.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOperatorLoyaltyFeeConfig", {
OMSId: 1,
LoyaltyProductId: 6,
});
POST /AP/GetOperatorLoyaltyFeeConfig HTTP/1.1
Host: hostname goes here...
aptoken: 9c0faeb9-4d29-4eb8-aca7-b36a9b46923c
Content-Type: application/json
Content-Length: 48
{
"OMSId": 1,
"LoyaltyProductId": 6
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where loyalty fee config is defined. required. |
| LoyaltyProductId | integer. The ID of the product set as the loyalty product or token in the OMS. required. |
Response
{
"OMSId": 1,
"LoyaltyProductId": 6,
"LoyaltyDiscount": 0.05,
"ReferenceProductId": 2,
"ReferenceProductPrice": 100000.0,
"IsEnabled": false,
"LastUpdated": "2023-04-27T12:38:28.378Z",
"UpdatedBy": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| LoyaltyProductId | integer. The product ID of the loyalty product or token. |
| LoyaltyDiscount | decimal. The discount from the standard fee that you are willing to apply, for example, 0.5 (denominated in the loyalty product). The amount is displayed in decimal format; that is 0.5 = 50%. |
| ReferenceProductId | integer. The product ID of the default base currency to be used to calculate the exchange rate between regular fee products and the discount product. The basis is the last trade price of the product pairing, for example, loyalty product/reference product. |
| ReferenceProductPrice | decimal. This is the default market value for XYZ (from the previous example) in a base currency to use in the event that there is no "last" traded price for the XYZ/Reference_Product market. This value is applicable only if no XYZUSD market exists on the exchange. |
| IsEnabled | boolean. If true, allows transactions to use the Loyalty Token and Fee. |
| LastUpdated | string. The exact date and time the loyalty fee configuration has been updated. |
| UpdatedBy | integer. The ID of the user who updated the loyalty fee configuration. |
GetOperatorLoyaltyFeeConfigsForOms
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves loyalty fee configurations information for the specified OMS.
An exchange operator can promote activity on a specific cryptocurrency token by offering discounted transaction fees denominated in that token to customers who choose this fee structure. The Loyalty Token is a parallel fee structure that replaces the general set of transaction fees.
An OMS is not required to have a Loyalty Token or Fee, and a user may opt to use it but not required.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOperatorLoyaltyFeeConfigsForOms", {
OMSId: 1,
});
POST /AP/GetOperatorLoyaltyFeeConfigsForOms HTTP/1.1
Host: hostname goes here...
aptoken: 9c0faeb9-4d29-4eb8-aca7-b36a9b46923c
Content-Type: application/json
Content-Length: 48
{
"OMSId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where loyalty fee config is defined. required. |
Response
[
{
"OMSId": 1,
"LoyaltyProductId": 5,
"LoyaltyDiscount": 0.1000000000000000000000000000,
"ReferenceProductId": 1,
"ReferenceProductPrice": 100000.00000000000000000000000,
"IsEnabled": true,
"LastUpdated": "2023-10-30T16:23:04.064Z",
"UpdatedBy": 1
},
{
"OMSId": 1,
"LoyaltyProductId": 6,
"LoyaltyDiscount": 0.1000000000000000000000000000,
"ReferenceProductId": 1,
"ReferenceProductPrice": 100000.00000000000000000000000,
"IsEnabled": true,
"LastUpdated": "2023-10-30T16:16:51.154Z",
"UpdatedBy": 1
},
{
"OMSId": 1,
"LoyaltyProductId": 7,
"LoyaltyDiscount": 0.1000000000000000000000000000,
"ReferenceProductId": 1,
"ReferenceProductPrice": 100000.00000000000000000000000,
"IsEnabled": true,
"LastUpdated": "2023-10-30T16:16:58.435Z",
"UpdatedBy": 1
}
]
Response is an array of objects, each object in the array represents a loyalty fee config.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| LoyaltyProductId | integer. The product ID of the loyalty product or token. |
| LoyaltyDiscount | decimal. The discount from the standard fee that you are willing to apply, for example, 0.5 (denominated in the loyalty product). The amount is displayed in decimal format; that is 0.5 = 50%. |
| ReferenceProductId | integer. The product ID of the default base currency to be used to calculate the exchange rate between regular fee products and the discount product. The basis is the last trade price of the product pairing, for example, loyalty product/reference product. |
| ReferenceProductPrice | decimal. This is the default market value for XYZ (from the previous example) in a base currency to use in the event that there is no "last" traded price for the XYZ/Reference_Product market. This value is applicable only if no XYZUSD market exists on the exchange. |
| IsEnabled | boolean. If true, allows transactions to use the Loyalty Token and Fee. |
| LastUpdated | string. The exact date and time the loyalty fee configuration has been updated. |
| UpdatedBy | integer. The ID of the user who updated the loyalty fee configuration. |
GetAllOperatorLoyaltyFeeConfigs
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves configuration information for a list of all operators loyalty fee configurations.
An exchange operator can promote activity on a specific cryptocurrency token by offering discounted transaction fees denominated in that token to customers who choose this fee structure. The Loyalty Token is a parallel fee structure that replaces the general set of transaction fees.
An OMS is not required to have a Loyalty Token or Fee, and a user may opt to use it but not required.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAllOperatorLoyaltyFeeConfigs", {});
POST /AP/GetAllOperatorLoyaltyFeeConfigs HTTP/1.1
Host: hostname goes here...
aptoken: e389bffc-e642-41aa-899b-a1afbb5ccb5a
Content-Type: application/json
Content-Length: 41
{
}
No request payload required.
Response
[
{
"OMSId": 1,
"LoyaltyProductId": 6,
"LoyaltyDiscount": 0.05,
"ReferenceProductId": 2,
"ReferenceProductPrice": 100000.0,
"IsEnabled": true,
"LastUpdated": "2023-04-27T10:41:47.310Z",
"UpdatedBy": 1
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| LoyaltyProductId | integer. The product ID of the loyalty product or token. |
| LoyaltyDiscount | decimal. The discount from the standard fee that you are willing to apply, for example, 0.5 (denominated in the loyalty product). The amount is displayed in decimal format; that is 0.5 = 50%. |
| ReferenceProductId | integer. The product ID of the default base currency to be used to calculate the exchange rate between regular fee products and the discount product. The basis is the last trade price of the product pairing, for example, loyalty product/reference product. |
| ReferenceProductPrice | decimal. This is the default market value for XYZ (from the previous example) in a base currency to use in the event that there is no "last" traded price for the XYZ/Reference_Product market. This value is applicable only if no XYZUSD market exists on the exchange. |
| IsEnabled | boolean. If true, allows transactions to use the Loyalty Token and Fee. |
| LastUpdated | string. The exact date and time the loyalty fee configuration has been updated. |
| UpdatedBy | integer. The ID of the user who updated the loyalty fee configuration. |
GetOrderFee
Permissions: Operator, Trading
Call Type: Synchronous
Returns an estimate of the transaction/trading fee for a specific order side, instrument, and order type. An exchange operator decides and sets the fees for each instrument.
The exchange generally deducts fees from the "receiving" side of the trade (although an operator can modify this). There are two products in every trade (and in every instrument); for example, the instrument BTCUSD comprises a Bitcoin product and a US dollar product. Placing a buy order on the book causes fees to be deducted from Product 1, in this case, Bitcoin; placing a sell order causes fees to be deducted from Product 2, in this case, US dollar.
A user with Trading permission can get fee estimates for any account that user is associated with and for any instrument or product that that account can trade; a user with Operator permission can get fee estimates for any account, instrument, or product.
If loyalty token is enabled and there is no market for the loyalty token, the system automatically uses 3rd party rates for the loyalty token market.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrderFee", {
OMSId: 1,
AccountId: 9,
InstrumentId: 1,
Quantity: 0.5,
Side: 0,
Price: "10000",
OrderType: 2,
MakerTaker: "Maker",
});
POST /AP/GetOrderFee HTTP/1.1
Host: hostname goes here...
aptoken: f7e2c811-a9db-454e-9c9e-77533baf92d9 //valid sessiontoken
Content-Type: application/json
Content-Length: 177
{
"OMSId": 1,
"AccountId": 9,
"InstrumentId": 1,
"Quantity": 0.5,
"Side": 0,
"Price": "10000",
"OrderType": 2,
"MakerTaker": "Maker"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the trade would take place. required. |
| AccountId | integer. The ID of the account requesting the fee estimate. There can be account overrides, the exchange operator can decide to apply very specific fees to specific accounts, such as a discounted price to a specific account. required. |
| InstrumentId | integer. The ID of the instrument being or to be traded. required. |
| Quantity | decimal. The quantity or amount of the proposed trade for which the OMS would charge a fee. required. |
| Price | decimal. The price at which the proposed trade would take place. Supply your price for a limit order; the exact price is difficult to know before execution. required. |
| OrderType | integer.. The type of the proposed order. An operator can set fees per OrderType. required. One of: 0 Unknown 1 Market 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| MakerTaker | integer. Depending on the venue, there may be different fees for a maker (one who places the order on the books, either buy or sell) or taker (one who accepts the order, either buy or sell). If the user places a large order that is only partially filled, he is a partial maker. required. 0 Unknown 1 Maker 2 Taker |
| Side | integer. Side of the trade. It will decide at which product will the fee be donominated. In APEX, the fee is charged in the incoming product by default. required. One of: 0 Buy 1 Sell 2 Short 3 Unknown |
Response
{
"OrderFee": 0.00001,
"ProductId": 2
}
| Key | Value |
|---|---|
| OrderFee | decimal. The estimated fee for the trade as described. |
| ProductId | integer. The ID of the product (currency) in which the fee is denominated. |
Instrument
GetInstrument
Permissions: Public
Call Type: Synchronous
Retrieves the details of a specific instrument from the OMS of the trading venue. An instrument is something that can be traded in the exchange.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetInstrument", {
OMSId: 1,
InstrumentId: 1,
});
POST /AP/GetInstrument HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 44
{
"OMSId": 1,
"InstrumentId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument. required. |
Response
{
"OMSId": 1,
"InstrumentId": 1,
"Symbol": "BTCUSD",
"Product1": 2,
"Product1Symbol": "BTC",
"Product2": 1,
"Product2Symbol": "USD",
"InstrumentType": "Standard",
"VenueInstrumentId": 1,
"VenueId": 1,
"SortIndex": 0,
"SessionStatus": "Running",
"PreviousSessionStatus": "Unknown",
"SessionStatusDateTime": "2023-03-17T03:51:12.373Z",
"SelfTradePrevention": false,
"QuantityIncrement": 0.00000001,
"PriceIncrement": 0.001,
"MinimumQuantity": 0.0001,
"MinimumPrice": 0.01,
"VenueSymbol": "BTCUSD",
"IsDisable": false,
"MasterDataId": 0,
"PriceCollarThreshold": 0.0,
"PriceCollarPercent": 0.0,
"PriceCollarEnabled": false,
"PriceFloorLimit": 0.0,
"PriceFloorLimitEnabled": false,
"PriceCeilingLimit": 0.0,
"PriceCeilingLimitEnabled": false,
"CreateWithMarketRunning": true,
"AllowOnlyMarketMakerCounterParty": false,
"PriceCollarIndexDifference": 10.0,
"PriceCollarConvertToOtcEnabled": false,
"PriceCollarConvertToOtcClientUserId": 0,
"PriceCollarConvertToOtcAccountId": 0,
"PriceCollarConvertToOtcThreshold": 0.0,
"OtcConvertSizeThreshold": 0.0,
"OtcConvertSizeEnabled": false,
"OtcTradesPublic": true,
"PriceTier": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the instrument is traded. |
| InstrumentId | integer. The ID of the instrument. |
| Symbol | string. Trading symbol of the instrument, for example BTCUSD. |
| Product1 | integer. The ID of the first product comprising the instrument or the ID of the base product/currency of the instrument. |
| Product1Symbol | string. The symbol of the first product comprising the instrument or the symbol of the base product/currency of the instrument. |
| Product2 | integer. The ID of the second product comprising the instrument or the ID of the quote product/currency of the instrument. |
| Product2Symbol | string. The symbol of the second product comprising the instrument or the symbol of the quote product/currency of the instrument. |
| InstrumentType | string. or integer. A number representing the type of the instrument. All instrument types currently are standard, an exchange of one product for another (or unknown, an error condition), but this may expand to new types in the future. 0 Unknown (an error condition) 1 Standard |
| VenueInstrumentId | integer A venue instrument is created at the exchange level as an instrument "template" for adding new instruments to the exchange. This is the ID of the venue instrument behind the instrument being requested. |
| VenueId | integer. The ID of the trading venue on which the instrument trades. |
| SortIndex | integer. The numerical position in which to sort the returned list of instruments on a visual display. Since this call returns information about a single instrument, SortIndex should return 0. |
| SessionStatus | string. or integer. Is the market for this instrument currently open and operational? Returns one of: 0 Unknown 1 Running 2 Paused 3 Stopped 4 Starting 5 RunningPostOnly |
| PreviousSessionStatus | string. What was the previous session status for this instrument? One of: 0 Unknown 1 Running 2 Paused 3 Stopped 4 Starting 5 RunningPostOnly |
| SessionStatusDateTime | string. The time and date at which the session status was reported, in Microsoft Ticks format. |
| SelfTradePrevention | boolean. An account that is trading with itself still incurs fees. If this instrument prevents an account from trading the instrument with itself, the value returns true; otherwise defaults to false. |
| QuantityIncrement | decimal. The smallest tradeable increment of the instrument. For example, for BTCUSD, the quantity increment might be 0.0005, but for ETHUSD, the quantity increment might be 50. |
| PriceIncrement | decimal. The smallest amount by which the instrument can rise or fall in the market. |
| MinimumQuantity | decimal. The smallest quantity at which the instrument can be traded. |
| MinimumPrice | decimal. The lowest price that the instrument can have. |
| VenueSymbol | string. The symbol of the instrument in the trading venue or exchange. |
| IsDisable | boolean. Identifies if the instrument is available to be traded or not, if true, instrument cannot be traded, else it can be traded but would still depend on the SessionStatus. |
| PriceCollarThreshold | decimal. Determines the order quantity of the specific instrument that will not be subject to price collar. For example if threshold is set to 1, any order less with less than 1 quantity will not be subject to price collar checks. |
| PriceCollarPercent | decimal. This sets the maximum allowable percentage with which one order (market or limit) may move the market from the initial execution price of the order, e.g., setting a price collar percent of 10% on BTC/USD will only allow one order to move the market price a maximum of +-10%. |
| PriceCollarEnabled | boolean. Turns price collar on/off. If enabled, price collar will apply according to other price collar parameters such as PriceCollarThreshold. |
| PriceFloorLimit | decimal. The lowest price that the instrument can be traded in a specific session; for instance, daily price floor limit of an instrument can change, it really depends on regulator requirements most of the time. |
| PriceFloorLimitEnabled | boolean. Turns on/off price floor limit, if enabled price floor limit will apply. |
| PriceCeilingLimit | decimal. The highest price that the instrument can be traded in a specific session; for instance, daily price ceiling limit of an instrument can change, it really depends on regulator requirements most of the time. |
| PriceCeilingLimitEnabled | boolean. Turns on/off price ceiling limit, if enabled price ceiling limit will apply. |
| AllowOnlyMarketMakerCounterParty | boolean. If true, all orders for the instrument will only match with orders of a market maker, orders of normal trading accounts will not appear in the orderbook. This can be used if the exchange will serve as a broker. |
| PriceCollarIndexDifference | decimal. The percent difference from the index/real-market price that an order is allowed to execute at. Anything falling outside of the index price +/- (1 + PriceCollarIndexDifference) will be collared |
| PriceCollarConvertToOtcEnabled | boolean. Turns on/off conversion of collared orders to block trades |
| PriceCollarConvertToOtcClientUserId | int. Internal System UserId to assign the collared otc orders to. Should always be 1 in current implementation (default) |
| PriceCollarConvertToOtcAccountId | int. Account Id to assign the collared orders to. This will effectively be a liability account that will need to have working block trades managed by operator. |
| PriceCollarConvertToOtcThreshold | decimal. Threshold of remaining size of order to convert to block trade. If collared order does not have remaining quantity above this threshold the remainder will be cancelled. |
| OtcConvertSizeEnabled | boolean. Turns on/off auto conversion of 'large' limit orders converted to block trade orders upon receipt by the matching engine |
| OtcConvertSizeThreshold | decimal. Threshold to convert limit order quantity to block trade automatically for discovery by block trade market participants |
| OtcTradesPublic | boolean If set to true, OTC trades will affect instrument Level1 data(price, volume), will reflect in the chart. |
| PriceTier | integer. The price tier the instrument. |
GetInstruments
Permissions: Public
Call Type: Synchronous
Retrieves a list of instruments available on the exchange. An instrument is something that can be traded in the exchange.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Get all enabled instruments only
await apex.RPCPromise('GetInstruments',{
OMSId: 1
})
//Get all instruments including the disabled ones
await apex.RPCPromise('GetInstruments',{
OMSId: 1,
InstrumentState: "both"
})
//Get all disabled/inactive instruments only
await apex.RPCPromise('GetInstruments',{
OMSId: 1
InstrumentState: "inactive"
})
POST /AP/GetInstruments HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 20
//Get all enabled instruments only
{
"OMSId": 1
}
//Get all instruments including the disabled ones
{
"OMSId": 1
"InstrumentState": "both"
}
//Get all disabled/inactive instruments only
{
"OMSId": 1
"InstrumentState": "inactive"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the instruments are available. required. |
| InstrumentState | string. Filters the results, you can include disabled instruments in the results, or you can just get disabled instruments if you want. Value can only be either Both or Inactive. If set to Both, response will include all the instruments even the disabled instruments, if set to Inactive, response will only include all the disabled instruments, if not set, response will only return enabled or active instruments. optional. |
Response
[
{
"OMSId": 1,
"InstrumentId": 2,
"Symbol": "ETHUSD",
"Product1": 4,
"Product1Symbol": "ETH",
"Product2": 1,
"Product2Symbol": "USD",
"InstrumentType": "Standard",
"VenueInstrumentId": 2,
"VenueId": 1,
"SortIndex": 0,
"SessionStatus": "Running",
"PreviousSessionStatus": "Stopped",
"SessionStatusDateTime": "2023-01-23T04:49:21.699Z",
"SelfTradePrevention": true,
"QuantityIncrement": 0.0001,
"PriceIncrement": 0.00000001,
"MinimumQuantity": 0.0001,
"MinimumPrice": 0.00000001,
"VenueSymbol": "ETHUSD",
"IsDisable": false,
"MasterDataId": 0,
"PriceCollarThreshold": 0.0,
"PriceCollarPercent": 0.0,
"PriceCollarEnabled": false,
"PriceFloorLimit": 0.0,
"PriceFloorLimitEnabled": false,
"PriceCeilingLimit": 0.0,
"PriceCeilingLimitEnabled": false,
"CreateWithMarketRunning": true,
"AllowOnlyMarketMakerCounterParty": false,
"PriceCollarIndexDifference": 10.0,
"PriceCollarConvertToOtcEnabled": false,
"PriceCollarConvertToOtcClientUserId": 0,
"PriceCollarConvertToOtcAccountId": 0,
"PriceCollarConvertToOtcThreshold": 0.0,
"OtcConvertSizeThreshold": 0.0,
"OtcConvertSizeEnabled": false,
"OtcTradesPublic": true,
"PriceTier": 0
},
{
"OMSId": 1,
"InstrumentId": 3,
"Symbol": "TBTCUSD",
"Product1": 3,
"Product1Symbol": "TBTC",
"Product2": 1,
"Product2Symbol": "USD",
"InstrumentType": "Standard",
"VenueInstrumentId": 3,
"VenueId": 1,
"SortIndex": 0,
"SessionStatus": "Stopped",
"PreviousSessionStatus": "Paused",
"SessionStatusDateTime": "2022-10-25T17:56:32.218Z",
"SelfTradePrevention": true,
"QuantityIncrement": 0.001,
"PriceIncrement": 0.001,
"MinimumQuantity": 0.001,
"MinimumPrice": 0.00000001,
"VenueSymbol": "TBTCUSD",
"IsDisable": false,
"MasterDataId": 0,
"PriceCollarThreshold": 0.0,
"PriceCollarPercent": 0.0,
"PriceCollarEnabled": false,
"PriceFloorLimit": 0.0,
"PriceFloorLimitEnabled": false,
"PriceCeilingLimit": 0.0,
"PriceCeilingLimitEnabled": false,
"CreateWithMarketRunning": true,
"AllowOnlyMarketMakerCounterParty": false,
"PriceCollarIndexDifference": 0.0,
"PriceCollarConvertToOtcEnabled": false,
"PriceCollarConvertToOtcClientUserId": 0,
"PriceCollarConvertToOtcAccountId": 0,
"PriceCollarConvertToOtcThreshold": 0.0,
"OtcConvertSizeThreshold": 0.0,
"OtcConvertSizeEnabled": false,
"OtcTradesPublic": true,
"PriceTier": 0
}
]
The response for GetInstruments is an array of objects, each object represents an instrument.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the instrument is traded. |
| InstrumentId | integer. The ID of the instrument. |
| Symbol | string. Trading symbol of the instrument, for example BTCUSD. |
| Product1 | integer. The ID of the first product comprising the instrument or the ID of the base product/currency of the instrument. |
| Product1Symbol | string. The symbol of the first product comprising the instrument or the symbol of the base product/currency of the instrument. |
| Product2 | integer. The ID of the second product comprising the instrument or the ID of the quote product/currency of the instrument. |
| Product2Symbol | string. The symbol of the second product comprising the instrument or the symbol of the quote product/currency of the instrument. |
| InstrumentType | string. or integer. A number representing the type of the instrument. All instrument types currently are standard, an exchange of one product for another (or unknown, an error condition), but this may expand to new types in the future. 0 Unknown (an error condition) 1 Standard |
| VenueInstrumentId | integer A venue instrument is created at the exchange level as an instrument "template" for adding new instruments to the exchange. This is the ID of the venue instrument behind the instrument being requested. |
| VenueId | integer. The ID of the trading venue on which the instrument trades. |
| SortIndex | integer. The numerical position in which to sort the returned list of instruments on a visual display. Since this call returns information about a single instrument, SortIndex should return 0. |
| SessionStatus | string. or integer. Is the market for this instrument currently open and operational? Returns one of: 0 Unknown 1 Running 2 Paused 3 Stopped 4 Starting 5 RunningPostOnly |
| PreviousSessionStatus | string. What was the previous session status for this instrument? One of: 0 Unknown 1 Running 2 Paused 3 Stopped 4 Starting 5 RunningPostOnly |
| SessionStatusDateTime | string. The time and date at which the session status was reported, in Microsoft Ticks format. |
| SelfTradePrevention | boolean. An account that is trading with itself still incurs fees. If this instrument prevents an account from trading the instrument with itself, the value returns true; otherwise defaults to false. |
| QuantityIncrement | decimal. The smallest tradeable increment of the instrument. For example, for BTCUSD, the quantity increment might be 0.0005, but for ETHUSD, the quantity increment might be 50. |
| PriceIncrement | decimal. The smallest amount by which the instrument can rise or fall in the market. |
| MinimumQuantity | decimal. The smallest quantity at which the instrument can be traded. |
| MinimumPrice | decimal. The lowest price that the instrument can have. |
| VenueSymbol | string. The symbol of the instrument in the trading venue or exchange. |
| IsDisable | boolean. Identifies if the instrument is available to be traded or not, if true, instrument cannot be traded, else it can be traded but would still depend on the SessionStatus. |
| PriceCollarThreshold | decimal. Determines the order quantity of the specific instrument that will not be subject to price collar. For example if threshold is set to 1, any order less with less than 1 quantity will not be subject to price collar checks. |
| PriceCollarPercent | decimal. This sets the maximum allowable percentage with which one order (market or limit) may move the market from the initial execution price of the order, e.g., setting a price collar percent of 10% on BTC/USD will only allow one order to move the market price a maximum of +-10%. |
| PriceCollarEnabled | boolean. Turns price collar on/off. If enabled, price collar will apply according to other price collar parameters such as PriceCollarThreshold. |
| PriceFloorLimit | decimal. The lowest price that the instrument can be traded in a specific session; for instance, daily price floor limit of an instrument can change, it really depends on regulator requirements most of the time. |
| PriceFloorLimitEnabled | boolean. Turns on/off price floor limit, if enabled price floor limit will apply. |
| PriceCeilingLimit | decimal. The highest price that the instrument can be traded in a specific session; for instance, daily price ceiling limit of an instrument can change, it really depends on regulator requirements most of the time. |
| PriceCeilingLimitEnabled | boolean. Turns on/off price ceiling limit, if enabled price ceiling limit will apply. |
| AllowOnlyMarketMakerCounterParty | boolean. If true, all orders for the instrument will only match with orders of a market maker, orders of normal trading accounts will not appear in the orderbook. This can be used if the exchange will serve as a broker. |
| PriceCollarIndexDifference | decimal. The percent difference from the index/real-market price that an order is allowed to execute at. Anything falling outside of the index price +/- (1 + PriceCollarIndexDifference) will be collared |
| PriceCollarConvertToOtcEnabled | boolean. Turns on/off conversion of collared orders to block trades |
| PriceCollarConvertToOtcClientUserId | int. Internal System UserId to assign the collared otc orders to. Should always be 1 in current implementation (default) |
| PriceCollarConvertToOtcAccountId | int. Account Id to assign the collared orders to. This will effectively be a liability account that will need to have working block trades managed by operator. |
| PriceCollarConvertToOtcThreshold | decimal. Threshold of remaining size of order to convert to block trade. If collared order does not have remaining quantity above this threshold the remainder will be cancelled. |
| OtcConvertSizeEnabled | boolean. Turns on/off auto conversion of 'large' limit orders converted to block trade orders upon receipt by the matching engine |
| OtcConvertSizeThreshold | decimal. Threshold to convert limit order quantity to block trade automatically for discovery by block trade market participants |
| OtcTradesPublic | boolean If set to true, OTC trades will affect instrument Level1 data(price, volume), will reflect in the chart. |
| PriceTier | integer. The price tier the instrument. |
GetInstrumentAttributes
Permissions: Operator, Trading
Call Type: Synchronous
Get attributes of a specific instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetInstrumentAttributes", {
OMSId: 1,
InstrumentId: 1,
});
POST /AP/GetInstrumentAttributes HTTP/1.1
Host: hostname goes here...
aptoken: d0260e4b-bf6e-4fcd-a8cd-ad1cb01f2235 //valid sessiontoken
Content-Type: application/json
Content-Length: 44
{
"OMSId": 1,
"InstrumentId": 1
}
| Key | Value |
|---|---|
| OMSId | integer The Id of the OMS where the instrument belongs. required. |
| InstrumentId | integer. The Id of the instrument which you want to get attributes of. required. |
Response
[
{
"OMSId": 1,
"InstrumentId": 1,
"KeyName": "Crypto",
"KeyValue": "true"
}
]
The response is an array of objects, each object represents an instrument attribute in key-value pair.
| Key | Value |
|---|---|
| OMSId | integer. Id of the OMS where the instrument belongs. |
| InstrumentId | integer. Id of the instrument whose attribute/s were returned. |
| KeyName | string. The instrument attribute keyname. |
| KeyValue | string. The instrument attribute keyvalue. |
GetInstrumentVerificationLevelConfig
Permissions: Operator,Trading,Deposit,Withdraw
Call Type: Synchronous
Gets an Instrument Verification Level Configurations for the requested account.
In APEX, a verification level determines the limits of an account in terms of deposits, withdrawals, transfers and trading. The verification level config response of this API only applies to trades or trading, or is only about an instrument. Each instrument will have separate and possibly unique limits than other instruments.
A limit value of -1 means infinite or no limit.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetInstrumentVerificationLevelConfig",
{
"OMSId": 1,
"AccountId": 7
}
POST /AP/GetInstrumentVerificationLevelConfig HTTP/1.1
Host: hostname goes here...
aptoken: 8908ed6d-3bd7-472e-ab70-58c2efef6cab
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccoundId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account for which you wish to get instrument verification level config for. required. |
Response
{
"Level": 111,
"LevelName": null,
"OMSId": 1,
"Instruments": [
{
"VerificationLevel": 111,
"VerificationLevelName": null,
"OMSId": 1,
"InstrumentId": 1,
"InstrumentName": "BTCUSD",
"DailyBuyLimit": 0.0,
"DailySellLimit": 0.0,
"MonthlyBuyLimit": 0.0,
"MonthlySellLimit": 0.0,
"NotionalProductId": 1,
"DailyNotionalLimit": -1.0,
"MonthlyNotionalLimit": -1.0,
"YearlyNotionalLimit": -1.0
},
{
"VerificationLevel": 111,
"VerificationLevelName": null,
"OMSId": 1,
"InstrumentId": 2,
"InstrumentName": "ETHUSD",
"DailyBuyLimit": 0.0,
"DailySellLimit": 0.0,
"MonthlyBuyLimit": 0.0,
"MonthlySellLimit": 0.0,
"NotionalProductId": 1,
"DailyNotionalLimit": -1.0,
"MonthlyNotionalLimit": -1.0,
"YearlyNotionalLimit": -1.0
}
]
}
| Key | Value |
|---|---|
| Level | integer. The verification level the account specified is currently on. |
| LevelName | string. The of the verification level the account specified is currently on. |
| OMSId | integer. The ID of the OMS where the account specified belongs to. |
| Instruments | array. An array of objects, each object will contain the limits of a specific instrument. |
| InstrumentId | integer. The ID of the of the instrument for which the limits apply to. |
| InstrumentName | string. The name of the instrument for which the limits apply to. |
| DailyBuyLimit | decimal. The maximum amount of the specific instrument that the specified account can buy within a day. |
| DailySellLimit | decimal. The maximum amount of the specific instrument that the specified account can sell within a day. |
| MonthlyBuyLimit | decimal. The maximum amount of the specific instrument that the specified account can buy within a month. |
| MonthlySellLimit | decimal. The maximum amount of the specific instrument that the specified account can sell within a month. |
| NotionalProductId | integer. The Id of the notional product for the instrument. |
| DailyNotionalLimit | decimal. The maximum notional amount of the specific instrument that the specified account can buy and sell within a day. Buy and Sell trade amount are combined. |
| MonthlyNotionalLimit | decimal. The maximum notional amount of the specific instrument that the specified account can buy and sell within a month. Buy and Sell trade amount are combined. |
| YearlyNotionalLimit | decimal. The maximum notional amount of the specific instrument that the specified account can buy and sell within a year. Buy and Sell trade amount are combined. |
Product
GetProduct
Permissions: Public
Call Type: Synchronous
Retrieves the details about a specific product on the exchange. A product is an asset that can be deposited and withdrawn but cannot be traded.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetProduct", {
OMSId: 1,
ProductId: 1,
});
POST /AP/GetProduct HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"ProductId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product on the specified OMS. required. |
Response
Returns an object with fields named as to what they mean.
{
"OMSId": 1,
"ProductId": 1,
"Product": "USD",
"ProductFullName": "US Dollar",
"MasterDataUniqueProductSymbol": "",
"ProductType": "NationalCurrency",
"DecimalPlaces": 2,
"TickSize": 0.01,
"DepositEnabled": true,
"WithdrawEnabled": true,
"NoFees": false,
"IsDisabled": false,
"MarginEnabled": false
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the product belongs. |
| ProductId | integer. The ID of the product. |
| Product | string. The symbol of the product. |
| ProductFullName | string. The full name of the product. |
| MasterDataUniqueProductSymbol | string. Always an empty string, for future provision. |
| ProductType | string The nature of the product. One of: 0 Unknown (an error condition) 1 - NationalCurrency 2 - CryptoCurrency 3 - Contract. |
| DecimalPlaces | integer. The maximum number of decimal places allowed for the amount of product that an account may have. |
| TickSize | decimal. The smallest increment of the amount of the specific product that an account may have. |
| DepositEnabled | boolean. Either true or false. This field turns on/off the deposit for the product. |
| WithdrawEnabled | boolean. Either true or false. This field turns on/off the withdrawal for the product. |
| NoFees | boolean. Either true or false. If false, fees incurred by the account can be charged in the denomination of the specific product. If NoFees is true, fees incurred by the account will never be charged in the denomination of the specific product. |
| IsDisabled | boolean. Either true or false. If true, product is disabled and cannot be used, no deposits and withdrawals can be done. |
| MarginEnabled | boolean. Either true or false. Margin is something not yet supported so value is default to false; for future provisions. |
GetProducts
Permissions: Public
Call Type: Synchronous
Returns an array of products available on the exchange. A product is an asset that can be deposited and withdrawn but cannot be traded.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Get all enabled products
await apex.RPCPromise('GetProducts',{
OMSId: 1,
})
//Get all products including disabled products
await apex.RPCPromise('GetProducts',{
OMSId: 1,
GetDisabled: true //or
GetDisabled: 1
})
//Get all products that matches an attribute and its value
await apex.RPCPromise('GetProducts',{
OMSId: 1,
Attribute: "Pegged"
AttributeValue: true
})
//Starting APEX version 4.4, Depth and StartIndex fields are already supported
await apex.RPCPromise('GetProducts',{
OMSId: 1,
GetDisabled: 1,
Depth: 10, //will only return max 10 results
StartIndex: 0, //will return products starting from Productd 1, a StartIndex of 10 will return products starting from ProductId 11(means that ProductsId 1 - 10 will not be in he results)
})
POST /AP/GetProducts HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 20
//Get all enabled products
{
"OMSId": 1
}
//Get all products including disabled products
{
"OMSId": 1,
"GetDisabled": true
}
//Get all products that matches an attribute and its value
{
"OMSId": 1,
"Attribute": "Pegged",
"AttributeValue": true
}
//Starting APEX version 4.4 Depth and StartIndex fields are already supported
{
"OMSId": 1,
"GetDisabled": 1,
"Depth": 10, //will only return max 10 results
"StartIndex": 0, //will return products starting from Productd 1, a StartIndex of 10 will return products starting from ProductId 11(means that ProductsId 1 - 10 will not be in he results)
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| Attribute | string. The attribute key or name for which you want to filter the results with. optional. |
| AttributeValue | string. Used to filter the results further, only products whose attribute value will match the one set will be returned. optional. |
| GetDisabled | boolean or integer. Used to filter disabled products, setting this to true will return all products including the disabled ones. optional. |
| Depth | integer. Used for pagination. Indicates the maximum number of results/products to be returned. Defaults to 50 if not defined. optional. |
| StartIndex | integer. Used for pagination. ProductId 1 represents index 0. A value of 2 for this field will not include ProductId 1 and 2 in the results. Defaults to 0 if not defined. optional. |
Response
[
{
"OMSId": 1,
"ProductId": 1,
"Product": "USD",
"ProductFullName": "US Dollar",
"MasterDataUniqueProductSymbol": "",
"ProductType": "NationalCurrency",
"DecimalPlaces": 2,
"TickSize": 0.01,
"DepositEnabled": true,
"WithdrawEnabled": true,
"NoFees": false,
"IsDisabled": false,
"MarginEnabled": false
},
{
"OMSId": 1,
"ProductId": 2,
"Product": "BTC",
"ProductFullName": "Bitcoin",
"MasterDataUniqueProductSymbol": "",
"ProductType": "CryptoCurrency",
"DecimalPlaces": 8,
"TickSize": 0.00000001,
"DepositEnabled": true,
"WithdrawEnabled": true,
"NoFees": false,
"IsDisabled": false,
"MarginEnabled": false
}
]
Returns an array of objects as a response, one object for each product available on the OMS.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the product belongs. |
| ProductId | integer. The ID of the product. |
| Product | string. The symbol of the product. |
| ProductFullName | string. The full name of the product. |
| MasterDataUniqueProductSymbol | string. Always an empty string, for future provision. |
| ProductType | string The nature of the product. One of: 0 Unknown (an error condition) 1 - NationalCurrency 2 - CryptoCurrency 3 - Contract. |
| DecimalPlaces | integer. The maximum number of decimal places allowed for the amount of product that an account may have. |
| TickSize | decimal. The smallest increment of the amount of the specific product that an account may have. |
| DepositEnabled | boolean. Either true or false. This field turns on/off the deposit for the product. |
| WithdrawEnabled | boolean. Either true or false. This field turns on/off the withdrawal for the product. |
| NoFees | boolean. Either true or false. If false, fees incurred by the account can be charged in the denomination of the specific product. If NoFees is true, fees incurred by the account will never be charged in the denomination of the specific product. |
| IsDisabled | boolean. Either true or false. If true, product is disabled and cannot be used, no deposits and withdrawals can be done. |
| MarginEnabled | boolean. Either true or false. Margin is something not yet supported so value is default to false; for future provisions. |
GetProductAttributes
Permissions: Operator, Trading
Call Type: Synchronous
Get attributes of a specific product.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetProductAttributes", {
OMSId: 1,
ProductId: 1,
});
POST /AP/GetProductAttributes HTTP/1.1
Host: hostname goes here...
aptoken: d0260e4b-bf6e-4fcd-a8cd-ad1cb01f2235 //valid sessiontoken
Content-Type: application/json
Content-Length: 44
{
"OMSId": 1,
"ProductId": 1
}
| Key | Value |
|---|---|
| OMSId | integer The Id of the OMS where the product belongs. required. |
| ProductId | integer. The Id of the product which you want to get attributes of. required. |
Response
[
{
"OMSId": 1,
"ProductId": 1,
"KeyName": "Pegged",
"KeyValue": "true"
}
]
The response is an array of objects, each object represents an product attribute in key-value pair.
| Key | Value |
|---|---|
| OMSId | integer. Id of the OMS where the product belongs. |
| ProductId | integer. Id of the product whose attribute/s were returned. |
| KeyName | string. The product attribute keyname. |
| KeyValue | string. The product attribute keyvalue. |
GetVerificationLevelConfig
Permissions: Operator,Trading,Deposit,Withdraw
Call Type: Synchronous
Gets the verification level configuration of the requested account.
In APEX, a verification level determines the limits of an account in terms of deposits, withdrawals, transfers and trading. This verification level config response of this API only applies to deposits, withdrawals and transfers and is only about a product or asset. Each product or asset will have separate and possibly unique limits than other products.
A limit value of -1 means infinite or no limit.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetVerificationLevelConfig",
{
"OMSId": 1,
"AccountId": 7
}
POST /AP/GetVerificationLevelConfig HTTP/1.1
Host: hostname goes here...
aptoken: 8908ed6d-3bd7-472e-ab70-58c2efef6cab
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccoundId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account for which you wish to get product verification level config for. required. |
Response
{
"Level": 111,
"LevelName": null,
"OMSId": 1,
"Products": [
{
"VerificationLevel": 111,
"VerificationLevelName": null,
"OMSId": 1,
"ProductId": 1,
"ProductName": "USD",
"AutoWithdrawThreshold": 0.0,
"DailyDepositLimit": 0.0,
"DailyDepositNotionalLimit": -1.0,
"MonthlyDepositLimit": 0.0,
"MonthlyDepositNotionalLimit": -1.0,
"YearlyDepositLimit": 0.0,
"YearlyDepositNotionalLimit": 1000000.0,
"DailyWithdrawLimit": 0.0,
"DailyWithdrawNotionalLimit": -1.0,
"MonthlyWithdrawLimit": 0.0,
"MonthlyWithdrawNotionalLimit": -1.0,
"YearlyWithdrawLimit": 0.0,
"YearlyWithdrawNotionalLimit": 1000000.0,
"DailyTransferNotionalLimit": -1.0,
"NotionalProductId": 0,
"OverLimitRejected": false,
"WithdrawProcessingDelaySec": 0,
"DepositTicketWorkflow": "Internal",
"WithdrawTicketWorkflow": "Internal",
"RequireWhitelistedAddress": false,
"AutoAcceptWhitelistedAddress": false
},
{
"VerificationLevel": 111,
"VerificationLevelName": null,
"OMSId": 1,
"ProductId": 2,
"ProductName": "BTC",
"AutoWithdrawThreshold": 0.0,
"DailyDepositLimit": 0.0,
"DailyDepositNotionalLimit": -1.0,
"MonthlyDepositLimit": 0.0,
"MonthlyDepositNotionalLimit": -1.0,
"YearlyDepositLimit": 0.0,
"YearlyDepositNotionalLimit": 1000000.0,
"DailyWithdrawLimit": 0.0,
"DailyWithdrawNotionalLimit": -1.0,
"MonthlyWithdrawLimit": 0.0,
"MonthlyWithdrawNotionalLimit": -1.0,
"YearlyWithdrawLimit": 0.0,
"YearlyWithdrawNotionalLimit": 1000000.0,
"DailyTransferNotionalLimit": -1.0,
"NotionalProductId": 0,
"OverLimitRejected": false,
"WithdrawProcessingDelaySec": 0,
"DepositTicketWorkflow": "Internal",
"WithdrawTicketWorkflow": "Internal",
"RequireWhitelistedAddress": false,
"AutoAcceptWhitelistedAddress": false
}
]
}
| Key | Value |
|---|---|
| Level | integer. The verification level the account specified is currently on. |
| LevelName | string. The of name the verification level the account specified is currently on. |
| OMSId | integer. The ID of the OMS where the account specified belongs to. |
| Products | array. An array of objects, each object will contain the limits of a specific product. |
| ProductId | integer. The ID of the product to which the specific verification level limits applies. |
| ProductName | string. The name of the product to which the specific verification level limits applies. |
| AutoWithdrawThreshold | decimal. The maximum withdraw amount which can be autoaccepted. If set to zero, all withdraw tickets needs to be accepted manually by the operator. |
| DailyDepositLimit | decimal. The maximum amount of the product that can be deposited daily. |
| DailyDepositNotionalLimit | decimal. The maximum notional amount of the product that can be deposited daily. |
| MonthlyDepositLimit | decimal. The maximum amount of the product that can be deposited monthly. |
| MonthlyDepositNotionalLimit | decimal. The maximum notional amount of the product that can be deposited monthly. |
| YearlyDepositLimit | decimal. The maximum amount of the product that can be deposited annually. |
| YearlyDepositNotionalLimit | decimal. The maximum notional amount of the product that can be deposited annually. |
| DailyWithdrawLimit | decimal. The maximum amount of the product that can be withdrawn daily. |
| DailyWithdrawNotionalLimit | decimal. The maximum notional amount of the product that can be withdrawn daily. |
| MonthlyWithdrawLimit | decimal. The maximum amount of the product that can be withdrawn monthly. |
| MonthlyWithdrawNotionalLimit | decimal. The maximum notional amount of the product that can be withdrawn monthly. |
| YearlyWithdrawLimit | decimal. The maximum amount of the product that can be withdrawn annually. |
| YearlyWithdrawNotionalLimit | decimal. The maximum notional amount of the product that can be withdrawn annually. |
| NotionalProductId | integer. The ID of the notional product. |
| OverLimitRejected | boolean. If true, all deposit and withdrawals which exceeds limits will be automatically rejected, else those tickets will stay at the status New. |
| WithdrawProcessingDelaySec | integer. The delay, in minutes, before a withdraw request will be Submitted onchain after getting accepted. |
| DepositTicketWorkflow | string. The deposit workflow. |
| WithdrawTicketWorkflow | string. The withdraw workflow. |
| RequireWhitelistedAddress | boolean. If true, users can only withdraw to whitelisted withdraw address, if the user does not have a verified withdraw address, he/she will not be able to submit a withdraw request. |
| AutoAcceptWhitelistedAddress | boolean. If true, withdrawal to whitelisted address will be auto-accepted. |
Assets
Permissions: Public
Call Type: Synchronous
The assets endpoint is to provide a detailed summary for each currency available on the exchange for CMC Integration
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Assets", {});
POST /AP/Assets HTTP/1.1
Host: hostname goes here...
No field is required in the request payload.
Response
[
{
"name": "Bitcoin",
"unified_cryptoasset_id": 1,
"min_withdraw": 0.00000001
},
{
"name": "TBTC",
"unified_cryptoasset_id": 5776,
"min_withdraw": 0.00000001
},
{
"name": "Ethereum Kovan",
"unified_cryptoasset_id": 1027,
"min_withdraw": 0.00000001
},
{
"name": "Chainlink",
"unified_cryptoasset_id": 1975,
"min_withdraw": 0.00000001
},
{
"name": "ICON",
"unified_cryptoasset_id": 2099,
"min_withdraw": 0.00000001
},
{
"name": "Dogecoin",
"unified_cryptoasset_id": 74,
"min_withdraw": 0.00000001
},
{
"name": "Tether",
"unified_cryptoasset_id": 825,
"min_withdraw": 0.00000001
},
{
"name": "USD Coin",
"unified_cryptoasset_id": 3408,
"min_withdraw": 0.00000001
}
]
Returns an array of objects as a response, each object represents a specific asset in the exchange.
| Key | Value |
|---|---|
| name | string. The asset/product name. |
| unified_cryptoasset_id | integer. The unified cryptoasset id of the product based on CMC. |
| min_withdraw | decimal. The maximum number of decimal places allowed. |
Report
GenerateTradeActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Creates an immediate report on historical trade activity on a specific OMS for a list of accounts during a specified time interval.
A user with Trading permission can only generate trade reports for accounts with which he/she is associated to; a user with Operator permission can generate trade reports for any account.
The actual Trade Activity Report will be generated as a comma-separated (CSV) file. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GenerateTradeActivityReport", {
OMSId: 1,
startTime: "2023-03-01T16:00:00.000Z",
endTime: "2023-03-02T16:00:00.000Z",
accountIdList: [185, 9], //1 or more accounts
});
POST /AP/GenerateTradeActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"startTime": "2023-03-01T16:00:00.000Z",
"endTime": "2023-03-02T16:00:00.000Z",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| accountIdList | integer array. A comma-delimited array of one ore more account IDs, each valid on a single OMS for the authenticated user. The account user may not be the only user of the account. required. |
| omsId | integer. The ID of the OMS on which the array of account IDs exist. required. |
| startTime | string. startTime identifies the time and date for the historic beginning of the trade activity report. required. |
| endTime | string. endTime identifies the time and date for the historic end of the trade activity report. required. |
Response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2023-03-29T09:23:48.919Z",
"initialRunTime": "2023-03-29T09:23:48.919Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "f99dfd7b-138a-451f-8eca-7dd9916198f7",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9, 185]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the trade activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the trade activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of GenerateTradeActivityReport, report flavor will always be TradeActivity |
| createTime | string. The time and date on which the request for the trade activity report was made. |
| initialRunTime | string. The time and date at which the trade activity report was first run. |
| intervalStartTime | string. The start of the period that the report will cover. |
| intervalEndTime | string. The end of the period that the report will cover. |
| RequestStatus | string. The status of the request for the trade activity report. A Generate~Report request will always return Submitted. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelled Pending |
| ReportFrequency | string. When the report runs. For a Generate~Report call, this is always OnDemand. One of: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date. The Generate~Report call requires a start time and an end time. The AlphaPoint software calculates the difference between them as intervalDuration. For example, say that you specify a 90-day start-date-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days. If you have called Generate~Report, that value simply confirms the length of time that the on-demand report covers. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. Will be null for a Generate~Report call, because generated reports are on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose trades are reported in the trade activity report. |
GenerateTreasuryActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of a Treasury Activity report for the specified accounts over a specified time interval.
A user with Trading permission can only generate treasury reports for accounts with which he/she is associated to; a user with Operator permission can generate treasury reports for any account.
The actual Treasury Activity Report will be generated as a comma-separated (CSV) file. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GenerateTreasuryActivityReport", {
OMSId: 1,
startTime: "2023-03-01T16:00:00.000Z",
endTime: "2023-03-02T16:00:00.000Z",
accountIdList: [185, 9], //1 or more accounts
});
POST /AP/GenerateTreasuryActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"startTime": "2023-03-01T16:00:00.000Z",
"endTime": "2023-03-02T16:00:00.000Z",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| accountIdList | integer array. A comma-delimited array of one ore more account IDs, each valid on a single OMS for the authenticated user. The account user may not be the only user of the account. required. |
| omsId | integer. The ID of the OMS on which the array of account IDs exist. required. |
| startTime | string. startTime identifies the time and date for the historic beginning of the treasury activity report. required. |
| endTime | string. endTime identifies the time and date for the historic end of the treasury activity report. required. |
Response
//Actual response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "Treasury",
"createTime": "2023-03-29T09:27:08.352Z",
"initialRunTime": "2023-03-29T09:27:08.352Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "125e3f2e-0f19-47ba-9248-dfb8b98a1fac",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9]
}
Similar objects are returned for Generate~Report and Schedule~Report calls. As a result, for an on-demand Generate~Report call, some string-value pairs such as initialRunTime may return the current time and ReportFrequency will always return OnDemand because the report is only generated once and on demand.
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the treasury activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the treasury activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of GenerateTreasuryActivityReport, report flavor will always be Treasury |
| createTime | string. The time and date on which the request for the treasury activity report was made. |
| initialRunTime | string. The time and date at which the treasury activity report was first run. |
| intervalStartTime | string. The start of the period that the report will cover. |
| intervalEndTime | string. The end of the period that the report will cover. |
| RequestStatus | string. The status of the request for the treasury activity report. A Generate~Report request will always return Submitted. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelled Pending |
| ReportFrequency | string. When the report runs. For a Generate~Report call, this is always OnDemand. One of: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date. The Generate~Report call requires a start time and an end time. The AlphaPoint software calculates the difference between them as intervalDuration. For example, say that you specify a 90-day start-date-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days. If you have called Generate~Report, that value simply confirms the length of time that the on-demand report covers. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. Will be null for a Generate~Report call, because generated reports are on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose treasury activities are reported in the treasury activity report. |
GetTreasuryProductsForAccount
Permissions: Operator, Trading, Withdraw, Deposit
Call Type: Synchronous
Returns a list of products upon which the account id is allowed to execute treasury operations. Technically, the products returned are those products with a configured and enabled AccountProvider.
Users with Trading, Withdraw, and Deposit permissions can call this API only for the accounts associated to them. Users with Operator permission can request the list of treasury products for any account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTreasuryProductsForAccount", {
AccountId: 1,
OMSId: 1,
});
POST /AP/GetTreasuryProductsForAccount HTTP/1.1
Host: hostname goes here...
aptoken: b031b607-818d-4799-9f5f-b07c7a28dd58 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| AccountId | integer. The ID of the account whose permitted treasury products will be returned. required. |
| OMSId | integer. The ID of the OMS where the account operates. required. |
Response
[
"ETH",
"LINK",
"USD",
"ICX",
"BTC",
"USD",
"TXRP",
"ETH",
"APU",
"OTC",
"test2",
"BTC",
];
Returns an array as a response. Each element in the array is a symbol of a product.
GenerateTransactionActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Creates an immediate report on historical transaction activity on a specific OMS for a list of accounts during a specified time interval.
A user with Trading permission can only generate transaction reports for accounts with which he/she is associated to; a user with Operator permission can generate transaction reports for any account.
The actual Transaction Activity Report will be generated as a comma-separated (CSV) file. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GenerateTransactionActivityReport", {
OMSId: 1,
startTime: "2023-03-01T16:00:00.000Z",
endTime: "2023-03-02T16:00:00.000Z",
accountIdList: [185, 9], //1 or more accounts
});
POST /AP/GenerateTransactionActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"startTime": "2023-03-01T16:00:00.000Z",
"endTime": "2023-03-02T16:00:00.000Z",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| accountIdList | integer array. A comma-delimited array of one ore more account IDs, each valid on a single OMS for the authenticated user. The account user may not be the only user of the account. required. |
| omsId | integer. The ID of the OMS on which the array of account IDs exist. required. |
| startTime | string. startTime identifies the time and date for the historic beginning of the transaction activity report. required. |
| endTime | string. endTime identifies the time and date for the historic end of the transaction activity report. required. |
Response
//Actual response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "Transaction",
"createTime": "2023-03-29T09:23:30.245Z",
"initialRunTime": "2023-03-29T09:23:30.245Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "a864c139-5395-4fbe-8627-6aa164a2180d",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9, 185]
}
Similar objects are returned for Generate~Report and Schedule~Report calls. As a result, for an on-demand Generate~Report call, some string-value pairs such as initialRunTime may return the current time and ReportFrequency will always return OnDemand because the report is only generated once and on demand.
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the transaction activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the transaction activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of GenerateTransactionActivityReport, report flavor will always be TransactionActivity |
| createTime | string. The time and date on which the request for the transaction activity report was made. |
| initialRunTime | string. The time and date at which the transaction activity report was first run. |
| intervalStartTime | string. The start of the period that the report will cover. |
| intervalEndTime | string. The end of the period that the report will cover. |
| RequestStatus | string. The status of the request for the transaction activity report. A Generate~Report request will always return Submitted. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelled Pending |
| ReportFrequency | string. When the report runs. For a Generate~Report call, this is always OnDemand. One of: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date. The Generate~Report call requires a start time and an end time. The AlphaPoint software calculates the difference between them as intervalDuration. For example, say that you specify a 90-day start-date-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days. If you have called Generate~Report, that value simply confirms the length of time that the on-demand report covers. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. Will be null for a Generate~Report call, because generated reports are on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the transaction activity report. |
GenerateProductDeltaActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of a Product Delta Activity report for the specified accounts over a specified time interval.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GenerateProductDeltaActivityReport", {
OMSId: 1,
startTime: "2023-03-01T16:00:00.000Z",
endTime: "2023-03-02T16:00:00.000Z",
accountIdList: [185, 9],
});
POST /AP/GenerateProductDeltaActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 8587842a-072b-46be-a589-fd4c3a706a7d
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"startTime": "2023-03-01T16:00:00.000Z",
"endTime": "2023-03-02T16:00:00.000Z",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| accountIdList | integer array. A comma-delimited array of one ore more account IDs, each valid on a single OMS for the authenticated user. The account user may not be the only user of the account. required. |
| omsId | integer. The ID of the OMS on which the array of account IDs exist. required. |
| startTime | string. startTime identifies the time and date for the historic beginning of the product delta activity report. required. |
| endTime | string. endTime identifies the time and date for the historic end of the product delta activity report. required. |
Response
{
"RequestingUser": 1,
"OMSId": 1,
"reportFlavor": "ProductDelta",
"createTime": "2023-12-06T08:44:41.721Z",
"initialRunTime": "2023-12-06T08:44:41.721Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "00117ffc-239d-4d37-804f-738b8250c1d9",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [
9,
185
]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the product delta activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the product delta activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of GenerateProductDeltaActivityReport, report flavor will always be ProductDelta |
| createTime | string. The time and date on which the request for the product delta activity report was made. |
| initialRunTime | string. The time and date at which the product delta activity report was first run. |
| intervalStartTime | string. The start of the period that the report will cover. |
| intervalEndTime | string. The end of the period that the report will cover. |
| RequestStatus | string. The status of the request for the product delta activity report. A Generate~Report request will always return Submitted. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelled Pending |
| ReportFrequency | string. When the report runs. For a Generate~Report call, this is always OnDemand. One of: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date. The Generate~Report call requires a start time and an end time. The AlphaPoint software calculates the difference between them as intervalDuration. For example, say that you specify a 90-day start-date-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days. If you have called Generate~Report, that value simply confirms the length of time that the on-demand report covers. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. Will be null for a Generate~Report call, because generated reports are on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the product delta activity report. |
GeneratePnLActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of a Profit and Loss Activity report for the specified accounts over a specified time interval.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GeneratePnLActivityReport", {
OMSId: 1,
startTime: "2023-03-01T16:00:00.000Z",
endTime: "2023-03-02T16:00:00.000Z",
accountIdList: [185, 9],
});
POST /AP/GeneratePnLActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 8587842a-072b-46be-a589-fd4c3a706a7d
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"startTime": "2023-03-01T16:00:00.000Z",
"endTime": "2023-03-02T16:00:00.000Z",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| accountIdList | integer array. A comma-delimited array of one ore more account IDs, each valid on a single OMS for the authenticated user. The account user may not be the only user of the account. required. |
| omsId | integer. The ID of the OMS on which the array of account IDs exist. required. |
| startTime | string. startTime identifies the time and date for the historic beginning of the profit and loss activity report. required. |
| endTime | string. endTime identifies the time and date for the historic end of the profit and loss activity report. required. |
Response
{
"RequestingUser": 1,
"OMSId": 1,
"reportFlavor": "ProfitAndLoss",
"createTime": "2023-12-06T08:50:54.313Z",
"initialRunTime": "2023-12-06T08:50:54.313Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "41696500-45e5-4609-b233-9b60389d7abc",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [
9,
185
]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the profit and loss activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the profit and loss activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of GeneratePnLActivityReport, report flavor will always be ProfitAndLoss |
| createTime | string. The time and date on which the request for the profit and loss activity report was made. |
| initialRunTime | string. The time and date at which the profit and loss activity report was first run. |
| intervalStartTime | string. The start of the period that the report will cover. |
| intervalEndTime | string. The end of the period that the report will cover. |
| RequestStatus | string. The status of the request for the profit and loss activity report. A Generate~Report request will always return Submitted. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelled Pending |
| ReportFrequency | string. When the report runs. For a Generate~Report call, this is always OnDemand. One of: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date. The Generate~Report call requires a start time and an end time. The AlphaPoint software calculates the difference between them as intervalDuration. For example, say that you specify a 90-day start-date-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days. If you have called Generate~Report, that value simply confirms the length of time that the on-demand report covers. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. Will be null for a Generate~Report call, because generated reports are on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the profit and loss activity report. |
ScheduleTradeActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of an series of Trade Activity reports for the specified accounts over a regular periodic time interval.
A user with Trading permission can only schedule generation of trade reports for accounts with which he/she is associated to; a user with Operator permission can schedule generation of trade reports for any account.
The actual Trade Activity Report will be generated as a comma-separated (CSV) file according to the interval, if interval set is daily, a trade report will be generated daily unless cancelled using the API CancelReport. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ScheduleTradeActivityReport", {
OMSId: 1,
beginTime: "2023-03-30T16:00:00.000Z",
Frequency: "Weekly",
accountIdList: [185, 9],
});
POST /AP/ScheduleTradeActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"beginTime": "2023-03-30T16:00:00.000Z",
"Frequency": "Weekly",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| frequency | integer or string. How often the report will run and a trade report get generated. One of the following: 0 Hourly 1 Daily 2 Weekly 3 Monthly 4 Annually 5 onDemand. If not defined, the default is 0 which means Hourly. optional. |
| accountIdList | integer array. Comma-separated integers; each element an account ID on the OMS whose trade activity will be reported on. All accounts must be from the same OMS. required. |
| omsId | integer. The ID of the OMS on which the accounts named in the list reside. required. |
| beginTime | string. The time at which the periodic reports begin; the day and time when you want reporting to start, in Microsoft Ticks format. required. |
Response
//Actual response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2023-03-29T16:11:13.093Z",
"initialRunTime": "2023-03-30T16:00:00.000Z",
"intervalStartTime": "2023-03-30T16:00:00.000Z",
"intervalEndTime": "2023-04-06T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Weekly",
"intervalDuration": 6048000000000,
"RequestId": "eb7f18bb-1978-47ba-aae1-b74c3a8acb2d",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9, 185]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the trade activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the trade activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of ScheduleTradeActivityReport, report flavor will always be TradeActivity |
| createTime | string. The time and date on which the request for the trade activity report was made, in Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the trade activity report was first run, in Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, in Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, in Microsoft Ticks format. |
| RequestStatus | enumerated string. The status of the request for the trade activity report. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelledPending |
| ReportFrequency | enumerated string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date, in POSIX format. The call specifies a start time and an intervalDuration. In scheduled a scheduled report, the interval duration depends on the frequency, if the frequency is Weekly, the interval duration will be 1 week. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. |
| accountIds | integer array. A comma-delimited array of account IDs whose trades are reported in the trade activity report. |
ScheduleTreasuryActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of an series of treasury Activity reports for the specified accounts over a regular periodic time interval.
A user with Trading permission can only schedule generation of treasury reports for accounts with which he/she is associated to; a user with Operator permission can schedule generation of treasury reports for any account.
The actual treasury Activity Report will be generated as a comma-separated (CSV) file according to the interval, if interval set is daily, a treasury report will be generated daily unless cancelled using the API CancelReport. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ScheduleTreasuryActivityReport", {
OMSId: 1,
beginTime: "2023-03-30T16:00:00.000Z",
Frequency: "Weekly",
accountIdList: [185, 9],
});
POST /AP/ScheduleTreasuryActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"beginTime": "2023-03-30T16:00:00.000Z",
"Frequency": "Weekly",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| frequency | integer or string. How often the report will run and a trade report get generated. One of the following: 0 Hourly 1 Daily 2 Weekly 3 Monthly 4 Annually 5 onDemand. If not defined, the default is 0 which means Hourly. optional. |
| accountIdList | integer array. Comma-separated integers; each element an account ID on the OMS whose treasury activity will be reported on. All accounts must be from the same OMS. required. |
| omsId | integer. The ID of the OMS on which the accounts named in the list reside. required. |
| beginTime | string. The time at which the periodic reports begin; the day and time when you want reporting to start, in Microsoft Ticks format. required. |
Response
//Actual response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "Treasury",
"createTime": "2023-03-29T16:19:49.606Z",
"initialRunTime": "2023-03-30T16:00:00.000Z",
"intervalStartTime": "2023-03-30T16:00:00.000Z",
"intervalEndTime": "2023-04-06T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Weekly",
"intervalDuration": 6048000000000,
"RequestId": "36622dd9-55bd-4e3c-90ab-93385c752695",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9, 185]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the treasury activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the treasury activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of ScheduleTreasuryActivityReport, report flavor will always be Treasury |
| createTime | string. The time and date on which the request for the treasury activity report was made, in Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the treasury activity report was first run, in Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, in Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, in Microsoft Ticks format. |
| RequestStatus | enumerated string. The status of the request for the treasury activity report. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelledPending |
| ReportFrequency | enumerated string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date, in POSIX format. The call specifies a start time and an intervalDuration. In scheduled a scheduled report, the interval duration depends on the frequency, if the frequency is Weekly, the interval duration will be 1 week. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. |
| accountIds | integer array. A comma-delimited array of account IDs whose treasury activities are reported in the treasury activity report. |
ScheduleTransactionActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of an series of Transaction Activity reports for the specified accounts over a regular periodic time interval.
A user with Trading permission can only schedule generation of transaction reports for accounts with which he/she is associated to; a user with Operator permission can schedule generation of transaction reports for any account.
The actual Transaction Activity Report will be generated as a comma-separated (CSV) file according to the interval, if interval set is daily, a transaction report will be generated daily unless cancelled using the API CancelReport. It can be downloaded using the API call DownloadDocument
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ScheduleTransactionActivityReport", {
OMSId: 1,
beginTime: "2023-03-30T16:00:00.000Z",
Frequency: "Weekly",
accountIdList: [185, 9],
});
POST /AP/ScheduleTransactionActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 2bf2e45b-42aa-4448-9d6f-bb0a8fd020e4 //valid sessiontoken
Content-Type: application/json
Content-Length: 142
{
"OMSId": 1,
"beginTime": "2023-03-30T16:00:00.000Z",
"Frequency": "Weekly",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| frequency | integer or string. How often the report will run and a trade report get generated. One of the following: 0 Hourly 1 Daily 2 Weekly 3 Monthly 4 Annually 5 onDemand. If not defined, the default is 0 which means Hourly. optional. |
| accountIdList | integer array. Comma-separated integers; each element an account ID on the OMS whose transaction activity will be reported on. All accounts must be from the same OMS. required. |
| omsId | integer. The ID of the OMS on which the accounts named in the list reside. required. |
| beginTime | string. The time at which the periodic reports begin; the day and time when you want reporting to start, in Microsoft Ticks format. required. |
Response
//Actual response
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "Transaction",
"createTime": "2023-03-29T16:24:35.923Z",
"initialRunTime": "2023-03-30T16:00:00.000Z",
"intervalStartTime": "2023-03-30T16:00:00.000Z",
"intervalEndTime": "2023-04-06T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Weekly",
"intervalDuration": 6048000000000,
"RequestId": "ba20a1d1-7acb-48b9-89eb-df2787e65934",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9, 185]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the transaction activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the transaction activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of ScheduleTransactionActivityReport, report flavor will always be Transaction |
| createTime | string. The time and date on which the request for the transaction activity report was made, in Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the transaction activity report was first run, in Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, in Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, in Microsoft Ticks format. |
| RequestStatus | enumerated string. The status of the request for the transaction activity report. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelledPending |
| ReportFrequency | enumerated string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date, in POSIX format. The call specifies a start time and an intervalDuration. In scheduled a scheduled report, the interval duration depends on the frequency, if the frequency is Weekly, the interval duration will be 1 week. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the transaction activity report. |
ScheduleProductDeltaActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of an series of Product Delta Activity reports for the specified accounts over a regular periodic time interval.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ScheduleProductDeltaActivityReport", {
OMSId: 1,
beginTime: "2023-03-30T16:00:00.000Z",
Frequency: "Weekly",
accountIdList: [185, 9],
});
POST /AP/ScheduleProductDeltaActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 8587842a-072b-46be-a589-fd4c3a706a7d
Content-Type: application/json
Content-Length: 126
{
"OMSId": 1,
"beginTime": "2023-03-30T16:00:00.000Z",
"Frequency": "Weekly",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| frequency | integer or string. How often the report will run and a product delta activity report get generated. One of the following: 0 Hourly 1 Daily 2 Weekly 3 Monthly 4 Annually 5 onDemand. If not defined, the default is 0 which means Hourly. optional. |
| accountIdList | integer array. Comma-separated integers; each element an account ID on the OMS whose product delta activity will be reported on. All accounts must be from the same OMS. required. |
| omsId | integer. The ID of the OMS on which the accounts named in the list reside. required. |
| beginTime | string. The time at which the periodic reports begin; the day and time when you want reporting to start, in Microsoft Ticks format. required. |
Response
{
"RequestingUser": 1,
"OMSId": 1,
"reportFlavor": "ProductDelta",
"createTime": "2023-12-06T08:57:25.933Z",
"initialRunTime": "2023-12-06T08:57:25.933Z",
"intervalStartTime": "2023-03-30T16:00:00.000Z",
"intervalEndTime": "2023-04-06T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Weekly",
"intervalDuration": 6048000000000,
"RequestId": "8dd8c68d-b724-d3f7-cc8a-f303c1c428af",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [
9,
185
]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the product delta activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the product delta activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of ScheduleProductDeltaActivityReport, report flavor will always be ProductDelta |
| createTime | string. The time and date on which the request for the product delta activity report was made, in Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the product delta activity report was first run, in Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, in Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, in Microsoft Ticks format. |
| RequestStatus | enumerated string. The status of the request for the product delta activity report. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelledPending |
| ReportFrequency | enumerated string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date, in POSIX format. The call specifies a start time and an intervalDuration. In scheduled a scheduled report, the interval duration depends on the frequency, if the frequency is Weekly, the interval duration will be 1 week. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the product delta activity report. |
ScheduleProfitAndLossActivityReport
Permissions: Operator, Trading
Call Type: Synchronous
Initiates the generation of an series of Profit and Loss Activity reports for the specified accounts over a regular periodic time interval.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ScheduleProfitandLossActivityReport", {
OMSId: 1,
beginTime: "2023-03-30T16:00:00.000Z",
Frequency: "Weekly",
accountIdList: [185, 9],
});
POST /AP/ScheduleProfitAndLossActivityReport HTTP/1.1
Host: hostname goes here...
aptoken: 8587842a-072b-46be-a589-fd4c3a706a7d
Content-Type: application/json
Content-Length: 126
{
"OMSId": 1,
"beginTime": "2023-03-30T16:00:00.000Z",
"Frequency": "Weekly",
"accountIdList": [185, 9]
}
| Key | Value |
|---|---|
| frequency | integer or string. How often the report will run and a profit and lost activity report get generated. One of the following: 0 Hourly 1 Daily 2 Weekly 3 Monthly 4 Annually 5 onDemand. If not defined, the default is 0 which means Hourly. optional. |
| accountIdList | integer array. Comma-separated integers; each element an account ID on the OMS whose profit and loss activity will be reported on. All accounts must be from the same OMS. required. |
| omsId | integer. The ID of the OMS on which the accounts named in the list reside. required. |
| beginTime | string. The time at which the periodic reports begin; the day and time when you want reporting to start, in Microsoft Ticks format. required. |
Response
{
"RequestingUser": 1,
"OMSId": 1,
"reportFlavor": "ProfitAndLoss",
"createTime": "2023-12-06T09:04:05.944Z",
"initialRunTime": "2023-12-06T09:04:05.944Z",
"intervalStartTime": "2023-03-30T16:00:00.000Z",
"intervalEndTime": "2023-04-06T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Weekly",
"intervalDuration": 6048000000000,
"RequestId": "36197677-d103-e143-3b9c-a5ae8f17e093",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [
9,
185
]
}
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the profit and loss activity report. This confirms the ID of the authenticated user who made the request by returning it as part of the response. |
| OMSId | integer. The ID of the OMS on which the profit and loss activity report will be run. |
| reportFlavor | string. The type of report to be generated. In the case of ScheduleProfitandLossActivityReport, report flavor will always be ProfitAndLoss |
| createTime | string. The time and date on which the request for the profit and loss activity report was made, in Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the profit and loss activity report was first run, in Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, in Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, in Microsoft Ticks format. |
| RequestStatus | enumerated string. The status of the request for the profit and loss activity report. Each request returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelledPending |
| ReportFrequency | enumerated string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report covers relative to the run date, in POSIX format. The call specifies a start time and an intervalDuration. In scheduled a scheduled report, the interval duration depends on the frequency, if the frequency is Weekly, the interval duration will be 1 week. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. |
| accountIds | integer array. A comma-delimited array of account IDs whose transactions are reported in the profit and loss activity report. |
CancelUserReport
Permissions: Operator, Trading
Call Type: Synchronous
Sends a request to DataService to Remove a User Report. If successful, changes the state of a UserReportTicket to UserCancelled. To get list of user reports that can be possibly cancelled, you can use the API GetUserReportTickets.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CancelUserReport", {
UserReportId: "389f244a-b958-4545-a4a7-61a73205b59e",
});
POST /AP/CancelUserReport HTTP/1.1
Host: hostname goes here...
aptoken: 250c3ff1-cfb2-488f-be88-dfaf12e4f975 //valid sessiontoken
Content-Type: application/json
Content-Length: 63
{
"UserReportId":"389f244a-b958-4545-a4a7-61a73205b59e"
}
| Key | Value |
|---|---|
| UserReportId | string. The GUID is a globally unique ID string that identifies the user report to be canceled. The OMS provides this ID when you create a report. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
The response to CancelUserReport verifies that the call was received, not that the user report has been canceled successfully. Individual event updates sent to the user show cancellations. To verify that a report has been canceled, call GetUserReportTickets or GetUserReportWriterResultRecords.
| Key | Value |
|---|---|
| result | boolean. A successful receipt of the cancellation returns true; and unsuccessful receipt of the cancellation (an error condition) returns false. |
| errormsg | string. A successful receipt of the cancellation returns null; the errormsg parameter for an unsuccessful receipt returns one of the following messages: Not Authorized (errorcode 20, Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the cancellation returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
GetUserReportWriterResultRecords
Permissions: Operator, Trading
Call Type: Synchronous
Queries the database for ReportWriterResultRecords that result from the execution of reports requested by the session User.
Users with Trading permission can request user report writer result records only for their own; users with Operator permission can request any user's report writer result records.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserReportWriterResultRecords", {
UserId: 6,
});
POST /AP/GetUserReportWriterResultRecords HTTP/1.1
Host: hostname goes here...
aptoken: d0260e4b-bf6e-4fcd-a8cd-ad1cb01f2235
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose report writer result records will be returned. required. |
| Depth | integer. The count of records to be returned, beginning at startIndex and working backwards into the past. If not defined, all report writer result records will be returned. optional. |
| StartIndex | integer. The record number at which the call starts returning records; from there, record return moves into the past. The most recent record is record is at startindex 0. optional. |
Response
[
{
"RequestingUser": 6,
"urtTicketId": "c2186954-3549-4214-99de-17281b0b7b02",
"descriptorId": "0d24a8bd-1017-4f5a-acbb-eb41316411ca",
"resultStatus": "SuccessComplete",
"reportExecutionStartTime": "2023-03-30T07:16:30.949Z",
"reportExecutionCompleteTime": "2023-03-30T07:16:30.954Z",
"reportOutputFilePathname": "",
"reportDescriptiveHeader": "TradeActivity|onDemand|2023-03-03T16:00:00.000Z|2023-03-04T16:00:00.000Z|2023-03-30T06:16:26.381Z|2023-03-30T07:16:30.949Z|0.00535 seconds"
}
]
| Key | Value |
|---|---|
| RequestingUser | Integer. ID of the user requesting the report writer result records. |
| urtTicketId | string. An alphanumeric string containing the unique report ID of the report. |
| descriptorId | string. A GUID (globally-unique identifier) that describes the report separately from the report ticket. |
| resultStatus | string. The status of each run of the reports. One of: 0 NotStarted 1 NotComplete 2 ErrorComplete 3 SuccessComplete 4 Cancelled |
| reportExecutionStartTime | string. The time that the report writer began execution, in Microsoft Ticks format. |
| reportExecutionCompleteTime | string. The time that the report writer completed the report, in Microsoft Ticks format. |
| reportOutputFilePathname | string. The pathname (location) of the report output file. |
| reportDescriptiveHeader | string. A string describing the report. |
GetUserReportTickets
Permissions: Operator, Trading
Call Type: Synchronous
Returns an array of user report tickets for a specific user ID. A user report ticket identifies a report requested or scheduled by a user. Reports can run once or periodically.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserReportTickets", {
UserId: 6,
});
POST /AP/GetUserReportTickets HTTP/1.1
Host: hostname goes here...
aptoken: 250c3ff1-cfb2-488f-be88-dfaf12e4f975 //valid sessiontoken
Content-Type: application/json
Content-Length: 20
{
"UserId":6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose user report tickets will be returned. required. |
Response
//Actual response
[
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2023-03-16T02:18:27.597Z",
"initialRunTime": "2023-03-16T02:18:27.596Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-03T16:00:00.000Z",
"RequestStatus": "Completed",
"ReportFrequency": "onDemand",
"intervalDuration": 1728000000000,
"RequestId": "0e3b96ac-c72c-4821-b124-b1d5c653e89f",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9]
},
{
"RequestingUser": 6,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2023-03-16T02:42:48.647Z",
"initialRunTime": "2023-03-16T02:42:48.646Z",
"intervalStartTime": "2023-03-01T16:00:00.000Z",
"intervalEndTime": "2023-03-02T16:00:00.000Z",
"RequestStatus": "Completed",
"ReportFrequency": "onDemand",
"intervalDuration": 864000000000,
"RequestId": "0f14b67b-8e80-43c3-b1ce-7c9146e645f8",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [9]
}
]
Returns an array of objects as a response, each object represents a report.
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the report. |
| OMSId | integer. The ID of the OMS on which the report was run. |
| reportFlavor | string. The type of report. One of Tradeactivity Transaction Treasury |
| createTime | string. The time and date at which the request for the report was made, Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the report was first run, Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, Microsoft Ticks format. |
| RequestStatus | string. The status of the request for the report. Each status returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelPending |
| ReportFrequency | string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report looks backward relative to the run date, in POSIX format. The system calculates intervalDuration between intervalStartTime and intervalEndTime and reports it in POSIX format. For example, say that you specify a 90-day start-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days and represents the backward-looking period of the report. Say that you have set up a weekly report to look back 90 days. When the report runs again in a week's time, it again looks back 90 days -- but now those 90 days are offset by a week from the first report. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. This will be null for a Generate~Report call, because generated reports are all on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose trades are reported in the trade activity report. |
RemoveUserReportTicket
Permissions: Operator,Trading
Call Type: Synchronous
Removes the specified user report ticket from processing.
Request
//Request should be using the standard WebSocket frame
{
m: 0,
i: 0,
n: 'RemoveUserReportTicket',
o: '{fb9bbe89-5263-d8dd-3115-4dd33b21cee7}'
}
POST /AP/RemoveUserReportTicket HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: a5b478f1-89d3-c60a-c43a-724f457ab235
Authorization: Basic aGFyb2xkczoxMjM0
Content-Length: 38
{e27e5268-db50-70fa-de84-ee0b6ae16093}
The request payload doesn't have a fieldname, assigning the value to a field name will result to Operation Failed error. The only value that should be passed in the payload is the UserReportTicketId value.
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional message details sent by the system. Usually null. |
GetUserReportTicketsByStatus
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves a list of user report tickets included in the list of statuses.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserReportTicketsByStatus", [
{ RequestStatus: "Submitted" },
{ RequestStatus: "Scheduled" },
]);
POST /ap/GetUserReportTicketsByStatus HTTP/1.1
Host: hostname goes here...
aptoken: 57881420-0eb0-4161-3a2c-34f605da789d
Content-Type: application/json
Content-Length: 117
[
{
"RequestStatus": "Submitted"
},
{
"RequestStatus": "Scheduled"
}
]
The request payload should be an array with object/s as its elements. The object field name should be RequestStatus.
Valid RequestStatus values are:
- Submitted
- Validating
- Scheduled
- InProgress
- Completed
- Aborting
- Aborted
- UserCancelled
- SysRetired
- UserCancelledPending
Specifying any other value than the mentioned ones above will result to an error.
| Key | Value |
|---|---|
| RequestStatus | string. The status of user report tickets you wish to retrieve. Multiple statuses can be specified. If no Request status is defined, the default status that the backend will look for is Submitted. optional. |
Response
[
{
"RequestingUser": 15,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2024-01-02T05:11:10.733Z",
"initialRunTime": "2024-01-02T05:11:10.732Z",
"intervalStartTime": "2024-01-01T16:00:00.000Z",
"intervalEndTime": "2024-01-02T16:00:00.000Z",
"RequestStatus": "Submitted",
"ReportFrequency": "Daily",
"intervalDuration": 864000000000,
"RequestId": "11464174-60cd-afcc-29e8-00fab6e7d129",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [18]
},
{
"RequestingUser": 28,
"OMSId": 1,
"reportFlavor": "TradeActivity",
"createTime": "2023-12-13T15:00:04.794Z",
"initialRunTime": "2023-12-13T15:00:04.792Z",
"intervalStartTime": "2024-01-01T22:00:00.000Z",
"intervalEndTime": "2024-01-02T22:00:00.000Z",
"RequestStatus": "Scheduled",
"ReportFrequency": "Daily",
"intervalDuration": 864000000000,
"RequestId": "8f4e3a95-fed3-3823-d950-86c60550e816",
"lastInstanceId": "00000000-0000-0000-0000-000000000000",
"accountIds": [32]
}
]
Returns an array of objects as a response, each object represents a user report ticket whose status matches the specificied status/es in the request.
| Key | Value |
|---|---|
| RequestingUser | integer. The User ID of the person requesting the report. |
| OMSId | integer. The ID of the OMS on which the report was run. |
| reportFlavor | string. The type of report. One of Tradeactivity Transaction Treasury |
| createTime | string. The time and date at which the request for the report was made, Microsoft Ticks format. |
| initialRunTime | string. The time and date at which the report was first run, Microsoft Ticks format. |
| intervalStartTime | string. The start of the period that the report will cover, Microsoft Ticks format. |
| intervalEndTime | string. The end of the period that the report will cover, Microsoft Ticks format. |
| RequestStatus | string. The status of the request, will be the specificied status/es in the request. Each status returns one of: Submitted Validating Scheduled InProgress Completed Aborting Aborted UserCancelled SysRetired UserCancelPending |
| ReportFrequency | string. When the report runs: OnDemand Hourly Daily Weekly Monthly Annually |
| intervalDuration | long integer. The period that the report looks backward relative to the run date, in POSIX format. The system calculates intervalDuration between intervalStartTime and intervalEndTime and reports it in POSIX format. For example, say that you specify a 90-day start-to-end-date window for a report. The intervalDuration value returns a value equivalent to 90 days and represents the backward-looking period of the report. Say that you have set up a weekly report to look back 90 days. When the report runs again in a week's time, it again looks back 90 days -- but now those 90 days are offset by a week from the first report. |
| RequestId | string. The ID of the original request. Request IDs are long strings unique within the OMS. |
| lastInstanceId | string. For scheduled reports, the report ID of the most recent previously run report. This will be null for a Generate~Report call, because generated reports are all on-demand. |
| accountIds | integer array. A comma-delimited array of account IDs whose trades are reported in the trade activity report. |
DownloadDocument
Permissions: Operator, Trading
Call Type: Synchronous
Download Document
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("DownloadDocument", {
DescriptorId: "66769552-cacd-471b-bb53-04b1ed1c87f9",
});
POST /AP/DownloadDocument HTTP/1.1
Host: hostname goes here...
aptoken: a241cfbd-ccb3-4f71-9b04-3416549bba6f
Content-Type: application/json
Content-Length: 63
{
"DescriptorId":"66769552-cacd-471b-bb53-04b1ed1c87f9"
}
| Key | Value |
|---|---|
| DescriptorId | string. The GUID that uniquely identifies a report that can be downloaded. required. |
Response
{
"descriptorId": "66769552-cacd-471b-bb53-04b1ed1c87f9",
"docName": "URM.6.onDemand.TradeActivity.9.2023-04-01T15.2023-04-17T15.66769552-cacd-471b-bb53-04b1ed1c87f9.csv",
"numSlices": 1,
"statusCode": "Success",
"statusMessage": "success"
}
| Key | Value |
|---|---|
| DescriptorId | string. The GUID that uniquely identifies a report that can be downloaded. |
| DocName | string. The actual filename of the document stored in the server. |
| NumSlices | integer. The number of slices. |
| statusCode | string. Either Success(if request is success) or Error. |
| statusMessage | string. Either success(if request is success) or error . |
DownloadDocumentSlice
Permissions: Operator, Trading
Call Type: Synchronous
Download Document Slice.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("DownloadDocumentSlice", {
DescriptorId: "66769552-cacd-471b-bb53-04b1ed1c87f9",
sliceNum: 0,
});
POST /AP/DownloadDocumentSlice HTTP/1.1
Host: hostname goes here...
aptoken: a241cfbd-ccb3-4f71-9b04-3416549bba6f
Content-Type: application/json
Content-Length: 83
{
"DescriptorId":"66769552-cacd-471b-bb53-04b1ed1c87f9",
"sliceNum": 0
}
| Key | Value |
|---|---|
| DescriptorId | string. The GUID that uniquely identifies a report that can be downloaded. required. |
| sliceNum | integer. Defaults to zero. optional. |
Response
{
"descriptorId": "66769552-cacd-471b-bb53-04b1ed1c87f9",
"base64Bytes": "IlJlZ2lzdGVyZWRFbnRpdHlJZCIsIlRyYW5zUmVwb3J0SWQiLCJUcmFuc1JlcG9ydFJldmlzaW9uIiwiVHJhbnNSZXBvcnRUeXBlIiwiT3JkZXJJZCIsIkNsaWVudE9yZGVySWQiLCJRdW90ZUlkIiwiRXh0VHJhZGVSZXBvcnRJZCIsIlRyYWRlSWQiLCJUcmFuc1JlcG9ydERhdGV0aW1lIiwiU2lkZSIsIlNpemUiLCJJbnN0cnVtZW50IiwiUHJpY2UiLCJJbnNpZGVCaWQiLCJJbnNpZGVCaWRTaXplIiwiSW5zaWRlT2ZmZXIiLCJJbnNpZGVPZmZlclNpemUiLCJMZWF2ZXNTaXplIiwiTWFrZXJUYWtlciIsIlRyYWRlciIsIkFjY291bnRJZCIsIkFjY291bnRIYW5kbGUiLCJGZWUiLCJGZWVQcm9kdWN0IiwiTm90aW9uYWwiLCJCYXNlU2V0dGxlbWVudEFtb3VudCIsIkNvdW50ZXJwYXJ0eVNldHRsZW1lbnRBbW91bnQiLCJPTVNJZCINCiIiLCIxODA2IiwiMSIsIk9yZGVyRXhlY3V0aW9uIiwiNjYwMCIsIjAiLCIiLCIiLCI5MDMiLCIyMDIzLTA0LTEwVDA4OjQyOjM1LjA4MVoiLCJTZWxsIiwiMS4wMDAwMDAwMDAiLCJCVENVU0QiLCIyNTAwMC4wMDAwMDAwMDAiLCIyNTAwMC4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIjI2MDAwLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCJUYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjAwMDAxNzYzOCIsIjIiLCIyNTAwMC4wMDAwMDAwMDAiLCItMS4wMDAwMDAwMDAiLCIyNDk5OS45OTk5ODIzNjIiLCIxIg0KIiIsIjE4MDgiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjAwIiwiMCIsIiIsIiIsIjkwNCIsIjIwMjMtMDQtMTBUMDg6NDI6MzUuMDgxWiIsIlNlbGwiLCIxLjAwMDAwMDAwMCIsIkJUQ1VTRCIsIjI0MDAwLjAwMDAwMDAwMCIsIjI1MDAwLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjYwMDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDE2OTMyIiwiMiIsIjI0MDAwLjAwMDAwMDAwMCIsIi0xLjAwMDAwMDAwMCIsIjIzOTk5Ljk5OTk4MzA2OCIsIjEiDQoiIiwiMTgxMCIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MDMiLCIwIiwiIiwiIiwiOTA1IiwiMjAyMy0wNC0xMFQwODo0NDo1NC4wNThaIiwiQnV5IiwiMC4xMDAwMDAwMDAiLCJCVENVU0QiLCIyNTUwMC4wMDAwMDAwMDAiLCIiLCIwLjAwMDAwMDAwMCIsIjI1NTAwLjAwMDAwMDAwMCIsIjAuMTAwMDAwMDAwIiwiMC4yMDAwMDAwMDAiLCJUYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjAwMDAwMjAwMCIsIjIiLCIyNTUwLjAwMDAwMDAwMCIsIjAuMDk5OTk4MDAwIiwiLTI1NTAuMDAwMDAwMDAwIiwiMSINCiIiLCIxODEyIiwiMSIsIk9yZGVyRXhlY3V0aW9uIiwiNjYwMyIsIjAiLCIiLCIiLCI5MDYiLCIyMDIzLTA0LTEwVDA4OjQ0OjU0LjA1OVoiLCJCdXkiLCIwLjIwMDAwMDAwMCIsIkJUQ1VTRCIsIjI1OTAwLjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiMjU1MDAuMDAwMDAwMDAwIiwiMC4xMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDA0MDAwIiwiMiIsIjUxODAuMDAwMDAwMDAwIiwiMC4xOTk5OTYwMDAiLCItNTE4MC4wMDAwMDAwMDAiLCIxIg0KIiIsIjE4MTMiLCIxIiwiUXVvdGVFeGVjdXRpb24iLCIiLCIiLCI2NjA0IiwiIiwiOTA3IiwiMjAyMy0wNC0xMVQwODo1MDoyMy43NDBaIiwiQnV5IiwiMC4wMDAxMDAwMDAiLCJCVENVU0QiLCIyNTAwMC4wMDAwMDAwMDAiLCIyNTAwMC4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIjI2MDAwLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMC45OTk5MDAwMDAiLCJNYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjAwMDAwMDAwMiIsIjIiLCIyLjUwMDAwMDAwMCIsIjAuMDAwMDk5OTk4IiwiLTIuNTAwMDAwMDAwIiwiMSINCiIiLCIxODE1IiwiMSIsIlF1b3RlRXhlY3V0aW9uIiwiIiwiIiwiNjYwNCIsIiIsIjkwOCIsIjIwMjMtMDQtMTFUMDg6NTI6NDQuNTcxWiIsIkJ1eSIsIjAuMDAwMTAwMDAwIiwiQlRDVVNEIiwiMjUwMDAuMDAwMDAwMDAwIiwiMjUwMDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIyNjAwMC4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIjAuOTk5ODAwMDAwIiwiTWFrZXIiLCI2IiwiOSIsIkFub3RoZXJOYW1lIiwiMC4wMDAwMDAwMDIiLCIyIiwiMi41MDAwMDAwMDAiLCIwLjAwMDA5OTk5OCIsIi0yLjUwMDAwMDAwMCIsIjEiDQoiIiwiMTgyMiIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MTYiLCIwIiwiIiwiIiwiOTExIiwiMjAyMy0wNC0xMVQwODo1NzozNS45NDRaIiwiU2VsbCIsIjAuMDEwMDAwMDAwIiwiRVRIVVNEIiwiMjM0MzYuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIiLCIwLjAwMDAwMDAwMCIsIjAuMDAwMDAwMDAwIiwiVGFrZXIiLCI2IiwiOSIsIkFub3RoZXJOYW1lIiwiMC4wOTM3NDQwMDAiLCIxIiwiMjM0LjM2MDAwMDAwMCIsIi0wLjAxMDAwMDAwMCIsIjIzNC4yNjYyNTYwMDAiLCIxIg0KIiIsIjE4MjQiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjE3IiwiMCIsIiIsIiIsIjkxMiIsIjIwMjMtMDQtMTFUMDk6MDM6MzEuMjAzWiIsIlNlbGwiLCIwLjAwMDEwMDAwMCIsIkVUSFVTRCIsIjIzNDM2LjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwOTM3NDQwIiwiMSIsIjIuMzQzNjAwMDAwIiwiLTAuMDAwMTAwMDAwIiwiMi4zNDI2NjI1NjAiLCIxIg0KIiIsIjE4MjYiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjE4IiwiMCIsIiIsIiIsIjkxMyIsIjIwMjMtMDQtMTFUMDk6MDY6MjguMjk2WiIsIlNlbGwiLCIwLjAwOTkwMDAwMCIsIkVUSFVTRCIsIjIzNDM2LjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIwLjk5MDEwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDkyODA2NTYwIiwiMSIsIjIzMi4wMTY0MDAwMDAiLCItMC4wMDk5MDAwMDAiLCIyMzEuOTIzNTkzNDQwIiwiMSINCiIiLCIxODI4IiwiMSIsIk9yZGVyRXhlY3V0aW9uIiwiNjYxOCIsIjAiLCIiLCIiLCI5MTQiLCIyMDIzLTA0LTExVDA5OjA2OjI4LjI5NloiLCJTZWxsIiwiMC4wMjAwMDAwMDAiLCJFVEhVU0QiLCIyMzQzNi4wMDAwMDAwMDAiLCIiLCIwLjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiMC45NzAxMDAwMDAiLCJUYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjE4NzQ4ODAwMCIsIjEiLCI0NjguNzIwMDAwMDAwIiwiLTAuMDIwMDAwMDAwIiwiNDY4LjUzMjUxMjAwMCIsIjEiDQoiIiwiMTgzMCIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MTgiLCIwIiwiIiwiIiwiOTE1IiwiMjAyMy0wNC0xMVQwOTowNjoyOC4yOTZaIiwiU2VsbCIsIjAuMDIwMDAwMDAwIiwiRVRIVVNEIiwiMjM0MzYuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIiLCIwLjAwMDAwMDAwMCIsIjAuOTUwMTAwMDAwIiwiVGFrZXIiLCI2IiwiOSIsIkFub3RoZXJOYW1lIiwiMC4xODc0ODgwMDAiLCIxIiwiNDY4LjcyMDAwMDAwMCIsIi0wLjAyMDAwMDAwMCIsIjQ2OC41MzI1MTIwMDAiLCIxIg0KIiIsIjE4MzIiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjE4IiwiMCIsIiIsIiIsIjkxNiIsIjIwMjMtMDQtMTFUMDk6MDY6MjguMjk2WiIsIlNlbGwiLCIwLjAyMDAwMDAwMCIsIkVUSFVTRCIsIjIzNDM2LjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIwLjkzMDEwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMTg3NDg4MDAwIiwiMSIsIjQ2OC43MjAwMDAwMDAiLCItMC4wMjAwMDAwMDAiLCI0NjguNTMyNTEyMDAwIiwiMSINCiIiLCIxODM0IiwiMSIsIk9yZGVyRXhlY3V0aW9uIiwiNjYxOCIsIjAiLCIiLCIiLCI5MTciLCIyMDIzLTA0LTExVDA5OjA2OjI4LjI5NloiLCJTZWxsIiwiMC45MzAxMDAwMDAiLCJFVEhVU0QiLCIxOTkwLjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiIiwiMC4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuNzQwMzU5NjAwIiwiMSIsIjE4NTAuODk5MDAwMDAwIiwiLTAuOTMwMTAwMDAwIiwiMTg1MC4xNTg2NDA0MDAiLCIxIg0KIiIsIjE4MzYiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjE5IiwiMCIsIiIsIiIsIjkxOCIsIjIwMjMtMDQtMTFUMDk6MDY6NTIuMzkzWiIsIlNlbGwiLCIwLjAwMTAwMDAwMCIsIkVUSFVTRCIsIjE5OTAuMDAwMDAwMDAwIiwiMTk5MC4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIiIsIjAuMDAwMDAwMDAwIiwiMC4wMDAwMDAwMDAiLCJUYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjAwMDc5NjAwMCIsIjEiLCIxLjk5MDAwMDAwMCIsIi0wLjAwMTAwMDAwMCIsIjEuOTg5MjA0MDAwIiwiMSINCiIiLCIxODM3IiwiMSIsIlF1b3RlRXhlY3V0aW9uIiwiIiwiIiwiNjYwNCIsIiIsIjkxOSIsIjIwMjMtMDQtMTFUMDk6NTg6MDMuMTAwWiIsIkJ1eSIsIjAuMDk5ODAwMDAwIiwiQlRDVVNEIiwiMjUwMDAuMDAwMDAwMDAwIiwiMjUwMDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIyNjAwMC4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIjAuOTAwMDAwMDAwIiwiTWFrZXIiLCI2IiwiOSIsIkFub3RoZXJOYW1lIiwiMC4wMDAwMDE5OTYiLCIyIiwiMjQ5NS4wMDAwMDAwMDAiLCIwLjA5OTc5ODAwNCIsIi0yNDk1LjAwMDAwMDAwMCIsIjEiDQoiIiwiMTgzOSIsIjEiLCJRdW90ZUV4ZWN1dGlvbiIsIiIsIiIsIjY2MDQiLCIiLCI5MjAiLCIyMDIzLTA0LTExVDA5OjU5OjEwLjQwOVoiLCJCdXkiLCIwLjkwMDAwMDAwMCIsIkJUQ1VTRCIsIjI1MDAwLjAwMDAwMDAwMCIsIjI1MDAwLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjYwMDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIk1ha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDE4MDAwIiwiMiIsIjIyNTAwLjAwMDAwMDAwMCIsIjAuODk5OTgyMDAwIiwiLTIyNTAwLjAwMDAwMDAwMCIsIjEiDQoiIiwiMTg0MiIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MjgiLCIwIiwiIiwiIiwiOTIxIiwiMjAyMy0wNC0xMVQxMDoxMzozMy4yMjlaIiwiQnV5IiwiMC45OTk4MDAwMDAiLCJCVENVU0QiLCIyNjAwMC4wMDAwMDAwMDAiLCIyLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjYwMDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDE5OTk2IiwiMiIsIjI1OTk0LjgwMDAwMDAwMCIsIjAuOTk5NzgwMDA0IiwiLTI1OTk0LjgwMDAwMDAwMCIsIjEiDQoiIiwiMTg0NCIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MjkiLCIwIiwiIiwiIiwiOTIyIiwiMjAyMy0wNC0xMVQxMDoxMzozOC41NThaIiwiQnV5IiwiMC45OTk4MDAwMDAiLCJCVENVU0QiLCIyNjUwMC4wMDAwMDAwMDAiLCIyLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjY1MDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDE5OTk2IiwiMiIsIjI2NDk0LjcwMDAwMDAwMCIsIjAuOTk5NzgwMDA0IiwiLTI2NDk0LjcwMDAwMDAwMCIsIjEiDQoiIiwiMTg0NiIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MzAiLCIwIiwiIiwiIiwiOTIzIiwiMjAyMy0wNC0xMVQxMDoxMzo1MS41NTZaIiwiQnV5IiwiMC4wMDAyMDAwMDAiLCJCVENVU0QiLCIyNjUwMC4wMDAwMDAwMDAiLCIyLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjY1MDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjk5OTYwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDAwMDA0IiwiMiIsIjUuMzAwMDAwMDAwIiwiMC4wMDAxOTk5OTYiLCItNS4zMDAwMDAwMDAiLCIxIg0KIiIsIjE4NDgiLCIxIiwiT3JkZXJFeGVjdXRpb24iLCI2NjMwIiwiMCIsIiIsIiIsIjkyNCIsIjIwMjMtMDQtMTFUMTA6MTM6NTEuNTU2WiIsIkJ1eSIsIjAuMDEwMDAwMDAwIiwiQlRDVVNEIiwiMzYwMDAuMDAwMDAwMDAwIiwiMi4wMDAwMDAwMDAiLCIxLjAwMDAwMDAwMCIsIjI2NTAwLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMC45ODk2MDAwMDAiLCJUYWtlciIsIjYiLCI5IiwiQW5vdGhlck5hbWUiLCIwLjAwMDAwMDIwMCIsIjIiLCIzNjAuMDAwMDAwMDAwIiwiMC4wMDk5OTk4MDAiLCItMzYwLjAwMDAwMDAwMCIsIjEiDQoiIiwiMTg1MCIsIjEiLCJPcmRlckV4ZWN1dGlvbiIsIjY2MzAiLCIwIiwiIiwiIiwiOTI1IiwiMjAyMy0wNC0xMVQxMDoxMzo1MS41NTZaIiwiQnV5IiwiMC45ODk2MDAwMDAiLCJCVENVU0QiLCIzNzAwMC4wMDAwMDAwMDAiLCIyLjAwMDAwMDAwMCIsIjEuMDAwMDAwMDAwIiwiMjY1MDAuMDAwMDAwMDAwIiwiMS4wMDAwMDAwMDAiLCIwLjAwMDAwMDAwMCIsIlRha2VyIiwiNiIsIjkiLCJBbm90aGVyTmFtZSIsIjAuMDAwMDE5NzkyIiwiMiIsIjM2NjE1LjIwMDAwMDAwMCIsIjAuOTg5NTgwMjA4IiwiLTM2NjE1LjIwMDAwMDAwMCIsIjEiDQo=",
"statusCode": "Success",
"statusMessage": "Success"
}
| Key | Value |
|---|---|
| DescriptorId | string. The GUID that uniquely identifies a report that can be downloaded. |
| base64Bytes | string. The actual contents of the document in base64 format. |
| statusCode | string. Either Success(if request is success) or Error. |
| statusMessage | string. Either success(if request is success) or error . |
Subscription
UnsubscribeLevel2
Permissions: Public
Call Type: Synchronous
Unsubscribes the user from a Level 2 Market Data Feed subscription.
Request
UnSubscribeLevel2 is not available in http. Subscription APIs are only supported in websockets.
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("UnSubscribeLevel2", {
OMSId: 1,
InstrumentId: 1,
});
//Instrument can also be identified via its symbol e.g. BTCUSD
await apex.RPCPromise("UnSubscribeLevel2", {
OMSId: 1,
Symbol: "BTCUSD",
});
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument being tracked by the Level 2 market data feed. required. |
| Symbol | string. Can be used instead of the InstrumentId. The symbol of the instrument you are unsubscribing level2 data from. required. |
Response
UnSubscribeLevel2 is not available in http. Subscription APIs are only supported in websockets.
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful receipt of the unsubscribe request returns true; and unsuccessful receipt (an error condition) returns false. |
| errormsg | string. A successful receipt of the unsubscribe request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the unsubscribe request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SubscribeLevel2
Permissions: Public
Call Type: Synchronous
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.
Only a user with Operator permission can issue a Level2MarketData permission using the call AddUserMarketDataPermission.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.SubscribeLevel2({
OMSId: 1,
InstrumentId: 1,
Depth: 10,
});
//Instrument can also be identified via its symbol e.g. BTCUSD
await apex.SubscribeLevel2({
OMSId: 1,
Symbol: "BTCUSD",
Depth: 10,
});
SubscribeLevel2 is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument you’re tracking. required. |
| Symbol | string. Can be used instead of the InstrumentId. The symbol of the instrument you are subscribing to. required. |
| Depth | integer. The depth of the order book. The example request returns 10 price levels on each side of the market. required. |
Response
[
[
0, // MDUpdateId
1, // Number of Accounts
123, // ActionDateTime in Posix format X 1000
0, // ActionType 0 (New), 1 (Update), 2(Delete)
0.0, // LastTradePrice
0, // Number of Orders
0.0, //Price
0, // ProductPairCode
0.0, // Quantity
0, // Side
],
];
SubscribeLevel2 is not available in http. Subscription APIs are only supported in websockets.
The response is an array of elements for one specific instrument, the number of elements correspons to the depth specified in the Request. It is sent as an uncommented, comma-delimited list of numbers. The example is commented.
| Key | Value |
|---|---|
| MDUpdateID | long integer. Market Data Update ID. This sequential ID identifies the order in which the update was created. |
| Number of Accounts | integer. Number of accounts |
| ActionDateTime | long integer.. ActionDateTime identifies the time and date that the snapshot was taken or the event occurred, in POSIX format X 1000 (milliseconds since 1 January 1970). |
| ActionType | integer. L2 information provides price data. This value shows whether this data is: 0 new 1 update 2 deletion |
| LastTradePrice | decimal. The price at which the instrument was last traded. |
| Number of Orders | decimal. Number of orders |
| Price | decimal. Bid or Ask price for the Quantity (see Quantity below). |
| ProductPairCode | integer. ProductPairCode is the same value and used for the same purpose as InstrumentID. The two are completely equivalent. InstrumentId 47 = ProductPairCode 47. |
| Quantity | decimal. Quantity available at a given Bid or Ask price (see Price above). |
| Side | integer. One of: 0 Buy 1 Sell 2 Short (reserved for future use) 3 Unknown (error condition) |
SubscribeLevel1
Permissions: Public
Call Type: Synchronous
Retrieves the latest Level 1 Ticker information and then subscribes the user to ongoing Level 1 market data event updates for one specific instrument.
The SubscribeLevel1 call responds with the Level 1 response shown below. The OMS then periodically sends in the same format as this response Leve1UpdateEvent information when best-bid/best-offer issue, until you send the UnsubscribeLevel1 call.
Only a user with Operator permission can issue Level1MarketData permission using the call AddUserMarketDataPermission.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.SubscribeLevel1({
OMSId: 1,
InstrumentId: 1,
});
//Instrument can also be identified via its symbol e.g. BTCUSD
await apex.SubscribeLevel1({
OMSId: 1,
Symbol: "BTCUSD",
});
SubscribeLevel1 is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument you’re tracking. required. |
| Symbol | string. Can be used instead of the InstrumentId. The symbol of the instrument you are subscribing to. required. |
Response
The SubscribeLevel1 response and Level1UpdateEvent both provide the same information.
{
"OMSId": 1,
"InstrumentId": 1,
"BestBid": 6423.57,
"BestOffer": 6436.53,
"LastTradedPx": 6423.57,
"LastTradedQty": 0.96183964,
"LastTradeTime": 1534862990343,
"SessionOpen": 6249.64,
"SessionHigh": 11111,
"SessionLow": 4433,
"SessionClose": 6249.64,
"Volume": 0.96183964,
"CurrentDayVolume": 3516.31668185,
"CurrentDayNumTrades": 8529,
"CurrentDayPxChange": 173.93,
"CurrentNotional": 0.0,
"Rolling24HrNotional": 0.0,
"Rolling24HrVolume": 4319.63870783,
"Rolling24NumTrades": 10585,
"Rolling24HrPxChange": -0.4165607307408487,
"TimeStamp": "1534862990358"
}
SubscribeLevel1 is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| InstrumentId | integer. The ID of the instrument being tracked. |
| BestBid | decimal. The current best bid for the instrument. |
| BestOffer | decimal. The current best offer for the instrument. |
| LastTradedPx | decimal. The last-traded price for the instrument. |
| LastTradedQty | decimal. The last-traded quantity for the instrument. |
| LastTradeTime | long integer. The time of the last trade, in POSIX format. |
| SessionOpen | decimal. Opening price. In markets with openings and closings, this is the opening price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| SessionHigh | decimal. Highest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionLow | decimal. Lowest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionClose | decimal. The closing price. In markets with openings and closings, this is the closing price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| Volume | decimal. The last-traded quantity for the instrument, same value as LastTradedQty |
| CurrentDayVolume | decimal. The unit volume of the instrument traded either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayNumTrades | integer. The number of trades during the current day, either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayPxChange | decimal. Current day price change, either during a trading session or UTC Midnight to UTC midnight. |
| CurrentNotional | decimal. Current day quote volume - resets at UTC Midnight. |
| Rolling24HrNotional | decimal. Rolling 24 hours quote volume. |
| Rolling24HrVolume | decimal. Unit volume of the instrument during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrNumTrades | decimal. Number of trades during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrPxChange | decimal. Price change during the past 24 hours, regardless of time zone. Recalculates continuously. |
| TimeStamp | string. The time this information was provided, in POSIX format, it is stringified. |
UnsubscribeLevel1
Permissions: Public
Call Type: Synchronous
Unsubscribes the user from a Level 1 Market Data Feed subscription.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.UnSubscribeLevel1({
OMSId: 1,
InstrumentId: 1,
});
//Instrument can also be identified via its symbol e.g. BTCUSD
await apex.UnSubscribeLevel1({
OMSId: 1,
Symbol: "BTCUSD",
});
UnSubscribeLevel1 is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument you’re unsubscribing level1 updates from. required. |
| Symbol | string. Can be used instead of the InstrumentId. The symbol of the instrument you’re unsubscribing level1 updates from. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
UnSubscribeLevel1 is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| result | boolean. A successful receipt of the unsubscribe request returns true; and unsuccessful receipt (an error condition) returns false. |
| errormsg | string. A successful receipt of the unsubscribe request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the unsubscribe request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SubscribeTrades
Permissions: Public
Call Type: Synchronous
Subscribes an authenticated user to the Trades Market Data Feed for a specific instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.SubscribeTrades({
OMSId: 1,
InstrumentId: 1,
IncludeLastCount: 10,
});
SubscribeTrades is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the instrument is traded. required. |
| InstrumentId | integer. The ID of the instrument whose trades will be reported. required. |
| IncludeLastCount | integer. Specifies the number of previous trades to retrieve in the immediate snapshot. The maximum is 10000. required. |
Response
Numerical keys reduce package transmission load. See Response table for an explanation.
[
{
0: 1713390,
1: 1,
2: 0.25643269,
3: 6419.77,
4: 203100209,
5: 203101083,
6: 1534863265752,
7: 2,
8: 1,
9: 0,
10: 0,
},
];
SubscribeTrades is not available in http. Subscription APIs are only supported in websockets.
The response returns an array of trades. The keys of each trade are numbers to reduce payload traffic.
| Key | Value |
|---|---|
| 0 (TradeId) | integer. The ID of this trade. |
| 1 (InstrumentId) | integer. The ID of the instrument. |
| 2 (Quantity) | decimal. The quantity of the instrument traded. |
| 3 (Price) | decimal. The price at which the instrument was traded. |
| 4 (Order1) | integer. The ID of the first order that resulted in the trade, either Buy or Sell. |
| 5 (Order2) | integer. The ID of the second order that resulted in the trade, either Buy or Sell. |
| 6 (Tradetime) | long integer. UTC trade time in Total Milliseconds. POSIX format. |
| 7 (Direction) | integer. Effect of the trade on the instrument’s market price. One of: 0 NoChange 1 UpTick 2 DownTick |
| 8 (TakerSide) | integer. Which side of the trade took liquidity? One of: 0 Buy 1 Sell The maker side of the trade provides liquidity by placing the order on the book (this can be a buy or a sell order). The other, taker, side takes the liquidity. It, too, can be buy-side or sell-side. |
| 9 (BlockTrade) | boolean. Was this a privately negotiated trade that was reported to the OMS? A private trade returns 1 (true); otherwise 0 (false). Default is false. Block trades are not supported in exchange version 3.1 |
| 10 (order1ClientId or order2ClientId) | integer. The client-supplied order ID for the trade. Internal logic determines whether the program reports the order1ClientId or the order2ClientId. |
UnsubscribeTrades
Permissions: Public
Call Type: Synchronous
Unsubscribes the user from a Trades Market Data Feed
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.UnSubscribeTrades({
OMSId: 1,
InstrumentId: 1,
});
UnsubscribeTrades is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the user has subscribed to a trades market data feed. required. |
| InstrumentId | integer. The ID of the instrument being tracked by the trades market data feed. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
UnsubscribeTrades is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| result | boolean. A successful receipt of the unsubscribe request returns true; and unsuccessful receipt (an error condition) returns false. |
| errormsg | string. A successful receipt of the unsubscribe request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the unsubscribe request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SubscribeTicker
Permissions: Public
Call Type: Synchronous
Subscribes User to Ticker Market Data Feed of a specific instrument. Interval is number of seconds for each bar. IncludeLastCount field specifies the number of previous bars to retrieve as a snapshot.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.SubscribeTicker({
OMSId: 1,
InstrumentId: 1,
Interval: 60,
IncludeLastCount: 10,
});
SubscribeTicker is not available in http. Subscription APIs are only supported in websockets.
Supported Intervals are:
60, 300, 900, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 604800, 2419200, 9676800, 125798400
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument whose ticker data you want to track. required. |
| Interval | integer. The number of seconds for each bar. required. |
| IncludeLastCount | integer. The number of previous bars to retrieve as a snapshot. required. |
Response
[
[
1692926460000, //EndDateTime
28432.44, //High
28432.44, //Low
28432.44, //Open
28432.44, //Close
0, //Volume
0, //Best Bid
0, //Best Ask
1, //InstrumentId
1692926400000, //BeginDateTime
],
];
SubscribeTicker is not available in http. Subscription APIs are only supported in websockets.
The response returns an array of objects , each object an unlabeled, comma-delimited array of numbers. The Open price and Close price are those at the beginning of the tick — the Interval time subscribed to in the request. For 24-hour exchanges, the trading day runs from UTC midnight to UTC midnight; highs, lows, opens, closes, and volumes consider that midnight-to-midnight period to be the trading day.
| Key | Value |
|---|---|
| EndDateTime | long integer. The end/closing date and time of the ticker, in UTC and POSIX format. |
| High | decimal. The Highest Trade Price for the Time-Period ( 0 if no trades ). |
| Low | decimal. The Lowest Trade Price for the Time-Period ( 0 if no trades ). |
| Open | decimal. The Opening Trade Price for the Time-Period ( 0 if no trades ). |
| Close | decimal. The Last Trade Price for the Time-Period ( 0 if no trades ). |
| Volume | decimal. The Total Trade Volume since the last Tick. |
| Bid | decimal. The best bid price at the time of the Tick. |
| Ask | decimal. The best ask price at the time of the Tick. |
| InstrumentId | integer. The ID of the instrument. |
| BeginDateTime | long integer. The start/opening date and time of the ticker, in UTC and POSIX format. |
UnsubscribeTicker
Permissions: Public
Call Type: Synchronous
Unsubscribes the user from a Ticker Market Data Feed.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.UnSubscribeTicker({
OMSId: 1,
InstrumentId: 1,
});
UnsubscribeTicker is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument being tracked by the ticker market data feed. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
UnsubscribeTicker is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| result | boolean. A successful receipt of the unsubscribe request returns true; and unsuccessful receipt (an error condition) returns false. |
| errormsg | string. A successful receipt of the unsubscribe request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful receipt of the unsubscribe request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SubscribeAccountEvents
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Subscribe to account-level events, such as orders, trades, deposits and withdraws. Can be used to monitor account transactions real-time.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SubscribeAccountEvents", {
OMSId: 1,
AccountId: 1,
});
SubscribeAccountEvents is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account to subscribe with. required. |
Response
{
Subscribed: true
}
//Example account event that can be received
{
m: 3,
i: 2,
n: 'WithdrawTicketUpdateEvent',
o: '{"AssetManagerId":1,"AccountProviderId":0,"AccountId":7,"AccountName":"sample","AssetId":3,"AssetName":"TBTC","Amount":0.0010000000000000000000000000,"NotionalValue":0.0010000000000000000000000000,"NotionalProductId":1,"TemplateForm":"{\\"Fullname\\":\\"sample\\"}","TemplateFormType":null,"OMSId":1,"RequestCode":"ef0ec64d-953b-477d-80b7-c3b0bf4cad64","RequestIP":null,"RequestUserId":1,"RequestUserName":"admin","OperatorId":1,"Status":"Pending2Fa","FeeAmt":0.0000000000000000000000000000,"UpdatedByUser":0,"UpdatedByUserName":null,"TicketNumber":292,"WithdrawTransactionDetails":"{\\"TxId\\":null,\\"ExternalAddress\\":null,\\"Amount\\":0,\\"Confirmed\\":false,\\"LastUpdated\\":\\"0001-01-01T00:00:00.000Z\\",\\"TimeSubmitted\\":\\"0001-01-01T00:00:00.000Z\\",\\"AccountProviderName\\":null,\\"AccountProviderId\\":0}","RejectReason":null,"CreatedTimestamp":"2023-03-23T12:48:31.067Z","LastUpdateTimestamp":"2023-03-23T12:48:31.067Z","CreatedTimestampTick":638151725110676052,"LastUpdateTimestampTick":638151725110676052,"Comments":[],"Attachments":[],"AuditLog":[]}'
}
{
m: 3,
i: 4,
n: 'AccountPositionEvent',
o: '{"OMSId":1,"AccountId":7,"ProductSymbol":"TBTC","ProductId":3,"Amount":1.1381543994360000000000000000,"Hold":1.1256211000000000000000000000,"PendingDeposits":0,"PendingWithdraws":0,"TotalDayDeposits":0,"TotalMonthDeposits":0,"TotalYearDeposits":0,"TotalDayDepositNotional":0,"TotalMonthDepositNotional":0,"TotalYearDepositNotional":0,"TotalDayWithdraws":0,"TotalMonthWithdraws":0,"TotalYearWithdraws":0,"TotalDayWithdrawNotional":0,"TotalMonthWithdrawNotional":0,"TotalYearWithdrawNotional":0,"NotionalProductId":1,"NotionalProductSymbol":"USD","NotionalValue":1.1381543994360000000000000000,"NotionalHoldAmount":1.1256211000000000000000000000,"NotionalRate":1,"TotalDayTransferNotional":0}'
}
SubscribeAccountEvents is not available in http. Subscription APIs are only supported in websockets.
Returns either Subscribed: true or false. If false, it means that you were not able to subscribe to events of the account. After successfully subscribing to account events, you will receive the events message for transactions that involves the account such as a withdraw transaction, the specific event name will be WithdrawTicketUpdateEvent
UnSubscribeAccountEvents
Permissions: Trading
Call Type: Synchronous
UnSubscribe from account-level events. After being unsubscribed, you will stop receiving real-time events about transactions that concerns the specific account you unsubscribed to.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("UnSubscribeAccountEvents", {
OMSId: 1,
AccountId: 1,
});
UnSubscribeAccountEvents is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account to subscribe with. This to make sure you will be unsubscribed to the correct account. required. |
Response
{
UnSubscribed: true;
}
UnSubscribeAccountEvents is not available in http. Subscription APIs are only supported in websockets.
SubscribeOrderStateEvents
Permissions: Trading
Call Type: Synchronous
Subscribe to order state events of a specific account's orders. Optional parameter to filter by instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SubscribeOrderStateEvents", {
OMSId: 1,
AccountId: 1,
InstrumentId: 1, //optional to filter for a specific instrument
});
SubscribeOrderStateEvents is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account to subscribe with. required. |
| InstrumentId | integer. The ID of the instrument to subscribe orderstateevents with. This field serves as the filter parameter. optional. |
Response
{
Subscribed: true;
}
SubscribeOrderStateEvents is not available in http. Subscription APIs are only supported in websockets.
Returns either Subscribed: true or false. If false, it means that you were not able to subscribe to orderstateevents of the account. After successfully subscribing to orderstatevents of the account, you will receive the events message for any change of state of the account's order/s.
UnSubscribeOrderStateEvents
Permissions: Trading
Call Type: Synchronous
UnSubscribe from account-level events. After being unsubscribed, you will stop receiving real-time events about transactions that concerns the specific account you unsubscribed to.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise('UnSubscribeOrderStateEvents',{
OMSId: 1,
AccountId: 1
InstrumentId: 1 //Optional to unsubscribe to a specific instrument only
})
UnSubscribeOrderStateEvents is not available in http. Subscription APIs are only supported in websockets.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account to subscribe with. This is to make sure you will be unsubscribed to the correct account. required. |
| InstrumentId | integer. The ID of the instrument to unsubscribe orderstateevents with. This field serves as the filter parameter. optional. |
Response
{
UnSubscribed: true;
}
UnSubscribeOrderStateEvents is not available in http. Subscription APIs are only supported in websockets.
System
Ping
Permissions: Public
Call Type: Synchronous
Keepalive, can be used to avoid getting session timeout.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Ping", {});
POST /AP/Ping HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 52
//No request payload needed
{
}
No request payload required.
Response
{
"msg": "PONG";
}
| Key | Value |
|---|---|
| msg | PONG means Ping request was successful and the gateway has responded. |
GetOMSVersion
Permissions: Public
Call Type: Synchronous
Gets Exchange's OMS Version
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOMSVersion", {});
POST /AP/GetOMSVersion HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
No request payload required.
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "4.3.65.1063"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. The OMS version. |
HealthCheck
Permissions: Public
Call Type: Synchronous
Gets Exchange's services overall health.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("HealthCheck", {});
POST /AP/HealthCheck HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
No request payload required.
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "running: {\"ExchangeId\":1,\"Data1\":638169552829684050,\"Data2\":1,\"OmsId\":0,\"GatewayIn\":638169552829684082,\"OmsIn\":638169552829719513,\"MatchingEngineIn\":638169552829860044,\"OmsOut\":638169552829872324,\"GatewayOut\":638169552829928412,\"RoundTripTimeMic\":24436}"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Shows whether the exchange services are running, running mean services are up. ExchangeId integer. - the ID of the Exchange. Data1 long integer. - the timestamp when the request was first processed, in UTC. Data2 long integer. - Always defaults to 1. OmsId long integer. - always defaults to 0. GatewayIn long integer. - the timestamp when the request was first processed, in UTC. OmsIn long integer. - the timestamp when the request was first processed, in UTC. MatchingEngineIn long integer. - the timestamp when the request was first processed, in UTC. OmsOut long integer. - the timestamp when the check on OMS finished, in UTC. GatewayOut long integer. - the timestamp when the check on Gateway finished. RoundTripTimeMic - the duration of all the checks, in milliseconds. |
GetGeneralKVP
Permissions: Public
Call Type: Synchronous
Gets general KVPs(Key-Value-Pair); key value pairs extends some system functionality. For instance, the UIConfig key can have values that can then affect the behavior of the AdminUI.
New API in APEX version 4.4.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetGeneralKVP", {
Key: "UIConfig",
});
POST /ap/GetGeneralKVP HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 27
{
"Key": "UIConfig"
}
| Key | Value |
|---|---|
| Key | string. Name of the key to get value for. Not explicitly required but if not defined, the response will always be Resource Not Found. required. |
Response
{
"Key": "UIConfig",
"Value": "[{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"navLogoUrl\",\"ConfigValue\":\"\",\"ConfigValueType\":\"String\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"navTaglineText\",\"ConfigValue\":\"The Engine of Exchange\",\"ConfigValueType\":\"String\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"transfersHistoryEnabled\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"ticketAmountAllowEdit\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"useWithdrawFees\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"interestBearingAccountsEnabled\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"locale\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"ui.snackbar.autoHideDuration\",\"ConfigValue\":3000,\"ConfigValueType\":\"Int32\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"OperatorId\",\"ConfigValue\":1,\"ConfigValueType\":\"Int32\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"enableCreateUser\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"permissionedCreateUser\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"DateTimeFormat\",\"ConfigValue\":\"YYYY/MM/DD HH:mm:ss.SSS\",\"ConfigValueType\":\"String\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"UsersInfoRequestedKeys\",\"ConfigValue\":\"[\\\"2FAType\\\"]\",\"ConfigValueType\":\"Array\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"AccountsInfoRequestedKeys\",\"ConfigValue\":\"[\\\"fsRegAcctId\\\"]\",\"ConfigValueType\":\"Array\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"useAMLConfigurations\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"manualKYCEnabled\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"lockedUsersEnabled\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"custodyFeesEnabled\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"custodyFeesServiceURL\",\"ConfigValue\":\"https://hostname goes here.../AssetCustodyService\",\"ConfigValueType\":\"String\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"useNewVerificationLevelLimits\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"usePriceIncrementFloorCeilingSettings\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"showResendVerificationEmailLink\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"disableAddOperator\",\"ConfigValue\":\"True\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"availableFeeTypes\",\"ConfigValue\":\"[\\\"Flat\\\",\\\"MakerFee\\\",\\\"TakerFee\\\",\\\"FlatPegToProduct\\\",\\\"AffiliateFee\\\"]\",\"ConfigValueType\":\"Array\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"showContractProduct\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"templatesFromFile\",\"ConfigValue\":\"False\",\"ConfigValueType\":\"boolean\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"emailTemplateLanguages\",\"ConfigValue\":\"[\\\"EN\\\",\\\"SP\\\",\\\"test1\\\"]\",\"ConfigValueType\":\"Array\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"primarySettlementProducts\",\"ConfigValue\":\"[\\\"USD\\\",\\\"BTC\\\",\\\"ETH\\\",\\\"XRP\\\",\\\"GBP\\\",\\\"EUR\\\",\\\"CAD\\\",\\\"FFF\\\"]\",\"ConfigValueType\":\"Array\"},{\"ServiceName\":\"UiConfigService\",\"ConfigKey\":\"paginationLimit\",\"ConfigValue\":150,\"ConfigValueType\":\"Int32\"}]",
"Permissions": []
}
Response is a JSON object which contains the Key and the Value as fields.
| Key | Value |
|---|---|
| Key | string. The name of the key. |
| Value | string. The corresponding value of the key. Stringtified array of objects, each object is also a key-value-pair. |
| Permissions | array. The list of permissions that a specific user should have(at least 1 if there are many) so he/she can view the KVP. |
GetOMSs
Permissions: Public
Call Type: Synchronous
Retrieves a list of Order Management Systems available.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOMSs", {
OperatorId: 1,
});
POST /AP/GetOMSs HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 25
{
"OperatorId": 1
}
| Key | Value |
|---|---|
| OperatorId | integer. The Id of the operator. required. |
Response
[
{
OMSId: 1,
OMSName: "AlphapointUniversity",
},
];
[
{
OMSId: 1,
OMSName: "AlphapointUniversity",
},
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the specific OMS. |
| OMSName | integer. The name of the specific OMS. |
GetOMS
Permissions: Operator
Call Type: Synchronous
Retrieves details for a logical OMS.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOMS", {
OMSId: 1,
});
POST /AP/GetOMS HTTP/1.1
Host: hostname goes here...
aptoken: d0d93fa5-e899-45a4-b08e-b539ec597796
Content-Type: application/json
Content-Length: 14
{
"OMSId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS that you wish to retrieve details for. required. |
Response
{
"Id": 1,
"OwnerId": 0,
"OMSName": "AlphapointUniversity",
"InstanceGUID": "",
"AssetManagerCoreId": "",
"AssetManagerCoreUser": "",
"AssetManagerCorePassword": "",
"AssetManagerId": 1,
"OMSRiskMode": "Unknown",
"SystemMarginEnabled": false,
"PermissionedMarketData": false,
"PermissionedInstrument": false,
"PermissionedProduct": false,
"FeeAccountId": 2,
"DepositContraAccountId": 3,
"LendingAccountId": 0,
"VenueTimeZone": "Dateline Standard Time",
"BaseNotionalProductSymbol": "USD",
"OmsVersion": "4.3.65.1063",
"StandardAccountId": 0,
"TradeSettlementAccountId": 0,
"LendingInterestAccountId": 0
}
| Key | Value |
|---|---|
| Id | integer. The numerical ID of the OMS. |
| OwnerId | integer. The identifier assigned to the creator of the OMS. |
| OMSName | string. The name of the OMS. |
| InstanceGUID | integer. A unique identifier for a particular instance of the Alphapoint trading system |
| AssetManagerCoreId | integer. The identifier of the core asset management system used to manage the assets traded on the platform. |
| AssetManagerCoreUser | integer. The user of the core asset management system used to manage the assets traded on the platform. |
| AssetManagerCorePassword | string. The password of the core asset management system user. |
| AssetManagerId | integer. The numerical id of the Asset Manager. |
| OMSRiskMode | string. The risk mode of the OMS, can be used to set different risk limits for different trading scenarios. |
| SystemMarginEnabled | boolean. A flag that indicates whether or not margin trading is enabled for the OMS. |
| PermissionedMarketData | boolean. This specifies the level of market data access that is allowed for the OMS. |
| PermissionedInstrument | boolean. This specifies the level of access that is allowed for the OMS with respect to the instruments that it can trade. |
| PermissionedProduct | boolean. This specifies the level of access that is allowed for the OMS with respect to the products that it can trade. |
| FeeAccountId | integer. The ID of the account that is used to collect fees associated with trading on the OMS. |
| DepositContraAccountId | integer. the id of the account used to receive deposits from clients who wish to trade on the platform. |
| LendingAccountId | integer. The ID of the account that is used for lending activities associated with the OMS. |
| VenueTimeZone | string. The time zone in which the trading venue is located. |
| BaseNotionalProductSymbol | string. The symbol of the base notional product that is set on the OMS. An example would be USD. |
| OmsVersion | string. The current version of the OMS. |
| StandardAccountId | integer. The identifier of the specific trading account that is used for standard trading activities on the platform. |
| TradeSettlementAccountId | integer. the account that is used for settlement of trades executed on the platform. |
| LendingInterestAccountId | integer. The account that is used for managing the interest payments associated with lending activities. |
GatewayStats
Permissions: Public
Call Type: Synchronous
Gets Gateway Stats
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GatewayStats", {});
No request payload required.
Response
{
result: true,
errormsg: null,
errorcode: 0,
detail: '{"ConnectedClients":29,"UserSessions":26,"UptimeMs":2147483648}'
}
GatewayStats is only applicable in WebSockets.
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
| detail | string. Contains the actual stats of the Gateway ConnectedClients: the total number of clients connected to the websocket gateway. Connected does not mean authenticated. UserSessions: the total number of users with active sessions. UptimeMs: the uptime of the websocket gateway in milliseconds. |
Trading
SendOrderList
Permissions: Operator, Trading
Call Type: Synchronous
Sends or creates a list of orders. Payload is an array containing JSON object/s, each JSON object represents a single order which is exactly the same as the payload of a SendOrder request. The orders can be assorted, means that it can be for different instruments and different accounts.
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.
A user with Trading permission can create an order only for those accounts and instruments with which the user is associated; a user with Operator permissions can create an order for any account and instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SendOrderList", [
{
InstrumentId: 2,
OMSId: 1,
AccountId: 185,
TimeInForce: 1,
ClientOrderId: 0,
OrderIdOCO: 0,
UseDisplayQuantity: false,
Side: 0,
Quantity: 0.02,
OrderType: 2,
PegPriceType: "3",
LimitPrice: 23436,
},
{
InstrumentId: 2,
OMSId: 1,
AccountId: 185,
TimeInForce: 1,
ClientOrderId: 0,
OrderIdOCO: 0,
UseDisplayQuantity: false,
Side: 0,
Quantity: 0.02,
OrderType: 2,
PegPriceType: "3",
LimitPrice: 23436,
},
]);
POST /AP/SendOrderList HTTP/1.1
Host: hostname goes here...
aptoken: f7e2c811-a9db-454e-9c9e-77533baf92d9 //valid sessiontoken
Content-Type: application/json
Content-Length: 583
[
{
"InstrumentId": 2,
"OMSId": 1,
"AccountId": 185,
"TimeInForce": 1,
"ClientOrderId": 0,
"OrderIdOCO": 0,
"UseDisplayQuantity": false,
"Side": 0,
"Quantity": 0.02,
"OrderType": 2,
"PegPriceType": "3",
"LimitPrice": 23436
},
{
"InstrumentId": 2,
"OMSId": 1,
"AccountId": 185,
"TimeInForce": 1,
"ClientOrderId": 0,
"OrderIdOCO": 0,
"UseDisplayQuantity": false,
"Side": 0,
"Quantity": 0.02,
"OrderType": 2,
"PegPriceType": "3",
"LimitPrice": 23436
}
]
If OrderType=1 (Market), Side=0 (Buy), and LimitPrice is supplied, the Market order will execute up to the value specified
| Key | Value |
|---|---|
| InstrumentId | integer. The ID of the instrument being traded. |
| OMSId | integer. The ID of the OMS where the instrument is being traded. |
| AccountId | integer. The ID of the account placing the order. |
| TimeInForce | integer. An integer that represents the period during which the new order is executable. One of: 0 Unknown (error condition) 1 GTC (good 'til canceled, the default) 2 OPG (execute as close to opening price as possible: not yet used, for future provision) 3 IOC (immediate or canceled) 4 FOK (fill-or-kill — fill immediately or kill immediately) 5 GTX (good 'til executed: not yet used, for future provision) 6 GTD (good 'til date: not yet used, for future provision) |
| ClientOrderId | long integer. A user-assigned ID for the order (like a purchase-order number assigned by a company). This ID is useful for recognizing future states related to this order. ClientOrderId defaults to 0. Starting APEX version 4.2, duplicate client orderid of two open orders of the same account is not allowed, the incoming order with the same clientorderid will get rejected. |
| OrderIdOCO | long integer. The order ID if One Cancels the Other — If this order is order A, OrderIdOCO refers to the order ID of an order B (which is not the order being created by this call). If order B executes, then order A created by this call is canceled. You can also set up order B to watch order A in the same way, but that may require an update to order B to make it watch this one, which could have implications for priority in the order book. See CancelReplaceOrder and ModifyOrder. |
| UseDisplayQuantity | boolean. If you enter a Limit order with a reserve(reserve order), you must set UseDisplayQuantity to true. |
| Side | integer. A number representing on of the following potential sides of a trade. One of: 0 Buy 1 Sell |
| Quantity | decimal. The quantity of the instrument being ordered. |
| OrderType | integer. A number representing the nature of the order. One of: 0 Unknown 1 Market 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade. |
| PegPriceType | integer. When entering a stop/trailing order, set PegPriceType to an integer that corresponds to the type of price that pegs the stop: 1 Last(default) 2 Bid 3 Ask 4 Midpoint |
| LimitPrice | decimal. The price at which to execute the order, if the order is a Limit order. |
| DisplayQuantity | integer If UseDisplayQuantity is set to true, you must set a value of this field greater than 0, else, order will not appear in the orderbook. |
Response
{
"result": false, //It returns false but the request were successfully placed.
"errormsg": "Operation In Process",
"errorcode": 107,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. Specifically for this API only, it returns false even if the request went through. |
| errormsg | string. A successful request returns Operation In Process; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 107. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SendCancelList
Permissions: Operator, Trading
Call Type: Synchronous
Send a list of orders to cancel. Payload is an array of objects, each object represents an order to be cancelled.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SendCancelList", [
{
OMSId: 1,
OrderId: 6714,
AccountId: 9,
},
{
OMSId: 1,
OrderId: 6507,
AccountId: 9,
},
]);
POST /AP/SendCancelList HTTP/1.1
Host: hostname goes here...
aptoken: cf165646-2021-4460-9fc4-234e0cec454b
Content-Type: application/json
Content-Length: 178
[
{
"OMSId": 1,
"OrderId": 6714,
"AccountId": 9
},
{
"OMSId": 1,
"OrderId": 6507,
"AccountId": 9
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the original order was placed. required. |
| OrderId | integer. The ID of the order/s to be canceled. To get orderid/s of open orders, you can use GetOpenOrders API.required. |
| AccountId | integer. Account for which order/s will be canceled. If not specified, order/s will not be cancelled required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
SendCancelReplaceList
Permissions: Operator, Trading
Call Type: Synchronous
Send a list of Cancel/Replace requests. Only working orders can be replaced.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SendCancelReplaceList", [
{
OMSId: 1,
ReplaceOrderId: 6696,
ClientOrdId: 0,
OrderType: "Limit",
Side: "Buy",
AccountId: 7,
InstrumentId: 1,
LimitPrice: 29500,
TimeInForce: 1,
Quantity: 0.003,
},
{
OMSId: 1,
ReplaceOrderId: 6698,
ClientOrdId: 0,
OrderType: "Limit",
Side: "Buy",
AccountId: 7,
InstrumentId: 1,
LimitPrice: 29900,
TimeInForce: 1,
Quantity: 0.004,
},
]);
POST /AP/SendCancelReplaceList HTTP/1.1
Host: hostname goes here...
aptoken: 912ea315-31a3-43da-b229-d8f59c7db302
Content-Type: application/json
Content-Length: 566
[
{
"OMSId":1,
"OrderIdToReplace":6696,
"ClientOrdId":0,
"OrderType":"Limit",
"Side":"Buy",
"AccountId":7,
"InstrumentId":1,
"LimitPrice":29500,
"TimeInForce":1,
"Quantity":0.003
},
{
"OMSId":1,
"OrderIdToReplace":6698,
"ClientOrdId":0,
"OrderType":"Limit",
"Side":"Buy",
"AccountId":7,
"InstrumentId":1,
"LimitPrice":29900,
"TimeInForce":1,
"Quantity":0.004
}
]
| Key | Value |
|---|---|
| OmsId | integer. The ID of the OMS on which the order is being canceled and replaced by another order. required. |
| ReplaceOrderId | long integer. The ID of the order to be replaced. required. |
| ReplaceClientOrderId | long integer. The ClientOrderId of the existing order to be replaced. optional. |
| ClientOrderId | long integer. A custom ID that can identify the replacement order later on. In newer version of APEX(version 4.2 and above), it required for this field to be unique for every working order. Defaults to 0 if not defined. optional. |
| OrderType | integer or string. An integer representing the type of the replacement order: 0 Unknown 1 Market 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade. Either the string or integer value is accepted. required. |
| Side | integer. An integer representing the side of the replacement order: 0 Buy 1 Sell required. |
| AccountId | integer. The ID of the account who owns the order and is replacing the order, AccountId of the replacement order must match the AccountId of the existing order. required. |
| InstrumentId | integer. The ID of the instrument being traded. required. |
| UseDisplayQuantity | boolean. The display quantity is the quantity of a product shown to the market to buy or sell. A larger quantity may be wanted or available, but it may disadvantageous to display it when buying or selling. The display quantity is set when placing an order (using SendOrder or CancelReplaceOrder for instance). If you enter a Limit order with reserve, you must set useDisplayQuantity to true. optional. |
| DisplayQuantity | decimal. The quantity of a product that is available to buy or sell that is publicly displayed to the market or simply in the orderbook. Will be used when UseDisplayQuantity is set to true, and in that case it needs to be defined else order will not appear in the order book as it will default to 0. optional. |
| LimitPrice | decimal. The price at which to execute the new order, if the new order is a limit order. If the replacement order is a market order, there is no need to define this field. Expressed in ticks for trailing stops. conditionally required. |
| StopPrice | decimal. The price at which to execute the new order if the replacement order is a stop order. If the replacement order is a not a stop order, there is no need to define this field. Expressed in ticks for trailing stops. conditionally required. |
| ReferencePrice | decimal. Used if the replacement order is trailing order. If the replacement order is not a trailing order, there is no need to define this field. conditionally required. |
| PegPriceType | integer or string. The type of price you set in a stop/trailing order to "peg the stop." 0 Unknown (error condition) 1 Last 2 Bid 3 Ask 4 Midpoint.Either the integer or string value is accepted. If the replacement order is not a trailing/stop order, there is no need to define this field. conditionally required. |
| TimeInForce | integer or string. Represents the period during which the new order is executable. One of: 0 Unknown (error condition) 1 GTC (good 'til canceled, the default) 2 OPG (execute as close to opening price as possible: not yet used, for future provision) 3 IOC (immediate or canceled) 4 FOK (fill or kill — fill the order immediately, or cancel it immediately) 5 GTX (good 'til executed: not yet used, for future provision) 6 GTD (good 'til date: not yet used, for future provision). Either the integer or string value is accepted. required. |
| OrderIdOCO | integer. One Cancels the Other — If the order being canceled in this call is order A, and the order replacing order A in this call is order B, then OrderIdOCO refers to an order C that is currently open. If order C executes, then order B is canceled. You can also set up order C to watch order B in this way, but that will require an update to order C. Orderid to link this order to for OCO, negative values represent ordinal offset to current orderid, i.e., -1 = previous order. optional. |
| Quantity | decimal. The quantity of the replacement order. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104), Order Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
ModifyOrder
Permissions: Operator, Trading
Call Type: Synchronous
Reduces an order’s quantity without losing priority in the order book. An order’s quantity can only be reduced. The other call that can modify an order — CancelReplaceOrder — resets order book priority, but you can use it to increase an order quantity and also change the limitprice.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ModifyOrder", {
OMSId: 1,
OrderId: 6507,
InstrumentId: 9,
Quantity: 0.1,
AccountId: 9,
});
POST /AP/ModifyOrder HTTP/1.1
Host: hostname goes here...
aptoken: 356cdf76-b767-4af5-890e-837ea17030d0
Content-Type: application/json
Content-Length: 109
{
"OMSId": 1,
"OrderId": 6507,
"InstrumentId": 9,
"Quantity": 0.1,
"AccountId": 9
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the original order was placed. required. |
| OrderId | long integer. The ID of the order to be modified. The ID was supplied by the server when the order was created. required. |
| InstrumentId | integer. The ID of the instrument traded in the order. required. |
| Quantity | decimal. The new quantity of the order. This value can only be reduced from a previous quantity. required. |
| AccountId | integer. Account for which order will be modified. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
//Possible error/s
//Quantity defined is greater than the existing quantity of the order being modified. This API can only reduce the quantity of the existing order.
{
"result": false,
"errormsg": "Invalid Quantity",
"errorcode": 100,
"detail": null
}
//One or more required fields are not defined
{
"result": false,
"errormsg": "Invalid Request",
"errorcode": 100,
"detail": "Not all required fields are provided"
}
The response acknowledges the successful receipt of your request to modify an order; it does not indicate that the order has been modified. To find if an order has been modified, check using GetOpenOrders and GetOrderHistory.
| Key | Value |
|---|---|
| result | boolean. The successful receipt of a modify order request returns true; otherwise, returns false. This is the acknowledgment of receipt of the request to modify, not a confirmation that the modification has taken place. |
| errormsg | string. A successful receipt of a modify request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Invalid Quantity (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| errorcode | integer. The receipt of a successful request to modify returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
CancelAllOrders
Permissions: Operator, Trading
Call Type: Synchronous
Cancels all open matching orders for the specified account on an OMS.
A user with Trading permission can cancel orders for accounts it is associated with; a user with Operator permissions can cancel orders for any account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Cancel all orders of a specific account for a specific instrument
await apex.RPCPromise("CancelAllOrders", {
OMSId: 1,
AccountId: 9,
InstrumentId: 1,
});
//Cancel all orders of all accounts for a specific instrument
await apex.RPCPromise("CancelAllOrders", {
OMSId: 1,
AccountId: 0,
InstrumentId: 1,
});
//Cancel all orders of all accounts for all instruments
await apex.RPCPromise("CancelAllOrders", {
OMSId: 1,
AccountId: 0,
InstrumentId: 0,
});
POST /AP/CancelAllOrders HTTP/1.1
Host: hostname goes here...
aptoken: 0b9e03f8-40c8-4653-b52f-1e75e9f9cd0b //valid sessiontoken
Content-Type: application/json
Content-Length: 60
//Cancel all orders of a specific account for a specific instrument
{
"OMSId": 1,
"AccountId": 9,
"InstrumentId": 1
}
//Cancel all orders of all accounts for a specific instrument
{
"OMSId": 1,
"AccountId": 0,
"InstrumentId": 1
}
//Cancel all orders of all accounts for all instruments
{
"OMSId": 1,
"AccountId": 0,
"InstrumentId": 0
}
| Key | Value |
|---|---|
| AccountId | integer. The account for which all orders are being canceled. If no AccountId is defined, orders for all accounts will be cancelled. optional. |
| OMSId | integer. The OMS under which the account operates. required.. |
| IntrumentId | integer. The instrument for which all orders are being canceled. If there is no instrumentid defined, all orders for all instruments will be cancelled. optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
The Response is a standard response object.
| Key | Value |
|---|---|
| result | boolean. If the call has been successfully received by the OMS, result is true; otherwise it is false. |
| errormsg | string. A successful receipt of the call returns null. The errormsg key for an unsuccessful call returns one of the following messages: Not Authorized (errorcode 20) Invalid Response (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) Operation Not Supported (errorcode 106) |
| errorcode | integer. A successful receipt of the call returns 0. An unsuccessful receipt of the call returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. |
GetOrderStatus
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves the status information for a single order.
A user with Trading permission can retrieve status information for accounts and orders with which the user is associated; a user with Operator permission can retreive status information for any account or order ID.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrderStatus", {
OMSId: 1,
AccountId: 7,
OrderId: 6562,
});
POST /AP/GetOrderStatus HTTP/1.1
Host: hostname goes here...
aptoken: f7e2c811-a9db-454e-9c9e-77533baf92d9 //valid session token
Content-Type: application/json
Content-Length: 63
{
"OMSId": 1,
"AccountId": 7,
"OrderId": 6562
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the order was placed. optional. |
| AccountId | integer. The ID of the account under which the order was placed. If the authenticated user has elevated permission such as SUPERUSER, AccountId is not explicitly required. conditionally required. |
| OrderId | integer. The ID of the order whose status will be returned. If the authenticated user has elevated permission such as SUPERUSER, OrderId is not explicitly required. conditionally required. |
Response
{
"Side": "Buy",
"OrderId": 6562,
"Price": 23436.0,
"Quantity": 0.02,
"DisplayQuantity": 0.0,
"Instrument": 1,
"Account": 7,
"AccountName": "sample",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1680020672485,
"ReceiveTimeTicks": 638156174724846502,
"LastUpdatedTime": 1680020672485,
"LastUpdatedTimeTicks": 638156174724852936,
"OrigQuantity": 0.02,
"QuantityExecuted": 0.0,
"GrossValueExecuted": 0.0,
"ExecutableValue": 0.0,
"AvgPrice": 0.0,
"CounterPartyId": 0,
"ChangeReason": "NewInputAccepted",
"OrigOrderId": 6562,
"OrigClOrdId": 0,
"EnteredBy": 0,
"UserName": "",
"IsQuote": false,
"InsideAsk": 29000.0,
"InsideAskSize": 0.52,
"InsideBid": 23436.0,
"InsideBidSize": 0.0,
"LastTradePrice": 29000.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "AddedToBook",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Ask",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": null,
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
The call GetOrderStatus returns a JSON object which contains the data of a specific order.
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which submitted the order. |
| AccountName | string. Name of the of the account which submitted the order. |
| OrderType | string. Will always be BlockTrade as this GetOpenTradeReports API will only return open blocktrades. |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current or the latest state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 FullyExecuted. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. Usually returns as an empty string. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One of the following: NoAccountRiskCheck, AddedToBook, RemovedFromBook, PostOnly, Liquidation, ReverseMarginPosition, Synthetic. |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| OMSId | integer. The ID of the OMS. |
GetOrdersHistory
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves a history of orders for the specified search parameters.
For example, if depth = 200 and startIndex = 0, the history returns 200 unique orders into the past starting with the most recent (0) order. If depth = 200 and startIndex = 100, the history returns 200 unique orders into the past starting at 101st order in the past.
The owner of the trading venue determines how long to retain order history before archiving.
A user with Trading permission can retrieve orders history only for accounts it is associated with; a user with Operator permission can retrieve orders history for any user or account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrdersHistory", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetOrdersHistory HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the orders took place. If no other values are specified, the call returns the orders associated with the default account for the logged-in user on this OMS. required. |
| AccountId | integer. The account ID that made the trades. A user with Trading permission must be associated with this account, although other users also can be associated with the account. Not explicitly required if the authenticated user has elevated permission/s. conditionally required. |
| OrderState | string. The current state of the order. Can be used to filter results. If not specified all orders regardless of the order state will be returned. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 FullyExecuted. optional. |
| OrderId | long integer. ID for the order.Can be used to filter results. Can be used to filter for a specific orderid. There is a specific API call GetOrderHistoryByOrderId for filtering orders by OrderId. optional. |
| ClientOrderId | long integer. A user-assigned ID for the order (like a purchase-order number assigned by a company).Can be used to filter results. clientOrderId defaults to 0. optional. |
| OriginalOrderId | long integer. The original ID of the order. If specified, the call returns changed orders associated with this order ID. Can be used to filter results. optional. |
| OriginalClientOrderId | long integer. If the order has been changed, shows the original client order ID, a value that the client can create (much like a purchase order). Can be used to filter results. optional. |
| UserId | integer. The ID of the user whose account orders will be returned. If not specified, the call returns the orders of the logged-in user.Can be used to filter results. optional. |
| InstrumentId | long integer. The ID of the instrument named in the order. If not specified, the call returns orders for all instruments traded by this account. Can be used to filter results. optional. |
| StartTimestamp | long integer. Date and time at which to begin the orders history, in POSIX format. Can be used to filter results. optional. |
| EndTimestamp | long integer. Date and time at which to end the orders report, in POSIX format. Can be used to filter results. optional. |
| Depth | integer. In this case, the maximum number/count of unique orders to return, counting from the StartIndex if it is also specified. If not specified, returns the 100 most recent to orders; results can vary depending if other optional fields are defined such as StartIndex, StartTimestamp, and EndTimestamp. Can be used to filter results and for pagination. optional. |
| Limit | integer. Functions exactly the same as the Depth field. optional. |
| StartIndex | integer. A value of 0 means the first object in the result will be the the most recent order, a value of 2 means that the first object in the result set will be the third most recent order. If not specified, defaults to 0. Can be used to filter results or for pagination. optional. |
Response
[
{
"Side": "Sell",
"OrderId": 6713,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663431785,
"ReceiveTimeTicks": 638182602317851821,
"LastUpdatedTime": 1682663431791,
"LastUpdatedTimeTicks": 638182602317910891,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6713,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 6000.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Sell",
"OrderId": 6709,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663089848,
"ReceiveTimeTicks": 638182598898484597,
"LastUpdatedTime": 1682663089923,
"LastUpdatedTimeTicks": 638182598899230197,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6709,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 0.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
The call GetOrdersHistory returns an array or objects, each object represents an order at its latest status; an order will only occupy 1 index or just 1 instance in the result. GetOrdersHistory API does not return the full history of a specific order, there is another API that will give you just that: GetOrderHistoryByOrderId.
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which the order belongs to. |
| AccountName | string. Name of the of the account which which the order belongs to. |
| OrderType | string. Describes the type of order this is. One of: 0 Unknown (an error condition) 1 Market order 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current or the latest state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 Fully Executed. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| LastUpdatedTime | long integer. Time stamp when the order was last updated, in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| LastUpdatedTimeTicks | long integer. Time stamp when the order was last updated, in Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| ExecutableValue | decimal. Defaults to 0. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | long integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | long integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One or more of: 1 NoAccountRiskCheck 2 AddedToBook 4 RemovedFromBook 8 PostOnly 16 Liquidation 32 ReverseMarginPosition |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| OMSId | integer. The ID of the OMS. |
GetTradesHistory
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves a list of trades for a specified account, order ID, user, instrument, or starting and ending time stamp. The returned list begins at start index i, where i is an integer identifying a specific trade in reverse order; that is, the most recent trade has an index of 0. “Depth” is the count of trades to report backwards from StartIndex.
Users with Trading permission can retrieve trade history for accounts with which they are associated; users with Operator permission can retrieve trade history for any account.
Request
All values in the request other than OMSId are optional.
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTradesHistory", {
OMSId: 1,
AccountId: 7,
Depth: 2,
});
POST /AP/GetTradesHistory HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: d7676b7e-0290-1ad2-c08a-1280888ffda7
Content-Length: 211
{
"OMSId": 1,
"AccountId": 7,
"Depth": 2,
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the trades took place. required. |
| AccountId | integer. The account ID that made the trades. If no account ID is supplied, the system assumes the default account for the logged-in user making the call. optional. |
| InstrumentId | integer. The ID of the instrument whose trade history is reported. If not specified, defaults to 0 which means results won't be filtered according to it. optional. |
| TradeId | long integer. The ID of a specific trade. optional. |
| OrderId | long integer. The ID of the order resulting in the trade. If specified, the call returns all trades associated with the order. If not specified, defaults to 0 which means results won't be filtered according to it. optional. |
| UserId | integer. If not specified, the call returns trades associated with the users belonging to the default account for the logged-in user. optional. |
| StartTimeStamp | long integer. The historical date and time at which to begin the trade report, in POSIX format. If not specified, defaults to 0 which means results won't be filtered according to it. Value must be in milliseconds if to be used. optional. |
| EndTimeStamp | long integer. Date and time at which to end the trade report, in POSIX format. If not specified, defaults to 0 which means results won't be filtered according to it. Value must be in milliseconds if to be used. optional. |
| Depth | integer. In this case, the count of trades to return, counting from the StartIndex. If Depth is not specified, returns all trades between BeginTimeStamp and EndTimeStamp, beginning at StartIndex. If no other filter parameter is defined, the maximum will result set will be according to the MaxApiResponseResultSet Gateway config value. optional. |
| StartIndex | integer. The starting index into the history of trades, from 0 (the most recent trade) and moving backwards in time. If not specified, defaults to 0 which means results won't be filtered according to it. optional. |
| ExecutionId | integer. The ID of the individual buy or sell execution. If not specified, defaults to 0 which means results won't be filtered according to it. optional. |
Response
[
{
"OMSId": 1,
"ExecutionId": 1928,
"TradeId": 964,
"OrderId": 6713,
"AccountId": 7,
"AccountName": "sample",
"SubAccountId": 0,
"ClientOrderId": 0,
"InstrumentId": 11,
"Side": "Sell",
"OrderType": "Market",
"Quantity": 0.01,
"RemainingQuantity": 0.0,
"Price": 6000.0,
"Value": 60.0,
"CounterParty": "185",
"OrderTradeRevision": 1,
"Direction": "NoChange",
"IsBlockTrade": false,
"Fee": 0.0,
"FeeProductId": 0,
"OrderOriginator": 6,
"UserName": "sample_user",
"TradeTimeMS": 1682663431787,
"MakerTaker": "Taker",
"AdapterTradeId": 0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"IsQuote": false,
"CounterPartyClientUserId": 1,
"NotionalProductId": 1,
"NotionalRate": 1.0,
"NotionalValue": 60.0,
"NotionalHoldAmount": 0,
"TradeTime": 638182602317874025
},
{
"OMSId": 1,
"ExecutionId": 1924,
"TradeId": 962,
"OrderId": 6709,
"AccountId": 7,
"AccountName": "sample",
"SubAccountId": 0,
"ClientOrderId": 0,
"InstrumentId": 11,
"Side": "Sell",
"OrderType": "Market",
"Quantity": 0.01,
"RemainingQuantity": 0.0,
"Price": 6000.0,
"Value": 60.0,
"CounterParty": "9",
"OrderTradeRevision": 1,
"Direction": "NoChange",
"IsBlockTrade": false,
"Fee": 0.0,
"FeeProductId": 0,
"OrderOriginator": 6,
"UserName": "sample_user",
"TradeTimeMS": 1682663089862,
"MakerTaker": "Taker",
"AdapterTradeId": 0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"IsQuote": false,
"CounterPartyClientUserId": 1,
"NotionalProductId": 1,
"NotionalRate": 1.0,
"NotionalValue": 60.0,
"NotionalHoldAmount": 0,
"TradeTime": 638182598898615128
}
]
The response is an array of objects, each element represents a single trade.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS to which the account belongs. |
| ExecutionId | integer. The ID of this account's side of the trade. Every trade has two sides. |
| TradeId | long integer. The ID of the overall trade. |
| OrderId | long integer. The ID of the order causing the trade (buy or sell). |
| AccountId | integer. The ID of the account that made the trade (buy or sell). |
| AccountName | string. The Name of the account that made the trade (buy or sell). |
| SubAccountId | integer. Not currently used; reserved for future use. Defaults to 0. |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The clientOrderId defaults to 0 if not supplied. |
| InstrumentId | integer. The ID of the instrument being traded. An instrument comprises two products, for example Dollars and Bitcoin. |
| Side | string. One of the following potential sides of a trade: 0 Buy 1 Sell |
| OrderType | string. One of the following potential sides of a trade: Market Limit BlockTrade StopMarket StopLimit TrailingStopLimit StopMarket TrailingStopMarket |
| Quantity | decimal. The unit quantity of this side of the trade. |
| RemainingQuantity | decimal. The number of units remaining to be traded by the order after this execution. This number is not revealed to the other party in the trade. This value is also known as "leave size" or "leave quantity." |
| Price | decimal. The unit price at which the instrument traded. |
| Value | decimal. The total value of the deal. The system calculates this as: unit price X quantity executed. |
| CounterParty | string. The ID of the other party in a block trade. Usually, IDs are stated as integers; this value is an integer written as a string. |
| OrderTradeRevision | integer. The revision number of this trade; usually 1. |
| Direction | integer. The effect of the trade on the instrument's market price. One of: 0 No change 1 Uptick 2 DownTick |
| IsBlockTrade | boolean. A value of true means that this trade was a block trade; a value of false that it was not a block trade. |
| Fee | decimal. Any fee levied against the trade by the Exchange. |
| FeeProductId | integer. The ID of the product in which the fee was levied. |
| OrderOriginator | integer. The ID of the user who initiated the trade. |
| UserName | string. The UserName of the user who initiated the trade. |
| TradeTimeMS | long integer. The date and time that the trade took place, in milliseconds and POSIX format. All dates and times are UTC. |
| MakerTaker | string. One of the following potential liquidity provider of a trade: Maker Taker |
| AdapterTradeId | integer. The ID of the adapter of the overall trade. |
| InsideBid | decimal. The best (highest) price level of the buy side of the book at the time of the trade. |
| InsideBidSize | decimal. The quantity of the best (highest) price level of the buy side of the book at the time of the trade. |
| InsideAsk | decimal. The best (lowest) price level of the sell side of the book at the time of the trade. |
| InsideAskSize | decimal. The quantity of the best (lowest) price level of the sell side of the book at the time of the trade. |
| CounterPartyClientUserId | integer. Indicates counterparty source of trade (OMS, Remarketer, FIX) |
| NotionalProductId | integer. Notional product the notional value was captured in |
| NotionalRate | decimal. Notional rate from base currency at time of trade |
| NotionalValue | decimal. Notional value in base currency of venue at time of trade |
| TradeTime | long integer. The date and time that the trade took place, in C# Ticks. All dates and times are UTC. |
GetOrderHistoryByOrderId
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves an order with the specified OrderId, includes all the history of that specific order, from being added to the book up to the full execution or rejection, or cancellation. ReceiveTime in POSIX format X 1000 (milliseconds since 1 January 1970)
A user with Trading permission can retrieve an order history only for his/her account/s; a user with Operator permission can retrieve order history for all accounts.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrderHistoryByOrderId", {
OMSId: 1,
OrderId: 6459,
});
POST /AP/GetOrderHistoryByOrderId HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 42
{
"OMSId": 1,
"OrderId": 6459
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| OrderId | long integer. The ID of the of the order which you want to get details and history of. Not explicitly required but no order will be retrieved if not defined. required. |
Response
[
{
"Side": "Buy",
"OrderId": 6459,
"Price": 1.3638,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 9,
"Account": 7,
"AccountName": "sample_user",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1678263954878,
"ReceiveTimeTicks": 638138607548778980,
"LastUpdatedTime": 1678263960020,
"LastUpdatedTimeTicks": 638138607600197010,
"OrigQuantity": 18307.63,
"QuantityExecuted": 18307.63,
"GrossValueExecuted": 24966.439664,
"ExecutableValue": 0.0,
"AvgPrice": 1.3637177321149706433874837977,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6455,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_superuser",
"IsQuote": false,
"InsideAsk": 1.3646,
"InsideAskSize": 8959.3,
"InsideBid": 1.3638,
"InsideBidSize": 10776.98,
"LastTradePrice": 1.3636,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "AddedToBook, RemovedFromBook",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Last",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Buy",
"OrderId": 6459,
"Price": 1.3638,
"Quantity": 10776.98,
"DisplayQuantity": 10776.98,
"Instrument": 9,
"Account": 7,
"AccountName": "sample_user",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1678263954878,
"ReceiveTimeTicks": 638138607548778980,
"LastUpdatedTime": 1678263954881,
"LastUpdatedTimeTicks": 638138607548809830,
"OrigQuantity": 18307.63,
"QuantityExecuted": 7530.65,
"GrossValueExecuted": 10268.79434,
"ExecutableValue": 0.0,
"AvgPrice": 1.3636,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6455,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_superuser",
"IsQuote": false,
"InsideAsk": 1.3646,
"InsideAskSize": 8959.3,
"InsideBid": 1.3638,
"InsideBidSize": 10776.98,
"LastTradePrice": 1.3636,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "AddedToBook",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Last",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Buy",
"OrderId": 6459,
"Price": 1.3638,
"Quantity": 10776.98,
"DisplayQuantity": 10776.98,
"Instrument": 9,
"Account": 7,
"AccountName": "sample_user",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1678263954878,
"ReceiveTimeTicks": 638138607548778980,
"LastUpdatedTime": 1678263954881,
"LastUpdatedTimeTicks": 638138607548807642,
"OrigQuantity": 18307.63,
"QuantityExecuted": 7530.65,
"GrossValueExecuted": 10268.79434,
"ExecutableValue": 0.0,
"AvgPrice": 1.3636,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6455,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_superuser",
"IsQuote": false,
"InsideAsk": 1.3636,
"InsideAskSize": 7530.65,
"InsideBid": 0.0,
"InsideBidSize": 0.0,
"LastTradePrice": 1.3636,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Last",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Buy",
"OrderId": 6459,
"Price": 1.3638,
"Quantity": 18307.63,
"DisplayQuantity": 18307.63,
"Instrument": 9,
"Account": 7,
"AccountName": "sample_user",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1678263954878,
"ReceiveTimeTicks": 638138607548778980,
"LastUpdatedTime": 1678263954880,
"LastUpdatedTimeTicks": 638138607548795384,
"OrigQuantity": 18307.63,
"QuantityExecuted": 0.0,
"GrossValueExecuted": 0.0,
"ExecutableValue": 0.0,
"AvgPrice": 0.0,
"CounterPartyId": 0,
"ChangeReason": "NewInputAccepted",
"OrigOrderId": 6455,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_superuser",
"IsQuote": false,
"InsideAsk": 1.3636,
"InsideAskSize": 7530.65,
"InsideBid": 0.0,
"InsideBidSize": 0.0,
"LastTradePrice": 1.3636,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Last",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
Returns the full history of a specific order or simply all the orderstates that the order went through. Response is an array of objects, each object represents the order itself in a specific orderstate.
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which the order belongs to. |
| AccountName | string. Name of the of the account which which the order belongs to. |
| OrderType | string. Describes the type of order this is. One of: 0 Unknown (an error condition) 1 Market order 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current or the latest state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 Fully Executed. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| LastUpdatedTime | long integer. Time stamp when the order was last updated, UNIX timestamp format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| LastUpdatedTimeTicks | long integer. Time stamp when the order was last updated, in Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| ExecutableValue | decimal. Defaults to 0. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | long integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | long integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One or more of: 1 NoAccountRiskCheck 2 AddedToBook 4 RemovedFromBook 8 PostOnly 16 Liquidation 32 ReverseMarginPosition |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| OMSId | integer. The ID of the OMS. |
GetTickerHistory
Permissions: Public
Call Type: Synchronous
Requests a ticker history (high, low, open, close, volume, bid, ask, ID) of a specific instrument from the given FromDate up to the ToDate in the request payload. You will need to format the returned data per your requirements.
Because permission is Public, any user can retrieve the ticker history for any instrument on the OMS.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTickerHistory", {
InstrumentId: 1,
Interval: 60,
FromDate: "2023-01-18 01:02:03",
ToDate: "2023-08-31 23:59:59",
OMSId: 1,
});
POST /AP/GetTickerHistory HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 117
{
"InstrumentId": 1,
"Interval": 60,
"FromDate": "2023-01-18 01:02:03",
"ToDate": "2023-08-31 23:59:59",
"OMSId": 1
}
| Key | Value |
|---|---|
| InstrumentId | integer. The ID of a specific instrument. required. |
| Interval | integer. The time between ticks, in seconds. For example, a value of 60 returns ticker array elements between FromDate to ToDate in 60-second increments. required. |
| FromDate | string. Oldest date from which the ticker history will start; in DateTime format. If hour:minutes:seconds is not defined, it defaults to 00:00:00. required. |
| ToDate | string. Most recent date, at which the ticker history will end; in DateTime format. If hour:minutes:seconds is not defined, it defaults to 00:00:00. required. |
| OMSId | integer. The ID of the OMS. required. |
Response
The response is an array of arrays of comma-separated, but unlabeled, numbers. This sample shows comments applied to identify the data being returned (comments are not part of the response:
[
[
1692926460000, //EndDateTime
28432.44, //High
28432.44, //Low
28432.44, //Open
28432.44, //Close
0, //Volume
0, //Best Bid
0, //Best Ask
1, //InstrumentId
1692926400000 //BeginDateTime
]
];
Returns an array of arrays dating from the FromDate value of the request to the ToDate. The data are returned oldest-date first. The data returned in the arrays are not labeled.
| Key | Value |
|---|---|
| EndDateTime | long integer. The end/closing date and time of the ticker, in UTC and POSIX format. |
| High | decimal. The Highest Trade Price for the Time-Period ( 0 if no trades ). |
| Low | decimal. The Lowest Trade Price for the Time-Period ( 0 if no trades ). |
| Open | decimal. The Opening Trade Price for the Time-Period ( 0 if no trades ). |
| Close | decimal. The Last Trade Price for the Time-Period ( 0 if no trades ). |
| Volume | decimal. The Total Trade Volume since the last Tick. |
| Bid | decimal. The best bid price at the time of the Tick. |
| Ask | decimal. The best ask price at the time of the Tick. |
| InstrumentId | integer. The ID of the instrument. |
| BeginDateTime | long integer. The start/opening date and time of the ticker, in UTC and POSIX format. |
GetLastTrades
Permissions: Public, Trading
Call Type: Synchronous
Gets the trades that happened for a specific instrument, parameter Count can be set to limit the results, number of results defaults to 100 if not defined.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Get all trades for instrument id 1
await apex.RPCPromise("GetLastTrades", {
InstrumentId: 1,
OMSId: 1,
});
//Get the 10 most recent trades for instrumentid 1
await apex.RPCPromise("GetLastTrades", {
InstrumentId: 1,
OMSId: 1,
Count: 10,
});
POST /AP/GetLastTrades HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 48
//Get all trades for instrument id 1
{
"OMSId": 1,
"InstrumentId": 1
}
//Get the 10 most recent trades for instrumentid 1
{
"OMSId": 1,
"InstrumentId": 1,
"Count": 10
}
| Key | Value |
|---|---|
| InstrumentId | The id of the instrument, symbol is not accepted.If you don't specify this, response will have the current timestamp which is not valid. required. |
| OMSId | ID of the OMS where the pair or instrument is being traded. required. |
| Count | Value represents the number of trades you want to get, value of 10 will return 10 most recent trades. If not set, 100 most recent trades for the instrument will be included in the results. optional. |
Response
[
[14, 2, 0.02, 1970, 5922, 5923, 1675332676849, 1, 0, 0, 0],
[15, 2, 0.98, 1970, 5922, 6012, 1676397856371, 0, 0, 0, 0],
];
Returns an object with multiple arrays as a response, each array represents 1 trade.
| Key | Value |
|---|---|
| 0 (TradeId) | integer. The ID of this trade. |
| 1 (InstrumentId) | integer. The ID of the instrument. |
| 2 (Quantity) | decimal. The quantity of the instrument traded. |
| 3 (Price) | decimal. The price at which the instrument was traded. |
| 4 (Order1) | integer. The ID of the first order that resulted in the trade, either Buy or Sell. |
| 5 (Order2) | integer. The ID of the second order that resulted in the trade, either Buy or Sell. |
| 6 (Tradetime) | long integer. UTC trade time in Total Milliseconds. POSIX format. |
| 7 (Direction) | integer. Effect of the trade on the instrument’s market price. One of: 0 NoChange 1 UpTick 2 DownTick |
| 8 (TakerSide) | integer. Which side of the trade took liquidity? One of: 0 Buy 1 Sell The maker side of the trade provides liquidity by placing the order on the book (this can be a buy or a sell order). The other, taker, side takes the liquidity. It, too, can be buy-side or sell-side. |
| 9 (BlockTrade) | boolean. Was this a privately negotiated trade that was reported to the OMS? A private trade returns 1 (true); otherwise 0 (false). Default is false. Block trades are not supported in exchange version 3.1 |
| 10 (order1ClientId or order2ClientId) | integer. The client-supplied order ID for the trade. Internal logic determines whether the program reports the order1ClientId or the order2ClientId. |
GetLevel1Summary
Permissions: Trading, Public
Call Type: Synchronous
Provides a current Level 1 snapshot (best bid, best offer and other data such lasttradedprice) of all instruments trading on an OMS.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetLevel1Summary", {
OMSId: 1,
});
POST /AP/GetLevel1Summary HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 27
{
"OMSId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
Response
[
"{ \"OMSId\":1, \"InstrumentId\":1, \"BestBid\":30000, \"BestOffer\":32000, \"LastTradedPx\":29354.89, \"LastTradedQty\":0.2563, \"LastTradeTime\":1690773094972, \"SessionOpen\":0, \"SessionHigh\":0, \"SessionLow\":0, \"SessionClose\":29354.89, \"Volume\":0.2563, \"CurrentDayVolume\":0, \"CurrentDayNotional\":0, \"CurrentDayNumTrades\":0, \"CurrentDayPxChange\":0, \"Rolling24HrVolume\":0.0000000000000000000000000000, \"Rolling24HrNotional\":0.000000000000000000000000, \"Rolling24NumTrades\":0, \"Rolling24HrPxChange\":0, \"TimeStamp\":\"1690782922150\", \"BidQty\":1, \"AskQty\":1, \"BidOrderCt\":0, \"AskOrderCt\":0, \"Rolling24HrPxChangePercent\":0 }",
"{ \"OMSId\":1, \"InstrumentId\":2, \"BestBid\":0, \"BestOffer\":0, \"LastTradedPx\":2500, \"LastTradedQty\":1, \"LastTradeTime\":1689087260408, \"SessionOpen\":0, \"SessionHigh\":0, \"SessionLow\":0, \"SessionClose\":2500, \"Volume\":1, \"CurrentDayVolume\":0, \"CurrentDayNotional\":0, \"CurrentDayNumTrades\":0, \"CurrentDayPxChange\":0, \"Rolling24HrVolume\":0.0000, \"Rolling24HrNotional\":0.0000, \"Rolling24NumTrades\":0, \"Rolling24HrPxChange\":0, \"TimeStamp\":\"1690782922150\", \"BidQty\":0, \"AskQty\":0, \"BidOrderCt\":0, \"AskOrderCt\":0, \"Rolling24HrPxChangePercent\":0 }",
"{ \"OMSId\":1, \"InstrumentId\":3, \"BestBid\":0, \"BestOffer\":0, \"LastTradedPx\":9.66, \"LastTradedQty\":0.001, \"LastTradeTime\":1656645761755, \"SessionOpen\":0, \"SessionHigh\":0, \"SessionLow\":0, \"SessionClose\":9.66, \"Volume\":0.001, \"CurrentDayVolume\":0, \"CurrentDayNotional\":0, \"CurrentDayNumTrades\":0, \"CurrentDayPxChange\":0, \"Rolling24HrVolume\":0.000, \"Rolling24HrNotional\":0.00000, \"Rolling24NumTrades\":0, \"Rolling24HrPxChange\":0, \"TimeStamp\":\"1690782921869\", \"BidQty\":0, \"AskQty\":0, \"BidOrderCt\":0, \"AskOrderCt\":0, \"Rolling24HrPxChangePercent\":0 }"
]
Returns an array with multiple objects, each object represents the Level1 data of a specific instrument.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| InstrumentId | integer. The ID of the instrument being tracked. |
| BestBid | decimal. The current best bid for the instrument. |
| BestOffer | decimal. The current best offer for the instrument. |
| LastTradedPx | decimal. The last-traded price for the instrument. |
| LastTradedQty | decimal. The last-traded quantity for the instrument. |
| LastTradeTime | long integer. The time of the last trade, in POSIX format. |
| SessionOpen | decimal. Opening price. In markets with openings and closings, this is the opening price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| SessionHigh | decimal. Highest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionLow | decimal. Lowest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionClose | decimal. The closing price. In markets with openings and closings, this is the closing price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| Volume | decimal. The last-traded quantity for the instrument, same value as LastTradedQty |
| CurrentDayVolume | decimal. The unit volume of the instrument traded either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayNumTrades | integer. The number of trades during the current day, either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayPxChange | decimal. Current day price change, either during a trading session or UTC Midnight to UTC midnight. |
| CurrentNotional | decimal. Current day quote volume - resets at UTC Midnight. |
| Rolling24HrNotional | decimal. Rolling 24 hours quote volume. |
| Rolling24HrVolume | decimal. Unit volume of the instrument during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrNumTrades | integer. Number of trades during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrPxChange | decimal. Price change during the past 24 hours, regardless of time zone. Recalculates continuously. |
| TimeStamp | string. The time this information was provided, in POSIX format. |
| BidQty | decimal. The quantity currently being bid. |
| AskQty | decimal. The quantity currently being asked. |
| BidOrderCt | integer. The count of bid orders. |
| AskOrderCt | integer. The count of ask orders. |
| Rolling24HrPxChangePercent | decimal. Percent change in price during the past 24hours. |
GetLevel1SummaryMin
Permissions: Trading, Public
Call Type: Synchronous
Retrieves the latest Level 1 Snapshot of all markets/instruments. Snapshot includes LastTradedPx, Rolling24HrPxChange, Rolling24HrPxChangePercent, Rolling24HrVolume. Can also be filtered according to instrument ids.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetLevel1SummaryMin", {
OMSId: 1,
InstrumentIds: "[1,2,3]",
});
POST /AP/GetLevel1SummaryMin HTTP/1.1
Host: hostname goes here...
aptoken: 11882457-4c83-4d7a-a932-890ec3ac5aa2
Content-Type: application/json
Content-Length: 48
{
"OMSId": 1,
"InstrumentIds":"[1]"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentIds | string. An array but will be passed as a string. List of instrument ids to get level1 summary of. If this field is not specified, level1 summary of all instruments will be returned. optional. |
Response
[
[
1, //InstrumentId
"BTCUSD", //Instrument symbol
29900, //LastTradedPx
-1100, //Rolling24HrPxChange
-3.5483870967741935483870967700, //Rolling24HrPxChangePercent
0.0021000000000000000000000000 //Rolling24HrVolume
],
[
2,
"ETHUSD",
20030,
0,
0,
0.0000
]
]
| Key | Value |
|---|---|
| InstrumentId | integer. The ID of the instrument. |
| InstrumentSymbol | string. The symbol of the instrument. |
| LastTradedPX | decimal. The last-traded price for the instrument. |
| Rolling24HrVolume | decimal. The unit volume of the instrument that is the subject of the snapshot during the past 24 hours. |
| Rolling24HrPxChange | decimal. Change in price during the past 24 hours. |
| Rolling24HrPxChangePercent | decimal. Percent change in price during the past 24 hours. |
GetOpenTradeReports
Permissions: Operator,Trading,AccountReadOnly,Manual Trader
Call Type: Synchronous
Retrieves the Open Trade Reports(block trades), for the given accountId. ReceiveTime in POSIX format X 1000 (milliseconds since 1 January 1970)
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOpenTradeReports", {
OMSId: 1,
AccountId: 1,
});
POST /AP/GetOpenTradeReports HTTP/1.1
Host: hostname goes here...
aptoken: cf165646-2021-4460-9fc4-234e0cec454b
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account whose open blocktrade/s will be retrieved. required. |
Response
[
{
"Side": "Buy",
"OrderId": 6723,
"Price": 29500,
"Quantity": 0.2563,
"DisplayQuantity": 0.2563,
"Instrument": 1,
"Account": 9,
"AccountName": "AnotherName",
"OrderType": "BlockTrade",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1683190853154,
"ReceiveTimeTicks": 638187876531538042,
"LastUpdatedTime": 1683190853159,
"LastUpdatedTimeTicks": 638187876531592832,
"OrigQuantity": 0.2563,
"QuantityExecuted": 0,
"GrossValueExecuted": 0,
"ExecutableValue": 0,
"AvgPrice": 0,
"CounterPartyId": 7,
"ChangeReason": "NewInputAccepted",
"OrigOrderId": 6723,
"OrigClOrdId": 0,
"EnteredBy": 1,
"UserName": "admin",
"IsQuote": false,
"InsideAsk": 31000,
"InsideAskSize": 0.5,
"InsideBid": 30000,
"InsideBidSize": 0.5,
"LastTradePrice": 30500,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0,
"PegPriceType": "Last",
"PegOffset": 0,
"PegLimitOffset": 0,
"IpAddress": null,
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which submitted the order. |
| AccountName | string. Name of the of the account which submitted the order. |
| OrderType | string. Will always be BlockTrade as this GetOpenTradeReports API will only return open blocktrades. |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 FullyExecuted. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who will be the counter party of the blocktrade. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified |
| OrigOrderId | integer. If the order has been changed, this is the ID of the original order. |
| OrigClOrdId | integer. If the order has been changed, this is the ID of the original client order ID. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | integer. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote API), the value for IsQuote is true, else false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Not applicable for an order resulting from SubmitBlockTrade |
| PegPriceType | string. Not applicable for an order resulting from SubmitBlockTrade |
| PegOffset | decimal. Not applicable for an order resulting from SubmitBlockTrade |
| PegLimitOffset | decimal. Not applicable for an order resulting from SubmitBlockTrade |
| IpAddress | string. The IP address from where the order was submitted. |
| OMSId | integer. The ID of the OMS. |
GetOrders
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves a list of the latest states of orders for an account. ReceiveTime in POSIX format X 1000 (milliseconds since 1 January 1970).
Results can also be filtered according to different search parameters such as OrderState, InstrumentId, OrderId etc. This API functions just like GetOrdersHistory
A user with Trading permission can retrieve orders only for accounts is associated with; a user with Operator permission can retrieve orders for any account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrders", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetOrders HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | Integer. The ID of the OMS on which the orders took place. If no other values are specified, the call returns the orders associated with the default account for the logged-in user on this OMS. required. |
| AccountId | Integer. The account ID that made the trades. A user with Trading permission must be associated with this account, although other users also can be associated with the account. required. |
| OrderState | string. The current state of the order. Can be used to filter results. If not specified all orders regardless of the order state will be returned. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 FullyExecuted. optional. |
| OrderId | long integer. ID for the order.Can be used to filter results. Can be used to filter for a specific orderid. There is a specific API call GetOrderHistoryByOrderId for filtering orders by OrderId. optional. |
| ClientOrderId | long integer. A user-assigned ID for the order (like a purchase-order number assigned by a company).Can be used to filter results. clientOrderId defaults to 0. optional. |
| OriginalOrderId | long integer. The original ID of the order. If specified, the call returns changed orders associated with this order ID. Can be used to filter results. optional. |
| OriginalClientOrderId | long integer. If the order has been changed, shows the original client order ID, a value that the client can create (much like a purchase order). Can be used to filter results. optional. |
| UserId | integer. The ID of the user whose account orders will be returned. If not specified, the call returns the orders of the logged-in user.Can be used to filter results. optional. |
| InstrumentId | long integer. The ID of the instrument named in the order. If not specified, the call returns orders for all instruments traded by this account. Can be used to filter results. optional. |
| StartTimestamp | long integer. Date and time at which to begin the orders history, in POSIX format. Can be used to filter results. optional. |
| EndTimestamp | long integer. Date and time at which to end the orders report, in POSIX format. Can be used to filter results. optional. |
| Depth | integer. In this case, the maximum number/count of orders to return, counting from the StartIndex if it is also specified. If not specified, returns all orders from the most recent to oldest; results can vary depending if other optional fields are defined such as StartIndex, StartTimestamp, and EndTimestamp. Can be used to filter results and for pagination. optional. |
| Limit | integer. Functions exactly the same as the Depth field. optional. |
| StartIndex | integer. A value of 0 means the first object in the result will be the the most recent order, a value of 2 means that the first object in the result set will be the third most recent order. If not specified, defaults to 0. Can be used to filter results or for pagination. optional. |
Response
[
{
"Side": "Sell",
"OrderId": 6713,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663431785,
"ReceiveTimeTicks": 638182602317851821,
"LastUpdatedTime": 1682663431791,
"LastUpdatedTimeTicks": 638182602317910891,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6713,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 6000.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Sell",
"OrderId": 6709,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663089848,
"ReceiveTimeTicks": 638182598898484597,
"LastUpdatedTime": 1682663089923,
"LastUpdatedTimeTicks": 638182598899230197,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6709,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 0.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
Returns an array of objects, each object represents an order. The call returns an empty array if there are no orders for the account.
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which the order belongs to. |
| AccountName | string. Name of the of the account which which the order belongs to. |
| OrderType | string. Describes the type of order this is. One of: 0 Unknown (an error condition) 1 Market order 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current or the latest state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 Fully Executed. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| LastUpdatedTime | long integer. Time stamp when the order was last updated, in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| LastUpdatedTimeTicks | long integer. Time stamp when the order was last updated, in Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| ExecutableValue | decimal. Defaults to 0. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | long integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | long integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One or more of: 1 NoAccountRiskCheck 2 AddedToBook 4 RemovedFromBook 8 PostOnly 16 Liquidation 32 ReverseMarginPosition |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| OMSId | integer. The ID of the OMS. |
GetOrderHistory
Permissions: Operator, Trading
Call Type: Synchronous
Retrieves a history of orders for the specified search parameters.
For example, if depth = 200 and startIndex = 0, the history returns 200 unique orders into the past starting with the most recent (0) order. If depth = 200 and startIndex = 100, the history returns 200 unique orders into the past starting at 101st order in the past.
The owner of the trading venue determines how long to retain order history before archiving.
A user with Trading permission can retrieve orders history only for accounts it is associated with; a user with Operator permission can retrieve orders history for any user or account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOrderHistory", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetOrderHistory HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | Integer. The ID of the OMS on which the orders took place. If no other values are specified, the call returns the orders associated with the default account for the logged-in user on this OMS. required. |
| AccountId | Integer. The account ID that made the trades. A user with Trading permission must be associated with this account, although other users also can be associated with the account. required. |
| OrderState | string. The current state of the order. Can be used to filter results. If not specified all orders regardless of the order state will be returned. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 FullyExecuted. optional. |
| OrderId | long integer. ID for the order.Can be used to filter results. Can be used to filter for a specific orderid. There is a specific API call GetOrderHistoryByOrderId for filtering orders by OrderId. optional. |
| ClientOrderId | long integer. A user-assigned ID for the order (like a purchase-order number assigned by a company).Can be used to filter results. clientOrderId defaults to 0. optional. |
| OriginalOrderId | long integer. The original ID of the order. If specified, the call returns changed orders associated with this order ID. Can be used to filter results. optional. |
| OriginalClientOrderId | long integer. If the order has been changed, shows the original client order ID, a value that the client can create (much like a purchase order). Can be used to filter results. optional. |
| UserId | integer. The ID of the user whose account orders will be returned. If not specified, the call returns the orders of the logged-in user.Can be used to filter results. optional. |
| InstrumentId | long integer. The ID of the instrument named in the order. If not specified, the call returns orders for all instruments traded by this account. Can be used to filter results. optional. |
| StartTimestamp | long integer. Date and time at which to begin the orders history, in POSIX format. Can be used to filter results. optional. |
| EndTimestamp | long integer. Date and time at which to end the orders report, in POSIX format. Can be used to filter results. optional. |
| Depth | integer. In this case, the maximum number/count of orders to return, counting from the StartIndex if it is also specified. If not specified, returns 100 most recent orders; results can vary depending if other optional fields are defined such as StartIndex, StartTimestamp, and EndTimestamp. Can be used to filter results and for pagination. optional. |
| Limit | integer. Functions exactly the same as the Depth field. optional. |
| StartIndex | integer. A value of 0 means the first object in the result will be the the most recent order, a value of 2 means that the first object in the result set will be the third most recent order. If not specified, defaults to 0. Can be used to filter results or for pagination. optional. |
Response
[
{
"Side": "Sell",
"OrderId": 6713,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663431785,
"ReceiveTimeTicks": 638182602317851821,
"LastUpdatedTime": 1682663431791,
"LastUpdatedTimeTicks": 638182602317910891,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6713,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 6000.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Sell",
"OrderId": 6709,
"Price": 0.0,
"Quantity": 0.0,
"DisplayQuantity": 0.0,
"Instrument": 11,
"Account": 7,
"AccountName": "sample",
"OrderType": "Market",
"ClientOrderId": 0,
"OrderState": "FullyExecuted",
"ReceiveTime": 1682663089848,
"ReceiveTimeTicks": 638182598898484597,
"LastUpdatedTime": 1682663089923,
"LastUpdatedTimeTicks": 638182598899230197,
"OrigQuantity": 0.01,
"QuantityExecuted": 0.01,
"GrossValueExecuted": 60.0,
"ExecutableValue": 0.0,
"AvgPrice": 6000.0,
"CounterPartyId": 0,
"ChangeReason": "Trade",
"OrigOrderId": 6709,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"InsideBid": 6000.0,
"InsideBidSize": 0.01,
"LastTradePrice": 0.0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 0.0,
"PegPriceType": "Bid",
"PegOffset": 0.0,
"PegLimitOffset": 0.0,
"IpAddress": "69.10.61.175",
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
The call GetOrderHistory returns an array or objects, each object representin an order at its latest status; an order will only occupy 1 index or just 1 instance in the result. GetOrderHistory API does not return the full history of a specific order, there is another API that will give you just that: GetOrderHistoryByOrderId.
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which the order belongs to. |
| AccountName | string. Name of the of the account which which the order belongs to. |
| OrderType | string. Describes the type of order this is. One of: 0 Unknown (an error condition) 1 Market order 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current or the latest state of the order. One of: 0 Unknown 1 Working 2 Rejected 3 Canceled 4 Expired 5 Fully Executed. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| LastUpdatedTime | long integer. Time stamp when the order was last updated, in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| LastUpdatedTimeTicks | long integer. Time stamp when the order was last updated, in Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| ExecutableValue | decimal. Defaults to 0. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | long integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | long integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One or more of: 1 NoAccountRiskCheck 2 AddedToBook 4 RemovedFromBook 8 PostOnly 16 Liquidation 32 ReverseMarginPosition |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| OMSId | integer. The ID of the OMS. |
SendOrder
Permissions: Operator, Trading
Call Type: Asynchronous
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.
A user with Trading permission can create an order only for those accounts and instruments with which the user is associated; a user with elevated permission such as Operator can create/send an order for any account and instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Limit order
await apex.RPCPromise("SendOrder", {
InstrumentId: 9,
OMSId: 1,
AccountId: 9,
TimeInForce: 1,
ClientOrderId: 0,
OrderIdOCO: 0,
UseDisplayQuantity: false,
Side: 0,
Quantity: 1,
OrderType: 2,
PegPriceType: 3,
LimitPrice: 31000,
});
//Market order
await apex.RPCPromise("SendOrder", {
InstrumentId: 9,
OMSId: 1,
AccountId: 9,
TimeInForce: 1,
ClientOrderId: 0,
OrderIdOCO: 0,
UseDisplayQuantity: false,
Side: 0,
OrderType: 1,
PegPriceType: 3,
Quantity: 0.5,
});
//Order by value: In a market order, a user can opt to input total value of the trade instead of putting the quantity which will then be automatically calculated: value/marketprice.
await apex.RPCPromise("SendOrder", {
InstrumentId: 9,
OMSId: 1,
AccountId: 9,
TimeInForce: 1,
ClientOrderId: 0,
OrderIdOCO: 0,
UseDisplayQuantity: false,
Side: 0,
OrderType: 1,
PegPriceType: 3,
Value: 10,
});
POST /AP/SendOrder HTTP/1.1
Host: hostname goes here...
aptoken: 604f9459-163f-4114-8ecc-928597554747
Content-Type: application/json
Content-Length: 252
//Limit order
{
"InstrumentId": 9,
"OMSId": 1,
"AccountId": 9,
"TimeInForce": 1,
"ClientOrderId": 0,
"OrderIdOCO": 0,
"UseDisplayQuantity": false,
"Side": 0,
"Quantity": 1,
"OrderType": 2,
"PegPriceType": 3,
"LimitPrice": 31000,
}
//Market order
{
"InstrumentId": 9,
"OMSId": 1,
"AccountId": 9,
"TimeInForce": 1,
"ClientOrderId": 0,
"OrderIdOCO": 0,
"UseDisplayQuantity": false,
"Side": 0,
"OrderType": 1,
"PegPriceType": 3,
"Quantity": 0.5,
}
//Order by value: In a market order, a user can opt to input total value of the trade instead of putting the quantity which will then be automatically calculated: value/marketprice.
{
"InstrumentId": 9,
"OMSId": 1,
"AccountId": 9,
"TimeInForce": 1,
"ClientOrderId": 0,
"OrderIdOCO": 0,
"UseDisplayQuantity": false,
"Side": 0,
"OrderType": 1,
"PegPriceType": 3,
"Value": 10,
}
If OrderType=1 (Market), Side=0 (Buy), and LimitPrice is supplied, the Market order will execute up to the value specified
| Key | Value |
|---|---|
| InstrumentId | integer. The ID of the instrument being traded. required. |
| OMSId | integer. The ID of the OMS where the instrument is being traded. |
| AccountId | integer. The ID of the account the order will be placed for. required. |
| TimeInForce | integer. An integer that represents the period during which the new order is executable. One of: 0 Unknown (error condition) 1 GTC (good 'til canceled, the default) 2 OPG (execute as close to opening price as possible: not yet used, for future provision) 3 IOC (immediate or canceled) 4 FOK (fill-or-kill — fill immediately or kill immediately) 5 GTX (good 'til executed: not yet used, for future provision) 6 GTD (good 'til date: not yet used, for future provision) required. |
| ClientOrderId | long integer. A user-assigned ID for the order (like a purchase-order number assigned by a company). This ID is useful for recognizing future states related to this order. ClientOrderId defaults to 0. Starting APEX version 4.2, duplicate client orderid of two open orders of the same account is not allowed, the incoming order with the same clientorderid will get rejected.optional. |
| OrderIdOCO | long integer. The order ID if One Cancels the Other — If this order is order A, OrderIdOCO refers to the order ID of an order B (which is not the order being created by this call). If order B executes, then order A created by this call is canceled. You can also set up order B to watch order A in the same way, but that may require an update to order B to make it watch this one, which could have implications for priority in the order book. See CancelReplaceOrder and ModifyOrder.. optional. |
| UseDisplayQuantity | boolean. If you enter a Limit order with a reserve(reserve order), you must set UseDisplayQuantity to true else, the quantity of your order will be 0, defaults to false. optional. |
| Side | integer. A number representing on of the following potential sides of a trade. One of: 0 Buy 1 Sell required. |
| Quantity | decimal. The quantity of the instrument being ordered. Not required if OrderType is Market(1) and as long as Value is defined. conditionally required. |
| OrderType | integer. A number representing the nature of the order. One of: 0 Unknown 1 Market 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade. required. |
| PegPriceType | integer. Only applicable to TrailingStop and Stop orders, integer or a string that corresponds to the type of price that pegs the stop: 1 Last 2 Bid 3 Ask 4 Midpoint(Currently unsupported; for future provision) Defaults to Last(1) if not defined. optional. |
| LimitPrice | decimal. The price at which the order will be placed, applicable and required if OrderType is Limit(2) or StopLimit(4) or TrailingStopLimit(7). conditionally required. |
| StopPrice | decimal. Applicable to TrailingStop(Limit and Market) and Stop(Limit and Market) orders only; the price at which the order will get activated. Defaults to 0 if not defined. Is not required to be defined for TrailingStop order as this price will be determined automatically based on the TrailingAmount, PegPriceType and most importantly the movement of the price where the order is pegged(PegPriceType). conditionally required. |
| TrailingAmount | decimal. Applicable to TrailingStopLimit and TrailingStopMarket orders only; a number that will be either added to(buy side) or subtracted from(sell side) the price where the order is pegged(depends on the PegPriceType); the sum or the difference will be the StopPrice of the TrailingStop order. On the buy side, if the price where the order is pegged increases and never goes down below the value when the order was placed, the resulting StopPrice will be the sum of the price where the order is pegged during submission and the TrailingAmount; however, if the price where the order is pegged decreases, the StopPrice will change, it will be the sum of the whatever is the lowest value the pegged price will have and the TrailingAmount: the logic on the sell side is the opposite. conditionally required. |
| LimitOffset | decimal. Applicable to TrailingStopLimit only; a number that will be either added(buy side) or subtracted(sell side) to the StopPrice, the sum or the difference will be the LimitPrice of the order when it gets activated. conditionally required. |
| DisplayQuantity | integer If UseDisplayQuantity is set to true, you must set a value of this field greater than 0, else, order will not appear in the orderbook.optional. |
| Value | decimal The total value of the trade. Only applicable in a market order type: a user can opt to input a value instead of defining the quantity which will then be automatically calculated: value/marketprice.optional. |
Response
{
"status": "Accepted",
"errormsg": "",
"OrderId": 6500
}
//Possible error messages
//Order is rejected due to lack of funds
{
"status": "Rejected",
"errormsg": "Not_Enough_Funds",
"errorcode": 101
}
//Order is rejected due to duplicate Client_OrderId, it means that the order you are sending has the same Client_OrderId with your other working/open order.
{
"status": "Rejected",
"errormsg": "Invalid_ClientOrderId",
"errorcode": 101
}
| Key | Value |
|---|---|
| status | string. If the order is accepted by the system, it returns "Accepted," if not it returns "Rejected." Accepted Rejected |
| errormsg | string. Any error message the server returns. |
| OrderId | long integer. The ID assigned to the order by the server. This allows you to track the order. |
CancelReplaceOrder
Permissions: Operator,Trading
Call Type: Asynchronous
CancelReplaceOrder is a 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 it only allows a reduction in order quantity.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//Limit order to replace OrderId 123456
await apex.RPCPromise('CancelReplaceOrder',{
OMSId: 1,
OrderIdToReplace: 123456,
ClientOrdId: 0,
OrderType: 'Limit',
Side: 'Buy',
AccountId: 20,
InstrumentId: 9,
LimitPrice: 1.363,
TimeInForce: 1,
Quantity: 7322.24,
});
//StopMarket order to replace OrderId 123456
await apex.RPCPromise('CancelReplaceOrder',{
OMSId: 1,
OrderIdToReplace: 123456,
ClientOrdId: 0,
OrderType: 'StopMarket',
Side: 'Buy',
AccountId: 20,
InstrumentId: 9,
StopPrice: 1.363,
TimeInForce: 1,
Quantity: 7322.24,
});
//Posible options in the payload
{
//Different OrderTypes available
"OrderType": {
"Options": [
"Unknown",
"Market",
"Limit",
"StopMarket",
"StopLimit",
"TrailingStopMarket",
"TrailingStopLimit",
"BlockTrade"
]
},
//Different Sides available
"Side": {
"Options": [
"Buy",
"Sell",
"Short",
"Unknown"
]
},
//Different PegPriceTypes available
"PegPriceType": {
"Options": [
"Unknown",
"Last",
"Bid",
"Ask",
"Midpoint"
]
},
//Different TimeInForce available
"TimeInForce": {
"Options": [
"Unknown",
"GTC",
"OPG",
"IOC",
"FOK",
"GTX",
"GTD"
]
},
},
POST /AP/CancelReplaceOrder HTTP/1.1
Host: hostname goes here...
aptoken: 604f9459-163f-4114-8ecc-928597554747
Content-Type: application/json
Content-Length: 252
//Limit order to replace OrderId 123456
{
"OMSId":1,
"OrderIdToReplace":123456,
"ClientOrdId":0,
"OrderType":"Limit",
"Side":"Buy",
"AccountId":20,
"InstrumentId":9,
"LimitPrice":1.363,
"TimeInForce":1,
"Quantity":7322.24
}
//StopMarket order to replace OrderId 123456
{
"OMSId":1,
"OrderIdToReplace":123456,
"ClientOrdId":0,
"OrderType":"StopMarket",
"Side":"Buy",
"AccountId":20,
"InstrumentId":9,
"StopPrice":1.363,
"TimeInForce":1,
"Quantity":7322.24
}
//Different OrderTypes available
"OrderType": {
"Options": [
"Unknown",
"Market",
"Limit",
"StopMarket",
"StopLimit",
"TrailingStopMarket",
"TrailingStopLimit",
"BlockTrade"
]
},
//Different Sides available
"Side": {
"Options": [
"Buy",
"Sell",
"Short",
"Unknown"
]
},
//Different PegPriceTypes available
"PegPriceType": {
"Options": [
"Unknown",
"Last",
"Bid",
"Ask",
"Midpoint"
]
},
//Different TimeInForce available
"TimeInForce": {
"Options": [
"Unknown",
"GTC",
"OPG",
"IOC",
"FOK",
"GTX",
"GTD"
]
},
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the order is being canceled and replaced by another order. required. |
| OrderIdToReplace | long integer. The ID of the order to replace with this order. required. |
| ClientOrderId | long integer. A user-assigned ID for the new, replacement order (like a purchase-order number assigned by a company). This ID is useful for recognizing future states related to this order. If unspecified, ClientOrderId defaults to 0. optional. |
| OrderType | string or integer. The type of the replacement order. One of: 0 Unknown 1 Market 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade The string value or the equivalent integer value can be used. required. |
| Side | string or integer. The side of the replacement order. One of: 0 Buy 1 Sell 2 Short(reserved for future use) 3 Unknown (error condition). The string value or the equivalent integer value can be used. required. |
| AccountId | integer. The ID of the account under which the original order was placed and the new order will be placed. If AccountId will not match the one on the order to be replaced, request will fail. required. |
| InstrumentId | integer. The ID of the instrument being traded. Must be identical with the instrument ID of the order to be replaced, else, request will fail. required. |
| UseDisplayQuantity | boolean. The display quantity is the quantity of a product shown to the market to buy or sell. A larger quantity may be wanted or available, but it may disadvantageous to display it when buying or selling. The display quantity is set when placing an order (using SendOrder or CancelReplaceOrder for instance). If you enter a Limit order with reserve, you must set useDisplayQuantity to true. conditionally required. |
| DisplayQuantity | decimal. The quantity of a product that is available to buy or sell that is publicly displayed to the market. Needs to be defined with a value greater than 0 if UseDisplayQuantity is set to true, otherwise new order will not be visible in the orderbook. conditionally required. |
| LimitPrice | deciaml. The price at which to execute the new order, if the new order is a limit order. conditionally required. |
| StopPrice | decimal. The price at which to execute the new order, if the order is a stop order. conditionally required. |
| ReferencePrice | decimal. The reference price of the instrument in the order. optional. |
| PegPriceType | string or integer. When entering a stop/trailing order, set PegPriceType to the type of price that pegs the stop. One of: 1 Last 2 Bid 3 Ask 4 Midpoint The string value or the equivalent integer value can be used. conditionally required. |
| TimeInForce | string or integer. The period during which the new order is executable. One of: 0 Unknown (error condition) 1 GTC (good 'til canceled, the default) 2 OPG (execute as close to opening price as possible: not yet used, for future provision) 3 IOC (immediate or canceled) 4 FOK (fill or kill — fill the order immediately, or cancel it immediately) 5 GTX (good 'til executed: not yet used, for future provision) 6 GTD (good 'til date: not yet used, for future provision) The string value or the equivalent integer value can be used. required. |
| OrderIdOCO | long integer. One Cancels the Other — If the order being canceled in this call is order A, and the order replacing order A in this call is order B, then OrderIdOCO refers to an order C that is currently open. If order C executes, then order B is canceled. You can also set up order C to watch order B in this way, but that will require an update to order C. optional. |
| Quantity | decimal. The amount of the order (either buy or sell). Not explicitly required but defaults to 0 when not defined, so it makes sense to be set greater than 0. required. |
Response
{
"ReplacementOrderId": 123457,
"ReplacementClOrdId": 0,
"OrigOrderId": 123456,
"OrigClOrdId": 0
}
The response returns the new replacement order ID and echoes back any replacement client ID you have supplied, along with the original order ID and the original client order ID.
| Key | Value |
|---|---|
| replacementOrderId | integer. The order ID assigned to the replacement order by the server. |
| replacementClOrdId | long integer. Echoes the contents of the clientOrderId value from the request. |
| origOrderId | integer. Echoes orderIdToReplace, which is the original order you are replacing. |
| origClOrdId | long integer. Provides the client order ID of the original order (not specified in the requesting call). |
CancelOrder
Permissions: Operator, Trading
Call Type: Synchronous
Cancels a specific open order that has been placed but has not yet been fully executed. Only cancels one order at a time specific to the orderid defined in the request.
A user with Trading permission can cancel an order only for an account it is associated with; a user with Operator permission can cancel an order for any account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CancelOrder", {
OMSId: 1,
AccountId: 9,
OrderId: 6500,
});
POST /AP/CancelOrder HTTP/1.1
Host: hostname goes here...
aptoken: 604f9459-163f-4114-8ecc-928597554747
Content-Type: application/json
Content-Length: 57
{
"OMSId": 1,
"OrderId": 6500,
"AccountId": 9
}
The OMS ID and the Order ID precisely identify the order you wish to cancel, the Order ID is unique across an OMS but there is still a need to identify the account owning the order.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the order exists. required. |
| AccountId | integer. The ID of the account under which the order was placed. required. |
| OrderId | long integer. The order to be canceled. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
The response to CancelOrder verifies that the call was received, not that the order has been canceled successfully. Individual event updates to the user show order cancellation. To verify that an order has been canceled, call GetOrderStatus or GetOpenOrders.
| Key | Value |
|---|---|
| result | boolean. Returns true if the call to cancel the order has been successfully received, otherwise returns false. |
| errormsg | string. A successful receipt of a call to cancel an order returns null; the errormsg parameter for an unsuccessful call to cancel an order returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) Operation Not Supported (errorcode 106) |
| errorcode | integer. A successfully received call to cancel an order returns 0. An unsuccessfully received call to cancel an order returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. The contents of this parameter are usually null. |
GetOpenOrders
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Retrieves the Open Orders, excludes Block Trades and Quotes, for the given accountId. Time in POSIX format X 1000 (milliseconds since 1 January 1970). Optionally include InstrumentId to filter by Instrument.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetOpenOrders", {
OMSId: 1,
AccountId: 9,
});
POST /AP/GetOpenOrders HTTP/1.1
Host: hostname goes here...
aptoken: 604f9459-163f-4114-8ecc-928597554747
Content-Type: application/json
Content-Length: 43
{
"OMSId": 1,
"AccountId": 9
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS to which the user belongs. A user will belong only to one OMS. required. |
| AccountId | integer. The ID of the account which you are getting open orders for. required. |
| InstrumentId | integer. The ID of a specific instrument, can be used to filter results. optional. |
Response
[
{
"Side": "Buy",
"OrderId": 6598,
"Price": 39000,
"Quantity": 1,
"DisplayQuantity": 1,
"Instrument": 1,
"Account": 9,
"AccountName": "AnotherName",
"OrderType": "StopMarket",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1681114594150,
"ReceiveTimeTicks": 638167113941496303,
"LastUpdatedTime": 1681114594155,
"LastUpdatedTimeTicks": 638167113941554842,
"OrigQuantity": 1,
"QuantityExecuted": 0,
"GrossValueExecuted": 0,
"ExecutableValue": 0,
"AvgPrice": 0,
"CounterPartyId": 0,
"ChangeReason": "NewInputAccepted",
"OrigOrderId": 6598,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 26000,
"InsideAskSize": 1,
"InsideBid": 25000,
"InsideBidSize": 1,
"LastTradePrice": 26000,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "0",
"UseMargin": false,
"StopPrice": 39000,
"PegPriceType": "Ask",
"PegOffset": 0,
"PegLimitOffset": 0,
"IpAddress": null,
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Buy",
"OrderId": 6627,
"Price": 2,
"Quantity": 1,
"DisplayQuantity": 1,
"Instrument": 1,
"Account": 9,
"AccountName": "AnotherName",
"OrderType": "Limit",
"ClientOrderId": 0,
"OrderState": "Working",
"ReceiveTime": 1681207997025,
"ReceiveTimeTicks": 638168047970250300,
"LastUpdatedTime": 1681207997026,
"LastUpdatedTimeTicks": 638168047970264465,
"OrigQuantity": 1,
"QuantityExecuted": 0,
"GrossValueExecuted": 0,
"ExecutableValue": 0,
"AvgPrice": 0,
"CounterPartyId": 0,
"ChangeReason": "NewInputAccepted",
"OrigOrderId": 6627,
"OrigClOrdId": 0,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 26000,
"InsideAskSize": 1,
"InsideBid": 2,
"InsideBidSize": 1,
"LastTradePrice": 25000,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "AddedToBook",
"UseMargin": false,
"StopPrice": 0,
"PegPriceType": "Ask",
"PegOffset": 0,
"PegLimitOffset": 0,
"IpAddress": null,
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
},
{
"Side": "Buy",
"OrderId": 6507,
"Price": 31000,
"Quantity": 0.01,
"DisplayQuantity": 0.01,
"Instrument": 9,
"Account": 9,
"AccountName": "AnotherName",
"OrderType": "Limit",
"ClientOrderId": 1,
"OrderState": "Working",
"ReceiveTime": 1678976987086,
"ReceiveTimeTicks": 638145737870859306,
"LastUpdatedTime": 1679025072387,
"LastUpdatedTimeTicks": 638146218723867613,
"OrigQuantity": 1,
"QuantityExecuted": 0,
"GrossValueExecuted": 0,
"ExecutableValue": 0,
"AvgPrice": 0,
"CounterPartyId": 0,
"ChangeReason": "UserModified",
"OrigOrderId": 6507,
"OrigClOrdId": 1,
"EnteredBy": 6,
"UserName": "sample_user",
"IsQuote": false,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0,
"InsideBid": 31000,
"InsideBidSize": 1,
"LastTradePrice": 0,
"RejectReason": "",
"IsLockedIn": false,
"CancelReason": "",
"OrderFlag": "AddedToBook",
"UseMargin": false,
"StopPrice": 0,
"PegPriceType": "Ask",
"PegOffset": 0,
"PegLimitOffset": 0,
"IpAddress": null,
"IPv6a": 0,
"IPv6b": 0,
"ClientOrderIdUuid": null,
"OMSId": 1
}
]
| Key | Value |
|---|---|
| Side | string. The side of a trade. One of: 0 Buy 1 Sell |
| OrderId | long integer. The ID of the open order. The OrderID is unique in each OMS. |
| Price | decimal. The price at which the buy or sell has been ordered. |
| Quantity | decimal. The quantity of the product to be bought or sold. |
| DisplayQuantity | decimal. The quantity available to buy or sell that is publicly displayed to the market. To display a displayQuantity value, an order must be a Limit order with a reserve. |
| Instrument | integer. ID of the instrument being traded. The call GetInstruments can supply the instrument IDs that are available. |
| Account | integer. ID of the of the account which the order belongs to. |
| AccountName | string. Name of the of the account which which the order belongs to. |
| OrderType | string. Describes the type of order this is. One of: 0 Unknown (an error condition) 1 Market order 2 Limit 3 StopMarket 4 StopLimit 5 TrailingStopMarket 6 TrailingStopLimit 7 BlockTrade |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The ClientOrderId defaults to 0 if not supplied. |
| OrderState | string. The current state of the order. Will always be Working as this API is getting open orders. |
| ReceiveTime | long integer. Time stamp of the order in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| ReceiveTimeTicks | long integer. Time stamp of the order Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| LastUpdatedTime | long integer. Time stamp when the order was last updated, in POSIX format x 1000 (milliseconds since 1/1/1970 in UTC time zone). |
| LastUpdatedTimeTicks | long integer. Time stamp when the order was last updated, in Microsoft Ticks format and UTC time zone. Note: Microsoft Ticks format is usually provided as a string. Here it is provided as a long integer. |
| OrigQuantity | decimal. If the open order has been changed or partially filled, this value shows the original quantity of the order. |
| QuantityExecuted | decimal. If the open order has been at least partially executed, this value shows the amount that has been executed. |
| GrossValueExecuted | decimal. If the open order has been at least partially executed, this value shows the gross amount that has been executed. |
| ExecutableValue | decimal. Defaults to 0. |
| AvgPrice | decimal. The average executed price of the order. |
| CounterPartyId | integer. The ID of the account who is the counterparty for the trade if order is already executed, either partial or fully executed. |
| ChangeReason | string. If the order has been changed, this string value holds the reason. One of: 0 Unknown 1 NewInputAccepted 2 NewInputRejected 3 OtherRejected 4 Expired 5 Trade 6 SystemCanceled_NoMoreMarket 7 SystemCanceled_BelowMinimum 8 SystemCanceled_PriceCollar 9 SystemCanceled_MarginFailed 100 UserModified. An order that is newly added to book will have NewInputAccepted value by default. |
| OrigOrderId | long integer. If the order is a replacement order, this is the ID of the original order. |
| OrigClOrdId | long integer. If the order is a replacement order, this is the client order ID or the original order. |
| EnteredBy | integer. The ID of the user who submitted the order. |
| Username | string. The username of the user who submitted the order. |
| IsQuote | boolean. If this order is a quote(created using CreateQuote), the value for IsQuote is true, otherwise it is false. |
| InsideAsk | decimal. If this order is a quote, this value is the Inside Ask price. |
| InsideAskSize | decimal. If this order is a quote, this value is the quantity of the Inside Ask quote. |
| InsideBid | decimal. If this order is a quote, this value is the Inside Bid price. |
| InsideBidSize | decimal. If this order is a quote, this value is the quantity of the Inside Bid quote. |
| LastTradePrice | decimal. The last price that this instrument traded at. |
| RejectReason | string. If this open order has been rejected, this string holds the reason for the rejection. |
| IsLockedIn | boolean. For a block trade, if both parties to the block trade agree that one of the parties will report the trade for both sides, this value is true. Othersise, false. |
| CancelReason | string. If this order has been canceled, this string holds the cancellation reason. |
| OrderFlag | string. One or more of: 1 NoAccountRiskCheck 2 AddedToBook 4 RemovedFromBook 8 PostOnly 16 Liquidation 32 ReverseMarginPosition |
| UseMargin | boolean. Margin is not yet supported so this always defaults to false. |
| StopPrice | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegPriceType | string. The type of price to peg the Stop to for Stop/Trailing orders. |
| PegOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| PegLimitOffset | decimal. Only applicable to trailing/stop orders. Defaults to 0.0 if order is another type. |
| IpAddress | string. The IP address from where the order was submitted. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| IPv6a | UInt64. The IPv6 where the order was submitted from. Currently not being used, for future provision. Defaults to 0. |
| OMSId | integer. The ID of the OMS. |
GetAccountTrades
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Requests the details on up to 200 past trade executions for a single specific account and OMS, 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.
Users with Trading or AccountReadOnly permission may access trade information only for accounts with which they are associated; users with Operator permission may access trade information for any account.
The operator of the trading venue determines how long to retain an accessible trading history before archiving.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountTrades", {
OMSId: 1,
AccountId: 7,
Depth: 2, //filter only the 2 most recent trades of the account
});
POST /AP/GetAccountTrades HTTP/1.1
Host: hostname goes here...
aptoken: d350c7a3-f63c-4938-ade8-d68b326e9298
Content-Type: application/json
Content-Length: 61
{
"OMSId": 1,
"AccountId": 7,
"Depth": 2
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS to which the user belongs. A user will belong to only one OMS. required. |
| AccountId | integer. The ID of the account. If not specified, if authenticated user has the default permissions, its default account's trades will be returned, else if the authenticated user has elevated permissions, trades of any account will be returned. optional. |
| StartIndex | integer. The starting index into the history of trades, beginning from 0 (the most recent trade). optional. |
| Count or Depth | integer. The number of trades to return. The system can return up to 200 trades. optional. |
| InstrumentId | integer. The ID of the instrument for which account trades will be returned, filter parameter. optional. |
| TradeId | integer. The ID of a specific trade, filter parameter. optional. |
| OrderId | integer. The ID of a specific order, filter parameter. optional. |
| StartTimeStamp | long integer. Filter parameter. optional. |
| EndTimeStamp | long integer. Filter parameter. optional. |
| ExecutionId | integer. Filter parameter. optional. |
Response
[
{
"OMSId": 1,
"ExecutionId": 1831,
"TradeId": 916,
"OrderId": 6559,
"AccountId": 7,
"AccountName": "sample",
"SubAccountId": 0,
"ClientOrderId": 0,
"InstrumentId": 2,
"Side": "Buy",
"OrderType": "Limit",
"Quantity": 0.02,
"RemainingQuantity": 0.0,
"Price": 23436.0,
"Value": 468.72,
"CounterParty": "9",
"OrderTradeRevision": 1,
"Direction": "NoChange",
"IsBlockTrade": false,
"Fee": 0.0004,
"FeeProductId": 4,
"OrderOriginator": 0,
"UserName": "",
"TradeTimeMS": 1681203988297,
"MakerTaker": "Maker",
"AdapterTradeId": 0,
"InsideBid": 23436.0,
"InsideBidSize": 0.0,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"IsQuote": false,
"CounterPartyClientUserId": 1,
"NotionalProductId": 1,
"NotionalRate": 1.0,
"NotionalValue": 468.72,
"NotionalHoldAmount": 0,
"TradeTime": 638168007882966478
},
{
"OMSId": 1,
"ExecutionId": 1829,
"TradeId": 915,
"OrderId": 6557,
"AccountId": 7,
"AccountName": "sample",
"SubAccountId": 0,
"ClientOrderId": 0,
"InstrumentId": 2,
"Side": "Buy",
"OrderType": "Limit",
"Quantity": 0.02,
"RemainingQuantity": 0.0,
"Price": 23436.0,
"Value": 468.72,
"CounterParty": "9",
"OrderTradeRevision": 1,
"Direction": "NoChange",
"IsBlockTrade": false,
"Fee": 0.0004,
"FeeProductId": 4,
"OrderOriginator": 0,
"UserName": "",
"TradeTimeMS": 1681203988296,
"MakerTaker": "Maker",
"AdapterTradeId": 0,
"InsideBid": 23436.0,
"InsideBidSize": 0.0,
"InsideAsk": 79228162514264337593543950335,
"InsideAskSize": 0.0,
"IsQuote": false,
"CounterPartyClientUserId": 1,
"NotionalProductId": 1,
"NotionalRate": 1.0,
"NotionalValue": 468.72,
"NotionalHoldAmount": 0,
"TradeTime": 638168007882963921
}
]
The response is an array of objects, each element of which represents a trade by the account.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS to which the account belongs. |
| ExecutionId | integer. The ID of this account's side of the trade. Every trade has two sides. |
| TradeId | integer. The ID of the overall trade. |
| OrderId | long integer. The ID of the order causing the trade (buy or sell). |
| AccountId | integer. The ID of the account that made the trade (buy or sell). |
| AccountName | string. The Name of the account that made the trade (buy or sell). |
| SubAccountId | integer. Not currently used; reserved for future use. Defaults to 0. |
| ClientOrderId | long integer. An ID supplied by the client to identify the order (like a purchase order number). The clientOrderId defaults to 0 if not supplied. |
| InstrumentId | integer. The ID of the instrument being traded. An instrument comprises two products, for example Dollars and Bitcoin. |
| Side | string. One of the following potential sides of a trade: 0 Buy 1 Sell |
| OrderType | string. One of the following potential sides of a trade: Market Limit BlockTrade StopMarket StopLimit TrailingStopLimit StopMarket TrailingStopMarket |
| Quantity | decimal. The unit quantity of this side of the trade. |
| RemainingQuantity | decimal. The number of units remaining to be traded by the order after this execution. This number is not revealed to the other party in the trade. This value is also known as "leave size" or "leave quantity." |
| Price | decimal. The unit price at which the instrument traded. |
| Value | decimal. The total value of the deal. The system calculates this as: unit price X quantity executed. |
| CounterParty | string. The ID of the other party in a block trade. Usually, IDs are stated as integers; this value is an integer written as a string. |
| OrderTradeRevision | integer. The revision number of this trade; usually 1. |
| Direction | string. The effect of the trade on the instrument's market price. One of: 0 No change 1 Uptick 2 DownTick |
| IsBlockTrade | boolean. A value of true means that this trade was a block trade; a value of false that it was not a block trade. |
| Fee | decimal. Any fee levied against the trade by the Exchange. |
| FeeProductId | integer. The ID of the product in which the fee was levied. |
| OrderOriginator | integer. The ID of the user who initiated the trade. |
| UserName | integer. The UserName of the user who initiated the trade. |
| TradeTimeMS | long integer. The date and time that the trade took place, in milliseconds and POSIX format. All dates and times are UTC. |
| MakerTaker | string. One of the following potential liquidity provider of a trade: Maker Taker |
| AdapterTradeId | integer. The ID of the adapter of the overall trade. |
| InsideBid | decimal. The best (highest) price level of the buy side of the book at the time of the trade. |
| InsideBidSize | decimal. The quantity of the best (highest) price level of the buy side of the book at the time of the trade. |
| InsideAsk | decimal. The best (lowest) price level of the sell side of the book at the time of the trade. |
| InsideAskSize | decimal. The quantity of the best (lowest) price level of the sell side of the book at the time of the trade. |
| CounterPartyClientUserId | integer. Indicates counterparty source of trade (OMS, Remarketer, FIX) |
| NotionalProductId | integer. Notional product the notional value was captured in |
| NotionalRate | decimal. Notional rate from base currency at time of trade |
| NotionalValue | decimal. Notional value in base currency of venue at time of trade |
| TradeTime | long integer. The date and time that the trade took place, in C# Ticks. All dates and times are UTC. |
Summary
Permissions: Public
Call Type: Synchronous
Returns the summary for each instrument present in the exchange.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Summary", {});
POST /AP/Summary HTTP/1.1
Host: hostname goes here...
No field is required in the request payload.
Response
[
{
"trading_pairs": "BTC_USD",
"last_price": 29000,
"lowest_ask": 29000,
"highest_bid": 28700,
"base_volume": 0.222,
"quote_volume": 6425.0,
"price_change_percent_24h": 3.57142857142857142857142857,
"highest_price_24h": 29000,
"lowest_price_24h": 28000
},
{
"trading_pairs": "ETH_USD",
"last_price": 1970,
"lowest_ask": 0,
"highest_bid": 0,
"base_volume": 0.0,
"quote_volume": 0.0,
"price_change_percent_24h": 0,
"highest_price_24h": 0,
"lowest_price_24h": 0
}
]
Returns an array of objects, each object represents a specific pair or instrument in the exchange.
| Key | Value |
|---|---|
| trading_pairs | string. The instrument pair. |
| last_price | decimal. The last traded price of the instrument. |
| lowest_ask | decimal. The current lowest ask for the instrument. |
| highest_bid | decimal. The current highest bid for the instrument. |
| base_volume | decimal. The current base volume of the instrument. |
| quote_volume | decimal. The current quote volume of the instrument. |
| price_change_percent_24h | decimal. The price percentage change of the instrument in 24H, resets UTC midnight. |
| highest_price_24h | decimal. The highest traded price of the instrument in 24H, resets UTC midnight. |
| lowest_price_24h | decimal. The lowest traded price of the instrument in 24H, resets UTC midnight. |
Ticker
Permissions: Public
Call Type: Synchronous
Ticker endpoint provide a 24-hour pricing and volume summary for each market pair and each market type (spot, perpetuals, physical futures, options) available on the exchange for CMC integration.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Ticker", {});
POST /AP/Ticker HTTP/1.1
Host: hostname goes here...
No field is required in the request payload.
Response
{
"BTC_USD": {
"base_id": 1,
"quote_id": 0,
"last_price": 29000,
"base_volume": 0.222,
"quote_volume": 6425.0
},
"ETH_USD": {
"base_id": 1027,
"quote_id": 0,
"last_price": 1970,
"base_volume": 0.0,
"quote_volume": 0.0
}
}
| Key | Value |
|---|---|
| base_id | integer. The unified cryptoasset id of the base product of the instrument. |
| quote_id | integer. The quote id of the instrument. |
| last_price | decimal. The last traded price of the instrument. |
| base_volume | decimal. The current base volume of the instrument. |
| quote_volume | decimal. The current quote volume of the instrument. |
OrderBook
Permissions: Public
Call Type: Synchronous
The OrderBook endpoint is to provide a complete level 2 order book (arranged by best asks/bids) with full depth returned for a given market pair for CMC integration. Parameters can also be supplied in the request payload.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
//No need to set Depth if Level is set to 1
await apex.RPCPromise("OrderBook", {
Market_Pair: "BTCUSD",
Level: 1,
});
//Level 2, you need to set Depth to a number higher than 1 else you will only see best bid and best ask
await apex.RPCPromise("OrderBook", {
Market_Pair: "BTCUSD",
Depth: 10,
Level: 2,
});
POST /AP/OrderBook HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 52
//No need to set Depth if Level is set to 1
{
"Market_Pair": "BTCUSD",
"Level": 1
}
////Level 2, you need to set Depth to a number higher than 1 else you will only see best bid and best ask
{
Market_Pair: "BTCUSD",
Depth: 10,
Level: 2,
}
| Key | Value |
|---|---|
| Market_Pair | string The instrument symbol, instrument id is not accepted. required. |
| Depth | integer Depth of the orderbook you want to see, this only applicable if Level parameter is set to 2. Depth will always be 1 if this is not set or if Level is set to 1. optional. |
| Level | integer Either 1 or 2. 1 mean you only want to see the best bid and best ask, 2 means you want to see other levels of the book, number of bids and ask you will see depends on the Depth set, if Depth is not set and Level is set to 2, best bid and best ask will only be the ones to be returned.If Level is not set, default is 1. optional. |
Response
//Level 1
{
"timestamp": 1679548364728,
"bids": [
[
2, //Quantity
28900 //Price
]
],
"asks": [
[
0.5, //Quantity
29000 //Price
]
]
}
//level 2, Depth 10, only 2 bids existing, only 1 ask existing
{
"timestamp": 1679548299447,
"bids": [
[
2, //Quantity
28900 //Price
],
[
1,
28700
]
],
"asks": [
[
0.5,
29000
]
]
}
Returns a JSON object with fields timestamp, bids and asks.
| Key | Value |
|---|---|
| timestamp | long integer Unix timestamp in milliseconds, equivalent to the current timestamp when the response was returned. |
| bids | array The quantity(decimal) and price(decimal) per level which someone is willing to buy. |
| asks | array The quantity(decimal) and price(decimal) per level which someone is willing sell. |
Trades
Permissions: Public
Call Type: Synchronous
Returns trades for a specific market pair or instrument. Only returns the 100 most recent trades.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("Trades", {
market_pair: "BTCUSD",
});
POST /AP/Trades HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 33
{
"market_pair": "BTCUSD"
}
| Key | Value |
|---|---|
| market_pair | string The market pair or instrument symbol. required. |
Response
[
{
trade_id: 1572,
price: 31000,
base_volume: 0.001,
quote_volume: 31.0,
timestamp: "2023-05-05T04:47:58.917Z",
type: "sell",
},
{
trade_id: 1573,
price: 31599,
base_volume: 0.001,
quote_volume: 31.599,
timestamp: "2023-05-05T04:48:25.327Z",
type: "buy",
}
];
| Key | Value |
|---|---|
| trade_id | integer The ID of the trade execution. |
| price | decimal The price at which the trade was executed. |
| base_volume | decimal The traded quantity of the base product/currency. |
| quote_volume | decimal The traded quantity of the quote product/currency. |
| timestamp | string The exact date and time when the trade was executed, in UTC. |
| type | string The side of the trade, either sell or buy. |
GetEarliestTickTime
Permissions: Level1MarketData, Operator
Call Type: Synchronous
Gets the earliest ticker time possible for a specific instrument or market pair.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetEarliestTickTime", {
InstrumentId: 1,
OMSId: 1,
});
POST /AP/GetEarliestTickTime HTTP/1.1
Host: hostname goes here..
Content-Type: application/json
aptoken: 239260f0-dd79-439b-85e2-a5a24fcd9158 //valid session token, can be acquired during HTTP authentication
Content-Length: 54
{
"OMSId": 1,
"InstrumentId": 1
}
| Key | Value |
|---|---|
| InstrumentId | integer. The id of the instrument, symbol is not accepted.If you don't specify this, response will have the current timestamp which is not valid. required. |
| OMSId | integer. ID of the OMS where the pair or instrument is being traded. required. |
Response
[1651148820000];
Returns an array with exactly 1 element which is the equivalent timestamp in milliseconds of the earliest ticker data for the specific instrument in the request.
GetL2Snapshot
Permissions: Public
Call Type: Synchronous
Provides a current Level 2 snapshot of a specific instrument trading on an OMS to a user-determined market depth. The Level 2 snapshot allows the user to specify the level of market depth information on either side of the bid and ask.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise('GetL2Snapshot',{
OMSId: 1
InstrumentId: 1,
Depth: 100
})
POST /AP/GetL2Snapshot HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 63
{
"OMSId": 1,
"InstrumentId": 1,
"Depth": 100
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument that is the subject of the snapshot. required. |
| Depth | integer. Maximum number of bids and asks that can be included in the results. If set to 10, there can be maximum of 10 bids and 10 asks in the results. required. |
Response
[
[
26, // MDUpdateId
1, // Number of Unique Accounts
1679559223042, //ActionDateTime in Posix format X 1000
0, // ActionType 0 (New), 1 (Update), 2(Delete)
29000, // LastTradePrice
1, // Number of Orders
28700, //Price
1, // ProductPairCode
0.5, // Quantity
0, // Side 0 means buy and it is on the bid side
],
[
26,
2,
1679559223042,
0,
29000,
2,
29000,
1,
0.52,
1, // Side 1 means sell and it is on the ask side
],
][
// This is how the response is sent:
[0, 1, 123, 0, 0.0, 0, 0.0, 0, 0.0, 0]
];
The response is an array of elements for one specific instrument, the number of elements corresponding to the market depth specified in the Request. It is sent as an uncommented, comma-delimited list of numbers. The example is commented. The Level2UpdateEvent contains the same data, but is sent by the OMS whenever trades occur. To receive Level2UpdateEvents, a user must subscribe to Level2UpdateEvents.
| Key | Value |
|---|---|
| MDUpdateID | integer. Market Data Update ID. This sequential ID identifies the order in which the update was created. |
| Number of Unique Accounts | integer. Number of accounts that placed orders. |
| ActionDateTime | long integer.. ActionDateTime identifies the time and date that the snapshot was taken or the event occurred, in POSIX format X 1000 (milliseconds since 1 January 1970). |
| ActionType | integer. L2 information provides price data. This value shows whether this data is: 0 new 1 update 2 deletion |
| LastTradePrice | decimal. The price at which the instrument was last traded. |
| Number of Orders | integer. Number of orders in the GetL2Snapshot. |
| Price | decimal. Bid or Ask price for the Quantity (see Quantity below). |
| ProductPairCode | integer. ProductPairCode is the same value and used for the same purpose as InstrumentID. The two are completely equivalent. InstrumentId 47 = ProductPairCode 47. |
| Quantity | decimal. Quantity available at a given Bid or Ask price (see Price above). |
| Side | integer. One of: 0 Buy means it is on the bid side 1 Sell means it is on the ask side 2 Short (reserved for future use) 3 Unknown (error condition) |
GetLevel1
Permissions: Trading, Public
Call Type: Synchronous
Provides a current Level 1 snapshot (best bid, best offer and other data such lasttradedprice) of a specific instrument trading on an OMS. The Level 1 snapshot does not allow the user to specify the level of market depth information on either side of the bid and ask.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise('GetLevel1',{
OMSId: 1
InstrumentId: 1
})
POST /AP/GetLevel1 HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 27
{
"OMSId": 1
"InstrumentId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| InstrumentId | integer. The ID of the instrument whose Level 1 market snapshot will be taken. required. |
Response
{
"OMSId": 1,
"InstrumentId": 1,
"BestBid": 28700,
"BestOffer": 29000,
"LastTradedPx": 29000,
"LastTradedQty": 0.001,
"LastTradeTime": 1679466290437,
"SessionOpen": 28000,
"SessionHigh": 29000,
"SessionLow": 28000,
"SessionClose": 29000,
"Volume": 0.001,
"CurrentDayVolume": 0.222,
"CurrentDayNotional": 6425.0,
"CurrentDayNumTrades": 5,
"CurrentDayPxChange": 1000,
"Rolling24HrVolume": 0.0,
"Rolling24HrNotional": 0.0,
"Rolling24NumTrades": 0,
"Rolling24HrPxChange": 0,
"TimeStamp": "1679466290440",
"BidQty": 0.5,
"AskQty": 0.5,
"BidOrderCt": 0,
"AskOrderCt": 0,
"Rolling24HrPxChangePercent": 0
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. |
| InstrumentId | integer. The ID of the instrument being tracked. |
| BestBid | decimal. The current best bid for the instrument. |
| BestOffer | decimal. The current best offer for the instrument. |
| LastTradedPx | decimal. The last-traded price for the instrument. |
| LastTradedQty | decimal. The last-traded quantity for the instrument. |
| LastTradeTime | long integer. The time of the last trade, in POSIX format. |
| SessionOpen | decimal. Opening price. In markets with openings and closings, this is the opening price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| SessionHigh | decimal. Highest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionLow | decimal. Lowest price during the trading day, either during a session with opening and closing prices or UTC midnight to UTC midnight. |
| SessionClose | decimal. The closing price. In markets with openings and closings, this is the closing price for the current session; in 24-hour markets, it is the price as of UTC Midnight. |
| Volume | decimal. The last-traded quantity for the instrument, same value as LastTradedQty |
| CurrentDayVolume | decimal. The unit volume of the instrument traded either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayNumTrades | integer. The number of trades during the current day, either during a session with openings and closings or in 24-hour markets, the period from UTC Midnight to UTC Midnight. |
| CurrentDayPxChange | decimal. Current day price change, either during a trading session or UTC Midnight to UTC midnight. |
| CurrentNotional | decimal. Current day quote volume - resets at UTC Midnight. |
| Rolling24HrNotional | decimal. Rolling 24 hours quote volume. |
| Rolling24HrVolume | decimal. Unit volume of the instrument during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrNumTrades | integer. Number of trades during the past 24 hours, regardless of time zone. Recalculates continuously. |
| Rolling24HrPxChange | decimal. Price change during the past 24 hours, regardless of time zone. Recalculates continuously. |
| TimeStamp | string. The time this information was provided, in POSIX format. |
| BidQty | decimal. The quantity currently being bid. |
| AskQty | decimal. The quantity currently being asked. |
| BidOrderCt | integer. The count of bid orders. |
| AskOrderCt | integer. The count of ask orders. |
| Rolling24HrPxChangePercent | decimal. Percent change in price during the past 24hours. |
GetEnums
Permissions: Public
Call Type: Synchronous
Get Order Object Enum Definitions
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetEnums", {});
POST /AP/GetEnums HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
{
}
No request payload required.
Response
[
{
"Class": "Order",
"Property": "OrderState",
"Enums": [
{
"Name": "Working",
"Description": "Order is in non-terminal state either on the order book or not activated yet if a stop order",
"Number": 1
},
{
"Name": "Rejected",
"Description": "Order is in a terminal state and has been rejected by the matching engine",
"Number": 2
},
{
"Name": "Canceled",
"Description": "Order is in a terminal state and has been cancelled by the oms or by the user",
"Number": 3
},
{
"Name": "Expired",
"Description": "Order is in a terminal state and has been expired by the matching engine",
"Number": 4
},
{
"Name": "FullyExecuted",
"Description": "Order is in a terminal state and has been fully executed by the matching engine",
"Number": 5
}
]
}
]
| Key | Value |
|---|---|
| Class | integer. The class name. Since GetEnums is solely for Orders currently, the class name will always be Order. |
| Property | integer. The property name, since GetEnums is solely for Orders currently, property name will always be OrderState. |
| Enums | array of objects. The actual enum values for Orders. Name - string The name of the order state enum. Description - string The description of the order state enum. Number - integer The number of the order state enum. |
Transfer
GetTransfer
Permissions: Operator,Trading
Call Type: Synchronous
Get information on the specified transfer.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTransfer", {
OMSId: 1,
AccountId: 7,
TransferId: 1,
});
POST /AP/GetTransfer HTTP/1.1
Host: hostname goes here...
aptoken: 8ccf974c-cb02-4d46-b940-d87d50b4a0bf
Content-Type: application/json
Content-Length: 63
{
"OMSId": 1,
"AccountId": 7,
"TransferId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account to which the transfer belongs to, the account is either the sender or the receiver of the transfer. required. |
| TransferId | integer. The ID of the specific transfer. required. |
Response
{
"TransferId": 2,
"SenderAccountId": 9,
"SenderUserName": "sample_user",
"ReceiverAccountId": 7,
"ReceiverUserName": "sample",
"ProductId": 3,
"Amount": 0.0001,
"Notes": "",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637836628541673107,
"LastUpdatedTimeInTicks": 637836628541749306,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 0.0,
"NotionalProductId": 0
}
| Key | Value |
|---|---|
| TransferId | integer. The ID of the OMS. |
| SenderAccountId | integer. The ID of the sender account, the account where the transfer amount was debited. |
| SenderUserName | string. The username of the sender account. |
| ReceiverAccountId | integer. The ID of the receiver account, the account where the transfer amount was credited. |
| ReceiverUserName | string. The username of the receiver account. |
| ProductId | integer. The ID of the asset or product that was transfered. |
| Amount | decimal. The amount of the transfered asset or product. |
| Notes | string. Some notes/comments that pertains to the transfer. |
| OMSId | integer. The ID of the OMS. |
| Reason | string. The reason for the transfer, defaults to User which means user initiated. |
| TransferState | string. The state of the transfer; one of the following: Accepted, Pending, Rejected, Canceled, Failed. |
| CreatedTimeInTicks | long integer. The exact date and time the transfer occured. |
| LastUpdatedInTimeTicks | long integer. The exact date and time the transfer was last updated. |
| UniqueClientTransactionId | string. Unique string that identifies a transfer, for idempotency. |
| InvoiceId | integer. The invoice ID of the transfer, defaults to 0, reserved for future use. |
| NotionalValue | decimal. The notional value of the transfer amount, calculated based on the notional product. |
| NotionalProductId | integer. The ID of the notional product. |
GetTransfers
Permissions: Operator,Trading
Call Type: Synchronous
Get transfers for a specific account. Only sent(the account specified is the sender) transfers will be retrieved.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTransfers", {
OMSId: 1,
AccountId: 7,
StartIndex: 0,
Limit: 2,
});
POST /AP/GetTransfers HTTP/1.1
Host: hostname goes here...
aptoken: 91cb65ba-7163-4609-a3e5-eef8783bf78b
Content-Type: application/json
Content-Length: 86
{
"OMSId": 1,
"AccountId": 7,
"StartIndex": 0,
"Limit": 2
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account for which you wish to retrieve transfers, the account is either the sender or the receiver of the transfer. required. |
| Limit | integer. The maximum number of transfers you wish to retrieve. Used for pagination together with the StartIndex field. If not set, all transfers of the specified account will be returned but would still depend on the StartIndex. optional. |
| StartIndex | integer. The starting index of the result you wish retrieve. Pagination field, value of 0 means results will start at the very first result. optional. |
Response
[
{
"TransferId": 26,
"SenderAccountId": 7,
"SenderUserName": "sample",
"ReceiverAccountId": 9,
"ReceiverUserName": "sample_user",
"ProductId": 2,
"Amount": 0.001,
"Notes": "",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637840807074355612,
"LastUpdatedTimeInTicks": 637840807074445388,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 0.0,
"NotionalProductId": 0
},
{
"TransferId": 116,
"SenderAccountId": 7,
"SenderUserName": "sample",
"ReceiverAccountId": 98,
"ReceiverUserName": "user@example.com",
"ProductId": 3,
"Amount": 0.001,
"Notes": "",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637894937494344686,
"LastUpdatedTimeInTicks": 637894937494480907,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 0.0,
"NotionalProductId": 0
}
]
| Key | Value |
|---|---|
| TransferId | integer. The ID of the OMS. |
| SenderAccountId | integer. The ID of the sender account, the account where the transfer amount was debited. |
| SenderUserName | string. The username of the sender account. |
| ReceiverAccountId | integer. The ID of the receiver account, the account where the transfer amount was credited. |
| ReceiverUserName | string. The username of the receiver account. |
| ProductId | integer. The ID of the asset or product that was transfered. |
| Amount | decimal. The amount of the transfered asset or product. |
| Notes | string. Some notes/comments that pertains to the transfer. |
| OMSId | integer. The ID of the OMS. |
| Reason | string. The reason for the transfer, defaults to User which means user initiated. |
| TransferState | string. The state of the transfer; one of the following: Accepted, Pending, Rejected, Canceled, Failed. |
| CreatedTimeInTicks | long integer. The exact date and time the transfer occured. |
| LastUpdatedInTimeTicks | long integer. The exact date and time the transfer was last updated. |
| UniqueClientTransactionId | string. Unique string that identifies a transfer, for idempotency. |
| InvoiceId | integer. The invoice ID of the transfer, defaults to 0, reserved for future use. |
| NotionalValue | decimal. The notional value of the transfer amount, calculated based on the notional product. |
| NotionalProductId | integer. The ID of the notional product. |
GetTransfersReceived
Permissions: Operator,Trading
Call Type: Synchronous
Get a list of recieved transfers by an account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTransfersReceived", {
OMSId: 1,
AccountId: 20,
Limit: 2,
StartIndex: 0,
});
POST /AP/GetTransfersReceived HTTP/1.1
Host: hostname goes here...
aptoken: c0c5fb0b-2b9d-9a2e-9fe2-a2eb8bfcc252
Content-Type: application/json
Content-Length: 81
{
"OMSId": 1,
"AccountId": 20,
"Limit": 2,
"StartIndex": 0
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account for which you wish to retrieve received transfers. required. |
| Limit | integer. The maximum number of received transfers you wish to retrieve. Used for pagination together with the StartIndex field. If not set, all received transfers of the specified account will be returned but would still depend on the StartIndex. optional. |
| StartIndex | integer. The starting index of the result you wish retrieve. Pagination field, value of 0 means results will start at the very first result, result set is ordered by transfer ID, ascending, means the first index would be the very first received transfer of the account, the most recent received transfer will have the highest index. optional. |
Response
[
{
"TransferId": 20,
"SenderAccountId": 21,
"SenderUserName": "user@example.com",
"ReceiverAccountId": 20,
"ReceiverUserName": "user@example.com",
"ProductId": 1,
"Amount": 1.0,
"Notes": "Sample transfer.",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637947129156176837,
"LastUpdatedTimeInTicks": 637947129156281039,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 1.0,
"NotionalProductId": 1
},
{
"TransferId": 22,
"SenderAccountId": 21,
"SenderUserName": "user@example.com",
"ReceiverAccountId": 20,
"ReceiverUserName": "user@example.com",
"ProductId": 1,
"Amount": 1.0,
"Notes": "Sample transfer with SubscribeAllAccountEvents",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637947136610526395,
"LastUpdatedTimeInTicks": 637947136610580531,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 1.0,
"NotionalProductId": 1
}
]
| Key | Value |
|---|---|
| TransferId | integer. The ID of the OMS. |
| SenderAccountId | integer. The ID of the sender account, the account where the transfer amount was debited. |
| SenderUserName | string. The username of the sender account. |
| ReceiverAccountId | integer. The ID of the receiver account, the account where the transfer amount was credited. |
| ReceiverUserName | string. The username of the receiver account. |
| ProductId | integer. The ID of the asset or product that was transfered. |
| Amount | decimal. The amount of the transfered asset or product. |
| Notes | string. Some notes/comments that pertains to the transfer. |
| OMSId | integer. The ID of the OMS. |
| Reason | string. The reason for the transfer, defaults to User which means user initiated. |
| TransferState | string. The state of the transfer; one of the following: Accepted, Pending, Rejected, Canceled, Failed. |
| CreatedTimeInTicks | long integer. The exact date and time the transfer occured. |
| LastUpdatedInTimeTicks | long integer. The exact date and time the transfer was last updated. |
| UniqueClientTransactionId | string. Unique string that identifies a transfer, for idempotency. |
| InvoiceId | integer. The invoice ID of the transfer, defaults to 0, reserved for future use. |
| NotionalValue | decimal. The notional value of the transfer amount, calculated based on the notional product. |
| NotionalProductId | integer. The ID of the notional product. |
GetTransfersHistory
Permissions: Operator,Trading
Call Type: Synchronous
Get a list of transfers for an account, including both sent and received. Can be filtered with several search parameters/fields.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetTransfersHistory", {
OMSId: 1,
AccountId: 1,
ProductId: 2,
TransferId: 73,
TransferState: "Accepted",
StartTimeStamp: 637992910693518990,
EndTimeStamp: 637992910693518990,
Limit: 5,
StartIndex: 0,
});
POST /AP/GetTransfersHistory HTTP/1.1
Host: hostname goes here...
aptoken: c0c5fb0b-2b9d-9a2e-9fe2-a2eb8bfcc252
Content-Type: application/json
Content-Length: 242
{
"OMSId": 1,
"AccountId": 1,
"ProductId": 2,
"TransferId": 73,
"TransferState": "Accepted",
"StartTimeStamp": 637992910693518990,
"EndTimeStamp": 637992910693518990,
"Limit": 5,
"StartIndex": 0
}
Filter or search parameters/fields needs to be aligned and coordinated to arrive at the expected results.
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| AccountId | integer. The ID of the account for which you wish to retrieve transfers. required. |
| ProductId | integer. The ID of the product that was transfered, if defined only transfers of such product will be returned. optional. |
| TransferId | integer. The ID of the specific transfer you wish to retrieve, if specified only 1 result will be returned(if TransferId is existing else reponse will be empty). optional. |
| TransferState | string or integer. The state of the transfers you wish to retrieve, if defined, only transfers with the transfer state specified will be returned. One of the following: 0 - Accepted, 1 - Pending, 2 - Rejected, 3 - Canceled, 4 - Failed. If not defined, it defaults to 0 which means only transfers in "Accepted" status will be retrieved. optional. |
| StartTimeStamp | long integer. If defined, only transfers that occured on or after the specified timestamp will be returned, format is in timeticks. optional. |
| EndTimeStamp | long integer. If defined, only transfers that occured on or before the specified timestamp will be returned, format is in timeticks. optional. |
| Limit | integer. The maximum number of transfers you wish to retrieve. Used for pagination together with the StartIndex field. If not set, all received transfers of the specified account will be returned but would still depend on the StartIndex. optional. |
| StartIndex | integer. Pagination field, value of 0 means results will start at the very first result, result set is ordered by transfer ID, ascending, means the first index would be the very first received transfer of the account, the most recent received transfer will have the highest index. optional. |
Response
[
{
"TransferId": 73,
"SenderAccountId": 1,
"SenderUserName": "admin",
"ReceiverAccountId": 94,
"ReceiverUserName": "user@example.com",
"ProductId": 2,
"Amount": 0.00000001,
"Notes": "Hey",
"OMSId": 1,
"Reason": "User",
"TransferState": "Accepted",
"CreatedTimeInTicks": 637992910693518990,
"LastUpdatedTimeInTicks": 637992910693685208,
"UniqueClientTransactionId": "",
"InvoiceId": 0,
"NotionalValue": 0.0001899965,
"NotionalProductId": 1
}
]
| Key | Value |
|---|---|
| TransferId | integer. The ID of the OMS. |
| SenderAccountId | integer. The ID of the sender account, the account where the transfer amount was debited. |
| SenderUserName | string. The username of the sender account. |
| ReceiverAccountId | integer. The ID of the receiver account, the account where the transfer amount was credited. |
| ReceiverUserName | string. The username of the receiver account. |
| ProductId | integer. The ID of the asset or product that was transfered. |
| Amount | decimal. The amount of the transfered asset or product. |
| Notes | string. Some notes/comments that pertains to the transfer. |
| OMSId | integer. The ID of the OMS. |
| Reason | string. The reason for the transfer, defaults to User which means user initiated. |
| TransferState | string. The state of the transfer; one of the following: Accepted, Pending, Rejected, Canceled, Failed. |
| CreatedTimeInTicks | long integer. The exact date and time the transfer occured. |
| LastUpdatedInTimeTicks | long integer. The exact date and time the transfer was last updated. |
| UniqueClientTransactionId | string. Unique string that identifies a transfer, for idempotency. |
| InvoiceId | integer. The invoice ID of the transfer, defaults to 0, reserved for future use. |
| NotionalValue | decimal. The notional value of the transfer amount, calculated based on the notional product. |
| NotionalProductId | integer. The ID of the notional product. |
TransferFunds
Permissions: Operator,Trading
Call Type: Synchronous
Transfer funds between accounts.
The behavior of this API is somehow connected to 2FA:
- If the user invoking the API has 2FA enabled, TransferFunds will initially respond with a message Waiting for 2FA. The user will need do Authenticate2FA providing the valid 2FA code so the funds transfer will be processed completely.
- Otherwise, if the user invoking the API does not have 2FA enabled, TransferFunds will immediately respond with success, of course given that the payload is valid.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("TransferFunds", {
OMSId: 1,
SenderAccountId: 1,
ReceiverAccountId: 10,
ProductId: 1,
Amount: 100.0,
Notes: "User entered notes.",
UniqueClientTransactionId: "UniqueTransferIdTag",
});
POST /AP/TransferFunds HTTP/1.1
Host: hostname goes here...
aptoken: c0c5fb0b-2b9d-9a2e-9fe2-a2eb8bfcc252
Content-Type: application/json
Content-Length: 233
{
"OMSId": 1,
"SenderAccountId": 1,
"ReceiverAccountId": 10,
"ProductId": 1,
"Amount": 100.00,
"Notes": "User entered notes.",
"UniqueClientTransactionId": "UniqueTransferIdTag"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| SenderAccountId | integer. The ID of the account which will be sending the transfer amount to the receiver account, transfer amount will be debited from this account. required. |
| ReceiverAccountId | integer. The ID of the account which will be receiving the transfer amount from the sender account, transfer amount will be credited to this account. Required if ReceiverUsername is not defined. conditionally required. |
| ReceiverUsername | string. The email address of the user whose account will get credited or the one which will receive the transfer. Required if ReceiverAccountId is not defined. conditionally required. |
| ProductId | integer. The ID of the product to that will be transfered from the sender account to the receiver account. required. |
| Amount | decimal. The amount of product to be transfered from the sender account to the receiver account. required. |
| Notes | string. Notes/comments about the transfer that you wish to record, empty string is allowed but explicitly not including this particular field will cause an error. required. |
| UniqueClientTransactionId | string. A unique identifier for the transfer that you can define, will be used for idempotency: transfer won't be run twice or there will be no risk of double spending optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "{\"TransferId\":220,\"SenderAccountId\":1,\"SenderUserName\":\"admin\",\"ReceiverAccountId\":10,\"ReceiverUserName\":\"sample\",\"ProductId\":1,\"Amount\":100.00000000000000000000000000,\"Notes\":\"User entered notes.\",\"OMSId\":1,\"Reason\":\"User\",\"TransferState\":\"Accepted\",\"CreatedTimeInTicks\":638181138234948611,\"LastUpdatedTimeInTicks\":638181138235136420,\"UniqueClientTransactionId\":\"UniqueTransferIdTag\",\"InvoiceId\":0,\"NotionalValue\":100.00000000000000000000000000,\"NotionalProductId\":1}"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. The details about the transfer that just occurred. |
CancelTransferFunds
Permissions: Operator,Trading
Call Type: Synchronous
Cancel a pending transfer of funds for a user. A user with the default permissions can only cancel pending transfers for its own account/s.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CancelTransferFunds", {
OMSId: 1,
TransferId: 306,
AccountId: 7,
});
POST /AP/CancelTransferFunds HTTP/1.1
Host: hostname goes here...
aptoken: babf8e09-60bd-4c3e-8363-1220f5fe2b3a
Content-Type: application/json
Content-Length: 65
{
"OMSId": 1,
"TransferId": 306,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| TransferId | integer. The ID of the specific pending transfer to be canceled.. required. |
| AccountId | integer. The ID of the account who owns the pending transfer, the sender account. This is the default account associated to the authenticated user. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional details about the result. Usually null. |
RequestTransferFunds
Permissions: Operator,Trading
Call Type: Synchronous
Request a transfer of funds from another user in the exchange.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RequestTransferFunds", {
OMSId: 1,
ProductId: 1,
Notes: "Sample only!",
ReceiverUsername: "user@example.com",
Amount: 1,
});
POST /AP/RequestTransferFunds HTTP/1.1
Host: hostname goes here...
aptoken: 324050b5-639f-40cd-b2e4-274b71efe741
Content-Type: application/json
Content-Length: 147
{
"OMSId": 1,
"ProductId": 1,
"Notes": "Sample only!",
"ReceiverUsername": "user@example.com",
"Amount": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product to that will be transfered from the sender account to the receiver account. required. |
| Notes | string. Notes/comments about the transfer that you wish to record, empty string is allowed but explicitly not including this particular field will cause an error. required. |
| ReceiverUsername | string. The username of the user who will receive the transferfunds request, can either be the actual username or the email address of the user. required. |
| Amount | decimal. The actual amount of product being requested to be transfered. required. |
Response
{
"result": true,
"requestcode": "0689a7c2-252e-4c5a-b79c-c908214d22cc"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| requestcode | string. The GUID of the transfer of funds request, will be used as the request payload for either confirming or rejecting the transfer of funds request using the API ConfirmRequestTransferFunds or RejectRequestTransferFunds. |
ConfirmRequestTransferFunds
Permissions: Operator,Trading
Call Type: Synchronous
Confirm a transfer of funds request
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmRequestTransferFunds", {
OMSId: 1,
RequestCode: "3c96533a-e2eb-4a6b-a240-8269738ca3c3",
OperatorId: 1,
});
POST /AP/ConfirmRequestTransferFunds HTTP/1.1
Host: hostname goes here...
aptoken: 324050b5-639f-40cd-b2e4-274b71efe741
Content-Type: application/json
Content-Length: 102
{
"OMSId": 1,
"RequestCode": "3c96533a-e2eb-4a6b-a240-8269738ca3c3",
"OperatorId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| RequestCode | string. The GUID of the transfer of funds request to be confirmed. required. |
| OperatorId | integer. The ID of the Operator where the OMS operates. required. |
Response
//Response if transfer of funds request is successfully confirmed.
{
"result": true,
"requestcode": "3c96533a-e2eb-4a6b-a240-8269738ca3c3"
}
//Response if transfer of funds request is already processed
{
"result": false,
"errormsg": "Invalid Request",
"errorcode": 100,
"detail": "Transfer already processed"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| requestcode | string. The GUID of the confirmed transfer of funds request. |
RejectRequestTransferFunds
Permissions: Operator,Trading
Call Type: Synchronous
Reject a transfer of funds request
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmRequestTransferFunds", {
OMSId: 1,
RequestCode: "6e48c0bc-881a-41ea-a0aa-1f7359f3647b",
OperatorId: 1,
});
POST /AP/RejectRequestTransferFunds HTTP/1.1
Host: hostname goes here...
aptoken: 324050b5-639f-40cd-b2e4-274b71efe741
Content-Type: application/json
Content-Length: 102
{
"OMSId": 1,
"RequestCode": "6e48c0bc-881a-41ea-a0aa-1f7359f3647b",
"OperatorId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| RequestCode | string. The GUID of the transfer of funds request to be rejected. required. |
| OperatorId | integer. The ID of the Operator where the OMS operates. required. |
Response
//Response if transfer of funds rejection is successful.
{
"result": true,
"requestcode": "6e48c0bc-881a-41ea-a0aa-1f7359f3647b"
}
//Response if transfer of funds request is already processed
{
"result": false,
"errormsg": "Invalid Request",
"errorcode": 100,
"detail": "Transfer already processed"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| requestcode | string. The GUID of the rejected transfer of funds request. |
GetRequestTransfer
Permissions: Operator,Trading
Call Type: Synchronous
Get a transfer of funds request either sent or received by a user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetRequestTransfer", {
OMSId: 1,
OperatorId: 1,
RequestCode: "039e47df-55c4-47b1-a2bc-8d424e833c46",
});
POST /AP/GetRequestTransfer HTTP/1.1
Host: hostname goes here...
aptoken: 8e6ea2c5-7ee2-4206-bf90-25f56e79e0b8
Content-Type: application/json
Content-Length: 102
{
"OMSId": 1,
"OperatorId": 1,
"RequestCode": "039e47df-55c4-47b1-a2bc-8d424e833c46"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| RequestCode | string. The GUID of the specific transfer of funds request to be retrieved. required. |
| OperatorId | integer. The ID of the Operator where the OMS operates. required. |
Response
{
"CreatedTimestamp": "2022-03-28T16:01:48.740Z",
"LastUpdateTimestamp": "2022-03-28T16:11:47.451Z",
"OMSId": 1,
"OperatorId": 1,
"RequestId": 1,
"RequestCode": "039e47df-55c4-47b1-a2bc-8d424e833c46",
"PayerUsername": "sample",
"PayerAccountId": 7,
"RequestorUsername": "sample_user",
"RequestorAccountId": 9,
"ProductId": 2,
"ProductName": "Bitcoin",
"Amount": 0.001,
"Notes": "",
"Status": "TransferCompleted"
}
| Key | Value |
|---|---|
| CreatedTimestamp | string. The exact date and time the transfer of funds request got created. |
| LastUpdateTimestamp | string. The exact date and time the transfer of funds request was last updated. |
| OMSId | integer. The ID of the OMS. |
| OperatorId | integer. The ID of the Operator where the OMS operates. |
| RequestId | integer. The ID of the transfer of funds request. |
| RequestCode | string. The GUID that uniquely identifies the transfer of funds request . |
| PayerUsername | string. The username of the user who received the transfer of funds request, this will be the user who will either confirm or reject the request. |
| PayerAccountId | integer. The ID of the default account of the payer, this is the account where the transfer amount will come fron in case the request is approved or confirmed. |
| RequestorUsername | string. The username of the user who requested the transfer of funds. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds, this will be the account that will receive the transfer amount in case the request is approved or confirmed. |
| ProductId | integer. The ID of the product which is being requested to be transfered. |
| ProductName | string. The name of the product which is being requested to be transfered.. |
| Amount | decimal. The amount being requested to be transfered. |
| Notes | string. Notes or comments about the transfer of funds request. |
| Status | string. The current status of the transfer of funds request, one of the following: TransferCompleted, PayerRejected, Requested |
GetRequestTransferRequestsReceived
Permissions: Operator,Trading
Call Type: Synchronous
Get a list of transfer of funds requests a user has recieved.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetRequestTransferRequestsReceived", {
OMSId: 1,
PayerAccountId: 9,
RequestorAccountId: 7,
});
POST /AP/GetRequestTransferRequestsReceived HTTP/1.1
Host: hostname goes here...
aptoken: 0db0b298-cc77-4f6d-809d-da79e2e0ef20
Content-Type: application/json
Content-Length: 76
{
"OMSId": 1,
"PayerAccountId": 9,
"RequestorAccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| PayerAccountId | integer. The ID of the default account of the user who received the transfer of funds request. Can be used to filter transfer of funds request with a specific payer account. This is usually the default account ID of the authenticated user. required. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds. optional. |
| RequestCode | string. The GUID of the specific transfer of funds request to be retrieved. If this will be defined, only 1 transfer of funds request will be returned, better use GetRequestTransfer. optional. |
Response
[
{
"CreatedTimestamp": "2023-04-27T04:54:01.032Z",
"LastUpdateTimestamp": "2023-04-27T04:54:01.032Z",
"OMSId": 1,
"OperatorId": 1,
"RequestId": 16,
"RequestCode": "28ebb242-a7dd-4c95-ba4d-6a166350d9be",
"PayerUsername": "sample_user",
"PayerAccountId": 9,
"RequestorUsername": "sample",
"RequestorAccountId": 7,
"ProductId": 2,
"ProductName": "Bitcoin",
"Amount": 1.0,
"Notes": "Sample Bitcoin request my friend!",
"Status": "Requested"
}
]
| Key | Value |
|---|---|
| CreatedTimestamp | string. The exact date and time the transfer of funds request got created. |
| LastUpdateTimestamp | string. The exact date and time the transfer of funds request was last updated. |
| OMSId | integer. The ID of the OMS. |
| OperatorId | integer. The ID of the Operator where the OMS operates. |
| RequestId | integer. The ID of the transfer of funds request. |
| RequestCode | string. The GUID that uniquely identifies the transfer of funds request . |
| PayerUsername | string. The username of the user who received the transfer of funds request, this will be the user who will either confirm or reject the request. |
| PayerAccountId | integer. The ID of the default account of the payer, this is the account where the transfer amount will come fron in case the request is approved or confirmed. |
| RequestorUsername | string. The username of the user who requested the transfer of funds. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds, this will be the account that will receive the transfer amount in case the request is approved or confirmed. |
| ProductId | integer. The ID of the product which is being requested to be transfered. |
| ProductName | string. The name of the product which is being requested to be transfered.. |
| Amount | decimal. The amount being requested to be transfered. |
| Notes | string. Notes or comments about the transfer of funds request. |
| Status | string. The current status of the transfer of funds request, one of the following: TransferCompleted, PayerRejected, Requested |
GetRequestTransferRequestsRequested
Permissions: Operator,Trading
Call Type: Synchronous
Get a list transfer of funds requests sent by a user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetRequestTransferRequestsRequested", {
OMSId: 1,
RequestorAccountId: 9,
PayerAccountId: 7,
});
POST /AP/GetRequestTransferRequestsRequested HTTP/1.1
Host: hostname goes here...
aptoken: 0db0b298-cc77-4f6d-809d-da79e2e0ef20
Content-Type: application/json
Content-Length: 79
{
"OMSId": 1,
"RequestorAccountId": 9,
"PayerAccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds. This is usually ID of the default account of the authenticated user. required. |
| PayerAccountId | integer. The ID of the default account of the user who received the transfer of funds request. Can be used to filter transfer of funds request with a specific payer account. optional. |
| RequestCode | string. The GUID of the specific transfer of funds request to be retrieved. If this will be defined, only 1 transfer of funds request will be returned, better use GetRequestTransfer. optional. |
Response
[
{
"CreatedTimestamp": "2022-03-28T16:01:48.740Z",
"LastUpdateTimestamp": "2022-03-28T16:11:47.451Z",
"OMSId": 1,
"OperatorId": 1,
"RequestId": 1,
"RequestCode": "039e47df-55c4-47b1-a2bc-8d424e833c46",
"PayerUsername": "sample",
"PayerAccountId": 7,
"RequestorUsername": "sample_user",
"RequestorAccountId": 9,
"ProductId": 2,
"ProductName": "Bitcoin",
"Amount": 0.001,
"Notes": "",
"Status": "TransferCompleted"
}
]
| Key | Value |
|---|---|
| CreatedTimestamp | string. The exact date and time the transfer of funds request got created. |
| LastUpdateTimestamp | string. The exact date and time the transfer of funds request was last updated. |
| OMSId | integer. The ID of the OMS. |
| OperatorId | integer. The ID of the Operator where the OMS operates. |
| RequestId | integer. The ID of the transfer of funds request. |
| RequestCode | string. The GUID that uniquely identifies the transfer of funds request . |
| PayerUsername | string. The username of the user who received the transfer of funds request, this will be the user who will either confirm or reject the request. |
| PayerAccountId | integer. The ID of the default account of the payer, this is the account where the transfer amount will come fron in case the request is approved or confirmed. |
| RequestorUsername | string. The username of the user who requested the transfer of funds. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds, this will be the account that will receive the transfer amount in case the request is approved or confirmed. |
| ProductId | integer. The ID of the product which is being requested to be transfered. |
| ProductName | string. The name of the product which is being requested to be transfered.. |
| Amount | decimal. The amount being requested to be transfered. |
| Notes | string. Notes or comments about the transfer of funds request. |
| Status | string. The current status of the transfer of funds request, one of the following: TransferCompleted, PayerRejected, Requested |
GetRequestTransfers
Permissions: Operator,Trading
Call Type: Synchronous
Get a list transfer of funds requests of a user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetRequestTransfers", {
OMSId: 1,
RequestorAccountId: 9,
PayerAccountId: 7,
});
POST /AP/GetRequestTransfers HTTP/1.1
Host: hostname goes here...
aptoken: 8e6ea2c5-7ee2-4206-bf90-25f56e79e0b8
Content-Type: application/json
Content-Length: 76
{
"OMSId": 1,
"RequestorAccountId": 9,
"PayerAccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds. required. |
| PayerAccountId | integer. The ID of the default account of the user who received the transfer of funds request. Can be used to filter transfer of funds request with a specific payer account. optional. |
| RequestCode | string. The GUID of the specific transfer of funds request to be retrieved. If this will be defined, only 1 transfer of funds request will be returned, better use GetRequestTransfer. optional. |
Response
[
{
"CreatedTimestamp": "2022-03-28T16:01:48.740Z",
"LastUpdateTimestamp": "2022-03-28T16:11:47.451Z",
"OMSId": 1,
"OperatorId": 1,
"RequestId": 1,
"RequestCode": "039e47df-55c4-47b1-a2bc-8d424e833c46",
"PayerUsername": "sample",
"PayerAccountId": 7,
"RequestorUsername": "sample_user",
"RequestorAccountId": 9,
"ProductId": 2,
"ProductName": "Bitcoin",
"Amount": 0.001,
"Notes": "",
"Status": "TransferCompleted"
}
]
| Key | Value |
|---|---|
| CreatedTimestamp | string. The exact date and time the transfer of funds request got created. |
| LastUpdateTimestamp | string. The exact date and time the transfer of funds request was last updated. |
| OMSId | integer. The ID of the OMS. |
| OperatorId | integer. The ID of the Operator where the OMS operates. |
| RequestId | integer. The ID of the transfer of funds request. |
| RequestCode | string. The GUID that uniquely identifies the transfer of funds request . |
| PayerUsername | string. The username of the user who received the transfer of funds request, this will be the user who will either confirm or reject the request. |
| PayerAccountId | integer. The ID of the default account of the payer, this is the account where the transfer amount will come fron in case the request is approved or confirmed. |
| RequestorUsername | string. The username of the user who requested the transfer of funds. |
| RequestorAccountId | integer. The ID of the default account of the user who requested the transfer of funds, this will be the account that will receive the transfer amount in case the request is approved or confirmed. |
| ProductId | integer. The ID of the product which is being requested to be transfered. |
| ProductName | string. The name of the product which is being requested to be transfered.. |
| Amount | decimal. The amount being requested to be transfered. |
| Notes | string. Notes or comments about the transfer of funds request. |
| Status | string. The current status of the transfer of funds request, one of the following: TransferCompleted, PayerRejected, Requested |
BatchTransfer
Permissions: Operator,Trading
Call Type: Synchronous
Transfer funds from one or more accounts to one or more accounts in a single API call. Payload is an array containing JSON object/s, each JSON object represents a single TransferFunds request. The transfer of funds can be assorted, means that it can be for different products, different amount, and different receiver accounts.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("");
await apex.RPCPromise("BatchTransfer", [
{
OMSId: 1,
SenderAccountId: 1,
ReceiverAccountId: 11,
ProductId: 2,
Amount: 110.0,
Notes: "User entered notes.",
},
{
OMSId: 1,
SenderAccountId: 1,
ReceiverAccountId: 10,
ProductId: 2,
Amount: 100.0,
Notes: "User entered notes.",
},
{
OMSId: 1,
SenderAccountId: 1,
ReceiverAccountId: 11,
ProductId: 2,
Amount: 100.0,
Notes: "User entered notes.",
},
{
OMSId: 1,
SenderAccountId: 9,
ReceiverAccountId: 11,
ProductId: 2,
Amount: 100.0,
Notes: "User entered notes.",
}
]);
POST /AP/BatchTransfer HTTP/1.1
Host: api.ap-can-uat.apstage.net
aptoken: 40622d15-afbd-d525-1801-02120fc32367
Content-Type: application/json
Content-Length: 598
[
{
"OMSId": 1,
"SenderAccountId": 1,
"ReceiverAccountId": 11,
"ProductId": 2,
"Amount": 110.00,
"Notes":"User entered notes."
},
{
"OMSId": 1,
"SenderAccountId": 1,
"ReceiverAccountId": 10,
"ProductId": 2,
"Amount": 100.00,
"Notes":"User entered notes."
},
{
"OMSId": 1,
"SenderAccountId": 1,
"ReceiverAccountId": 11,
"ProductId": 2,
"Amount": 100.00,
"Notes":"User entered notes."
},
{
OMSId: 1,
SenderAccountId: 9,
ReceiverAccountId: 11,
ProductId: 2,
Amount: 100.0,
Notes: "User entered notes.",
}
]
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| SenderAccountId | integer. The ID of the account which will be sending the transfer amount to the receiver account, transfer amount will be debited from this account. required. |
| ReceiverAccountId | integer. The ID of the account which will be receiving the transfer amount from the sender account, transfer amount will be credited to this account. required. |
| ProductId | integer. The ID of the product to that will be transfered from the sender account to the receiver account. required. |
| Amount | decimal. The amount of product to be transfered from the sender account to the receiver account. required. |
| Notes | string. Notes/comments about the transfer that you wish to record, empty string is allowed but explicitly not including this particular field will cause an error. required. |
| UniqueClientTransactionId | string. A unique identifier for the transfer that you can define, will be used for idempotency: transfer won't be run twice or there will be no risk of double spending optional. |
Response
{
"result": true,
"errormsg": "",
"errorcode": 0,
"detail": " Transfer 1: Success=True \n Transfer 2: Success=True \n Transfer 3: Success=True \n"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Will contain the results for individual transfer of funds, Success either True or False. As of now, Success is always True even if the actual transfer of funds did not succeed due to insufficient funds for instance. |
ConfirmTransferFundsRegisterUser
Permissions: Public
Call Type: Synchronous
Called upon user confirmation of their email from a transfer of funds to register their account. When a user does an internal transfer of funds to an email address which does not have a corresponding user in the system, APEX will automatically create the user and send an email to the email address. This also controlled by the Gateway config SendTransferFundsRegisterUserEmail, when the value is set to True, the contents of the email template TransferFundsRegisterUser will be sent, otherwise, the contents of usual VerifyEmail template will be sent.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmTransferFundsRegisterUser", {
UserId: 111,
VerifyEmailCode: "985d6237-10c3-6c19-c30e-2d1347445163",
Password: "Users Desired Plain text Password",
});
POST /ap/ConfirmTransferFundsRegisterUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 115
{
"UserId": 33,
"VerifyEmailCode": "985d6237-10c3-6c19-c30e-2d1347445163",
"Password": "DemoUs3r"
}
| Key | Value |
|---|---|
| UserId | integer. ID of the user which will be confirmed/verified. required. |
| VerifyEmailCode | string. GUID being generated by APEX, must be a valid GUID. required. |
| Password | string. The nominated password in plain text, will be hashed by the backend. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
User
GetUserAffiliateCount
Permissions: Operator,Trading
Call Type: Synchronous
Gets a count of users that were referred by a user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserAffiliateCount", {
OMSId: 1,
UserId: 5,
});
POST /AP/GetUserAffiliateCount HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: e6567bb5-0245-4cb3-b99e-b3adebe9c94c //valid session token
Content-Length: 38
{
"OMSId": 1,
"UserId": 5
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the user belongs to. Not explicitly required, defaults to the OMSId where the specified UserId belongs. optional. |
| UserId | integer. The ID of the user for which to get number of affiliates. Not explicitly required but would make sense to define it because the count will always be zero if no UserId will be specified. required. |
Response
{
"Count": 17
}
Returns a JSON object. The value of the field count is the total number of affiliates of the specific user in the request.
GetUserAffiliateTag
Permissions: Operator, Trading
Call Type: Synchronous
Returns the existing affiliate tag associated with the identified user. The exchange can use an affiliate tag to identify new users who join the exchange as a result of a recommendation from the identified user. An affiliate tag is globally unique for each user, there will be no user which can have duplicate affiliate tag.
A user with the standard permissions can only fetch its own affiliate tag, a user will elevated permission/s can fetch any user's affiliate tag.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserAffiliateTag", {
OMSId: 1,
UserId: 6,
});
POST /AP/GetUserAffiliateTag HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: e6567bb5-0245-4cb3-b99e-b3adebe9c94c //valid session token
Content-Length: 38
{
"OMSId": 1,
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose affiliate tag you want to retrieve.If not set, affiliate tag of the currently logged-in user will be returned optional. |
| OMSId | integer. The ID of the OMS on which the specified user is assigned. If not set, it will default to the OMSId from the userinfo of the specified user. optional. |
Response
The response is a JSON object of affiliate tag information including the UserId.
{
"OMSId": 1,
"UserId": 6,
"AffiliateId": 7,
"AffiliateTag": "sample"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the user operates. This echoes the omsId in the request. |
| UserId | integer. The ID of the user whose affiliate tag is returned. Echoes the userId in the request. |
| AffiliateId | integer. Affiliate ID of the user, this is unique per user. |
| AffiliateTag | string. The actual affiliate tag of the specified user. |
AddUserAffiliateTag
Permissions: Operator, Trading
Call Type: Synchronous
Associates an affiliate tag to a user. An exchange operator boost signups by can encouraging its current users to invite others to join by rewarding a user for every invite. For a user to be rewarded for every successful invite he/she makes, he/she needs to send an invite link together with his AffiliateTag. A user with elevated permission can add an affiliate tag for another user. A user can only have 1 affiliate tag at a time, if there is already an existing affiliate tag for the user, the affiliate tag in the request will replace the existing one. An affiliate tag is globally unique for each user, an affiliate tag already being used by any user cannot be added to any other user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise('AddUserAffiliateTag',{
"OMSId": 1,
"UserId": 6 //optional
"AffiliateTag": "myaffiliatetag"
})
POST /AP/AddUserAffiliateTag HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: e6567bb5-0245-4cb3-b99e-b3adebe9c94c //valid session token
Content-Length: 59
{
"OMSId": 1,
"UserId": 6, //Optional
"AffiliateTag": "myaffiliatetag"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the user operates. optional. |
| UserId | integer. ID of the user to whom the Affiliate tag will be added. If not specified, affiliate tag will be added for the user currently logged-in. Operator may opt to add user affiliate tags using a middleware, that's when UserId needs to be defined. optional. |
| AffiliateTag | string. The alphanumeric tag that will be set for the user. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. True signifies that the server has received the request to associate the affiliate tag with a specific user (not that it has done so); false signifies an error. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful response returns 0. An unsuccessful response returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
UpdateUserAffiliateTag
Permissions: Operator, Trading
Call Type: Synchronous
Updates an existing affiliate tag of a user. An affiliate tag is globally unique for each user, an affiliate tag already being used by any user cannot be used to update any other user's affiliate tag.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise('UpdateUserAffiliateTag',{
"AffiliateTag": "myaffiliatetag"
"AffiliateId": 7
})
POST /AP/UpdateUserAffiliateTag HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: e6567bb5-0245-4cb3-b99e-b3adebe9c94c //valid session token
Content-Length: 59
{
"AffiliateTag": "myaffiliatetag",
"AffiliateId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the user operates. optional. |
| UserId | integer. The ID of the user, not explicitly required. Needs to be defined if an operator decides to update user's affiliated tags using a middleware. conditionally required. |
| AffiliateId | integer. The affiliate Id of the user, this id automatically gets assigned to a user upon registration/signup. required. |
| AffiliateTag | string. The new affiliate tag to replace the existing one. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. True signifies that the server has received the request to update the affiliate tag with a specific user (not that it has done so); false signifies an error. |
| errormsg | string. A successful response returns null; the errormsg parameter for an unsuccessful response returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful response returns 0. An unsuccessful response returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
GetUserAccounts
Permissions: Operator, Trading, AccountReadOnly
Call Type: Synchronous
Returns a list of account IDs for a given user. More than one user may be associated with a given account. All fields in the payload are optional.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserAccounts", {
OMSId: 1,
UserId: 1,
});
POST /AP/GetUserAccounts HTTP/1.1
Host: hostname goes here...
aptoken: f385969b-6985-4310-86a9-71330ad7c62e
Content-Type: application/json
Content-Length: 20
{
"OMSId": 1
"UserId": 1
}
| Key | Value |
|---|---|
| OMSId | integer. The OMS on which the user has one ore more accounts. optional. |
| UserId | integer. The ID of the user whose accounts you want to return. If not specified, the accounts of the user currently authenticated will be returned. A user with elevated permissions can specify any UserID and will be able to get the account/s owned by any user. optional. |
Response
[1]
Returns an array as a response, each element represents an ID of an account associated to the user.
GetUserDevices
Permissions: Operator, Trading
Call Type: Synchronous
Get the Registered Device/s of a specific user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserDevices", {
UserId: 6,
});
POST /AP/GetUserDevices HTTP/1.1
Host: hostname goes here...
aptoken: a241cfbd-ccb3-4f71-9b04-3416549bba6f
Content-Type: application/json
Content-Length: 4
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user for whose registered device/s will be returned. If an authenticated user has elevated permission/s, other parameters can be used such as Username and Email, all parameters of optional too because if no parameter is defined, the registered devices of the authenticated user will be returned.conditionally optional. |
Response
[
{
"HashCode": 345283502,
"Location": "",
"DeviceName": "Windows NT 10.0; Win64; x64",
"IpAddress": "69.10.61.175",
"UserId": 6,
"IsTrusted": false,
"ExpirationTime": 638169851720253079
},
{
"HashCode": 1697796896,
"Location": "",
"DeviceName": "Windows NT 10.0; Win64; x64",
"IpAddress": "69.10.61.175",
"UserId": 6,
"IsTrusted": true,
"ExpirationTime": 637853361524214929
}
]
| Key | Value |
|---|---|
| HashCode | integer. A unique code that identifies the user registered device. |
| Location | string. Defaults to empty string, for future provision. |
| DeviceName | string. The name of the device. |
| IpAddress | string. The IpAddress from where the user registered the device. |
| UserId | integer. The ID of the user who owns the device. |
| IsTrusted | boolean. Either true or false, if true device is trusted which means the user has confirmed, otherwise it is false. |
| ExpirationTime | long integer. The date and time up to when the device will be trusted. In ticks format. |
GetUserInfo
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Retrieves the info of a specific user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserInfo", {
UserId: 6,
});
POST /AP/GetUserInfo HTTP/1.1
Host: hostname goes here...
aptoken: 60240266-6a71-4653-bbc3-7146777a37f9
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
All request payload given below are optional, you can use any of those one at a time. The authenticated user's info will be returned even if no request payload will be defined. A user with default permissions can only get its own user info, user with elevated permissions can get any user's info.
| Key | Value |
|---|---|
| UserId | integer. The ID of the user. optional. |
| string. The email address of the user. optional. | |
| Username | string. The username of the user. optional. |
| AffiliateId | integer. The affiliate ID of the user. optional. |
Response
{
"UserId": 6,
"UserName": "sampleuser",
"Email": "user@example.com",
"PasswordHash": "",
"PendingEmailCode": "",
"EmailVerified": true,
"AccountId": 9,
"DateTimeCreated": "2022-01-28T05:25:42.488Z",
"AffiliateId": 7,
"RefererId": 6,
"OMSId": 1,
"Use2FA": false,
"Salt": "",
"PendingCodeTime": "0001-01-01T00:00:00.000Z",
"Locked": false,
"LockedTime": "2023-01-21T02:49:15.477Z",
"NumberOfFailedAttempt": 0,
"MarginBorrowerEnabled": false,
"MarginAcquisitionHalt": false,
"OperatorId": 1
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user. |
| Username | string. The username of the user. |
| string. The email address of the user. | |
| PasswordHash | string. Always empty for security purposes. |
| PendingEmailCode | string. Always empty for security purposes. |
| EmailVerified | boolean. If true, user email is verified, else email is not yet verified. |
| AccountId | integer. The ID of the account associated to the user by default. During user signup/registration, a default account associated to the user is created. There is a significant difference between an account and a user in APEX. |
| DateTimeCreated | string. The exact date and time the user is created, in UTC. |
| AffiliateId | integer. The affiliate ID of the user. |
| RefererId | integer. The affiliate ID of the referer if the user signup through an affiliate URL. |
| OMSId | integer. The ID of the OMS where the user belongs to. |
| Use2FA | boolean. If true, 2FA is enabled, else 2FA is not enabled. |
| Salt | string. Always empty for security purposes. |
| Locked | boolean. If true, user is locked. A locked user will not be able to login. Else, user is not locked. |
| LockedTime | string. The exact date and time the user was locked, in UTC. |
| NumberOfFailedAttempt | integer. The number of times the user had failed authentication attempts. An operator can set maximum number of failed authentication attempts, after the max number is hit, the user will automatically get locked. |
| MarginBorrowerEnabled | boolean. Defaults to false. Reserved for future use. |
| MarginAcquisitionHalt | boolean. Defaults to false. Reserved for future use. |
| OperatorId | integer. The ID of the operator where the OMS operates. |
SetUserInfo
Permissions: Operator,Trading
Call Type: Synchronous
Updates a specific user's information.
Only the following can be updated using SetUserInfo:
- UserName: any user can change this field, UserId is required to be defined in the payload in order to identify the specific user whose username will be set or changed.
- Email: any user can set this field, either UserId or Username is required in the payload in order to identify the specific user whose email will be set or changed. Once changed, EmailVerified for the user will automatically be set to false, the new email address needs to be verified.
- EmailVerified: only a user with elevated permission can set this field to either true or false for any user.
- RefererId: only a user with elevated permission can set this field for any user.
- Use2FA: any user can set this field to true from False, seems like a bug because enabling 2FA is a 2 step process. On the other hand, only a user with elevated permission can set this field to false from true for any user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SetUserInfo", {
UserId: 6,
Email: "user@example.com",
});
POST /AP/SetUserInfo HTTP/1.1
Host: hostname goes here...
aptoken: aca4fb89-4985-4469-95c5-8208637b6710
Content-Type: application/json
Content-Length: 56
{
"UserId": 6,
"Email": "user@example.com"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose info will be set or changed. Not required if username is defined in the payload unless the request is for a username change.conditionally required. |
| Username | string. The username of the user whose info will be set or changed, it can also be the new username to be set. Not required if UserId is defined in the payload.conditionally required. |
| string. The new email address to be set for the user, required if email will be changed.conditionally required. | |
| RefererId | integer. The new referer ID to be set for the user, referer ID is the affiliate ID of the user who refered the specified user.conditionally required. |
Response
{
"UserId": 6,
"UserName": "sampleuser",
"Email": "user@example.com",
"PasswordHash": "",
"PendingEmailCode": "",
"EmailVerified": false,
"AccountId": 9,
"DateTimeCreated": "2022-01-28T05:25:42.488Z",
"AffiliateId": 7,
"RefererId": 6,
"OMSId": 1,
"Use2FA": false,
"Salt": "",
"PendingCodeTime": "2023-04-24T00:55:25.121Z",
"Locked": false,
"LockedTime": "2023-01-21T02:49:15.477Z",
"NumberOfFailedAttempt": 0,
"MarginBorrowerEnabled": false,
"MarginAcquisitionHalt": false,
"OperatorId": 1
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user. |
| Username | string. The username of the user. |
| string. The email address of the user. | |
| PasswordHash | string. Always empty for security purposes. |
| PendingEmailCode | string. Always empty for security purposes. |
| EmailVerified | boolean. If true, user email is verified, else email is not yet verified. |
| AccountId | integer. The ID of the account associated to the user by default. During user signup/registration, a default account associated to the user is created. There is a significant difference between an account and a user in APEX. |
| DateTimeCreated | string. The exact date and time the user is created, in UTC. |
| AffiliateId | integer. The affiliate ID of the user. |
| RefererId | integer. The affiliate ID of the referer if the user signup through an affiliate URL. |
| OMSId | integer. The ID of the OMS where the user belongs to. |
| Use2FA | boolean. If true, 2FA is enabled, else 2FA is not enabled. |
| Salt | string. Always empty for security purposes. |
| Locked | boolean. If true, user is locked. A locked user will not be able to login. Else, user is not locked. |
| LockedTime | string. The exact date and time the user was locked, in UTC. |
| NumberOfFailedAttempt | integer. The number of times the user had failed authentication attempts. An operator can set maximum number of failed authentication attempts, after the max number is hit, the user will automatically get locked. |
| MarginBorrowerEnabled | boolean. Defaults to false. Reserved for future use. |
| MarginAcquisitionHalt | boolean. Defaults to false. Reserved for future use. |
| OperatorId | integer. The ID of the operator where the OMS operates. |
GetUnredactedUserConfigByKey
Permissions: Operator,Trading
Call Type: Synchronous
Gets a unredacted config for a user, one key at a time.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUnredactedUserConfigByKey",
{
"UserId": 6
"Key": "2FAType"
});
POST /AP/GetUnredactedUserConfigByKey HTTP/1.1
Host: hostname goes here...
aptoken: 3f01261c-d5eb-4fad-85af-86f403d21531
Content-Type: application/json
Content-Length: 43
{
"UserId": 6
"Key": "2FAType"
}
The key must be an existing one, else, response will be 102 Server Error.
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose unreducted config key value will be returned. If not defined, the authenticated user's unreducted config key value matching the key on the request will be returned. optional. |
| Username | string. The username of the user whose unreducted config key value will be returned. If not defined, the authenticated user's unreducted config key value matching the key on the request will be returned. optional. |
| string. The email of the user whose unreducted config key value will be returned. If not defined, the authenticated user's unreducted config key value matching the key on the request will be returned. optional. | |
| AffiliateId | integer. The affiliate ID of the user whose unreducted config key value will be returned. If not defined, unreducted config key value matching the key on the request will be returned. optional. |
| Key | string. The actual user config key name for which unreducted value will be returned. required. |
Response
{
"Key": "2FAType",
"Value": "Google"
}
| Key | Value |
|---|---|
| Key | string. The user config key name. |
| Value | string. The unreducted user config key value. |
UnmaskUserConfig
Permissions: Operator,Trading
Call Type: Synchronous
Gets all the unmasked configs for a user
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("UnmaskUserConfig", {
AffiliateId: 7,
});
POST /AP/UnmaskUserConfig HTTP/1.1
Host: hostname goes here...
aptoken: 9689b493-5bab-4aae-9ac5-059a312d2cf9
Content-Type: application/json
Content-Length: 27
{
"AffiliateId": 7,
}
All request payload fields given in the Key-Value table below are optional if the authenticated user is getting its own unmasked user config/s, a user with default permission will always do that as it won't have access to other users' config/s. A user with elevated permission can define any of those optional fields 1 at a time to get any user's unmasked user config/s.
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose unmasked user config/s will be returned. If not defined, the authenticated user's unmasked user config/s will be returned. optional. |
| Username | string. The username of the user whose unmasked user config/s will be returned. If not defined, the authenticated user's unmasked user config/s will be returned. optional. |
| string. The email of the user whose unmasked user config/s will be returned. If not defined, the authenticated user's unmasked user config/s will be returned. optional. | |
| AffiliateId | integer. The affiliate ID of the user whose unmasked user config/s will be returned. If not defined, the authenticated user's unmasked user config/s will be returned. optional. |
Response
[
{
"Key": "2FAType",
"Value": "Google"
},
{
"Key": "GooglePassPhrase",
"Value": "********"
},
{
"Key": "levelIncreaseStatus",
"Value": "underReview"
}
]
| Key | Value |
|---|---|
| Key | string. The user config key name. |
| Value | string. The unmasked user config key value. |
SetUserConfig
Permissions: Operator,Trading
Call Type: Synchronous
Sets or updates a user's Key/Value pair configuration/s.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SetUserConfig", {
UserId: 6,
Config: [
{
Key: "Sample1",
Value: "SampleValue",
},
{
Key: "AnotherSample",
Value: "AnotherSampleValue",
},
],
});
POST /AP/SetUserConfig HTTP/1.1
Host: hostname goes here...
aptoken: 9689b493-5bab-4aae-9ac5-059a312d2cf9
Content-Type: application/json
Content-Length: 219
{
"UserId": 6,
"Config":[
{
"Key": "Sample1",
"Value": "SampleValue"
},
{
"Key": "AnotherSample",
"Value": "AnotherSampleValue"
}
]
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user for whom the user config will be added. If not defined, config will be added for the authenticated user. optional. |
| Username | string. The username of the user for whom the user config will be added. If not defined, config will be added for the authenticated user. optional. |
| string. The email of the user for whom the user config will be added. If not defined, config will be added for the authenticated user. optional. | |
| AffiliateId | integer. The affiliate ID of the user for whom the user config will be added. If not defined, config will be added for the authenticated user. optional. |
| Config | array. An array of objects where the actual key-value pair/s are defined. Each element is an object and represents 1 key-value pair. Key - string - the actual key name of the user config. required. Value - string - the actual value to be set for the specific key. required. If key is already existing, value will be updated. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. An additional message that the system may give, usually null. |
GetUserConfig
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves a list of Key/Value configs for a user. Values are masked or obfuscated by default.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserConfig", {
UserId: 6,
});
POST /AP/GetUserConfig HTTP/1.1
Host: hostname goes here...
aptoken: 9689b493-5bab-4aae-9ac5-059a312d2cf9
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose user config/s will be returned. If not defined, the authenticated user's user config/s will be returned. optional. |
| Username | string. The username of the user whose user config/s will be returned. If not defined, the authenticated user's user config/s will be returned. optional. |
| string. The email of the user whose user config/s will be returned. If not defined, the authenticated user's user config/s will be returned. optional. | |
| AffiliateId | integer. The affiliate ID of the user whose user config/s will be returned. If not defined, the authenticated user's user config/s will be returned. optional. |
Response
[
{
"Key": "2FAType",
"Value": "********"
},
{
"Key": "AnotherSample",
"Value": "********"
},
{
"Key": "GooglePassPhrase",
"Value": "********"
},
{
"Key": "levelIncreaseStatus",
"Value": "********"
},
{
"Key": "Sample",
"Value": "********"
},
{
"Key": "Sample1",
"Value": "********"
}
]
| Key | Value |
|---|---|
| Key | string. The user config key name. |
| Value | string. The user config key value. |
GetUserPermissions
Permissions: Operator,Trading,AccountReadOnly
Call Type: Synchronous
Retrieves the list of permissions for a specific user.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserPermissions", {
UserId: 6,
});
POST /AP/GetUserPermissions HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose permissions you wish to retrieve. required. |
Response
["Deposit", "Operator", "Trading", "Withdraw"];
Returns an array as a response. Each element in the array represents a specific permission that belongs to the specified user in the request.
RemoveUserAPIKeyPermission
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Remove permissions from an API Key, one permission at a time.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RemoveUserAPIKeyPermission", {
UserId: 18,
APIKey: "75e81e03303c365cf5409bece487ced5",
Permission: "Deposit",
});
POST /AP/RemoveUserAPIKeyPermission HTTP/1.1
Host: hostname goes here...
aptoken: 66dde963-8a0c-d71a-15a2-57f2bd41d457
Content-Type: application/json
Content-Length: 101
{
"UserId":18,
"APIKey":"75e81e03303c365cf5409bece487ced5",
"Permission": "Deposit"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user who owns the API key. required. |
| APIKey | string. The actual API key whose permission will be removed. required. |
| Permission | string. The specific permission to be removed from the API key. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. An additional message that the system may give, usually null. |
AddUserAPIKeyPermission
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Add permissions to a user API key, one permission at a time.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("AddUserAPIKeyPermission", {
UserId: 18,
APIKey: "75e81e03303c365cf5409bece487ced5",
Permission: "Deposit",
});
POST /AP/AddUserAPIKeyPermission HTTP/1.1
Host: hostname goes here...
aptoken: 66dde963-8a0c-d71a-15a2-57f2bd41d457
Content-Type: application/json
Content-Length: 101
{
"UserId":18,
"APIKey":"75e81e03303c365cf5409bece487ced5",
"Permission": "Deposit"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user who owns the API key. required. |
| APIKey | string. The actual API key for which the permission will be added. required. |
| Permission | string. The specific permission to be added to the API key. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. An additional message that the system may give, usually null. |
RemoveUserAPIKey
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Remove a user API key
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RemoveUserAPIKey", {
UserId: 6,
APIKey: "04c58e781cf23ddb7889beacebaf36ef",
});
POST /AP/RemoveUserAPIKey HTTP/1.1
Host: hostname goes here...
aptoken: 75956e2f-52c5-4286-b631-f063a6d2be1c
Content-Type: application/json
Content-Length: 72
{
"UserId": 6,
"APIKey": "04c58e781cf23ddb7889beacebaf36ef"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose API key will be removed or deleted. required. |
| APIKey | string. The actual API key to be removed or deleted. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. An additional message that the system may give, usually null. |
GetUserAPIKeys
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Return a users active API keys
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserAPIKeys", {
UserId: 6,
});
POST /AP/GetUserAPIKeys HTTP/1.1
Host: hostname goes here...
aptoken: 95225cf6-e997-4315-bd56-7e82bb0542a2
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user whose API keys will be retrieved and returned at the response. required. |
Response
[
{
"APIKey": "0bad72d6353624305cd6fabecc11b7ad",
"APISecret": "",
"UserId": 6,
"Permissions": ["Trading", "Withdraw", "Deposit", "AccountReadOnly"]
}
]
//Starting APEX version 4.4, API IP whitelisting feature has been added, API can only be used when connected to whitelisted IP
[
{
"APIKey": "b0a58da50d64df5dc5ec11b851aa1a3a",
"APISecret": "",
"UserId": 18,
"Permissions": [
"Trading",
"Withdraw",
"Deposit",
"AccountReadOnly"
],
"IpWhiteList": "1.2.3.4"
}
]
| Key | Value |
|---|---|
| APIKey | string. The actual API key. |
| APISecret | string. The secret key for the API, always empty in responses for security purposes, it will only be shown one time right after the creation of the API Key. |
| UserId | integer. The ID of the user who owns the API Key. |
| Permissions | array. An array with each element representing a specific permission. An API key can have very granular permissions. |
| IpWhiteList | string. A string of comma separated IPs. If there is/are IPs in the value, API key can only be used while connected to that IP or those IPs if there are multiple IPs. |
AddUserAPIKey
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Create an API key for a user. IP whitelisting is supported starting APEX version 4.4
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("AddUserAPIKey", {
UserId: 6,
Permissions: ["Trading"],
});
//with IP whitelisting, supported starting APEX version 4.4
await apex.RPCPromise("AddUserAPIKey", {
UserId: 6,
Permissions: ["Trading"],
IpWhiteList: "1.1.2.3",
});
POST /AP/AddUserAPIKey HTTP/1.1
Host: hostname goes here...
aptoken: 95225cf6-e997-4315-bd56-7e82bb0542a2
Content-Type: application/json
Content-Length: 52
{
"UserId":6,
"Permissions":["Trading"]
}
//With IP whitelisting, supported starting APEX version 4.4
{
"UserId":6,
"Permissions":["Trading"],
"IpWhiteList":"1.1.2.3"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user for whom the API key will be created. required. |
| Permissions | array. The specific permission/s to be assigned to the API Key, each element represents a specific permission that will be assigned to the API key. Requires atleast 1 permission. required. |
| IpWhiteList | string. A string of comma separated IPs. API key can only be used when connected to whitelisted IP/s if there is/are whitelisted IP/s. optional. |
Response
//Response in APEX versions below 4.4
{
"APIKey": "622c53ce8cf61ca825ec20a51300778e",
"APISecret": "abcdef6b533fc9b2fcfe4dba789045d0123121",
"UserId": 6,
"Permissions": [
"Trading"
],
"Nonce": 0
}
//Response in APEX version 4.4
{
"APIKey": "75e81e03303c365cf5409bece487ced5",
"APISecret": "12323c2854d28f5947e75191212121211",
"UserId": 6,
"Permissions": [
"Trading"
],
"Nonce": 0,
"IpWhiteList": "1.1.2.3"
}
| Key | Value |
|---|---|
| APIKey | string. The actual API key. |
| APISecret | string. The secret key for the API, it will only be shown one time right after the creation of the API Key. Needs to be noted and kept securely. Needed for generating Signature to be used for authentication. |
| UserId | integer. The ID of the user who owns the API Key. |
| Permissions | array. An array with each element representing a specific permission. An API key can have very granular permissions. |
| Nonce | integer. A random number being used to generate Signature, defaults to 0, can be edited during Signature generation. |
| IpWhiteList | string. A string of comma separated IPs. If there is/are IPs in the value, API key can only be used while connected to that IP or those IPs if there are multiple IPs. |
UpdateUserAPIKeyWhitelist
Permissions: SUPERUSER,Operator,Trading
Call Type: Synchronous
Update an APIKey whitelist for a given APIKey, can be used to add one or more new IPs or delete one or more existing IPs.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("UpdateUserAPIKeyWhitelist", {
UserId: 18,
APIKey: "b0a58da50d64df5dc5ec11b851aa1a3a",
IpWhiteList: "1.2.3.4",
});
POST /AP/UpdateUserAPIKeyWhitelist HTTP/1.1
Host: hostname goes here...
aptoken: 66dde963-8a0c-d71a-15a2-57f2bd41d457
Content-Type: application/json
Content-Length: 172
{
"UserId":18,
"APIKey":"b0a58da50d64df5dc5ec11b851aa1a3a",
"IpWhiteList":"1.2.3.4"
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user who owns the API. required. |
| APIKey | string The actual API key which IP whitelisting will be updated. required. |
| IpWhiteList | string. A string of comma separated IPs. The new IP/s to be whitelisted if there is any value assigned, sending an empty string or not including the IpWhiteList field in the request payload will remove all existing whitelisted IP/s if there is any. optional. |
Response
{
"APIKey": "b0a58da50d64df5dc5ec11b851aa1a3a",
"APISecret": null,
"UserId": 18,
"Permissions": ["Trading", "Withdraw", "Deposit", "AccountReadOnly"],
"Nonce": 0,
"IpWhiteList": "1.2.3.4"
}
| Key | Value |
|---|---|
| APIKey | string. The actual API key. |
| APISecret | string. null for security purposes. |
| UserId | integer. The ID of the user who owns the API Key. |
| Permissions | array. An array with each element representing a specific permission. An API key can have very granular permissions. |
| Nonce | integer. A random number being used to generate Signature, defaults to 0, can be edited during Signature generation. |
| IpWhiteList | string. The updated whitelisted IP/s. |
GetUserMarketDataPermissions
Permissions: Operator,Trading
Call Type: Synchronous
Retrieves a list of permissions a user has for viewing market data on each Instrument. Users will need market data permissions to view access Level1 or Level2 data of an instrument if an operator decides to turn on Permissioned Market Data.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetUserMarketDataPermissions", {
UserId: 6,
});
POST /AP/GetUserMarketDataPermissions HTTP/1.1
Host: hostname goes here...
aptoken: 7cb8f194-6ee6-4bf3-8e50-b11251eba458
Content-Type: application/json
Content-Length: 21
{
"UserId": 6
}
| Key | Value |
|---|---|
| UserId | integer. The ID of the user you wish to retrieve market data permissions of. required. |
Response
[
{
"UserId": 6,
"OMSId": 1,
"InstrumentId": 1,
"Level2": false
},
{
"UserId": 6,
"OMSId": 1,
"InstrumentId": 2,
"Level2": true
}
]
| Key | Value |
|---|---|
| UserId | integer. The ID of the user owning the specific market data permission on a specific instrument. |
| OMSId | integer. The ID of OMS where the user and the instrument belongs. |
| InstrumentId | integer. The ID of the instrument where the user has market data permission |
| Level2 | boolean. If true, user will have access to the Level2 data or the orderbook of the instrument. If false, user only has access to Level1 data such as the BestBid and BestAsk. |
ValidateUserRegistration
Permissions: Operator, Trading
Call Type: Synchronous
This API is being used for KYC integration, it is being invoked whenever a user will attempt to do a KYC verification with any integrated KYC service provider(e.g. Jumio, Sumsub). The KYC service provider or the Validator needs to be configured properly otherwise, the response will always be false which means there was an error. Upon successful invocation of this API, a user config will be added for the user: Key: levelIncreaseStatus, Value: underReview, that user config will prevent user from trying to submit another request while the verification for the current request is still ongoing.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ValidateUserRegistration", {
clientInfo: {
validator: "sumsub",
validationStage: 1,
},
userInfo: {},
additionalValidationData: [],
requestIdentifier: "2f9f96a5-ffbd-4e39-a071-0c21c85a5803",
});
POST /AP/ValidateUserRegistration HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: 92b0b4e1-0625-4be7-b276-98494033d3c8
Content-Length: 232
{
"clientInfo":
{
"validator":"sumsub",
"validationStage":1
},
"userInfo":
{
},
"additionalValidationData":[],
"requestIdentifier":"2f9f96a5-ffbd-4e39-a071-0c21c85a5803"
}
Request payload varies according to the KYC service provider or the Validator. For instance, Sumsub requires just very few parameters, whereas Jumio has more parameters needed. The example is specific for Sumsub.
| Key | Value |
|---|---|
| Validator | string. The KYC service provider. required. |
| ValidationStage | integer. The verification level number to which the account will be put into if the KYC will be approved and successful. required. |
| RequestIdentifier | string. The unique identifier of the KYC verification request, this will let the KYC service provider know which user on the side of APEX it will update later on. Not explicitly required but should be defined. required. |
Response
{
"result": "{\"ErrorMessage\":null,\"ValidationAnswerData\":{\"ProcessorTransactionID\":\"a8b5c7a0-9f59-42d2-9f8e-bbc03319695c\",\"IsAccepted\":false,\"NeedsManualReview\":false,\"DoNotSendNeedsManualReviewEmail\":false,\"AcceptedStage\":0,\"ApiError\":null,\"ApiErrorDescription\":null,\"DoNotEscalateLevel\":true,\"ProcessorData\":{\"accessToken\":\"_act-sbx-ce4e3ad6-57a9-4f83-886d-91be31a5d92e\",\"userId\":\"a8b5c7a0-9f59-42d2-9f8e-bbc03319695c\"},\"ValidatorTransactionID\":null,\"RawData\":\"{\\n \\\"token\\\" : \\\"_act-sbx-ce4e3ad6-57a9-4f83-886d-91be31a5d92e\\\",\\n \\\"userId\\\" : \\\"a8b5c7a0-9f59-42d2-9f8e-bbc03319695c\\\"\\n}\",\"RawDataFormat\":\"json\",\"RedirectUrl\":\"\"}}"
}
Just like with the request payload, the response payload varies according to the KYC service provider or the Validator. The example is specific for Sumsub.
| Key | Value |
|---|---|
| result | string. The result of user validation, a stringtified JSON object; fields may vary depending on the KYC provider. |
RegisterUser
Permissions: Public
Call Type: Synchronous
Register a new user on the system.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RegisterUser", {
UserInfo: {
UserName: "username",
Email: "user@example.com",
PasswordHash: "1234",
},
UserConfig: [{ Name: "Firstname", Value: "Sample" }],
AffiliateTag: "sampleaffiliatetag"
OperatorId: 1,
});
POST /AP/RegisterUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 239
{
"UserInfo":
{
"UserName":"username",
"Email":"user@example.com",
"PasswordHash":"1234"
},
"UserConfig":
[
{"Name":"Firstname","Value":"Sample"}
],
"AffiliateTag":"sampleaffiliatetag",
"OperatorId":1
}
| Key | Value |
|---|---|
| UserInfo | object. Username string. Nominated username. required. Email string Nominated email address. required. PasswordHash string Nominated password. required.. |
| UserConfig | object. Key-value pairs, will reflect at the user settings/config. optional. |
| AffiliateTag | string. The affiliate tag of the referrer user. This field can be utilized if the operator has an affiliate program. optional. |
| OperatorId | integer. ID of the Operator, defaults to 1 but if not defined, the newly registered user will be assigned to OMSId 0 so this needs to be defined and set to 1. required. |
Response
{
"UserId": 195
}
| Key | Value |
|---|---|
| UserId | integer. ID of the newly created/registered user. |
RegisterNewUser
Permissions: Public
Call Type: Synchronous
Register a new user on the system.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RegisterNewUser", {
UserInfo: {
UserName: "username",
Email: "user@example.com",
passwordHash: "1234",
},
UserConfig: [{ Name: "Firstname", Value: "Sample" }],
OperatorId: 1,
});
POST /AP/RegisterNewUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 239
{
"UserInfo":
{
"UserName":"username",
"Email":"user@example.com",
"passwordHash":"1234"
},
"UserConfig":
[
{"Name":"Firstname","Value":"Sample"}
],
"OperatorId":1
}
| Key | Value |
|---|---|
| UserInfo | object. Username string. Nominated username. required. Email *string Nominated email address. required. Password string Nominated password. required.. |
| UserConfig | object. Key-value pairs, will reflect at the user settings/config. optional. |
| OperatorId | integer. ID of the Operator, defaults to 1. optional. |
Response
{
"UserId": 195
}
| Key | Value |
|---|---|
| UserId | integer. ID of the newly created user. |
ConfirmUserEmail
Permissions: Public
Call Type: Synchronous
Called upon when a newly registered user clicks the veriication link sent via email.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmUserEmail", {
UserId: 194,
VerifyEmailCode: "7b495a17-d571-4fc5-bbe8-2941315457cd",
});
POST /AP/ConfirmUserEmail HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 87
{
"UserId": 194,
"VerifyEmailCode": "7b495a17-d571-4fc5-bbe8-2941315457cd"
}
| Key | Value |
|---|---|
| UserId | integer. ID of the user for which will be confirmed/verified. required. |
| VerifyEmailCode | string. GUID being generated by APEX and being sent to the email address a newly created user. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
ResendVerificationEmail
Permissions: Public
Call Type: Synchronous
Allow user or admin to resendverificationEmail if user is not EmailVerified.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ResendVerificationEmail", {
Email: "user@example.com",
});
POST /AP/ResendVerificationEmail HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 46
{
"Email": "user@example.com"
}
| Key | Value |
|---|---|
| string. Email address of the user to resend the verification email for. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
ResetPassword
Permissions: Public
Call Type: Synchronous
Initiates a password reset on a user. The user will receive a reset password email containing the reset password link. The user must be email verified in order the be able to reset his/her password.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ResetPassword", {
Username: "username",
});
POST /AP/ResetPassword HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 49
{
"Username": "username"
}
| Key | Value |
|---|---|
| Username | string. Username of the user to initiate password reset for. Value can also be the email address of the user. Not case-sensitive. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
ResetPassword2
Permissions: Public
Call Type: Synchronous
This is the actual API that resets the password of a user after clicking the reset password link and submitting new set of password.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ResetPassword2", {
UserId: 1,
Password: "newpassword",
PendingCode: "asdfasdfsdfsdfsadf121asdf",
});
POST /AP/ResetPassword2 HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 95
{
"UserId": 6,
"Password": "1234",
"PendingCode": "asdfasdfsdfsdfsadf121asdf"
}
| Key | Value |
|---|---|
| UserId | string. The ID of the user whose password will be reset. required. |
| Password | string. The actual new password. required. |
| PendingCode | string. GUID generated after ResetPassword call, identifies a unique user that has a password reset request. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
RegisterNewDevice
Permissions: Operator,Trading,Public
Call Type: Synchronous
RegisterNewDevice is the device registration confirmation call. It will take the hashcode and validation code sent in an email to verify a device as trusted.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("RegisterNewDevice", {
HashCode: "1032885396",
PendingEmailCode: "16b4be39-fd77-48fa-834b-396c8d510073",
});
POST /AP/RegisterNewDevice HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 99
{
"HashCode": "1032885396",
"PendingEmailCode": "16b4be39-fd77-48fa-834b-396c8d510073"
}
| Key | Value |
|---|---|
| HashCode | string. Hash code associated with the device. required. |
| PendingEmailCode | string. Email code to register device. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. If the hash code and validation code have successfully verified a device, result is true; otherwise it is false. |
| errormsg | string. A successful receipt of the call returns null. The errormsg key for an unsuccessful call returns one of the following messages: Not Authorized (errorcode 20) Invalid Response (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) Operation Not Supported (errorcode 106) |
| errorcode | integer. A successful receipt of the call returns 0. An unsuccessful receipt of the call returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. |
ValidateCode
Permissions: Public
Call Type: Synchronous
This checks pending code for password reset.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ValidateCode", {
UserId: 36,
VerifyCode: "dc4f8568-a85b-4c4d-85c8-17847fa3bcab",
});
POST /AP/ValidateCode HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 81
{
"UserId": 36,
"VerifyCode": "dc4f8568-a85b-4c4d-85c8-17847fa3bcab"
}
| Key | Value |
|---|---|
| UserId | string. The ID of the user for whom the code is being validated. required. |
| VerifyCode | string. The code to be verified. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. If the VerifyCode is still valid, result is true; otherwise it is false. |
| errormsg | string. A successful receipt of the call returns null. The errormsg key for an unsuccessful call returns one of the following messages: Not Authorized (errorcode 20) Invalid Response (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) Operation Not Supported (errorcode 106) |
| errorcode | integer. A successful receipt of the call returns 0. An unsuccessful receipt of the call returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. |
Withdraw
CreateAccountWithdrawInfo
Permissions: Operator,Withdraw
Call Type: Synchronous
Creates a new withdraw info for an account to store and use later for withdrawals. The accountwithdrawinfo to that will be created is also known as the whitelisted withdraw address.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CreateAccountWithdrawInfo", {
OMSId: 1,
AccountId: 7,
ProductId: 1,
AccountIdentifier: "asfasfasdf11dasfasf11",
Name: "Sample",
});
POST /AP/CreateAccountWithdrawInfo HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
aptoken: e6567bb5-0245-4cb3-b99e-b3adebe9c94c //valid session token
Content-Length: 136
{
"OMSId": 1,
"AccountId": 7,
"ProductId": 1,
"AccountIdentifier": "asfasfasdf11dasfasf11",
"Name": "Sample"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account for which the withdraw info will be created. required. |
| ProductId | integer. The ID of the product for which the withdraw info will be created for. required. |
| AccountIdentifier | string. The actual withdraw address. required. |
| Name | string. Any string that can be used to identify the withdraw info. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "4ed30f50-b8ad-491b-823d-70acdfdeb0be" //ID of the account withdraw info
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. The account withdraw info ID, GUID. |
GetAccountWithdrawTransactions
Permissions: Trading, AccountReadOnly
Call Type: Synchronous
Gets a list of transactions which are of TransactionReferenceType Withdraw for a specific account.
Users with Trading and AccountReadOnly permission can get withdraw transactions only for the account/s with which they are associated. Users with elevated permission such as Operator can get withdraw transactions for any account.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountWithdrawTransactions", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetAccountWithdrawTransactions HTTP/1.1
Host: hostname goes here...
aptoken: c5f917b9-f173-4c29-a615-1503d2e78023 //valid sessiontoken
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the account transactions took place. required. |
| AccountId | integer. The ID of the account whose transactions will be returned. required. |
| Depth | integer. The maximum number/count of withdraw transactions that can be fetched. optional. |
Response
[
{
"TransactionId": 22693,
"ReferenceId": 286,
"OMSId": 1,
"AccountId": 7,
"CR": 0.0,
"DR": 0.00001,
"Counterparty": 3,
"TransactionType": "Other",
"ReferenceType": "Withdraw",
"ProductId": 3,
"Balance": 1.11033172,
"TimeStamp": 1676348233473
},
{
"TransactionId": 22671,
"ReferenceId": 281,
"OMSId": 1,
"AccountId": 7,
"CR": 0.0,
"DR": 1.0,
"Counterparty": 2,
"TransactionType": "Fee",
"ReferenceType": "Withdraw",
"ProductId": 1,
"Balance": 1020604462.5137057184022,
"TimeStamp": 1676346027780
}
]
Returns an array of objects as a response, each object represents a withdraw transaction.
| Key | Value |
|---|---|
| TransactionId | integer. The ID of the transaction. |
| OMSId | integer. The ID of the OMS under which the requested transactions took place. |
| AccountId | integer. The single account under which the transactions took place. |
| CR | decimal. Credit entry for the account on the order book. Funds entering an account. |
| DR | decimal. Debit entry for the account on the order book. Funds leaving an account. |
| Counterparty | long integer. The account which was either debited or credited with the same amount of either the CR or DR. |
| TransacitionType | string. Can either be Other or Fee. |
| ReferenceId | long integer. The ID of the action or event that triggered this transaction. |
| ReferenceType | string. A withdraw transaction is always a withdraw ReferenceType |
| ProductId | integer. The ID of the product in which the withdraw was made. Use GetProduct to return information about a product based on its ID. |
| Balance | decimal. The balance in the account after the withdraw transaction. |
| Timestamp | long integer. Time at which the transaction took place, in POSIX format. |
ConfirmWithdrawInfo
Permissions: Public
Call Type: Synchronous
Confirms a withdraw address, completes the withdraw address whitelisting process.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmWithdrawInfo", {
OMSId: 1,
AccountId: 7,
VerifyEmailCode: "60f3528b-04f7-4c91-9629-02687725d61b",
});
POST /AP/ConfirmWithdrawInfo HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 102
{
"OMSId": 1,
"AccountId": 7,
"VerifyEmailCode": "60f3528b-04f7-4c91-9629-02687725d61b"
}
| Key | Value |
|---|---|
| OMSId | integer. ID of the OMS where the account belongs. required. |
| AccountId | integer. ID of the account for which the withdraw address will be verified. required. |
| VerifyEmailCode | string. GUID being generated by APEX and being sent to the email address the user who owns the account. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
ConfirmWithdraw
Permissions: Public
Call Type: Synchronous
Confirms a withdrawal, transitions a withdraw ticket from Pending2Fa to Confirmed2Fa status.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("ConfirmWithdraw", {
UserId: 1,
VerifyCode: "57791f11-c7f1-4be3-b098-94e04091928e",
});
POST /AP/ConfirmWithdraw HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
Content-Length: 80
{
"UserId": 1,
"VerifyCode": "57791f11-c7f1-4be3-b098-94e04091928e"
}
| Key | Value |
|---|---|
| UserId | integer. ID of the user for which the withdraw will be confirmed. required. |
| VerifyCode | string. GUID being generated by APEX and being sent to the email address the user. required. |
Response
{
"result": true
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. The error message. Only shows if there is an error. |
GetAccountWithdrawInfos
Permissions: Operator,Withdraw,AccountReadOnly
Call Type: Synchronous
Retrieves configuration information for a list of all withdraw info configurations for an account. Withdraw info is also referred to as a whitelisted withdraw address. It is needed whenever an exchange operator decides to require whitelisted withdraw address for withdrawal of certain product or all products.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetAccountWithdrawInfos", {
OMSId: 1,
AccountId: 7,
});
POST /AP/GetAccountWithdrawInfos HTTP/1.1
Host: hostname goes here...
aptoken: f274561b-a7c6-4e49-9781-8c50ed05caa5
Content-Type: application/json
Content-Length: 41
{
"OMSId": 1,
"AccountId": 7
}
| Key | Value |
|---|---|
| OMSId | integer The ID of the OMS where the account belongs to. optional. |
| AccountId | integer The ID of the account for which you wish to withdraw infos for. required. |
Response
[
{
"AccountWithdrawInfoId": "4ed30f50-b8ad-491b-823d-70acdfdeb0be",
"OMSId": 1,
"AccountId": 7,
"ProductId": 1,
"ProductName": "US Dollar",
"Name": "Sample",
"AccountIdentifier": "asfasfasdf11dasfasf11",
"Verified": false
}
]
| Key | Value |
|---|---|
| AccountWithdrawInfoId | string GUID of the withdraw info. |
| OMSId | integer The ID of the OMS where the account belongs to. |
| AccountId | integer The ID of the account who owns the withdraw info. |
| ProductId | integer The ID of the product the account withdraw info is for. |
| ProductName | string The name of the product the account withdraw info is for. |
| Name | string The name of the withdraw info. |
| AccountIdentifier | string The actual withdraw info or whitelisted withdraw address. |
| Verified | boolean Only verified withdraw info can be used for withdrawal of product which requires whitelisted withdraw address. If true, it means that user verified it and it can be used for withdrawals already, if False, user have not verified it yet and thus it can't still be used for withdrawals. |
DeleteAccountWithdrawInfo
Permissions: Operator,Withdraw
Call Type: Synchronous
Deletes a whitelisted address.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("DeleteAccountWithdrawInfo", {
OMSId: 1,
AccountId: 7,
AccountWithdrawInfoId: "e9f23d13-59fa-4bc7-aba6-3a5151045483",
});
POST /AP/DeleteAccountWithdrawInfo HTTP/1.1
Host: hostname goes here...
aptoken: 2c3a0675-1136-45c0-84a9-a9f40d07a290
Content-Type: application/json
Content-Length: 109
{
"OMSId":1,
"AccountId": 7,
"AccountWithdrawInfoId":"e9f23d13-59fa-4bc7-aba6-3a5151045483"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account belongs to. required. |
| AccountId | integer. The ID of the account who owns the accountwithdrawinfo to be deleted. If the authenticated user has elevated permission such as Operator, no need to specify account ID, for users with the standard permissions only, it is required.conditionally required. |
| AccountWithdrawInfoId | string. The GUID of the accountwithdrawinfo that will be deleted. required. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": null
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Message text that the system may send. Usually null. |
GetWithdrawFormTemplateTypes
Permissions: Operator, Withdraw
Call Type: Synchronous
Gets a list of withdraw template types for a specific asset or product.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawFormTemplateTypes", {
OMSId: 1,
ProductId: 3,
});
POST /AP/GetWithdrawFormTemplateTypes HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 39
{
"OMSId":1,
"ProductId":3
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which withdraw template types will be retrieved. required. |
Response
//Example response when product is a fiat, in this one it is for USD
{
"TemplateTypes": [
{
"AccountProviderId": 5,
"TemplateName": "Standard",
"AccountProviderName": "USD AP"
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
//Example response when product is a cryptocurrency, in this one it is for Bitcoin
{
"TemplateTypes": [
{
"AccountProviderId": 7,
"TemplateName": "ToExternalBitcoinAddress",
"AccountProviderName": "Secondary-BitgoRPC-BTC"
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
Responds with an object, one field is named TemplateTypes which is an array of objects, each object represents an account provider withdraw template type whose fields are described below:
| Key | Value |
|---|---|
| AccountProviderId | integer. The ID of the account provider of a specific withdraw template type. |
| TemplateName | string. The name of the specific withdraw template type. |
| AccountProviderName | string. The name of the account provider for the specific withdraw template type. An asset or a product can have multiple account providers. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetWithdrawTemplate
Permissions: Operator, Withdraw
Call Type: Synchronous
Gets the withdraw template for a specified asset or product.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawTemplate", {
OMSId: 1,
ProductId: 1,
TemplateType: "Standard",
AccountProviderId: 5, //optional
});
POST /AP/GetWithdrawTemplate HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 101
{
"OMSId":1,
"ProductId":1,
"TemplateType": "Standard",
"AccountProviderId": 5
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which withdraw template will be retrieved. required. |
| TemplateType | string. The template type where the withdraw form of the specified product belongs. optional. |
| AccountProviderId | string. The ID of the account provider where the withdraw form of the specified product belongs. optional. |
Response
{
"Template": "{\"FullName\":null,\"Language\":null,\"Comment\":null,\"BankAddress\":null,\"BankAccountNumber\":null,\"BankAccountName\":null,\"SwiftCode\":null,\"ExternalAddress\":null}",
"result": true,
"errormsg": null,
"statuscode": 0
}
| Key | Value |
|---|---|
| Template | string. The actual withdraw form fields for the specific withdraw template. Can be customized for some account provider. |
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20) Invalid Request (errorcode 100) Operation Failed (errorcode 101) Server Error (errorcode 102) Resource Not Found (errorcode 104) |
| statuscode | integer. A successful request returns 0. An unsuccessful receipt returns one of the errorcodes shown in the errormsg list. |
GetWithdrawTemplateTypes
Permissions: Operator, Withdraw
Call Type: Synchronous
Gets a list of Templates for a specific asset or product. Functions exactly the same as GetWithdrawFormTemplateTypes
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
{
"OMSId": 1,
"ProductId": 1
}
POST /AP/GetWithdrawFormTemplateTypes HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 68
{
"OMSId":1,
"ProductId":1,
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| ProductId | integer. The ID of the product for which withdraw template types will be retrieved. required. |
Response
//Example response when product is a fiat, in this one it is for USD
{
"TemplateTypes": [
{
"AccountProviderId": 5,
"TemplateName": "Standard",
"AccountProviderName": "USD AP"
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
//Example response when product is a cryptocurrency, in this one it is for Bitcoin
{
"TemplateTypes": [
{
"AccountProviderId": 7,
"TemplateName": "ToExternalBitcoinAddress",
"AccountProviderName": "Secondary-BitgoRPC-BTC"
}
],
"result": true,
"errormsg": null,
"statuscode": 0
}
| Key | Value |
|---|---|
| AccountProviderId | integer. The ID of the account provider of a specific withdraw template type. |
| TemplateName | string. The name of the specific withdraw template type. |
| AccountProviderName | string. The name of the account provider for the specific withdraw template type. An asset or a product can have multiple account providers. |
CancelWithdraw
Permissions: Withdraw
Call Type: Synchronous
Cancel Pending Withdraws
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CancelWithdraw", {
OMSId: 1,
UserId: 5,
AccountId: 7,
RequestCode: "2c89b0c1-fcf0-4710-9955-a7ac26fcdd54",
});
POST /AP/CancelWithdraw HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 118
{
"OMSId":1,
"UserId": 5,
"AccountId": 7,
"RequestCode": "2c89b0c1-fcf0-4710-9955-a7ac26fcdd54"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS. required. |
| UserId | integer. The ID of the user who owns the account. required. |
| AccountId | integer. The ID of the account who owns the withdraw ticket. required. |
| RequestCode | string. The GUID of the specific withdraw ticket that will be canceled. required. |
Response
//Response for a successful cancellation of withdraw
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "2c89b0c1-fcf0-4710-9955-a7ac26fcdd54"
}
//Response of the UserId, AccountId, and RequestCode doesn't align, means that either one of them is not correct, for instance the request code of the withdraw being cancelled does not belong the either the userid or accountid or can be both.
{
"result": false,
"errormsg": "Operation Failed",
"errorcode": 101,
"detail": "Withdraw Ticket not found for OmsId, AccountId, RequestCode"
}
//Response if the withdraw ticket being cancelled is already in a terminal state. For instance, it was already previously cancelled.
{
"result": false,
"errormsg": "Operation Failed",
"errorcode": 101,
"detail": "Withdraw ticket already processed"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. The RequestCode of the canceled withdraw ticket. |
CreateFiatWithdrawTicket
Permissions: Operator, Withdraw
Call Type: Synchronous
Initiates the withdrawal of national currency funds from an account
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CreateFiatWithdrawTicket", {
OMSId: 1,
AccountId: 9,
ProductId: 1,
Amount: 1,
TemplateForm: '{"Amount":1,"Type":"a","ClearingBank":"a","BankCode":"a","BankBranchCode":"a","BankAccountNumber":"a","Remark":"a"}',
TemplateType: 'Custom',
AccountProviderId: 5
});
//If sending request using WSClient, request should look like something below:
{
"m":0,
"i":80,
"n":"CreateFiatWithdrawTicket",
"o":"{\"OMSId\":1,\"AccountId\":9,\"ProductId\":1,\"Amount\":1,\"TemplateForm\":\"{\\\"Amount\\\":1,\\\"Type\\\":\\\"a\\\",\\\"ClearingBank\\\":\\\"a\\\",\\\"BankCode\\\":\\\"a\\\",\\\"BankBranchCode\\\":\\\"a\\\",\\\"BankAccountNumber\\\":\\\"a\\\",\\\"Remark\\\":\\\"a\\\"}\",\"TemplateType\":\"Custom\",\"AccountProviderId\":5}"
}
//The TemplateForm field should be properly serialized as a string. When that payload is parsed as JSON, it will be exactly the same as the payload when passing it via javascript code.
POST /AP/CreateFiatWithdrawTicket HTTP/1.1
Host: hostname goes here...
aptoken: 9c0faeb9-4d29-4eb8-aca7-b36a9b46923c
Content-Type: application/json
Content-Length: 374
{
"OMSId":1,
"AccountId":9,
"ProductId":1,
"Amount":1,
"TemplateForm":"{\"TemplateType\":\"8\",\"Amount\":1,\"FullName\":\"Name\",\"Language\":\"EN\",\"Comment\":\"Comment\",\"BankAddress\":\"12345\",\"BankAccountNumber\":\"12345\",\"BankAccountName\":\"Bank\",\"SwiftCode\":\"12345\"}",
"TemplateType":"Standard",
"AccountProviderId":8
}
| Key | Value |
|---|---|
| OMSId | integer The ID of the OMS where the account belongs to. required. |
| AccountId | integer The ID of the account from which the withdraw amount of the specific asset/product will be debited. |
| ProductId | integer The ID of the asset or product for which the withdraw amount will reflect as debit. required. |
| Amount | decimal The actual amount to be withdrawn. Amount must be greater than 0. required. |
| TemplateForm | string An object serialized as string. The fields in the object are usually the fields shown in the withdraw form. Needs to be properly serialized as a string. required. |
| TemplateType | string The withdraw form template type. Can be identified through the GetWithdrawTemplateTypes API.required. |
| AccountProviderId | string The ID of the account provider that will handle the withdraw. optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "2dd6b53a-e7ba-49e1-9f31-db63a61e9b2e"
}
//Response if product is not a national currency
{
"result": false,
"errormsg": "Invalid Request",
"errorcode": 100,
"detail": "Invalid Product, not a national currency"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional details: the RequestCode of the newly created withdraw ticket if request is successful, some additional details about the error if request failed. |
CreateCryptocurrencyWithdrawTicket
Permissions: Operator, Withdraw
Call Type: Synchronous
Initiates the withdrawal of crypto currency funds from an account
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CreateCryptocurrencyWithdrawTicket", {
OMSId: 1,
AccountId: 9,
ProductId: 3,
Amount: 0.001,
TemplateForm:
'{"TemplateType":"ToExternalBitcoinAddress","Comment":"Sample only!","ExternalAddress":"n2EuXCpMjA8XrqTAiGbDMi3qNsRS8HeZ1i","Amount":0.001}',
TemplateType: "ToExternalBitcoinAddress",
AccountProviderId: 7,
});
//If sending request using WSClient, request should look like something below:
{
"m":0,
"i":82,
"n":"CreateWithdrawTicket",
"o":"{\"OMSId\":1,\"AccountId\":9,\"ProductId\":3,\"Amount\":0.001,\"TemplateForm\":\"{\\\"TemplateType\\\":\\\"ToExternalBitcoinAddress\\\",\\\"Comment\\\":\\\"Sample only!\\\",\\\"ExternalAddress\\\":\\\"n2EuXCpMjA8XrqTAiGbDMi3qNsRS8HeZ1i\\\",\\\"Amount\\\":0.001}\",\"TemplateType\":\"ToExternalBitcoinAddress\",\"AccountProviderId\":7}"
}
//The TemplateForm field should be properly serialized as a string. When that payload is parsed as JSON, it will be exactly the same as the payload when passing it via javascript code.
POST /AP/CreateWithdrawTicket HTTP/1.1
Host: hostname goes here...
aptoken: 9c0faeb9-4d29-4eb8-aca7-b36a9b46923c
Content-Type: application/json
Content-Length: 329
{
"OMSId":1,
"AccountId":9,
"ProductId":3,
"Amount":0.001,
"TemplateForm":
"{\"TemplateType\":\"ToExternalBitcoinAddress\",\"Comment\":\"Sample only!\",\"ExternalAddress\":\"sdlkfjasdlkfjslkdfjlksfdj\",\"Amount\":0.001}",
"TemplateType":"ToExternalBitcoinAddress",
"AccountProviderId":7
}
| Key | Value |
|---|---|
| OMSId | integer The ID of the OMS where the account belongs to. required. |
| AccountId | integer The ID of the account from which the withdraw amount of the specific asset/product will be debited. |
| ProductId | integer The ID of the asset or product for which the withdraw amount will reflect as debit. required. |
| Amount | decimal The actual amount to be withdrawn. Amount must be greater than 0. required. |
| TemplateForm | string An object serialized as string. The fields in the object are usually the fields shown in the withdraw form. Needs to be properly serialized as a string. required. |
| TemplateType | string The withdraw form template type. Can be identified through the GetWithdrawTemplateTypes API.required. |
| AccountProviderId | string The ID of the account provider that will handle the withdraw. optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "5e184507-5004-439c-886d-b587490d53be"
}
//Response if product is not crypto currency
{
"result": false,
"errormsg": "Invalid Request",
"errorcode": 100,
"detail": "Invalid Product, not a crypto currency"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional details: the RequestCode of the newly created withdraw ticket if request is successful, some additional details about the error if request failed. |
CreateWithdrawTicket
Permissions: Operator, Withdraw
Call Type: Synchronous
Initiates the withdrawal of funds(any product type) from an account
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("CreateWithdrawTicket", {
OMSId: 1,
AccountId: 9,
ProductId: 3,
Amount: 0.001,
TemplateForm:
'{"TemplateType":"ToExternalBitcoinAddress","Comment":"Sample only!","ExternalAddress":"n2EuXCpMjA8XrqTAiGbDMi3qNsRS8HeZ1i","Amount":0.001}',
TemplateType: "ToExternalBitcoinAddress",
AccountProviderId: 7,
});
//If sending request using WSClient, request should look like something below:
{
"m":0,
"i":82,
"n":"CreateWithdrawTicket",
"o":"{\"OMSId\":1,\"AccountId\":9,\"ProductId\":3,\"Amount\":0.001,\"TemplateForm\":\"{\\\"TemplateType\\\":\\\"ToExternalBitcoinAddress\\\",\\\"Comment\\\":\\\"Sample only!\\\",\\\"ExternalAddress\\\":\\\"n2EuXCpMjA8XrqTAiGbDMi3qNsRS8HeZ1i\\\",\\\"Amount\\\":0.001}\",\"TemplateType\":\"ToExternalBitcoinAddress\",\"AccountProviderId\":7}"
}
//The TemplateForm field should be properly serialized as a string. When that payload is parsed as JSON, it will be exactly the same as the payload when passing it via javascript code.
POST /AP/CreateWithdrawTicket HTTP/1.1
Host: hostname goes here...
aptoken: 9c0faeb9-4d29-4eb8-aca7-b36a9b46923c
Content-Type: application/json
Content-Length: 329
{
"OMSId":1,
"AccountId":9,
"ProductId":3,
"Amount":0.001,
"TemplateForm":
"{\"TemplateType\":\"ToExternalBitcoinAddress\",\"Comment\":\"Sample only!\",\"ExternalAddress\":\"sdlkfjasdlkfjslkdfjlksfdj\",\"Amount\":0.001}",
"TemplateType":"ToExternalBitcoinAddress",
"AccountProviderId":7
}
| Key | Value |
|---|---|
| OMSId | integer The ID of the OMS where the account belongs to. required. |
| AccountId | integer The ID of the account from which the withdraw amount of the specific asset/product will be debited. |
| ProductId | integer The ID of the asset or product for which the withdraw amount will reflect as debit. required. |
| Amount | decimal The actual amount to be withdrawn. Amount must be greater than 0. required. |
| TemplateForm | string An object serialized as string. The fields in the object are usually the fields shown in the withdraw form. Needs to be properly serialized as a string. required. |
| TemplateType | string The withdraw form template type. Can be identified through the GetWithdrawTemplateTypes API.required. |
| AccountProviderId | string The ID of the account provider that will handle the withdraw. optional. |
Response
{
"result": true,
"errormsg": null,
"errorcode": 0,
"detail": "27976f52-2197-451c-b443-aa11aa2c1e76"
}
| Key | Value |
|---|---|
| result | boolean. A successful request returns true; and unsuccessful request (an error condition) returns false. |
| errormsg | string. A successful request returns null; the errormsg parameter for an unsuccessful request returns one of the following messages: Not Authorized (errorcode 20), Invalid Request (errorcode 100), Operation Failed (errorcode 101), Server Error (errorcode 102), Resource Not Found (errorcode 104) |
| errorcode | integer. A successful request returns 0. An unsuccessful request returns one of the errorcodes shown in the errormsg list. |
| detail | string. Additional details: the RequestCode of the newly created withdraw ticket if request is successful, some additional details about the error if request failed. |
GetWithdrawTickets
Permissions: Operator, Trading
Call Type: Synchronous
Returns an array of limited withdraw tickets from the specified OMS and Account, can also be filtered using ProductId.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawTickets", {
OMSId: 1,
OperatorId: 1,
AccountId: 7,
Limit: 1, //optional filter field
StartIndex: 0, // value of 0 means it will start at the most recent deposit ticket, value of 1 means it will start from the second most recent deposit ticket
});
POST /AP/GetWithdrawTickets HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 40
{
"OMSId":1,
"AccountId": 7,
"Limit": 1, //optional filter field
"StartIndex": 0, // value of 0 means it will start at the most recent withdraw ticket, value of 1 means it will start from the second most recent withdraw ticket
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS on which the account operates whose withdraw tickets you wish to return. required. |
| OperatorId | integer. The ID of the operator where the OMS is operating. required. |
| AccountId | integer. The ID of the account whose withdraw tickets will be included in the response. required. |
| ProductId | integer. The ID of a product. Filter parameter, response will only include withdraw tickets for the specified product. optional. |
| Limit | integer. Filter field to limit number of results. Used for pagination together with the StartIndex field. If not set, all withdraw tickets of the specified account will be returned but would still depend on the StartIndex. optional. |
| StartIndex | integer. Pagination field, value of 0 means results will start at the most recent withdraw ticket, value of 1 means results start from the second most recent withdraw ticket. If not set, results will always start with the most recent withdraw ticket of the specified account. optional. |
Response
[
{
"AssetManagerId": 1,
"AccountProviderId": 21,
"AccountId": 7,
"AccountName": "sample",
"AssetId": 27,
"AssetName": "StellarLumens",
"Amount": 1000.0,
"NotionalValue": 1000.0,
"NotionalProductId": 1,
"TemplateForm": "{\"MemoType\":\"id\",\"Memo\":\"2\",\"TemplateType\":\"ToExternalStellarAddress\",\"Comment\":\"Another sample!\",\"ExternalAddress\":\"GAVG3OCPF2Z3GN3ZUMMX4GZHRJ5WPGDHNQIMDOYXRXX2C6XFR2GUAKJL\",\"Amount\":1000}",
"TemplateFormType": "ToExternalStellarAddress",
"OMSId": 1,
"RequestCode": "0cf8fa35-4490-4ea7-8e19-2ffe78efb4be",
"RequestIP": "69.10.61.175",
"RequestUserId": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "FullyProcessed",
"FeeAmt": 0.0,
"UpdatedByUser": 1,
"UpdatedByUserName": "admin",
"TicketNumber": 304,
"WithdrawTransactionDetails": "{\"TxId\":\"2569b7434b2829485321868efe52b0af58d9761b3cb2bc551a88f084d524efa1\",\"ExternalAddress\":null,\"Amount\":1000.0000000000000000000000000,\"Confirmed\":true,\"LastUpdated\":\"2023-04-18T23:54:59.975Z\",\"TimeSubmitted\":\"2023-04-18T23:54:59.975Z\",\"AccountProviderName\":null,\"AccountProviderId\":21}",
"RejectReason": null,
"CreatedTimestamp": "2023-04-18T23:50:58.251Z",
"LastUpdateTimestamp": "2023-04-18T23:55:00.087Z",
"CreatedTimestampTick": 638174586582516883,
"LastUpdateTimestampTick": 638174589000878307,
"Comments": [
{
"CommentId": 959,
"EnteredBy": 1,
"EnteredDateTime": "2023-04-18T23:54:38.816Z",
"EnteredDateTimeTick": 638174588788163630,
"Comment": "Auto accepting the ticket and Amount is less then AutoWithdrawThreshold",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "0cf8fa35-4490-4ea7-8e19-2ffe78efb4be",
"TicketId": 304
},
{
"CommentId": 960,
"EnteredBy": 1,
"EnteredDateTime": "2023-04-18T23:54:38.817Z",
"EnteredDateTimeTick": 638174588788174328,
"Comment": "Status updated to (Confirmed2Fa) by user admin",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "0cf8fa35-4490-4ea7-8e19-2ffe78efb4be",
"TicketId": 304
},
{
"CommentId": 964,
"EnteredBy": 1,
"EnteredDateTime": "2023-04-18T23:55:00.106Z",
"EnteredDateTimeTick": 638174589001061030,
"Comment": "AmlProviderConfig is either not enabled or set to PassThrough. Skipping transaction registration and setting status to FullyProcessed ",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "0cf8fa35-4490-4ea7-8e19-2ffe78efb4be",
"TicketId": 304
}
],
"Attachments": [],
"AuditLog": []
}
]
Returns an array of objects, each object represents a withdraw ticket with all its details.
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager on which the withdraw was made. |
| AccountProviderId | integer. The ID of the Account Provider of the product where the the withdraw was made. A product can have multiple account provider. |
| AccountId | integer. The ID of the account from which the withdraw was made. |
| AccountName | string. The name of the account. |
| AssetId | integer. The ID of the asset (product) that was withdrawn. |
| AssetName | string. The short name of the asset (product) that was withdrawn, for example BTC for Bitcoin or USD for US Dollars. |
| Amount | decimal. The unit and fractional amount of the asset that was withdrawn, for example 2.5 Bitcoin or 2018.17 US Dollars. |
| NotionalValue | decimal. The value of the withdraw amount in the NotionalProduct set in the verification level of the account for the product withdrawn. |
| NotionalProductId | integer. The product ID of the NotionalProduct set on the verification level of the account for the product withdrawn. |
| TemplateForm | string. A stringtified object which has the fields of the actual withdraw form together with the values provided by the user. Will usually have the withdrawal address, and other relevant infos such as comments. |
| TemplateFormType | string. The type of the template form. Usually Standard for fiat withdrawals, needs a very specific value for crypto withdrawals such as ToExternalBitcoinAddress, ToExternalEthereumAddress depending on the Account Provider type. Those values are usually automatically provided(pre-defined on the account provider). |
| OMSId | integer. The ID of the OMS. |
| RequestCode | string. A globally unique identifier (GUID) assigned by the system that identifies this specific withdraw. |
| RequestIP | string. The IP address from which the withdraw request was submitted from. |
| RequestUserId | integer. The ID of the user who submitted the withdrawal request. |
| RequestUserName | string. The username of the user who submitted the withdrawal request. |
| OperatorId | integer. The ID of the operator where the OMS is operating. |
| Status | integer. The current status of the withdrawal ticket. Some of these statuses are valid only for cryptocurrency withdrawals, which uses an automated withdrawal process, and some are valid for fiat currency withdrawals, which requires a human admin (operator). Some of these statuses are used by AlphaPoint internally, yet they may appear on a returned Withdraw Ticket. Withdraw ticket statuses: 0 New (awaiting operator review) 1 AdminProcessing (An admin is looking at the ticket) 2 Accepted (withdrawal will proceed) 3 Rejected (admin or automatic rejection) 4 SystemProcessing (automatic processing underway) 5 FullyProcessed (the withdrawal has concluded) 6 Failed (the withdrawal failed for some reason) 7 Pending (the admin has placed the withdrawal in pending status) 8 Pending2Fa (user must click 2-factor authentication confirmation link) 9 AutoAccepted (withdrawal will be automatically processed) 10 Delayed (waiting for funds to be allocated for the withdrawal) 11 UserCanceled (withdraw canceled by user or Superuser) 12 AdminCanceled (withdraw canceled by Superuser) 13 AmlProcessing (anti-money-laundering process underway) 14 AmlAccepted (anti-money-laundering process complete) 15 AmlRejected (withdrawal did not stand up to anti-money-laundering process) 16 AmlFailed (withdrawal did not complete anti-money-laundering process) 17 LimitsAccepted (withdrawal meets limits for fiat or crypto asset) 18 LimitsRejected (withdrawal does not meet limits for fiat or crypto asset) 19 Submitted (withdrawal sent to Account Provider; awaiting blockchain confirmation) 20 Confirmed (Account Provider confirms that withdrawal is on the blockchain) 21 ManuallyConfirmed (admin has sent withdrawal via wallet or admin function directly; marks ticket as FullyProcessed; debits account) 22 Confirmed2Fa (user has confirmed withdraw via 2-factor authentication.) |
| FeeAmt | decimal. The fee assessed for making the withdraw, if any. withdraw fees usually are assessed in the asset/product being withdrawn. |
| UpdatedByUser | integer. The user ID of the last user to have updated the ticket (status, amount, etc.; this is usually an admin). |
| UpdatedByUserName | string. The user name of the last user to have updated the ticket, for example, jsmith. |
| TicketNumber | long integer. An ID number assigned by the system to identify the ticket (as opposed to identifying the withdraw). |
| WithdrawTransactionDetails | string. For fiat withdraw, it is the information entered by the user at the withdraw form, for cryptocurrency withdraw from blockchain, it will contain the TXID, FromAddress, ToAddress, AccountProviderName, and AccountProviderId |
| RejectReason | string. If the withdrawal request is rejected, this field will contain the reason that will be optionally provided by the operator. |
| CreatedTimeStamp | string. The date and time when the withdraw ticket was created, in standard DateTime format. All dates and times are UTC. |
| LastUpdateTimeStamp | string. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in standard DateTime format. All dates and times are UTC. |
| CreatedTimestampTick | long integer. The date and time when the withdraw ticket was created, in Microsoft Time Ticks format. |
| LastUpdateTimestampTick | long integer. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in Microsoft Time Ticks format. |
| Comments | array. Any comment appended to the withdraw ticket. Please see request payload fields of SubmitWithdrawTicketComment. |
| Attachments | array. Any attachment to the withdraw ticket. |
| AuditLog | array. Log trail of a specific withdraw ticket. |
GetWithdrawTicket
Permissions: Operator, Trading
Call Type: Synchronous
Returns a single withdraw ticket from OMS,trading venue operator and account that matches the GUID in Request Code.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawTicket", {
OMSId: 1,
AccountId: 7,
RequestCode: "d8c88f7c-a6ff-439c-a253-bf5462716429",
});
POST /AP/GetWithdrawTicket HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 40
{
"OMSId":1,
"AccountId": 7
"RequestCode": "d8c88f7c-a6ff-439c-a253-bf5462716429"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account owning the withdraw ticket belongs to. required. |
| AccountId | integer. The ID of the account who owns the withdraw ticket. required. |
| RequestCode | string. The GUID that identifies a specific withdraw ticket you wish to get details of. If not set, response will be the very first withdraw ticket owned by the AccountId defined in the request. optional. |
Response
{
"AssetManagerId": 1,
"AccountProviderId": 3,
"AccountId": 7,
"AccountName": "sample",
"AssetId": 3,
"AssetName": "Bitcoin Testnet",
"Amount": 0.0001,
"NotionalValue": 4.1048,
"NotionalProductId": 1,
"TemplateForm": "{\"TemplateType\":\"ToExternalBitcoinAddress\",\"Comment\":\"Send back to faucet\",\"ExternalAddress\":\"tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt\",\"Amount\":0.0001}",
"TemplateFormType": "ToExternalBitcoinAddress",
"OMSId": 1,
"RequestCode": "d8c88f7c-a6ff-439c-a253-bf5462716429",
"RequestIP": "136.158.44.105",
"RequestUserId": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "Rejected",
"FeeAmt": 0.000001,
"UpdatedByUser": 1,
"UpdatedByUserName": "admin",
"TicketNumber": 17,
"WithdrawTransactionDetails": "{\"TxId\":null,\"ExternalAddress\":\"tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt\",\"Amount\":0,\"Confirmed\":false,\"LastUpdated\":\"0001-01-01T00:00:00.000Z\",\"TimeSubmitted\":\"0001-01-01T00:00:00.000Z\",\"AccountProviderName\":\"ToExternalBitcoinAddress\",\"AccountProviderId\":3}",
"RejectReason": "overlimit",
"CreatedTimestamp": "2022-03-21T18:12:17.614Z",
"LastUpdateTimestamp": "2022-03-21T18:16:02.640Z",
"CreatedTimestampTick": 637834831376143088,
"LastUpdateTimestampTick": 637834833626400722,
"Comments": [
{
"CommentId": 72,
"EnteredBy": 1,
"EnteredDateTime": "2022-03-21T18:12:43.509Z",
"EnteredDateTimeTick": 637834831635099470,
"Comment": "Status as new because RejectReason is not OverLimitRejected",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "d8c88f7c-a6ff-439c-a253-bf5462716429",
"TicketId": 17
},
{
"CommentId": 73,
"EnteredBy": 1,
"EnteredDateTime": "2022-03-21T18:16:02.661Z",
"EnteredDateTimeTick": 637834833626615272,
"Comment": "Status updated to (Rejected) by user admin",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "d8c88f7c-a6ff-439c-a253-bf5462716429",
"TicketId": 17
}
],
"Attachments": [],
"AuditLog": []
}
Returns an array of objects, each object represents a withdraw ticket with all its details.
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager on which the withdraw was made. |
| AccountProviderId | integer. The ID of the Account Provider of the product where the the withdraw was made. A product can have multiple account provider. |
| AccountId | integer. The ID of the account from which the withdraw was made. |
| AccountName | string. The name of the account. |
| AssetId | integer. The ID of the asset (product) that was withdrawn. |
| AssetName | string. The short name of the asset (product) that was withdrawn, for example BTC for Bitcoin or USD for US Dollars. |
| Amount | decimal. The unit and fractional amount of the asset that was withdrawn, for example 2.5 Bitcoin or 2018.17 US Dollars. |
| NotionalValue | decimal. The value of the withdraw amount in the NotionalProduct set in the verification level of the account for the product withdrawn. |
| NotionalProductId | integer. The product ID of the NotionalProduct set on the verification level of the account for the product withdrawn. |
| TemplateForm | string. A stringtified object which has the fields of the actual withdraw form together with the values provided by the user. Will usually have the withdrawal address, and other relevant infos such as comments. |
| TemplateFormType | string. The type of the template form. Usually Standard for fiat withdrawals, needs a very specific value for crypto withdrawals such as ToExternalBitcoinAddress, ToExternalEthereumAddress depending on the Account Provider type. Those values are usually automatically provided(pre-defined on the account provider). |
| OMSId | integer. The ID of the OMS. |
| RequestCode | string. A globally unique identifier (GUID) assigned by the system that identifies this specific withdraw. |
| RequestIP | string. The IP address from which the withdraw request was submitted from. |
| RequestUserId | integer. The ID of the user who submitted the withdrawal request. |
| RequestUserName | string. The username of the user who submitted the withdrawal request. |
| OperatorId | integer. The ID of the operator where the OMS is operating. |
| Status | integer. The current status of the withdrawal ticket. Some of these statuses are valid only for cryptocurrency withdrawals, which uses an automated withdrawal process, and some are valid for fiat currency withdrawals, which requires a human admin (operator). Some of these statuses are used by AlphaPoint internally, yet they may appear on a returned Withdraw Ticket. Withdraw ticket statuses: 0 New (awaiting operator review) 1 AdminProcessing (An admin is looking at the ticket) 2 Accepted (withdrawal will proceed) 3 Rejected (admin or automatic rejection) 4 SystemProcessing (automatic processing underway) 5 FullyProcessed (the withdrawal has concluded) 6 Failed (the withdrawal failed for some reason) 7 Pending (the admin has placed the withdrawal in pending status) 8 Pending2Fa (user must click 2-factor authentication confirmation link) 9 AutoAccepted (withdrawal will be automatically processed) 10 Delayed (waiting for funds to be allocated for the withdrawal) 11 UserCanceled (withdraw canceled by user or Superuser) 12 AdminCanceled (withdraw canceled by Superuser) 13 AmlProcessing (anti-money-laundering process underway) 14 AmlAccepted (anti-money-laundering process complete) 15 AmlRejected (withdrawal did not stand up to anti-money-laundering process) 16 AmlFailed (withdrawal did not complete anti-money-laundering process) 17 LimitsAccepted (withdrawal meets limits for fiat or crypto asset) 18 LimitsRejected (withdrawal does not meet limits for fiat or crypto asset) 19 Submitted (withdrawal sent to Account Provider; awaiting blockchain confirmation) 20 Confirmed (Account Provider confirms that withdrawal is on the blockchain) 21 ManuallyConfirmed (admin has sent withdrawal via wallet or admin function directly; marks ticket as FullyProcessed; debits account) 22 Confirmed2Fa (user has confirmed withdraw via 2-factor authentication.) |
| FeeAmt | decimal. The fee assessed for making the withdraw, if any. withdraw fees usually are assessed in the asset/product being withdrawn. |
| UpdatedByUser | integer. The user ID of the last user to have updated the ticket (status, amount, etc.; this is usually an admin). |
| UpdatedByUserName | string. The user name of the last user to have updated the ticket, for example, jsmith. |
| TicketNumber | long integer. An ID number assigned by the system to identify the ticket (as opposed to identifying the withdraw). |
| WithdrawTransactionDetails | string. For fiat withdraw, it is the information entered by the user at the withdraw form, for cryptocurrency withdraw from blockchain, it will contain the TXID, FromAddress, ToAddress, AccountProviderName, and AccountProviderId |
| RejectReason | string. If the withdrawal request is rejected, this field will contain the reason that will be optionally provided by the operator. |
| CreatedTimeStamp | string. The date and time when the withdraw ticket was created, in standard DateTime format. All dates and times are UTC. |
| LastUpdateTimeStamp | string. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in standard DateTime format. All dates and times are UTC. |
| CreatedTimestampTick | long integer. The date and time when the withdraw ticket was created, in Microsoft Time Ticks format. |
| LastUpdateTimestampTick | long integer. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in Microsoft Time Ticks format. |
| Comments | array. Any comment appended to the withdraw ticket. Please see request payload fields of SubmitWithdrawTicketComment. |
| Attachments | array. Any attachment to the withdraw ticket. |
| AuditLog | array. Log trail of a specific withdraw ticket. |
GetWithdrawTicketByVerifyCode
Permissions: Operator, Trading
Call Type: Synchronous
Returns a single withdraw ticket from OMS,trading venue operator and account that matches the Current Verify Code for confirmation
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("GetWithdrawTicketByVerifyCode", {
OMSId: 1,
VerifyCode: "",
});
POST /AP/GetWithdrawTicketByVerifyCode HTTP/1.1
Host: hostname goes here...
aptoken: c75a49f1-6a12-4853-b136-7447be600eb9
Content-Type: application/json
Content-Length: 78
{
"OMSId":1,
"VerifyCode": "27f1eb8f-4503-4bde-84d5-861187925995"
}
| Key | Value |
|---|---|
| OMSId | integer. The ID of the OMS where the account owning the withdraw ticket belongs to. required. |
| VerifyCode | string. The verify code sent to the email of the user who owns the account of a specific withdraw ticket. required. |
Response
{
"AssetManagerId": 1,
"AccountProviderId": 7,
"AccountId": 7,
"AccountName": "sample",
"AssetId": 3,
"AssetName": "TBTC",
"Amount": 0.001,
"NotionalValue": 0.001,
"NotionalProductId": 1,
"TemplateForm": "{\"TemplateType\":\"ToExternalBitcoinAddress\",\"Comment\":\"Sample only!\",\"ExternalAddress\":\"tb1q20ulz3fv8aqjcrm2c665mfhe9tvwd3uz3jwlxc\",\"Amount\":0.001}",
"TemplateFormType": "ToExternalBitcoinAddress",
"OMSId": 1,
"RequestCode": "af082910-c5ab-421d-af97-e65c384a65fc",
"RequestIP": "69.10.61.175",
"RequestUserId": 5,
"RequestUserName": "sample",
"OperatorId": 1,
"Status": "Failed",
"FeeAmt": 0.0,
"UpdatedByUser": 1,
"UpdatedByUserName": "admin",
"TicketNumber": 287,
"WithdrawTransactionDetails": "{\"TxId\":null,\"ExternalAddress\":\"tb1q20ulz3fv8aqjcrm2c665mfhe9tvwd3uz3jwlxc\",\"Amount\":0,\"Confirmed\":false,\"LastUpdated\":\"0001-01-01T00:00:00.000Z\",\"TimeSubmitted\":\"0001-01-01T00:00:00.000Z\",\"AccountProviderName\":\"ToExternalBitcoinAddress\",\"AccountProviderId\":7}",
"RejectReason": null,
"CreatedTimestamp": "2023-02-28T06:32:23.639Z",
"LastUpdateTimestamp": "2023-03-22T10:39:44.717Z",
"CreatedTimestampTick": 638131627436397114,
"LastUpdateTimestampTick": 638150783847175901,
"Comments": [
{
"CommentId": 861,
"EnteredBy": 1,
"EnteredDateTime": "2023-03-22T10:36:31.451Z",
"EnteredDateTimeTick": 638150781914511710,
"Comment": "Status updated to (Accepted) by user admin",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "af082910-c5ab-421d-af97-e65c384a65fc",
"TicketId": 287
},
{
"CommentId": 862,
"EnteredBy": 1,
"EnteredDateTime": "2023-03-22T10:36:31.671Z",
"EnteredDateTimeTick": 638150781916714045,
"Comment": "AmlProviderConfig is either not enabled or set to PassThrough. Skipping address verification and submitting withdraw ticket",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "af082910-c5ab-421d-af97-e65c384a65fc",
"TicketId": 287
},
{
"CommentId": 863,
"EnteredBy": 1,
"EnteredDateTime": "2023-03-22T10:36:31.935Z",
"EnteredDateTimeTick": 638150781919351071,
"Comment": "Withdraw Failed: Withdraw_Submission_Failed",
"OperatorId": 1,
"OMSId": 1,
"TicketCode": "af082910-c5ab-421d-af97-e65c384a65fc",
"TicketId": 287
}
],
"Attachments": [],
"AuditLog": []
}
Returns an array of objects, each object represents a withdraw ticket with all its details.
| Key | Value |
|---|---|
| AssetManagerId | integer. The ID of the Asset Manager on which the withdraw was made. |
| AccountProviderId | integer. The ID of the Account Provider of the product where the the withdraw was made. A product can have multiple account provider. |
| AccountId | integer. The ID of the account from which the withdraw was made. |
| AccountName | string. The name of the account. |
| AssetId | integer. The ID of the asset (product) that was withdrawn. |
| AssetName | string. The short name of the asset (product) that was withdrawn, for example BTC for Bitcoin or USD for US Dollars. |
| Amount | decimal. The unit and fractional amount of the asset that was withdrawn, for example 2.5 Bitcoin or 2018.17 US Dollars. |
| NotionalValue | decimal. The value of the withdraw amount in the NotionalProduct set in the verification level of the account for the product withdrawn. |
| NotionalProductId | integer. The product ID of the NotionalProduct set on the verification level of the account for the product withdrawn. |
| TemplateForm | string. A stringtified object which has the fields of the actual withdraw form together with the values provided by the user. Will usually have the withdrawal address, and other relevant infos such as comments. |
| TemplateFormType | string. The type of the template form. Usually Standard for fiat withdrawals, needs a very specific value for crypto withdrawals such as ToExternalBitcoinAddress, ToExternalEthereumAddress depending on the Account Provider type. Those values are usually automatically provided(pre-defined on the account provider). |
| OMSId | integer. The ID of the OMS. |
| RequestCode | string. A globally unique identifier (GUID) assigned by the system that identifies this specific withdraw. |
| RequestIP | string. The IP address from which the withdraw request was submitted from. |
| RequestUserId | integer. The ID of the user who submitted the withdrawal request. |
| RequestUserName | string. The username of the user who submitted the withdrawal request. |
| OperatorId | integer. The ID of the operator where the OMS is operating. |
| Status | integer. The current status of the withdrawal ticket. Some of these statuses are valid only for cryptocurrency withdrawals, which uses an automated withdrawal process, and some are valid for fiat currency withdrawals, which requires a human admin (operator). Some of these statuses are used by AlphaPoint internally, yet they may appear on a returned Withdraw Ticket. Withdraw ticket statuses: 0 New (awaiting operator review) 1 AdminProcessing (An admin is looking at the ticket) 2 Accepted (withdrawal will proceed) 3 Rejected (admin or automatic rejection) 4 SystemProcessing (automatic processing underway) 5 FullyProcessed (the withdrawal has concluded) 6 Failed (the withdrawal failed for some reason) 7 Pending (the admin has placed the withdrawal in pending status) 8 Pending2Fa (user must click 2-factor authentication confirmation link) 9 AutoAccepted (withdrawal will be automatically processed) 10 Delayed (waiting for funds to be allocated for the withdrawal) 11 UserCanceled (withdraw canceled by user or Superuser) 12 AdminCanceled (withdraw canceled by Superuser) 13 AmlProcessing (anti-money-laundering process underway) 14 AmlAccepted (anti-money-laundering process complete) 15 AmlRejected (withdrawal did not stand up to anti-money-laundering process) 16 AmlFailed (withdrawal did not complete anti-money-laundering process) 17 LimitsAccepted (withdrawal meets limits for fiat or crypto asset) 18 LimitsRejected (withdrawal does not meet limits for fiat or crypto asset) 19 Submitted (withdrawal sent to Account Provider; awaiting blockchain confirmation) 20 Confirmed (Account Provider confirms that withdrawal is on the blockchain) 21 ManuallyConfirmed (admin has sent withdrawal via wallet or admin function directly; marks ticket as FullyProcessed; debits account) 22 Confirmed2Fa (user has confirmed withdraw via 2-factor authentication.) |
| FeeAmt | decimal. The fee assessed for making the withdraw, if any. withdraw fees usually are assessed in the asset/product being withdrawn. |
| UpdatedByUser | integer. The user ID of the last user to have updated the ticket (status, amount, etc.; this is usually an admin). |
| UpdatedByUserName | string. The user name of the last user to have updated the ticket, for example, jsmith. |
| TicketNumber | long integer. An ID number assigned by the system to identify the ticket (as opposed to identifying the withdraw). |
| WithdrawTransactionDetails | string. For fiat withdraw, it is the information entered by the user at the withdraw form, for cryptocurrency withdraw from blockchain, it will contain the TXID, FromAddress, ToAddress, AccountProviderName, and AccountProviderId |
| RejectReason | string. If the withdrawal request is rejected, this field will contain the reason that will be optionally provided by the operator. |
| CreatedTimeStamp | string. The date and time when the withdraw ticket was created, in standard DateTime format. All dates and times are UTC. |
| LastUpdateTimeStamp | string. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in standard DateTime format. All dates and times are UTC. |
| CreatedTimestampTick | long integer. The date and time when the withdraw ticket was created, in Microsoft Time Ticks format. |
| LastUpdateTimestampTick | long integer. The date and time when the withdraw ticket last was updated — usually by an admin changing its status — in Microsoft Time Ticks format. |
| Comments | array. Any comment appended to the withdraw ticket. Please see request payload fields of SubmitWithdrawTicketComment. |
| Attachments | array. Any attachment to the withdraw ticket. |
| AuditLog | array. Log trail of a specific withdraw ticket. |
SubmitWithdrawTicketComment
Permissions: Operator, Trading
Call Type: Synchronous
Add a comment to a specific withdraw ticket.
Request
const { APEX } = require("alphapoint-apex-api");
const apex = new APEX("websocket url goes here...");
await apex.RPCPromise("SubmitWithdrawTicketComment", {
Comment: "This is a manual withdraw.",
OMSId: 1,
OperatorId: 1,
TicketCode: "17701757-7b30-40b6-af0e-9340a58857d1",
TicketId: 285,
EnteredDateTime: "2023-01-17T13:39:53.413Z",
});
POST /AP/SubmitWithdrawTicketComment HTTP/1.1
Host: hostname goes here...
aptoken: e426b2e0-6aa9-4bb3-a99e-61d6a5ddef86
Content-Type: application/json
Content-Length: 278
{
"Comment":"This is a manual withdraw.",
"OMSId": 1,
"OperatorId": 1,
"TicketCode":"17701757-7b30-40b6-af0e-9340a58857d1",
"TicketId": 285,
"EnteredDateTime":"2023-01-17T13:39:53.413Z"
}
| Key | Value |
|---|---|
| Comment | string. The actual withdraw ticket comment. Request will be accepted without this field but it would result to a null comment which won't make any sense. optional. |
| OMSId | integer. The ID of the OMS. optional. |
| OperatorId | integer. The ID of the operator where the OMS is operating. optional. |
| TicketCode | string. The GUID that identifies a specific withdraw ticket you wish to add a comment to. required. |
| TicketId | integer. The ID a specific withdraw ticket you wish to add a comment to. required. |
| EnteredDateTime | string. The date and time, should be in the standard DateTime format and in UTC. required. |
Response
{
"success": true,
"commentid": 459
}
Returns an object with success and commentid fields.
| Key | Value |
|---|---|
| success | boolean. Either true(if request is successful and withdraw ticket comment successfully added) or false. |
| commenid | integer. The withdraw ticket comment ID. |