NAV
javascript http

Background Information

This section provides important information about the Notbank Exchange software.

Websocket vs HTTP

Notbank APIs offers a lot of flexibility as most of them can be invoked in both Websockets and HTTP protocol. All Notbank 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 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 Notbank.

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. Note that the keys must be in PascalCase format.

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.stringify(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.

Notbank Node Library

The Notbank Node library is a JavaScript library that provides a simple interface to the Notbank API. It allows you to easily connect to the Notbank API and make requests without having to worry about the underlying details of the API. The NotbankClient class is the main entry point to the library, and it provides methods for connecting to the API, making requests, and handling responses.

There are two ways to use the Notbank Node library: via Rest API or via Websockets. The library provides methods for both, allowing you to choose the one that best fits your needs. Here we provide javascript code for websocket use (using Notbank Node) and http code for Rest API use.

WebSocket connection and authentication

In order to connect to Notbank WebSocket via Notbank Node library, you need to create an instance of NotbankClient, using the createWebSocketClient() factory method, and then call the connect(hooks) method to establish a connection to use onOpen, onMessage,onClose and onError hooks. Once the connection is established, you can authenticate using the authenticate() method.

import Notbank from 'notbank'

const client = Notbank.NotbankClient.Factory.createWebsocketClient();
const hooks = {
  onOpen: async () => {
    await client.authenticate({
      ApiPublicKey: 'api_key',
      ApiSecretKey: 'api_secret',
      UserId: 'user_id',
    });
  },
  onMessage: (message) => {
    console.log('Received message:', message);
  },
  onClose: () => {
    console.log('Disconnected from Notbank WebSocket');
  },
  onError: (error) => {
    console.error('Error connecting to Notbank WebSocket:', error);
  }
}
await client.connect(hooks);

Users, Accounts, and Permissions

The Notbank 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 Notbank are simplified for ease of use, for instance, API SendOrder will require the permission NotbankTrading, as almost all Trading API. In other example, CreateFiatWithdraw and TransferFunds will require the NotbankWithdraw permission. All required or public permisions are specified on each API endpoint documentation.

API ENDPOINT MINIMUM PERMISSION REQUIRED
SendOrder NotbankTrading
CreateFiatWithdraw NotbankWithdraw
TransferFunds NotbankWithdraw

Products and Instruments

In Notbank software, 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 a US Dollar or a New Zealand Dollar or a Bitcoin or an ounce of gold. Transaction and withdrawal fees are denominated in products. (Products may be referred to as assets in some API calls.)

An instrument is a pair of exchanged products (or fractions of them). For example, US Dollar for Bitcoin. 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 dollars). Notbank software thinks of that exchange as explicit, and separates product from instrument.

Quotes and Orders

The Notbank API includes calls related to both quotes and orders. Quoting is not enabled for the retail end user of Notbank software. Only registered market participants or marketmakers may quote. Your trading venue may offer quotes separately from orders.

In this version of the Notbank matching engine software, quotes and orders are synonymous. They both can buy or sell. This is because the matching engine (like most matching engines) 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

Notbank software 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).

The Trading Day

Most Notbank installations operate 24-hour computer-based trading venues. The trading day runs from UTC Midnight to UTC Midnight (essentially, London time, but without any summertime offset), regardless of the nominal location of the venue. 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: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// connection code ...

await client.getAccountService().getAccountTransactions({
  AccountId: 7,
  TransactionReferenceTypes: ["Deposit", "Withdraw"],
  ProductId: 3,
});

// parameters:
{
  AccountId: number;
  Depth?: number;
  ProductId?: number;
  TransactionId?: number;
  ReferenceId?: number;
  TransactionTypes?: TransactionTypes[]; // <-- Enum array
  TransactionReferenceTypes?: TransactionReferenceTypes[]; // <-- Enum array
  StartTimestamp?: number;
  EndTimeStamp?: number;
}

enum TransactionTypes {
  Fee = "Fee",
  Trade = "Trade",
  Other = "Other",
  Reverse = "Reverse",
  Hold = "Hold",
  Rebate = "Rebate",
  MarginAcquisition = "MarginAcquisition",
  MarginRelinquishByTrade = "MarginRelinquishByTrade",
  MarginInterestTransfer = "MarginInterestTransfer",
  MarginOperatorTransferToMarginAccount = "MarginOperatorTransferToMarginAccount",
  MarginOperatorTransferToAssetAccount = "MarginOperatorTransferToAssetAccount",
  MarginUserTransfer = "MarginUserTransfer",
  MarginRelinquishByTransfer = "MarginRelinquishByTransfer",
  MarginRelinquishByReverseTrade = "MarginRelinquishByReverseTrade",
  Distribution = "Distribution",
  Payment = "Payment",
  OperatorLend = "OperatorLend",
  OperatorReceived = "OperatorReceived",
  Rebalance = "Rebalance",
  Commission = "Commission",
  AirDrop = "AirDrop"
}

enum TransactionReferenceTypes {
  Trade = "Trade",
  Deposit = "Deposit",
  Withdraw = "Withdraw",
  Transfer = "Transfer",
  OrderHold = "OrderHold",
  WithdrawHold = "WithdrawHold",
  DepositHold = "DepositHold",
  MarginHold = "MarginHold",
  ManualHold = "ManualHold",
  ManualEntry = "ManualEntry",
  MarginAcquisition = "MarginAcquisition",
  MarginRelinquish = "MarginRelinquish",
  MarginInterestNetting = "MarginInterestNetting",
  MarginOperatorTransferToMarginAccount = "MarginOperatorTransferToMarginAccount",
  MarginOperatorTransferToAssetAccount = "MarginOperatorTransferToAssetAccount",
  MarginUserTransfer = "MarginUserTransfer",
  MarginPositionReverseTrade = "MarginPositionReverseTrade",
  AffiliateRebate = "AffiliateRebate",
  DistributionEntry = "DistributionEntry",
  TransferHold = "TransferHold",
  AirDrop = "AirDrop"
}
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. 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: NotbankTrading, NotbankReadOnly
Call Type: Synchronous

Retrieves a list of Positions(Balances) on a specific account.

Request

import Notbank from 'notbank'
// websocket connection & authentication code ...

await client.getAccountService().getAccountPositions({
  AccountId: 7,
  IncludePending: true
});

//parameters
{
  AccountId: number;
  IncludePending?: boolean;
}
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: NotbankTrading, NotbankReadOnly
Call Type: Synchronous

Retrieves a list of Instrument Statistics of a specific account.

Request

import Notbank from 'notbank'
// websocket connection & authentication code ...

await client.getAccountService().getAccountInstrumentStatistics({
  AccountId: 7
});

//parameters
{
  AccountId: number;
}
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.

GetAccountInfo

Permissions: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection & authentication code ...

await client.getAccountService().getAccountInfo({
  AccountId: 7
});

//parameters
{
  AccountId?: number;
}
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.

Authentication

AuthenticateUser

Permissions: Public
CallType: Synchronous

Authenticates a user.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.authenticate({
  ApiPublicKey: 'api_key',
  ApiSecretKey: 'api_secret', // for security reasons, ApiSecret doesn't go through the net
  UserId: '1',
});
GET /AP/AuthenticateUser HTTP/1.1
Host: hostname goes here...
Content-Type: application/json
APIKey: "28c68ac3fcfafc3d4e8d653fe57e5baf",
Signature: "29c15c42e4fabcc9e229421e148e647903927c503ab4578ada55bb13a63a9636",
UserId: "96",
Nonce: "2247733562"

WebSocket or HTTP(Keys will be included as Headers)

Key Value
APIKey string. This is an Notbank-generated key used in user-identification.
Signature string. A long, alphanumeric string generated by Notbank by using the APIKey and Nonce. To generate your own signature with a different nonce, you can use this HMAC-Sha256 page to 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.

Response


//Response if API key is used. 2FA is bypassed.
{
    "Authenticated": true,
    "SessionToken": "02de4e6d-507d-4e89-8a2c-49a9935d5607",
    "User": {
        "UserId": 81,
        "UserName": "example1",
        "Email": "[email protected]",
        "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.
Email 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.

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.

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.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getAuthService().webAuthenticateUser({
  SessionToken: 'session-token',
});

WebAutheticate user is not applicable in HTTP, see Authenticate and AuthenticatUser for HTTP.

Key Value
SessionToken string. The user's existing active session token.

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getAuthService().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.

Fee

GetWithdrawFee

Permissions: NotbankTrading, NotbankWithdraw
Call Type: Synchronous

Get a fee estimate for a withdrawal.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getWithdrawFee({
  AccountId: 1,
  ProductId: 1,
  Amount: 100
});

// parameters
{
  AccountId: number; // Required: requester account ID.
  ProductId: number; // Required: Product ID of currency to withdraw.
  Amount: number; // Required: Amount of product to withdraw.
  AccountProviderId?: number; // Optional: Account provider ID (if applies).
}
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. 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,
  "message": "Fee calculated successfully" || "Invalid Request" || "Account or Product not found"
}
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: NotbankTrading, NotbankDeposit
Call Type: Synchronous

Get a fee estimate for a deposit.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getDepositFee({
  AccountId: 1,
  ProductId: 1,
  Amount: 100,
  AccountProviderId: 5
});

// parameters
{
  AccountId: number; // Required: requester account ID.
  ProductId: number; // Required: Product ID of currency to withdraw.
  Amount: number; // Required: Amount of product to withdraw.
  AccountProviderId: number; // Required: linked Account provider ID.
}
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. 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,
  "message": "Fee calculated successfully" || "Invalid Request" || "Account or Product not found"
}
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: NotbankWithdraw
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.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getOMSWithdrawFees({
  ProductId: 1,
  AccountProviderId: 8
});

// parameters
{
  ProductId?: number; // ID of the product (optional)
  AccountProviderId?: number; // ID of the account provider (optional)
}
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: NotbankDeposit
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getOMSDepositFees({
  ProductId: 1,
  AccountProviderId: 5
});

// parameters
{
  ProductId?: number; // ID of the product (optional)
  AccountProviderId?: number; // ID of the account provider (optional)
}
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 NotBank 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 NotBank version; for future provision. he way to calculate the minimum withdraw fee, either Percentage or Flat.

GetAccountFees

Permissions: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getAccountFees({
  AccountId: 9
});

// parameters
{
  AccountId: number; // ID of the account (required)
}
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.

GetOrderFee

Permissions: NotbankTrading
Call Type: Synchronous

