Skip to content

Commit

Permalink
feat: add maker/taker order id and client order id to trade messages
Browse files Browse the repository at this point in the history
  • Loading branch information
thaaddeus committed Feb 21, 2022
1 parent 59706f8 commit ea8e976
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Pushed real-time for each trade as it happens on a DEX (decoded from the `eventQ

- `eventTimestamp` is a timestamp of trade provided by DEX (with seconds precision) in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)

- `takerAccount` and `makerAccount` fields provide info regarding maker and taker open account addresses that constitute the trade
- `taker*` and `maker*` fields provide info regarding maker and taker orders that constitute the trade

```ts
{
Expand All @@ -406,6 +406,10 @@ Pushed real-time for each trade as it happens on a DEX (decoded from the `eventQ
"eventTimestamp": string
"takerAccount": string
"makerAccount": string
"takerOrderId": string
"makerOrderId": string
"takerClientId": string
"makerClientId": string
}
```

Expand All @@ -423,8 +427,12 @@ Pushed real-time for each trade as it happens on a DEX (decoded from the `eventQ
"price": "160.64",
"size": "0.50",
"eventTimestamp": "2021-12-14T12:35:29.000Z",
"takerAccount": "AAddgLu9reZCUWW1bNQFaXrCMAtwQpMRvmeusgk4pCM6",
"makerAccount": "EpAdzaqV13Es3x4dukfjFoCrKVXnZ7y9Y76whgMHo5qx"
"takerAccount": "27YAdJWpEdMB4Pxk8EmkQ5PgDEiwwdxjQibcJy6jBNGS",
"makerAccount": "GR8wiP7NfHR8nihLjiADRoRM7V7aUvtTfUnkBy8Zkd5T",
"takerOrderId": "169580918269611952651370",
"makerOrderId": "173897456382859898438567",
"takerClientId": "864345997654345666",
"makerClientId": "7067091222090985486"
}
```

Expand Down
6 changes: 5 additions & 1 deletion src/data_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ export class DataMapper {
size: message.size,
eventTimestamp: message.eventTimestamp,
takerAccount: message.account,
makerAccount: makerFillAccount!
makerAccount: makerFillAccount!,
takerOrderId: message.orderId,
makerOrderId: makerFillOrderId!,
takerClientId: message.clientId,
makerClientId: matchingMakerFill?.clientId!
}

yield this._putInEnvelope(tradeMessage, true)
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export interface Trade extends DataMessage, WithEventTimestamp {
readonly id: string
readonly takerAccount: string
readonly makerAccount: string
readonly takerOrderId: string
readonly makerOrderId: string
readonly takerClientId: string
readonly makerClientId: string
}

export interface Fill extends DataMessage, OrderItem {
Expand Down

0 comments on commit ea8e976

Please sign in to comment.