StaticUpdate
Update an existing record or create a new record in any static table.
- Section: Transactions
- Related Message: StaticUpdateReply
The static tables are defined by base table class = Static.
Because nq is an abstraction on top of the raw API, this description is broken up into two sections. Initially testing the message using nq may help to construct a raw interface.
nq API
Running .tx StaticUpdate Firm (for example) in nq will display the field names and types of the Firm table.
If updating a record, nq will automatically fill out missing fields with the existing values on the record.
Raw API
If updating an existing record, the UpdateNumber will need to match the update number of the existing record. This eliminates unintentionally overwriting a recent change to the same record from another source.
All fields must be specified in the raw API.
Metadata
- Message Type: TransactionMessage
- Message Number: 1010
Inherited fields
| Name | Type | Size (bytes) | Description |
|---|---|---|---|
| MessageType | Integer (unsigned) | 2 | The unique identifier of this message. |
| ClientId | Integer (unsigned) | 4 | The unique identifier of a session with the server, returned in a successful LoginReply message. |
| RequestId | Integer (unsigned) | 4 | Within each session each message must be uniquely identified by this field. It must be monotonically increasing for the duration of the session. |
Fields
| Name | Type | Size (bytes) | Description |
|---|---|---|---|
| Table | One of Table | 1 | The Table number of the static table to be updated. |
| Id | Integer (signed) | 8 | If the Id of an existing record in the table is specified, the record will be updated. To create a new record, leave as zero or specify as current max Id + 1. |
Permissions
Update InstrumentMarket Currency and Instrument
{ Id: 11, Instrument: 10 }
Permission Checks
| PermissionAction | Table | Scope | Index |
|---|---|---|---|
| Amend | InstrumentMarket | Instance | 2 |
| View | Market | Instance | 0 |
Test file: StaticUpdate_InstrumentMarket
Create new firm
{
ShortName: "test-firm2",
Name: "test-firm2",
FirmType: FirmType.Regular,
Enterprise: 1,
}
Permission Checks
| PermissionAction | Table | Scope | Index |
|---|---|---|---|
| Create | Firm | Enterprise | |
| Create | FirmName | All |
Test file: StaticUpdate_NewFirm
Enable and Set User Limits
{
Id: User.find(eq("UserId", "test-user")).Id,
BuyValLimit: 10,
CheckLimits: true,
}
Permission Checks
| PermissionAction | Table | Scope | Index |
|---|---|---|---|
| Amend | User | Instance | 2 |
| Amend | UserName | All |
Test file: StaticUpdate_UserLimits