Returns an estimate of the transaction/trading fee for a specific order side, instrument, and order type.

The exchange generally deducts fees from the "receiving" side of the trade. 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 NotbankTrading permission can get fee estimates for any account that user is associated with and for any instrument or product that that account can trade.

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getFeeService().getOrderFee({
  AccountId: 9,
  InstrumentId: 1,
  Quantity: 0.5,
  Price: 10000,
  OrderType: 2,
  MakerTaker: "Maker",
  Side: 0
});

// parameters
{
  AccountId: number; // Required: ID de la cuenta del usuario solicitante
  InstrumentId: number; // Required: ID del instrumento a ser negociado
  Quantity: number; // Required: Cantidad para la negociación
  Price: number; // Required: Precio de entrada para el comercio
  OrderType: OrderTypeInt; // Required: Tipo de orden (Market, Limit, etc.)
  MakerTaker: MakerTaker; // Required: Tipo de negociación
  Side: TradeSide; // Required: Lado del comercio (Buy, Sell, etc.)
}
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. 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. 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 NotBank, 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 (Pair)

GetInstrument

Permissions: Public
Call Type: Synchronous

Retrieves the details of a specific instrument (pair) from the OMS of the trading venue. An instrument is something that can be traded in the exchange.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getInstrumentService().getInstrument({
  InstrumentId: 1
});

// parameters
{
  InstrumentId: number;
}
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

import Notbank from 'notbank'
// websocket connection code ...

//Get all instruments including the disabled ones
await client.getInstrumentService().getInstruments({
  InstrumentState: InstrumentStateArgument.BOTH
});

//Get all disabled/inactive instruments only
await client.getInstrumentService().getInstruments({
  InstrumentState: InstrumentStateArgument.INACTIVE
});

// parameters
{
  InstrumentState?: InstrumentStateArgument;
}
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.

GetInstrumentVerificationLevelConfig

Permissions: NotbankTrading, NotbankDeposit, NotbankWithdraw
Call Type: Synchronous

Gets an Instrument Verification Level Configurations for the requested account.

In NotBank, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getInstrumentService().getInstrumentVerificationLevelConfigs({
  AccountId: 7
});

// parameters
{
  AccountId: number; // The Account Id (required)
}
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 (Currency)

GetProduct

Permissions: Public
Call Type: Synchronous

Retrieves the details about a specific product (currency) on the exchange. A product is an asset that can be deposited and withdrawn but cannot be traded.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getProductService().getProduct({
  ProductId: 1
});

// parameters
{
  ProductId: number;
}
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

import Notbank from 'notbank'
// websocket connection code ...

//Get all enabled products
await client.getProductService().getProducts();

//Get all products including disabled products
await client.getProductService().getProducts({
  GetDisabled: true
});

//Get all products that matches an attribute and its value
await client.getProductService().getProducts({
  Attribute: "Pegged",
  AttributeValue: true
});

await client.getProductService().getProducts({
  AttGetDisabledribute: 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)
});

// parameters
{
  Attribute?: string;
  AttributeValue?: string;
  GetDisabled?: number;
  Depth?: number;
  StartIndex?: number;
}
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
}

{
  "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.

GetVerificationLevelConfig

Permissions: NotbankTrading, NotbankDeposit, NotbankWithdraw
Call Type: Synchronous

Gets the verification level configuration of the requested account.

In NotBank, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getProductService().getVerificationLevelConfig({
  AccountId: 7
});

// parameters
{
  AccountId: number;
}
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.
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.

Report

GenerateTradeActivityReport

Permissions: NotbankTrading
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 NotbankTrading permission can only generate trade reports for accounts with which he/she is associated to.

The actual Trade Activity Report will be generated as a comma-separated (CSV) file. It can be downloaded using the API call DownloadDocument.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().generateTradeActivityReport({
  accountIdList: [185, 9],
  startTime: "2023-03-01T16:00:00.000Z",
  endTime: "2023-03-02T16:00:00.000Z"
});

// parameters
{
  accountIdList: number[]; // Required
  startTime: string; // Required, format ISO 8601
  endTime: string; // Required, format ISO 8601
}
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 Notbank 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.

GenerateTransactionActivityReport

Permissions: NotbankTrading
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 NotbankTrading permission can only generate transaction reports for accounts with which he/she is associated to.

The actual Transaction Activity Report will be generated as a comma-separated (CSV) file. It can be downloaded using the API call DownloadDocument.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().generateTransactionActivityReport({
  accountIdList: [185, 9],
  startTime: "2023-03-01T16:00:00.000Z",
  endTime: "2023-03-02T16:00:00.000Z"
});

// parameters
{
  accountIdList: number[]; // Required
  startTime: string; // Required, format ISO 8601
  endTime: string; // Required, format ISO 8601
}
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 Notbank 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: NotbankTrading
Call Type: Synchronous

Initiates the generation of a Product Delta Activity report for the specified accounts over a specified time interval.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().generateProductDeltaActivityReport({
  accountIdList: [185, 9],
  startTime: "2023-03-01T16:00:00.000Z",
  endTime: "2023-03-02T16:00:00.000Z"
});

// parameters
{
  accountIdList: number[]; // Required
  startTime: string; // Required, format ISO 8601
  endTime: string; // Required, format ISO 8601
}
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 Notbank 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: NotbankTrading
Call Type: Synchronous

Initiates the generation of a Profit and Loss Activity report for the specified accounts over a specified time interval.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().generatePnLActivityReport({
  accountIdList: [185, 9],
  startTime: "2023-03-01T16:00:00.000Z",
  endTime: "2023-03-02T16:00:00.000Z"
});

// parameters
{
  accountIdList: number[]; // Required
  startTime: string; // Required, format ISO 8601
  endTime: string; // Required, format ISO 8601
}
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 Notbank 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: NotbankTrading
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 NotbankTrading permission can only schedule generation of trade reports for accounts with which he/she is associated to.

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().scheduleTradeActivityReport({
  accountIdList: [185, 9],
  beginTime: "2023-03-01T16:00:00.000Z",
  Frequency: "Weekly"
});

// parameters
{
  accountIdList: number[]; // Required
  beginTime: string; // format ISO 8601
  frequency?: ReportFrequency | number | string; // Optional
}
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.

ScheduleTransactionActivityReport

Permissions: NotbankTrading
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 NotbankTrading permission can only schedule generation of transaction reports for accounts with which he/she is associated to.

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().scheduleTransactionActivityReport({
  accountIdList: [185, 9],
  beginTime: "2023-03-01T16:00:00.000Z",
  Frequency: "Weekly"
});

// parameters
{
  accountIdList: number[]; // Required
  beginTime: string; // format ISO 8601
  frequency?: ReportFrequency | number | string; // Optional
}
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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().scheduleProductDeltaActivityReport({
  accountIdList: [185, 9],
  beginTime: "2023-03-01T16:00:00.000Z",
  Frequency: "Weekly"
});

// parameters
{
  accountIdList: number[]; // Required
  beginTime: string; // format ISO 8601
  frequency?: ReportFrequency | number | string; // Optional
}
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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().scheduleProfitAndLossActivityReport({
  accountIdList: [185, 9],
  beginTime: "2023-03-01T16:00:00.000Z",
  Frequency: "Weekly"
});

// parameters
{
  accountIdList: number[]; // Required
  beginTime: string; // format ISO 8601
  frequency?: ReportFrequency | number | string; // Optional
}
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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().cancelUserReport({
  UserReportId: "389f244a-b958-4545-a4a7-61a73205b59e"
});

// parameters
{
  UserReportId: string;
}
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: NotbankTrading
Call Type: Synchronous

Queries the database for ReportWriterResultRecords that result from the execution of reports requested by the session User.

Users with NotbankTrading permission can request user report writer result records only for their own.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().getUserReportWriterResultRecords({
  UserId: 6
});

// parameters
{
  UserId: number;
  Depth?: number;
  StartIndex?: number;
}
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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().getUserReportTickets({
  UserId: 6
});

// parameters
{
  UserId: number;
}
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: NotbankTrading
Call Type: Synchronous

Removes the specified user report ticket from processing.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().removeUserReportTicket({
  UserReportTicketId: "e27e5268-db50-70fa-de84-ee0b6ae16093"
});

// parameters
{
  UserReportTicketId: string
}
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: NotbankTrading
Call Type: Synchronous

Retrieves a list of user report tickets included in the list of statuses.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().getUserReportTicketsByStatus([
  { RequestStatus: "Submitted" },
  { RequestStatus: "Scheduled" }
]);

// parameters
{
  RequestStatus: ReportRequestStatus;
}

ReportRequestStatus {
  Submitted = "Submitted",
  Validating = "Validating",
  Scheduled = "Scheduled",
  InProgress = "InProgress",
  Completed = "Completed",
  Aborting = "Aborting",
  Aborted = "Aborted",
  UserCancelled = "UserCancelled",
  SysRetired = "SysRetired",
  Pending = "Pending",
  UserCancelPending = "UserCancelPending"
}
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:

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: NotbankTrading
Call Type: Synchronous

Download Document

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().downloadDocument({
  DescriptorId: "66769552-cacd-471b-bb53-04b1ed1c87f9"
});

// parameters
{
  DescriptorId: string;
}
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: NotbankTrading
Call Type: Synchronous

Download Document Slice.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getReportService().downloadDocumentSlice({
  DescriptorId: "66769552-cacd-471b-bb53-04b1ed1c87f9",
  sliceNum: 0
});

// parameters
{
  DescriptorId: string;
  sliceNum?: number;
}
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 .

Websocket subscription

UnsubscribeLevel2

Permissions: Public
Call Type: Synchronous

Unsubscribes the user from a Level 2 Market Data Feed subscription.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeLevel2({
  InstrumentId: 2,
  Symbol: "BTCUSD"
});

// parameters
{
  InstrumentId: number;
  Symbol: string; // (i.e. "BTCUSD")
}

UnSubscribeLevel2 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 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

{
  "result": true,
  "errormsg": null,
  "errorcode": 0,
  "detail": null
}

UnSubscribeLevel2 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.

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.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeLevel2({
  InstrumentId: 2,
  Depth: 10
});

// parameters
{
  InstrumentId?: number; // El ID del instrumento
  Symbol?: string; // El símbolo del instrumento (por ejemplo, "BTCUSD")
  Depth: number; // Profundidad de mercado (ej. 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.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeLevel1({
  InstrumentId: 2
});

