-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1542 from finos/linked-table-view
Linked table view
- Loading branch information
Showing
21 changed files
with
824 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
vuu-ui/packages/vuu-data-test/src/simul/reference-data/accounts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export const accounts = [ | ||
"Account 01", | ||
"Account 02", | ||
"Account 03", | ||
"Account 04", | ||
"Account 105", | ||
"Account 06", | ||
"Account 07", | ||
"Account 08", | ||
"Account 09", | ||
"Account 10", | ||
"Account 11", | ||
"Account 12", | ||
"Account 13", | ||
"Account 14", | ||
"Account 15", | ||
"Account 16", | ||
"Account 17", | ||
"Account 18", | ||
"Account 19", | ||
"Account 20", | ||
]; |
1 change: 1 addition & 0 deletions
1
vuu-ui/packages/vuu-data-test/src/simul/reference-data/algos.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const algos = ["DARKLIQ", "IS", "SURESHOT", "VWAP", "LITLIQ", "TWAP"]; |
1 change: 1 addition & 0 deletions
1
vuu-ui/packages/vuu-data-test/src/simul/reference-data/orderStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const orderStatus = ["NEW", "CANCELLED", "FILLED"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
vuu-ui/packages/vuu-data-test/src/simul/reference-data/parent-child-orders.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
import { VuuRowDataItemType } from "@finos/vuu-protocol-types"; | ||
import { random } from "../../data-utils"; | ||
import { buildDataColumnMap, Table } from "../../Table"; | ||
import { schemas } from "../simul-schemas"; | ||
import { accounts } from "./accounts"; | ||
import { instrumentsData } from "./instruments"; | ||
import { orderStatus as statusValues } from "./orderStatus"; | ||
import { sides } from "./sides"; | ||
import { algos } from "./algos"; | ||
|
||
const childOrderData: VuuRowDataItemType[][] = []; | ||
const parentOrderData: VuuRowDataItemType[][] = []; | ||
|
||
const instrumentMap = buildDataColumnMap(schemas, "instruments"); | ||
|
||
const PARENT_ORDER_COUNT = 100_000; | ||
const CHILD_ORDER_COUNT = 500_000; | ||
|
||
const avgChildOrderPerOrder = Math.round( | ||
CHILD_ORDER_COUNT / PARENT_ORDER_COUNT, | ||
); | ||
const childMaxMultiple = 10; | ||
|
||
const start = performance.now(); | ||
|
||
let childOrderId = 0; | ||
|
||
for (let i = 0; i < PARENT_ORDER_COUNT; i++) { | ||
const now = +new Date(); | ||
const instrument = instrumentsData[random(0, instrumentsData.length - 1)]; | ||
|
||
const orderQuantity = 1000 * random(1, 100); | ||
const orderStatus = statusValues[random(0, statusValues.length - 1)]; | ||
const filledQty = | ||
orderStatus === "FILLED" | ||
? orderQuantity | ||
: orderStatus === "NEW" | ||
? 0 | ||
: orderQuantity - random(100, orderQuantity); | ||
const openQty = orderQuantity - filledQty; | ||
|
||
const account = accounts[random(0, accounts.length - 1)]; | ||
const algo = algos[random(0, algos.length - 1)]; | ||
const averagePrice = 0; | ||
const ccy = "GBP"; | ||
const exchange = instrument[instrumentMap.exchange]; | ||
const parentOrderIdAsInt = i; | ||
const parentOrderId = `${parentOrderIdAsInt}`; | ||
const lastUpdate = now; | ||
const price = 100; | ||
const quantity = orderQuantity; | ||
const ric = instrument[instrumentMap.ric]; | ||
const side = sides[random(0, sides.length - 1)]; | ||
const status = orderStatus; | ||
const volLimit = 100; | ||
|
||
const childOrderCount = random( | ||
0, | ||
avgChildOrderPerOrder * random(1, childMaxMultiple), | ||
); | ||
|
||
let remainingQty = orderQuantity; | ||
for (let j = 0; j < childOrderCount; j++) { | ||
// console.log(`create child`); | ||
|
||
const childOrderQuantity = Math.round(remainingQty / (childOrderCount - j)); | ||
remainingQty -= childOrderQuantity; | ||
const childOrderStatus = statusValues[random(0, statusValues.length - 1)]; | ||
const childFilledQty = | ||
orderStatus === "FILLED" | ||
? childOrderQuantity | ||
: childOrderStatus === "NEW" | ||
? 0 | ||
: childOrderQuantity - random(100, childOrderQuantity); | ||
const childOpenQty = childOrderQuantity - childFilledQty; | ||
|
||
const averagePrice = 0; | ||
const childIdAsInt = childOrderId++; | ||
const childId = `${childIdAsInt}`; | ||
const lastUpdate = 0; | ||
const price = 100; | ||
const strategy = 0; | ||
|
||
const row: VuuRowDataItemType[] = [ | ||
account, | ||
averagePrice, | ||
ccy, | ||
exchange, | ||
childFilledQty, | ||
childId, | ||
childIdAsInt, | ||
lastUpdate, | ||
childOpenQty, | ||
parentOrderId, | ||
price, | ||
childOrderQuantity, | ||
ric, | ||
side, | ||
childOrderStatus, | ||
strategy, | ||
volLimit, | ||
]; | ||
|
||
childOrderData.push(row); | ||
} | ||
|
||
const row: VuuRowDataItemType[] = [ | ||
account, | ||
algo, | ||
averagePrice, | ||
ccy, | ||
childOrderCount, | ||
exchange, | ||
filledQty, | ||
parentOrderId, | ||
parentOrderIdAsInt, | ||
lastUpdate, | ||
openQty, | ||
price, | ||
quantity, | ||
ric, | ||
side, | ||
status, | ||
volLimit, | ||
]; | ||
|
||
parentOrderData.push(row); | ||
} | ||
const end = performance.now(); | ||
|
||
console.log( | ||
`took ${end - start} to create ${parentOrderData.length} orders and ${childOrderData.length} child orders`, | ||
); | ||
|
||
export const parentOrdersTable = new Table( | ||
schemas.parentOrders, | ||
parentOrderData, | ||
buildDataColumnMap(schemas, "parentOrders"), | ||
); | ||
|
||
export const childOrdersTable = new Table( | ||
schemas.childOrders, | ||
childOrderData, | ||
buildDataColumnMap(schemas, "childOrders"), | ||
); | ||
|
||
export { childOrderData, parentOrderData }; |
1 change: 1 addition & 0 deletions
1
vuu-ui/packages/vuu-data-test/src/simul/reference-data/sides.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const sides = ["BUY", "SELL"]; |
Oops, something went wrong.