// parameters
{
  InstrumentId?: number; // The ID of the instrument being tracked
  Symbol?: string; // The symbol of the instrument (e.g., '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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeLevel1({
  InstrumentId: 2
});

// parameters
{
  InstrumentId?: number;
  Symbol?: string; // (i.e. "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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeTrades(
  request: {
    InstrumentId: 2
  },
  subcriptionHandler: (trade: TradeSummary) => void
);

// response type
TradeSummary: {
  TradeId: number;
  InstrumentId: number;
  Quantity: number;
  Price: number;
  Order1: number;
  Order2: number;
  Tradetime: number;
  Direction: number;
  TakerSide: number;
  BlockTrade: boolean;
  OrderClientId: number;
}

// parameters
{
  InstrumentId: number; // ID of the instrument (required)
  IncludeLastCount: number; // Number of previous trades to retrieve (required)
}

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. required.

Response

Numerical keys reduce package transmission load. See Response table for an explanation. json [ { 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeTrades({
  InstrumentId: 2
});
// parameters
{
  InstrumentId: number; // ID of the instrument (required)
}

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeTicker(
  request: {
    InstrumentId: 2,
    Interval: 60,
    IncludeLastCount: 5
  }, 
  // Callbacks
  snapshotHandler:  (tickers: TickerFeed[]) => void,
  updateHandler:  (tickers: TickerFeed[]) => void
);


// response Type
type TickerFeed = [
  EndDateTime: number,
  High: number,
  Low: number,
  Open: number,
  Close: number,
  Volume: number,
  Bid: number,
  Ask: number,
  InstrumentId: number,
  BeginDateTime: number
];

// request parameters
{
  InstrumentId: number;
  Interval: number;
  IncludeLastCount: number;
}

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeTicker(
  InstrumentId: 2
);

// request parameters
{
  InstrumentId: number; // ID of the instrument (required)
}

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: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeAccountEvents(
  request: {
    AccountId: 1
  }, 
  subcriptionHandler: {
    withdrawTicketUpdateEventHandler?: (event: WithdrawTicket) => void;
    orderTradeEventHandler?: (event: OrderTrade) => void;
    orderStateEventHandler?: (event: Order) => void;
    depositTicketUpdateEventHandler?: (event: DepositTicket) => void;
    accountPositionEventHandler?: (event: AccountPosition) => void;
    accountInfoUpdateEventHandler?: (event: AccountInfo) => void;
    cancelOrderRejectEventHandler?: (event: CancelOrderRejectEvent) => void;
    depositEventHandler?: (event: DepositEvent) => void;
    transactionEventHandler?: (event: Transaction) => void;
  }
);

// request parameters
{
  AccountId: number;  // Required
}

// response types

WithdrawTicket {
  AssetManagerId: number;
  AccountProviderId: number;
  AccountId: number;
  AccountName: string;
  AssetId: number;
  AssetName: string;
  Amount: number;
  NotionalValue: number;
  NotionalProductId: number;
  TemplateForm: string;
  TemplateFormType?: string;
  OMSId: number;
  RequestCode: string;
  RequestIP?: string;
  RequestUserId: number;
  RequestUserName: string;
  OperatorId: number;
  Status: string;
  FeeAmt: number;
  UpdatedByUser: number;
  UpdatedByUserName?: string;
  TicketNumber: number;
  WithdrawTransactionDetails: string;
  RejectReason?: string;
  CreatedTimestamp: string;
  LastUpdateTimestamp: string;
  CreatedTimestampTick: number;
  LastUpdateTimestampTick: number;
  Comments: any[];
  Attachments: any[];
  AuditLog: any[];
}

OrderTrade {
  OMSId: number;
  ExecutionId: number;
  TradeId: number;
  OrderId: number;
  AccountId: number;
  AccountName: string;
  SubAccountId: number;
  ClientOrderId: number;
  InstrumentId: number;
  Side: TradeSide;
  OrderType: OrderTypeInt;
  Quantity: number;
  RemainingQuantity: number;
  Price: number;
  Value: number;
  CounterParty: string;
  OrderTradeRevision: number;
  Direction: TradeDirection;
  IsBlockTrade: boolean;
  Fee: number;
  FeeProductId: number;
  OrderOriginator: number;
  UserName: string;
  TradeTimeMS: number;
  MakerTaker: MakerTaker;
  InsideBid: number;
  InsideBidSize: number;
  InsideAsk: number;
  InsideAskSize: number;
  NotionalProductId: number;
  NotionalRate: number;
  NotionalValue: number;
  TradeTime: number;
  AdapterTradeId: number;
  IsQuote: boolean;
  CounterPartyClientUserId: number;
  NotionalHoldAmount: number;
  TradeFlag: string;
}

Order {
  OMSId: number;
  Side: OrderSide;
  OrderId: number;
  Price: number;
  Quantity: number;
  DisplayQuantity: number;
  Instrument: number;
  Account: number;
  AccountName: string;
  OrderType: OrderTypeInt;
  ClientOrderId: number;
  OrderState: OrderState;
  ReceiveTime: number;
  ReceiveTimeTicks: number;
  LastUpdatedTime: number;
  LastUpdatedTimeTicks: number;
  OrigQuantity: number;
  QuantityExecuted: number;
  GrossValueExecuted: number;
  ExecutableValue: number;
  AvgPrice: number;
  CounterPartyId: number;
  ChangeReason: ChangeReason;
  OrigOrderId: number;
  OrigClOrdId: number;
  EnteredBy: number;
  UserName: string;
  IsQuote: false;
  InsideAsk: number;
  InsideAskSize: number;
  InsideBid: number;
  InsideBidSize: number;
  LastTradePrice: number;
  RejectReason?: any;
  IsLockedIn: false;
  CancelReason?: any;
  OrderFlag: string;
  UseMargin: false;
  StopPrice: number;
  PegPriceType: string;
  PegOffset: number;
  PegLimitOffset: number;
  IpAddress?: any;
  IPv6a: number;
  IPv6b: number;
  ClientOrderIdUuid?: any;
}

DepositTicket {
  AssetManagerId: number;
  AccountProviderId: number;
  AccountId: number;
  AssetId: number;
  AccountName: string;
  AssetName: string;
  Amount: number;
  NotionalValue: number;
  NotionalProductId: number;
  OMSId: number;
  RequestCode: string;
  ReferenceId: string;
  RequestIP: string;
  RequestUser: number;
  RequestUserName: string;
  OperatorId: number;
  Status: string;
  FeeAmt: number;
  UpdatedByUser: number;
  UpdatedByUserName: string;
  TicketNumber: number;
  DepositInfo: string;
  RejectReason?: string;
  CreatedTimestamp: string;
  LastUpdateTimeStamp: string;
  CreatedTimestampTick: string;
  LastUpdateTimeStampTick: string;
  Comments: any[];
  Attachments: any[];
}

AccountPosition {
  OMSId: number;
  AccountId: number;
  ProductSymbol: string;
  ProductId: number;
  Amount: number;
  Hold: number;
  PendingDeposits: number;
  PendingWithdraws: number;
  TotalDayDeposits: number;
  TotalMonthDeposits: number;
  TotalYearDeposits: number;
  TotalDayDepositNotional: number;
  TotalMonthDepositNotional: number;
  TotalYearDepositNotional: number;
  TotalDayWithdraws: number;
  TotalMonthWithdraws: number;
  TotalYearWithdraws: number;
  TotalDayWithdrawNotional: number;
  TotalMonthWithdrawNotional: number;
  TotalYearWithdrawNotional: number;
  NotionalProductId: number;
  NotionalProductSymbol: string;
  NotionalValue: number;
  NotionalHoldAmount: number;
  NotionalRate: number;
  TotalDayTransferNotional: number;
}

AccountInfo {
  OMSID: number;
  AccountId: number;
  AccountName: string;
  AccountHandle?: string;
  FirmId?: string;
  FirmName?: string;
  AccountType: AccountType;
  FeeGroupId: number;
  ParentID: number;
  RiskType: RiskType;
  VerificationLevel: number;
  VerificationLevelName?: string;
  CreditTier: number;
  FeeProductType: FeeProductType;
  FeeProduct: number;
  RefererId: number;
  LoyaltyProductId: number;
  LoyaltyEnabled: boolean;
  PriceTier: number;
  Frozen: boolean;
}

CancelOrderRejectEvent {
  OMSId: number;
  AccountId: number;
  OrderId: number;
  OrderRevision: number;
  OrderType: string;
  InstrumentId: number;
  Status: string;
  RejectReason: string;
}

DepositEvent {
  OMSId: number;
  AccountId: number;
  ProductId: number;
  Quantity: number;
  SubAccountId: number;
}

Transaction {
  TransactionId: number;
  OMSId: number;
  AccountId: number;
  CR: number;
  DR: number;
  Counterparty: number;
  TransactionType: string;
  ReferenceId: number;
  ReferenceType: string;
  ProductId: number;
  Balance: number;
  TimeStamp: number;
}

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_user","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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeAccountEvents(
  AccountId: 1
);

// request parameters
{
  AccountId: number; // ID of the account (required)
}

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: NotbankTrading
Call Type: Synchronous

Subscribe to order state events of a specific account's orders. Optional parameter to filter by instrument.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().subscribeOrderStateEvents(
  AccountId: 1
);

// request parameters
{
  AccountId: number; // ID of the account (required)
  InstrumentId?: number; // ID of the instrument (optional, filter)
}

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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSubscriptionService().unsubscribeOrderStateEvents(
  AccountId: 1
);

// request parameters
{
  AccountId: number; // ID of the account (required)
  InstrumentId?: number; // ID of the instrument (optional, filter)
}

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getSystemService().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.

HealthCheck

Permissions: Public
Call Type: Synchronous

Gets Exchange's services overall health.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getSystemService().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.

Trading

SendOrderList

Permissions: NotbankTrading
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 NotbankTrading permission can create an order only for those accounts and instruments with which the user is associated.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().sendOrderList([
  {
    "InstrumentId": 2,
    "AccountId": 185,
    "TimeInForce": 1,
    "ClientOrderId": 0,
    "OrderIdOCO": 0,
    "UseDisplayQuantity": false,
    "Side": 0,
    "Quantity": 0.02,
    "OrderType": 2,
    "PegPriceType": "3",
    "LimitPrice": 23436
  },
  {
    "InstrumentId": 2,
    "AccountId": 185,
    "TimeInForce": 1,
    "ClientOrderId": 0,
    "OrderIdOCO": 0,
    "UseDisplayQuantity": false,
    "Side": 0,
    "Quantity": 0.02,
    "OrderType": 2,
    "PegPriceType": "3",
    "LimitPrice": 23436
  }
]);

// request payload types
[
  {
    InstrumentId: number; // Required
    AccountId: number; // Required
    TimeInForce: TimeInForce; // Tiempo de ejecución
    ClientOrderId?: number; // Opcional (por defecto: 0)
    OrderIdOCO?: number; // Opcional: One Cancels the Other
    UseDisplayQuantity?: boolean; // Opcional: Si es una orden reserva
    Side: OrderSide; // Required: Lado de la orden
    Quantity: number; // Required: Cantidad de instrumento
    OrderType: OrderTypeInt; // Required: Tipo de orden
    PegPriceType?: PegPriceType; // Opcional, por defecto Last (1)
    LimitPrice?: number; // Opcional: Precio límite
    DisplayQuantity?: number; // Opcional: Cantidad visible si es una reserva
  },
]
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. 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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().sendCancelList([
  {
      "OrderId": 6714,
      "AccountId": 9
  },
  {
      "OrderId": 6507,
      "AccountId": 9
  }
]);

// request payload types
[
  {
    OrderId: number; // Required: ID de la orden a cancelar
    AccountId: number; // Required: ID de la cuenta asociada a la orden
  },
]
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: NotbankTrading
Call Type: Synchronous

Send a list of Cancel/Replace requests. Only working orders can be replaced.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().sendCancelReplaceList([
  {
    "OrderIdToReplace":6696,
    "ClientOrdId":0,
    "OrderType":"Limit",
    "Side":"Buy",
    "AccountId":7,
    "InstrumentId":1,
    "LimitPrice":29500,
    "TimeInForce":1,
    "Quantity":0.003
  },
  {
    "OrderIdToReplace":6698,
    "ClientOrdId":0,
    "OrderType":"Limit",
    "Side":"Buy",
    "AccountId":7,
    "InstrumentId":1,
    "LimitPrice":29900,
    "TimeInForce":1,
    "Quantity":0.004
  }
]);

// request payload types
[
  {
    ReplaceOrderId: number; // Required: ID de la orden a reemplazar
    ReplaceClientOrderId?: number; // Opcional: ID del cliente para la orden existente
    ClientOrderId?: number; // Opcional: Nuevo ID del cliente, único por working order
    OrderType: OrderTypeInt; // Required: Tipo de la nueva orden
    Side: OrderSide; // Required: Lado del trade
    AccountId: number; // Required: ID de la cuenta propietaria de las órdenes
    InstrumentId: number; // Required: ID del instrumento
    UseDisplayQuantity?: boolean; // Opcional: Define si la cantidad es visible
    DisplayQuantity?: number; // Opcional: Cantidad visible en el libro de órdenes
    LimitPrice?: number; // Opcional: Precio límite (solo para órdenes límite)
    StopPrice?: number; // Opcional: Precio objetivo (para órdenes Stop)
    ReferencePrice?: number; // Opcional: Precio base (para órdenes Trailing)
    PegPriceType?: PegPriceType; // Opcional: Tipo de precio para Stop/Trailing
    TimeInForce: TimeInForce; // Required: Tiempo de ejecución de la nueva orden
    OrderIdOCO?: number; // Opcional: Orden vinculada a otra (One Cancels the Other)
    Quantity: number; // Required: Cantidad de la nueva orden
},
]
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. 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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().modifyOrder({
  "OrderId": 6507,
  "InstrumentId": 9,
  "Quantity": 0.1,
  "AccountId": 9
});

// request payload types
{
  OrderId: number; // ID of the order to modify (required)
  InstrumentId: number; // ID of the instrument (required)
  Quantity: number; // New quantity (must be <= current quantity) (required)
  AccountId: number; // ID of the account (required)
}
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: NotbankTrading
Call Type: Synchronous

Cancels all open matching orders for the specified account on an OMS.

A user with NotbankTrading permission can cancel orders for accounts it is associated with.

Request

import Notbank from 'notbank'
// websocket connection code ...

//Cancel all orders of all accounts for a specific instrument
await client.getTradingService().cancelAllOrders({
  "AccountId": 9,
  "InstrumentId": 1
});

//Cancel all orders of all accounts for a specific instrument
await client.getTradingService().cancelAllOrders({
  "AccountId": 0,
  "InstrumentId": 1
});

//Cancel all orders of all accounts for all instruments
await client.getTradingService().cancelAllOrders({
  "AccountId": 0,
  "InstrumentId": 0
});

// request payload types
{
  AccountId?: number; // Opcional: ID de la cuenta. Si no se especifica, cancelará todas las cuentas
  InstrumentId?: number; // Opcional: ID del instrumento. Si no se especifica, cancelará todos los instrumentos
}

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: NotbankTrading
Call Type: Synchronous

Retrieves the status information for a single order.

A user with NotbankTrading permission can retrieve status information for accounts and orders with which the user is associated.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrderStatus({
    "AccountId": 7,
    "OrderId": 6562
});

// request payload types
{
  AccountId?: number; // Condicionalmente requerido si no tienes permiso SUPERUSER
  OrderId?: number; // Condicionalmente requerido si no tienes permiso SUPERUSER
}

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, 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: NotbankTrading
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 NotbankTrading permission can retrieve orders history only for accounts it is associated with.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrdersHistory({
    "AccountId": 7
});

// request payload types
{
  AccountId: number; // ID de cuenta
  OrderState?: OrderState; // Opcional: Estado de la orden
  OrderId?: number; // Opcional: ID de la orden
  ClientOrderId?: number; // Opcional: ID de orden del cliente
  OriginalOrderId?: number; // Opcional: ID de la orden original
  OriginalClientOrderId?: number; // Opcional: ID de cliente de la orden original
  UserId?: number; // Opcional: ID del usuario
  InstrumentId?: number; // Opcional: ID del instrumento
  StartTimestamp?: number; // Opcional: Marca de tiempo de inicio (POSIX)
  EndTimestamp?: number; // Opcional: Marca de tiempo de finalización (POSIX)
  Depth?: number; // Opcional: Máximo de órdenes por devolver
  Limit?: number; // Opcional: Máximo de órdenes por devolver (alias de Depth)
  StartIndex?: number; // Opcional: Índice de inicio para paginación
}

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 NotbankTrading 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, 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: NotbankTrading
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 NotbankTrading permission can retrieve trade history for accounts with which they are associated.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getTradesHistory({
    "AccountId": 7
});

// request payload types
{
  AccountId?: number; // Opcional: ID de la cuenta
  InstrumentId?: number; // Opcional: ID del instrumento
  TradeId?: number; // Opcional: ID del comercio específico
  OrderId?: number; // Opcional: ID de la orden
  UserId?: number; // Opcional: ID del usuario
  StartTimeStamp?: number; // Opcional: Marca de tiempo de inicio en formato POSIX
  EndTimeStamp?: number; // Opcional: Marca de tiempo de fin en formato POSIX
  Depth?: number; // Opcional: Cantidad de registros a devolver desde StartIndex
  StartIndex?: number; // Opcional: Índice inicial de los registros
  ExecutionId?: number; // Opcional: ID de la ejecución específica
}

All values in the request other than OMSId are optional.

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: NotbankTrading
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 NotbankTrading permission can retrieve an order history only for his/her account/s.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrderHistoryByOrderId({
  "OrderId": 6459
});

// request payload types
{
  OrderId: number; // Obligatorio: ID de la orden para obtener detalles
}
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, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getTickerHistory({
  "InstrumentId": 1,
  "Interval": 60,
  "FromDate": "2023-01-18 01:02:03",
  "ToDate": "2023-08-31 23:59:59"
});

// request payload types
{
  InstrumentId: number; // ID del Instrumento
  Interval: number; // Intervalos entre ticks (en segundos)
  FromDate: string; // Fecha/hora inicial en formato DateTime
  ToDate: string; // Fecha/hora final en formato DateTime
}
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, NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

//Get all trades for instrument id 1
await client.getTradingService().getLastTrades({
  "InstrumentId": 1
});

//Get the 10 most recent trades for instrumentid 1
await client.getTradingService().getLastTrades({
  "InstrumentId": 1,
  "Count": 10
});

// request payload types
{
  InstrumentId: number; // ID del Instrumento
  Interval: number; // Intervalos entre ticks (en segundos)
  FromDate: string; // Fecha/hora inicial en formato DateTime
  ToDate: string; // Fecha/hora final en formato DateTime
}
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: NotbankTrading, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getLevel1Summary();
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(quantity traded, in the product 1 or in the base currency denomination) 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 regardless of the timezone. Recalculates continuously.

GetLevel1SummaryMin

Permissions: NotbankTrading, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getLevel1SummaryMin({
  "InstrumentIds":"[1]"
});


// request payload types
{
  InstrumentIds?: string; // Optional: List of instrument ids as a string
}
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. Unit volume(quantity traded, in the product 1 or in the base currency denomination) of the instrument during the past 24 hours, regardless of time zone. Recalculates continuously.
Rolling24HrPxChange decimal. Change in price during the past 24 hours regardless of the timezone. Recalculates continuously.
Rolling24HrPxChangePercent decimal. Percent change in price during the past 24 hours regardless of the timezone. Recalculates continuously.

GetOpenTradeReports

Permissions: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOpenTradeReports({
  "AccountId": 9
});


// request payload types
{
  AccountId: number; // Required: ID of the account
}
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: NotbankTrading
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 NotbankTrading permission can retrieve orders only for accounts is associated with.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrders({
  "AccountId": 7
});


// request payload types
{
  AccountId: number; // Required: ID of the account
  OrderState?: string; // Optional: Filter by order state
  OrderId?: number; // Optional: Filter by order ID
  ClientOrderId?: number; // Optional: Filter by client order ID
  OriginalOrderId?: number; // Optional: Filter by original order ID
  OriginalClientOrderId?: number; // Optional: Filter by original client order ID
  UserId?: number; // Optional: Filter by user ID
  InstrumentId?: number; // Optional: Filter by instrument ID
  StartTimestamp?: number; // Optional: Filter by start timestamp
  EndTimestamp?: number; // Optional: Filter by end timestamp
  Depth?: number; // Optional: Maximum count of orders to return
  Limit?: number; // Optional: Functions same as Depth
  StartIndex?: number; // Optional: Pagination start index
}
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 NotbankTrading 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, 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: NotbankTrading
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 NotbankTrading permission can retrieve orders history only for accounts it is associated with.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrderHistory({
  "AccountId": 7
});


// request payload types
{
  AccountId: number; // ID de cuenta
  OrderState?: OrderState; // Opcional: Estado de la orden
  OrderId?: number; // Opcional: ID de la orden
  ClientOrderId?: number; // Opcional: ID de orden del cliente
  OriginalOrderId?: number; // Opcional: ID de la orden original
  OriginalClientOrderId?: number; // Opcional: ID de cliente de la orden original
  UserId?: number; // Opcional: ID del usuario
  InstrumentId?: number; // Opcional: ID del instrumento
  StartTimestamp?: number; // Opcional: Marca de tiempo de inicio (POSIX)
  EndTimestamp?: number; // Opcional: Marca de tiempo de finalización (POSIX)
  Depth?: number; // Opcional: Máximo de órdenes por devolver
  Limit?: number; // Opcional: Máximo de órdenes por devolver (alias de Depth)
  StartIndex?: number; // Opcional: Índice de inicio para paginación
}
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 NotbankTrading 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, 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: NotbankTrading
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 NotbankTrading permission can create an order only for those accounts and instruments with which the user is associated.

Request

import Notbank from 'notbank'
// websocket connection code ...

//Limit order
await client.getTradingService().sendOrder({
  "InstrumentId": 9,
  "AccountId": 9,
  "TimeInForce": 1,
  "ClientOrderId": 0,
  "OrderIdOCO": 0,
  "UseDisplayQuantity": false,
  "Side": 0,
  "Quantity": 1,
  "OrderType": 2,
  "PegPriceType": 3,
  "LimitPrice": 31000,
});

//Market order
await client.getTradingService().sendOrder({
  "InstrumentId": 9,
  "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 client.getTradingService().sendOrder({
  "InstrumentId": 9,
  "AccountId": 9,
  "TimeInForce": 1,
  "ClientOrderId": 0,
  "OrderIdOCO": 0,
  "UseDisplayQuantity": false,
  "Side": 0,
  "OrderType": 1,
  "PegPriceType": 3,
  "Value": 10,
});

// request payload types
{
  InstrumentId: number; // ID del instrumento (requerido)
  AccountId: number; // ID de cuenta asociada (requerido)
  TimeInForce: TimeInForce; // Tiempo aplicable (requerido)
  ClientOrderId?: number; // ID único generado por cliente (opcional)
  OrderIdOCO?: number; // Referencia a otra orden para OCO (opcional)
  UseDisplayQuantity?: boolean; // Mostrar cantidad parcial/reservas, opcional
  Side: OrderSide; // BUY (0) o SELL (1), requerido
  Quantity?: number; // Cantidad del instrumento (opcional según tipo de orden)
  OrderType: OrderTypeInt; // Tipo de la orden (requerido)
  PegPriceType?: PegPriceType; // Usado para órdenes STOP/TRAILING
  LimitPrice?: number; // Precio límite (requerido para certain OrderTypes)
  StopPrice?: number; // Precio de activación (usado para StopOrders, opcional)
  TrailingAmount?: number; // Monto del trailing (opcional si aplica)
  LimitOffset?: number; // Usado para TrailingStopLimit (opcional si aplica)
  DisplayQuantity?: number; // Cantidad visible en el libro de órdenes
  Value?: number; // Valor de la orden solo para Market Orders (opcional)
}
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. 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: NotbankTrading
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

import Notbank from 'notbank'
// websocket connection code ...

//Limit order to replace OrderId 123456
await client.getTradingService().cancelReplaceOrder({
  "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 client.getTradingService().sendOrder({
  "OrderIdToReplace":123456,
  "ClientOrdId":0,
  "OrderType":"StopMarket",
  "Side":"Buy",
  "AccountId":20,
  "InstrumentId":9,
  "StopPrice":1.363,
  "TimeInForce":1,
  "Quantity":7322.24
});

//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 client.getTradingService().sendOrder({
  "InstrumentId": 9,
  "AccountId": 9,
  "TimeInForce": 1,
  "ClientOrderId": 0,
  "OrderIdOCO": 0,
  "UseDisplayQuantity": false,
  "Side": 0,
  "OrderType": 1,
  "PegPriceType": 3,
  "Value": 10,
});


OrderTypeInt {
  Unknown = 0,
  Market = 1,
  Limit = 2,
  StopMarket = 3,
  StopLimit = 4,
  TrailingStopMarket = 5,
  TrailingStopLimit = 6,
  BlockTrade = 7
}

OrderSide {
  Buy = 0,
  Sell = 1
}

// Tipo de precio para órdenes Stop y Trailing
PegPriceType {
  Last = 1,
  Bid = 2,
  Ask = 3,
  Midpoint = 4 // No soportado actualmente
}

// Tiempo de ejecución
TimeInForce {
  Unknown = 0,
  GTC = 1, // Good 'til canceled
  OPG = 2, // Execute as close to opening price
  IOC = 3, // Immediate or canceled
  FOK = 4, // Fill or kill
  GTX = 5, // Good 'til executed
  GTD = 6 // Good 'til date
}

// request payload types
{
  OrderIdToReplace: number; // Obligatorio: ID de la orden a reemplazar
  ClientOrderId?: number; // Opcional: ID para la nueva orden (debe ser único)
  OrderType: OrderTypeInt; // Obligatorio: Tipo de la nueva orden
  Side: OrderSide; // Obligatorio: Lado del trade
  AccountId: number; // Obligatorio: ID de la cuenta asociada
  InstrumentId: number; // Obligatorio: ID del instrumento
  UseDisplayQuantity?: boolean; // Opcional: True si la cantidad visible aplica
  DisplayQuantity?: number; // Opcional: Cantidad visible (si aplica)
  LimitPrice?: number; // Opcional: Precio límite (para órdenes límite)
  StopPrice?: number; // Opcional: Precio objetivo (para órdenes stop)
  ReferencePrice?: number; // Opcional: Precio de referencia (para trailing)
  PegPriceType?: PegPriceType; // Opcional: Tipo de precio (Stop y Trailing)
  TimeInForce: TimeInForce; // Obligatorio: Tiempo de ejecución
  OrderIdOCO?: number; // Opcional: Vinculación para One Cancels the Other
  Quantity: number; // Obligatorio: Cantidad
}


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: NotbankTrading
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 NotbankTrading permission can cancel an order only for an account it is associated with.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().cancelOrder({
  "OrderId": 6500,
  "AccountId": 9
});


// request payload types
{
  AccountId?: number; // Opcional: ID de la cuenta (requerido si el usuario no está asociado con la cuenta)
  OrderId?: number; // Opcional: ID de la orden a cancelar (requerido si ClOrderId no está especificado)
  ClOrderId?: number; // Opcional: ID de cliente para la orden a cancelar (requerido si OrderId no está especificado)
}
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: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOpenOrders({
  "AccountId": 9
});


// request payload types
{
  AccountId: number;
  InstrumentId?: number;
}
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, 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: NotbankTrading, NotbankReadOnly
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 NotbankTrading or NotbankReadOnly permission may access trade information only for accounts with which they are associated.

The operator of the trading venue determines how long to retain an accessible trading history before archiving.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getAccountTrades({
  "AccountId": 7,
  "Depth": 2
});


// request payload types
{
  AccountId?: number; // Optional: ID of the account
  StartIndex?: number; // Optional: Start index for pagination
  Depth?: number; // Optional: Number of trades to return (up to 200)
  InstrumentId?: number; // Optional: Filter by instrument ID
  TradeId?: number; // Optional: Filter by trade ID
  OrderId?: number; // Optional: Filter by order ID
  StartTimestamp?: number; // Optional: Filter by start timestamp
  EndTimestamp?: number; // Optional: Filter by end timestamp
  ExecutionId?: number; // Optional: Filter by execution ID
}
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getSummary();

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getTicker();

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getOrderBook({
  "Market_Pair": "BTCUSD",
  "Level": 1
});


// request payload types
{
  Market_Pair: string; // The instrument symbol (e.g., "BTCUSD"). Required.
  Depth?: number; // The depth of the order book (for level 2). Optional.
  Level?: 1 | 2; // Level of the order book: 1 (best bid/ask only) or 2 (multiple depth levels). Optional.
}
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getTrades({
  "Market_Pair": "BTCUSD"
});


// request payload types
{
  market_pair: string; // Market pair or instrument symbol (e.g., "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.

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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getL2Snapshot({
  "InstrumentId": 1,
  "Depth": 100
});


// request payload types
{
  InstrumentId: number; // Required: ID of the instrument
  Depth: number; // Required: Maximum number of bids and asks
}
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: NotbankTrading, 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

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().getLevel1({
  "InstrumentId": 1
});


// request payload types
{
  InstrumentId: number; // Required: ID of the instrument
}
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(quantity traded, in the product 1 or in the base currency denomination) 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 regardles of the timezone. Recalculates continuously.

GetEnums

Permissions: Public
Call Type: Synchronous

Get Order Object Enum Definitions

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getTradingService().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 string. The class name. Since GetEnums is solely for Orders currently, the class name will always be Order.
Property string. 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.

User

GetUserAccounts

Permissions: NotbankTrading, NotbankReadOnly
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

import Notbank from 'notbank'
// websocket connection code ...

await client.getUserService().getUserAccounts({
  "UserId": 1
});


// request payload types
{
  UserId?: number; // Optional: ID of the user
}
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: NotbankTrading
Call Type: Synchronous

Get the Registered Device/s of a specific user.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getUserService().getUserDevices({
  "UserId": 6
});


// request payload types
{
  UserId?: number; // Optional: ID of the user
}
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.

Wallet

Endpoints

Unlike the methods defined above where the URL path starts with /ap/, in the next category Wallets, the URL path of all methods starts with /api/nb/ and they do not have Websocket support.

GetBanks

Permissions: NotbankDeposit, NotbankWithdraw, NotbankReadOnly
Call Type: Synchronous

Provides the list of banks supported on the platform.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getBanks({
  "country": "CL"
});


// request payload types
{
  country: string
  page?: string
  page_size?: string
}
GET /api/nb/banks?country=CL HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
country string. Country code in ISO 3166-1 alpha-2 format. required.
page string. Número de página. Valor por defecto 1. optional.
page_size string. Cantidad de elementos por página. Valor por defecto 10. optional.

Response

{
  "status": "success",
  "total": 100,
  "data": [
    {
      "id": "7aa9d19d-01b6-4993-8075-0e922bf471d2",
      "name": "Banco de Chile",
      "country": "CL"
    },
    {
      "id": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
      "name": "Banco Estado",
      "country": "CL"
    }
  ]
}

Returns an array as a response. Each element in the array represents a specific bank.

AddClientBankAccount

Permissions: NotbankDeposit, NotbankWithdraw
Call Type: Synchronous

Add an existing bank account.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().createBankAccount({
  "country": "CL",
  "bank": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
  "number": "11111111",
  "kind": "vista"
});


// request payload types
{
  country: string
  bank: string
  number: string
  kind: string
  pix_type?: string
  agency?: string
  dv?: string
  province?: string
}
POST /api/nb/bank-accounts HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "country": "CL",
  "bank": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
  "number": "11111111",
  "kind": "vista"
}
Key Value
country string. Country code in ISO 3166-1 alpha-2 format. Supported countries: AR, BR, CL, PE, CO. required.
bank string. Bank identifier. required.
number string. Bank account number. required.
kind string. Bank account type. required.
1. If country is AR, the options are:
- corriente
- vista
- ahorro
- electronic_checkbook
- ar_cbu
- ar_cvu
- ar_alias
2. If country is BR, the options are:
- br_corriente_fisica
- br_simple_fisica
- br_corriente_juridica
- br_poupanca_fisica
- br_poupanca_juridica
- br_caixa_facil
- br_pix
3. If country is CL, the options are:
- corriente
- vista
- ahorro
- electronic_checkbook
4. If country is PE, the options are:
- corriente
- ahorro
5. If country is CO, the options are:
- corriente
- ahorro
pix_type string. PIX account type. Only required if country is BR and kind is br_pix. Options are:
- CPF
- CNPJ
- Email
- Phone
- Otro
conditionally required.
agency string. Bank account agency. Only required if country is BR. conditionally required.
dv string. Bank account verification digit. Only required if country is BR. conditionally required.
province string. Province of the bank account. Only required if country is PE. conditionally required.

Response

{
  "status": "success",
  "data": {
    "id": "43438b99-70a4-4d98-8471-71f5a52b978b",
    "country": "CL",
    "bank": {
      "id": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
      "name": "Banco Estado",
      "country": "CL"
    },
    "number": "11111111",
    "kind": "vista",
    "currency": "CLP",
    "agency": null,
    "dv": null,
    "province": null,
    "pix_type": null
  }
}

Returns the instance of the added bank account.

GetClientBankAccount

Permissions: NotbankDeposit, NotbankWithdraw, NotbankReadOnly
Call Type: Synchronous

Provide bank account details.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getBankAccount({
  "bankAccountId": "43438b99-70a4-4d98-8471-71f5a52b978b"
});


// request payload types
{
  bankAccountId: string
}
GET /api/nb/bank-accounts/43438b99-70a4-4d98-8471-71f5a52b978b HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json

Path params

Key Value
bank-account-id string. Bank account identifier. required.

Response

{
  "status": "success",
  "data": {
    "id": "43438b99-70a4-4d98-8471-71f5a52b978b",
    "country": "CL",
    "bank": {
      "id": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
      "name": "Banco Estado",
      "country": "CL"
    },
    "number": "11111111",
    "kind": "vista",
    "currency": "CLP",
    "agency": null,
    "dv": null,
    "province": null,
    "pix_type": null
  }
}

Returns the requested bank account instance.

GetClientBankAccounts

Permissions: NotbankDeposit, NotbankWithdraw, NotbankReadOnly
Call Type: Synchronous

Provide the list of bank accounts.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getBankAccounts();


// request payload types
{
  page?: string
  page_size?: string
}

No request payload required.

GET /api/nb/bank-accounts HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json

Query params

Key Value
page string. Número de página. Valor por defecto 1. optional.
page_size string. Cantidad de elementos por página. Valor por defecto 10. optional.

Response

{
  "status": "success",
  "total": 100,
  "data": [
    {
      "id": "43438b99-70a4-4d98-8471-71f5a52b978b",
      "country": "CL",
      "bank": {
        "id": "388c4c6f-d0b5-4a42-927c-bbcc64e7ce2e",
        "name": "Banco Estado",
        "country": "CL"
      },
      "number": "11111111",
      "kind": "vista",
      "currency": "CLP",
      "agency": null,
      "dv": null,
      "province": null,
      "pix_type": null
    }
  ]
}

Returns an array as a response. Each element of the array corresponds to a bank account instance.

DeleteClientBankAccount

Permissions: NotbankDeposit, NotbankWithdraw
Call Type: Synchronous

Delete a bank account.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().deleteBankAccount({
  "bankAccountId": "43438b99-70a4-4d98-8471-71f5a52b978b"
});


// request payload types
{
  bankAccountId: string
}
DELETE /api/nb/bank-accounts/43438b99-70a4-4d98-8471-71f5a52b978b HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json

Path params

Key Value
bank-account-id string. Bank account identifier. required.

Response

{
  "status": "success"
}

Returns the result of the request.

GetNetworksTemplates

Permissions: NotbankDeposit, NotbankWithdraw, NotbankReadOnly
Call Type: Synchronous

Provides a list of cryptocurrency-supported networks and the parameters required to notify withdrawals.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getNetworksTemplates({
  "currency": "USDT"
});


// request payload types
{
  currency: string
  network?: string
}
GET /api/nb/wallet/crypto/withdrawal/templates?currency=USDT HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
currency string. Currency identifier. required.
network string. Currency network identifier. optional.

Response

{
  "status": "success",
  "data": [
    {
      "currency": "USDT",
      "network": "USDT_ETH",
      "network_name": "Ethereum",
      "network_protocol": "ERC-20",
      "template": [
        {
          "name": "currency",
          "type": "string",
          "required": true
        },
        {
          "name": "network",
          "type": "string",
          "required": true
        },
        {
          "name": "amount",
          "type": "number",
          "required": true,
          "decimalPlaces": 8
        },
        {
          "name": "address",
          "type": "string",
          "required": true
        },
        {
          "name": "memo_or_tag",
          "type": "string",
          "required": false
        },
        {
          "name": "comment",
          "type": "string",
          "required": false,
          "maxLength": 32
        },
        {
          "name": "2fa_code",
          "type": "string",
          "required": false,
          "maxLength": 6,
          "minLength": 6
        }
      ]
    },
    {
      "currency": "USDT",
      "network": "USDT_BSC",
      "network_name": "Binance Smart Chain",
      "network_protocol": "BEP-20",
      "template": [
        {
          "name": "currency",
          "type": "string",
          "required": true
        },
        {
          "name": "network",
          "type": "string",
          "required": true
        },
        {
          "name": "amount",
          "type": "number",
          "required": true,
          "decimalPlaces": 8
        },
        {
          "name": "address",
          "type": "string",
          "required": true
        },
        {
          "name": "memo_or_tag",
          "type": "string",
          "required": false
        },
        {
          "name": "comment",
          "type": "string",
          "required": false,
          "maxLength": 32
        },
        {
          "name": "2fa_code",
          "type": "string",
          "required": false,
          "maxLength": 6,
          "minLength": 6
        }
      ]
    }
  ]
}

Returns an array as a response. Each element in the array represents a network supported by the currency and the respective parameters required to notify a withdrawal.

GetDepositAddresses

Permissions: NotbankDeposit, NotbankReadOnly
Call Type: Synchronous

Provides a list of deposit addresses for a currency.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getDepositAddresses({
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC"
});


// request payload types
{
  account_id: number
  currency: string
  network: string
}
GET /api/nb/wallet/crypto?account_id=1&currency=USDT&network=USDT_BSC HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
account_id integer. The account identifier. required.
currency string. Currency identifier. required.
network string. Coin network identifier. required.

Response

{
  "status": "success",
  "data": [
    "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
    "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU"
  ]
}

Returns an array as a response. Each element in the array represents a repository address. The element with the highest index represents the most recent address.

CreateDepositAddress

Permissions: NotbankDeposit
Call Type: Synchronous

Create a deposit address.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().createDepositAddress({
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC"
});


// request payload types
{
  account_id: number
  currency: string
  network: string
}
POST /api/nb/wallet/crypto HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC"
}

Body params

Key Value
account_id integer. The account identifier. required.
currency string. Currency identifier. required.
network string. Currency network identifier. required.

Response

{
  "status": "success",
  "data": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU"
}

Returns an string. The element represents the new deposit address.

GetWhitelistedAddresses

Permissions: NotbankWithdraw
Call Type: Synchronous

Provides the list of addresses in the whitelist.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getWhitelistedAddresses({
  "account_id": 1,
  "search": "USDT"
});


// request payload types
{
  account_id: number
  search?: string
}
GET /api/nb/wallet/crypto/whitelist-addresses?account_id=1&search=USDT HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
account_id integer. The ID of the account for which whitelisted addresses were created. required.
search string. Search by label, currency, or whitelisted address identifier. optional.

Response

{
  "status": "success",
  "data": [
    {
      "id": "4ed30f50-b8ad-491b-823d-70acdfdeb0be",
      "currency": "USDT",
      "label": "test-address-name",
      "network": "USDT_BSC",
      "address": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
      "memo": null,
      "verified": true,
      "provider_id": 1
    }
  ]
}

Returns an array as a response. Each element of the array corresponds to the details of an address in the whitelist.

AddWhitelistedAddress

Permissions: NotbankWithdraw
Call Type: Synchronous

Add an address to the whitelist. Withdrawals can only be made to addresses that are whitelisted. A code will be sent by email to verify the address. Review ConfirmWhitelistedAddress.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().addWhitelistedAddress({
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC",
  "address": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
  "label": "test-address-name",
  "otp": "123456"
});


// request payload types
{
  account_id: number
  currency: string
  network: string
  address: string
  label: string
  memo_or_tag?: string
  otp: string
}
POST /api/nb/wallet/crypto/whitelist-addresses HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC",
  "address": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
  "label": "test-address-name",
  "otp": "123456"
}

Body params

Key Value
account_id integer. The ID of the account for which whitelisted addresses will be created. required.
currency string. Address currency identifier. required.
network string. Address network. required.
address string. Address identifier. required.
label string. Name or description of the address. required.
memo_or_tag string. Address memo or tag. optional.
otp string. Two-step authentication code. required.

Response

{
  "status": "success",
  "data": {
    "id": "4ed30f50-b8ad-491b-823d-70acdfdeb0be"
  }
}

Returns the unique identifier of the address added to the whitelist.

ConfirmWhitelistedAddress

Permissions: NotbankWithdraw
Call Type: Synchronous

Confirm the whitelisted address. Required to be able to make withdrawals to that address.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().confirmWhitelistedAddress({
  "whitelistedAddressId": "4ed30f50-b8ad-491b-823d-70acdfdeb0be",
  "account_id": 1,
  "sms_code": "4278"
});


// request payload types
{
  whitelistedAddressId: string
  account_id: number
  sms_code: string
}
POST /api/nb/wallet/crypto/whitelist-addresses/4ed30f50-b8ad-491b-823d-70acdfdeb0be/verification HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "sms_code": "4278"
}

Path params

Key Value
whitelisted-address-id string. Whitelisted address identifier. required.

Body params

Key Value
account_id integer. The account identifier. required.
sms_code string. Verification code sent by SMS. required.

ResendVerificationCodeWhitelistedAddress

Permissions: NotbankWithdraw
Call Type: Synchronous

Resend the code via SMS to validate the whitelisted address.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().resendVerificationCodeWhitelistedAddress({
  "whitelistedAddressId": "4ed30f50-b8ad-491b-823d-70acdfdeb0be",
  "account_id": 1
});


// request payload types
{
  whitelistedAddressId: string
  account_id: number
}
GET /api/nb/wallet/crypto/whitelist-addresses/4ed30f50-b8ad-491b-823d-70acdfdeb0be/verification?account_id=1 HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Path params

Key Value
whitelisted-address-id string. Whitelisted address identifier. required.

Query params

Key Value
account_id integer. The account identifier. required.

Response

{
  "status": "success",
}

Returns the status of SMS code forwarding.

DeleteWhitelistedAddress

Permissions: NotbankWithdraw
Call Type: Synchronous

Removes an address from the whitelist.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().deleteWhitelistedAddress({
  "whitelistedAddressId": "4ed30f50-b8ad-491b-823d-70acdfdeb0be",
  "account_id": 1,
  "otp": "123456"
});


// request payload types
{
  whitelistedAddressId: string;
  account_id: number;
  otp: string;
}
DELETE /api/nb/wallet/crypto/whitelist-addresses/4ed30f50-b8ad-491b-823d-70acdfdeb0be HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "otp": "123456"
}

Path params

Key Value
whitelisted-address-id string. Whitelisted address identifier. required.

Body params

Key Value
account_id integer. The account identifier. required.
otp string. Two-step authentication code. required.

Response

{
  "status": "success",
}

Returns the result of removing the whitelisted address.

UpdateOneStepWithdraw

Permissions: NotbankWithdraw
Call Type: Synchronous

Update your settings to enable or disable two-step authentication for cryptocurrency withdrawals. If disabled, two-step authentication will always be required. If enabled, two-step authentication will not be required if the amount does not exceed $1.000 USD. This setting is disabled by default.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().updateOneStepWithdraw({
  "account_id": 1,
  "action": "enable",
  "otp": 123456
});


// request payload types
{
  account_id: number
  action: string
  otp: string
}
POST /api/nb/wallet/crypto/whitelist-addresses/one-step/status HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "action": "enable",
  "otp": 123456
}

Body params

Key Value
account_id integer. The account identifier. required.
action string. Action to configure. Allowed values ​​are: enable and disable. required.
otp string. Two-step authentication code. required.

Response

{
  "status": "success",
}

Returns the result of the configuration modification.

CreateCryptoWithdraw

Permissions: NotbankWithdraw
Call Type: Synchronous

Create a cryptocurrency withdrawal request. Withdrawals are only allowed to whitelisted addresses.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().createCryptoWithdraw({
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC",
  "address": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
  "amount": 12.3,
  "otp": "123456"
});


// request payload types
{
  account_id: number
  currency: string
  network: string
  address: string
  amount: string
  memo_or_tag?: string
  otp?: string
}
POST /api/nb/wallet/crypto/withdrawal HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "currency": "USDT",
  "network": "USDT_BSC",
  "address": "2N3r9roRrHy7p6C5pGE8NQP9ZNT81H7ZKyU",
  "amount": 12.3,
  "otp": "123456"
}

Body params

Key Value
account_id integer. The ID of the account. required.
currency string. Currency identifier. required.
network string. Network identifier. required.
address string. Destination address. required.
amount string or number. Withdrawal amount. required.
memo_or_tag string. Memo or tag of the destination address. conditionally required.
otp string. Two-step authentication code. conditionally required.

Response

{
  "status": "success",
  "data": "0ea47288-76dd-4dd5-a544-e8af547ed3c7"
}

Returns the unique identifier of the withdrawal request.

CreateFiatDeposit

Permissions: NotbankDeposit
Call Type: Synchronous

Request a deposit of fiat currency.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().createFiatDeposit({
  "account_id": 1,
  "payment_method": 1,
  "currency": "CLP",
  "amount": 1000,
  "bank_account_id": "43438b99-70a4-4d98-8471-71f5a52b978b"
});


// request payload types
{
  account_id: number
  payment_method: number
  currency: string
  amount: string
  bank_account_id?: string
  voucher?: string
}
POST /api/nb/wallet/fiat/deposit HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "payment_method": 1,
  "currency": "CLP",
  "amount": 1000,
  "bank_account_id": "43438b99-70a4-4d98-8471-71f5a52b978b"
}

Body params

Key Value
account_id integer. Account identifier. required.
payment_method integer. Deposit payment method. Possible values are: 1 (Bank transfer) and 2 (Webpay, only for CLP). required.
currency string. Currency of the deposit. Possible values are: ARS, BRL, CLP, COP and PEN. required.
amount string or number. Deposit amount. required.
bank_account_id string. Bank account identifier. Only required if payment_method is 1. conditionally required.
voucher file. Proof of deposit. Only required if payment_method is 1 and currency is PEN. conditionally required.

Response


// payment_method: 1
{
  "status": "success",
  "message": "Request received"
}

// payment_method: 2
// payment_method: 1 and currency: COP
{
  "status": "success",
  "data": {
    "url": "https://..."  // URL to pay
  }
}

If the payment method used is 2 (Webpay) or 1 (Bank transfer) and currency COP, it returns the URL to make the payment. If the payment method is 1 (Bank transfer), it only returns the result of the request.

GetOwnersFiatWithdraw

Permissions: NotbankWithdraw
Call Type: Synchronous

Requests the owners of a CBU account.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getOwnersFiatWithdraw({
  "cbu": "6845784411100069899422"
});


// request payload types
{
  cbu: string
}
GET /api/nb/wallet/fiat/withdrawal/owners?cbu=6845784411100069899422 HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
cbu string. CBU account number to obtain the account owners required.

Response

{
  "status": "success",
  "data": [
    {
      "person_type": "F",
      "cuit": "CUIT number",
      "name": "Person name"
    }
  ]
}

Returns an array as a response. Each element of the array corresponds to the details of a owner.

Key Value
person_type string. Person type. Possible values are F and J.
cuit string. CUIT number of the person.
name string. Name of the person.

CreateFiatWithdraw

Permissions: NotbankWithdraw
Call Type: Synchronous

Request a withdraw of fiat currency. If the payment method is 1 (Bank Transfer) and the currency is ARS, before notifying the withdrawal, the recipient's data must be obtained with GetOwnersFiatWithdraw and after notifying, the withdrawal must be confirmed with ConfirmFiatWithdraw.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().createFiatWithdraw({
  "account_id": 1,
  "payment_method": 1,
  "currency": "CLP",
  "amount": 1000,
  "bank_account_id": "43438b99-70a4-4d98-8471-71f5a52b978b"
});


// request payload types
{
  account_id: number
  payment_method: number
  currency: string
  amount: string
  bank_account_id?: string
  cbu?: string
  person_type?: string
  cuit?: string
  name?: string
}
POST /api/nb/wallet/fiat/withdrawal HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "account_id": 1,
  "payment_method": 1,
  "currency": "CLP",
  "amount": 1000,
  "bank_account_id": "43438b99-70a4-4d98-8471-71f5a52b978b"
}

Body params

Key Value
account_id integer. Account identifier. required.
payment_method integer. Deposit payment method. Possible values are: 1 (Bank transfer). required.
currency string. Currency of the deposit. Possible values are: ARS, BRL, CLP, COP and PEN. required.
amount string or number. Deposit amount. required.
bank_account_id string. Bank account identifier. Only required if payment_method is 1. conditionally required.
cbu string. Destination account CBU. Only required if currency is ARS. conditionally required.
person_type string. Type of person who owns the destination account. Only required if currency is ARS. conditionally required.
cuit string. CUIT of the person who owns the destination account. Only required if the currency is ARS. conditionally required.
name string. Name of the person who owns the destination account. Only required if the currency is ARS. conditionally required.

Response


// payment_method == 1 and currency != ARS
{
  "status": "success",
  "message": "Request received"
}

// payment_method == 1 and currency == ARS
{
  "status": "success",
  "data": {
    "withdrawal_id": "32347216-4a4c-49ee-b0a5-1ad993fe522b"  // withdrawal id to confirm
  }
}

If the payment method used is 1 (Bank transfer) and currency ARS, it returns the ID of withdrawal request.

ConfirmFiatWithdraw

Permissions: NotbankWithdraw
Call Type: Synchronous

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().confirmFiatWithdraw({
  "withdrawal_id": "32347216-4a4c-49ee-b0a5-1ad993fe522b",
  "attempt_code": 123456
});


// request payload types
{
  withdrawal_id: string
  attempt_code: string
}
POST /api/nb/wallet/fiat/withdrawal/32347216-4a4c-49ee-b0a5-1ad993fe522b HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "attempt_code": 123456,
}

Path params

Key Value
withdrawal_id string. Withdrawal request identifier required.

Body params

Key Value
attempt_code string. Verification code required.

Response

{
  "status": "success",
  "message": "Request received"
}

Returns the result of the request.

TransferFunds

Permissions: NotbankWithdraw
Call Type: Synchronous

Request a transfer of funds or balances from one account to another.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().transferFunds({
  "sender_account_id": 1,
  "receiver_account_id": 2,
  "currency_name": "BTC",
  "amount": 1,
  "notes": "transfer detail",
  "otp": "123456"
});


// request payload types
{
  sender_account_id: number
  receiver_account_id: number
  currency_name: string
  amount: string
  notes?: string
  otp?: string
}
POST /api/nb/wallet/transfer-funds HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "sender_account_id": 1,
  "receiver_account_id": 2,
  "currency_name": "BTC",
  "amount": 1,
  "notes": "transfer detail",
  "otp": "123456"
}

Body params

Key Value
sender_account_id integer. The source account identifier. required.
receiver_account_id integer. The destination account identifier. required.
currency_name string. Name of the currency. required.
amount string or number. Amount to transfer. required.
notes string. Description of the transfer. optional.
otp string. Two-step authentication code. conditionally required.

Response

{
  "status": "success",
  "data": "0ea47288-76dd-4dd5-a544-e8af547ed3c7"
}

Returns the unique identifier of the transfer request.

GetTransactions

Permissions: NotbankReadOnly, NotbankDeposit, NotbankWithdraw, NotbankTrading
Call Type: Synchronous

Request historical transactions.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getWalletService().getTransactions();

// request payload types
{
  from_date?: string
  to_date?: string
  sort?: string
  currency?: string
  page?: number
  page_size?: number
}
GET /api/nb/wallet/transactions HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
from_date string. The oldest date from which the transaction history will begin. The supported format is DD/MM/YYYY. optional.
to_date string. The most recent date on which the transaction history will end. The supported format is DD/MM/YYYY. optional.
sort string. History sorting. Options are ASC and DESC. The default is DESC. optional.
currency string. Transaction history currency. optional.
page integer. Transaction history page. Default value 1. optional.
page_size integer. Number of transactions per page. Default value 10. optional.

Response

{
  "status": "success",
  "total": 100,
  "data": [
    {
      "id": "b5d8072b-2582-4289-b592-7b74263862e3",
      "legacy_id": "X23233",
      "currency": "BTC",
      "direction": 1,
      "amount": "12.32",
      "fee": "1",
      "balance": "134.34",
      "address": "test-address",
      "hash": "test-hash",
      "type": 1,
      "sub_type": 1,
      "status": 3,
      "created_at": "2025-07-09T14:58:52.012517",
      "updated_at": "2025-07-09T14:58:52.012517"
    }
  ]
}

Returns an array as a response. Each element of the array corresponds to the details of a transaction.

Key Value
id string. Transaction identifier.
legacy_id string. Legacy transaction identifier.
currency string. Transaction currency.
direction integer. Transaction direction. Possible values are: 1 (Income), 2 (Outgoing), and 0 (Other).
amount string. Transaction amount.
fee string. Transaction fee.
balance string. Balance recorded after the transaction.
address string. Wallet address associated with the transaction.
hash string. Hash associated with the transaction.
type integer. Transaction type. Possible values are: 0 (Other), 1 (Deposit), 2 (Withdrawal), 3 (Transfer), 4 (Trade), 5 (Payment), and 6 (Correction).
sub_type integer. Transaction type. Possible values are: 0 (Other), 1 (Payout), 2 (Payin), 3 (Deposit), 4 (Withdrawal), 5 (Wallet to Exchange), 6 (Exchange to Wallet), 7 (Trade), 8 (Payment), 9 (Simple), and 10 (Correction).
status integer. Transaction status. Possible values are: 0 (Other), 1 (Created), 2 (Pending), 3 (Success), 4 (Failed), and 5 (Reversed).
created_at string. Transaction creation date. ISO format.
updated_at string. Date of the last transaction update. ISO format.

Quote

GetQuotes

Permissions: NotbankTrading, NotbankReadOnly
Call Type: Synchronous

Request simple purchase, sale or conversion operations, reverse or direct.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getQuoteService().getQuotes({
  "mode": "direct",
});


// request payload types
{
  mode: string // "direct" or "inverse"
}
GET /api/nb/quotes?mode=direct HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
mode string. Simple operation mode. Options are: direct or inverse. optional.

Response

{
  "status": "success",
  "data": [
    {
      "id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3",
      "is_inverse": false,
      "type": 1,
      "state": 1,
      "currency_in": "CLP",
      "currency_out": "BTC",
      "amount_in": "100000000",
      "amount_out": "1",
      "amount_usdt_out": "100000",
      "fee_amount": "100",
      "fee_detail": "1%",
    }
  ]
}

Returns an array as a response. Each element of the array corresponds to the details of an Simple operation.

Key Value
id string. Operation identifier.
is_inverse boolean. Indicates whether it is a reverse operation.
type integer. Transaction type. Possible values are: 1 (Buy), 2 (Sell), and 3 (Conversion).
state integer. Transaction status. Possible values are: 0 (Pending), 1 (Executed), 3 (Insufficient Balance), 4 (Not Executed), 5 (Other), and 6 (Expired).
currency_in string. Input currency of the operation.
currency_out string. Output currency of the operation.
amount_in string. Input amount of the operation.
amount_out string. Output amount of the operation.
amount_usdt_out string. Output amount in USDT of the operation.
fee_amount string. Operation fee.
fee_detail string. Detail of the transaction fee.

CreateDirectQuote

Permissions: NotbankTrading
Call Type: Synchronous

Requests the creation of a direct Simple operation.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getQuoteService().createDirectQuote({
  "from_currency": "CLP",
  "from_amount": 100000,
  "to_currency": "BTC",
  "operation": 1,
  "account_id": 1
});


// request payload types
{
  account_id: number
  from_currency: string
  from_amount: number
  to_currency: string
  operation: number
}

Operation {
  BUY: 1,
  SELL: 2,
  CONVERSION: 3,
}
POST /api/nb/quotes/direct HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "from_currency": "CLP",
  "from_amount": 100000,
  "to_currency": "BTC",
  "operation": 1,
  "account_id": 1
}

Body params

Key Value
account_id integer. The ID of the account. required.
from_currency string. Input currency. required.
from_amount string or number. Amount of the transaction.. required.
to_currency string. Output currency. required.
operation string. Transaction type. Options are: 1 (Buy), 2 (Sell), 3 (Conversion). required.

Response

{
  "status": "success",
  "data": {
    "id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3"
  }
}

Returns the unique identifier of the direct Simple operation, for later consultation and execution.

CreateInverseQuote

Permissions: NotbankTrading
Call Type: Synchronous

Requests the creation of a reverse Simple operation.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getQuoteService().createInverseQuote({
  "from_currency": "CLP",
  "to_currency": "BTC",
  "to_amount": 1,
  "account_id": 1
});


// request payload types
{
  account_id: number
  from_currency: string
  to_currency: string
  to_amount: number
}
POST /api/nb/quotes/inverse HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

{
  "from_currency": "CLP",
  "to_currency": "BTC",
  "to_amount": 1,
  "account_id": 1
}

Body params

Key Value
account_id integer. The ID of the account. required.
from_currency string. Input currency. required.
to_currency string. Output currency. required.
to_amount string or number. Amount of the transaction. required.

Response

{
  "status": "success",
  "data": {
    "id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3"
  }
}

Returns the unique identifier of the Simple Inverse operation, for later consultation and execution.

GetQuote

Permissions: NotbankTrading, NotbankReadOnly
Call Type: Synchronous

Request the details of a Simple operation.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getQuoteService().getQuote({
  "quote_id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3"
});


// request payload types
{
  quote_id: string
}
GET /api/nb/quotes/c1c56ca3-75c3-4bb6-97e3-702448382cd3  HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Query params

Key Value
quote_id integer. The Simple operation identifier. required.

Response

{
  "status": "success",
  "data": {
    "id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3",
    "is_inverse": false,
    "type": 1,
    "state": 1,
    "currency_in": "CLP",
    "currency_out": "BTC",
    "amount_in": "100000000",
    "amount_out": "1",
    "amount_usdt_out": "100000",
    "fee_amount": "100",
    "fee_detail": "1%",
  }
}

Returns an object with the details of the Simple operation.

Key Value
id string. Operation identifier.
is_inverse boolean. Indicates whether it is a reverse operation.
type integer. Transaction type. Possible values are: 1 (Buy), 2 (Sell), and 3 (Conversion).
state integer. Transaction status. Possible values are: 0 (Pending), 1 (Executed), 3 (Insufficient Balance), 4 (Not Executed), 5 (Other), and 6 (Expired).
currency_in string. Input currency of the operation.
currency_out string. Output currency of the operation.
amount_in string. Input amount of the operation.
amount_out string. Output amount of the operation.
amount_usdt_out string. Output amount in USDT of the operation.
fee_amount string. Operation fee.
fee_detail string. Detail of the transaction fee.

ExecuteQuote

Permissions: NotbankTrading
Call Type: Synchronous

Requests the execution of a Simple operation. Execution is asynchronous, so the GetQuote endpoint must be used to determine the final status of the operation.

Request

import Notbank from 'notbank'
// websocket connection code ...

await client.getQuoteService().executeQuote({
  "quote_id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3"
});


// request payload types
{
  quote_id: string
}
POST /api/nb/quotes/c1c56ca3-75c3-4bb6-97e3-702448382cd3  HTTP/1.1
Host: hostname goes here...
aptoken: 2c262ce0-aebf-4dcb-8a70-cd60506a9ac8
Content-Type: application/json
Content-Length: 21

Response

{
  "status": "success",
  "data": {
    "id": "c1c56ca3-75c3-4bb6-97e3-702448382cd3",
    "is_inverse": false,
    "type": 1,
    "state": 1,
    "currency_in": "CLP",
    "currency_out": "BTC",
    "amount_in": "100000000",
    "amount_out": "1",
    "amount_usdt_out": "100000",
    "fee_amount": "100",
    "fee_detail": "1%",
  }
}

Returns an object with the details of the Simple operation.

Key Value
id string. Operation identifier.
is_inverse boolean. Indicates whether it is a reverse operation.
type integer. Transaction type. Possible values are: 1 (Buy), 2 (Sell), and 3 (Conversion).
state integer. Transaction status. Possible values are: 0 (Pending), 1 (Executed), 3 (Insufficient Balance), 4 (Not Executed), 5 (Other), and 6 (Expired).
currency_in string. Input currency of the operation.
currency_out string. Output currency of the operation.
amount_in string. Input amount of the operation.
amount_out string. Output amount of the operation.
amount_usdt_out string. Output amount in USDT of the operation.
fee_amount string. Operation fee.
fee_detail string. Detail of the transaction fee.