Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/finos/vuu into sync-main-pull
Browse files Browse the repository at this point in the history
  • Loading branch information
cfisher-scottlogic committed Oct 30, 2023
2 parents 679155b + f2dbf70 commit e982f34
Show file tree
Hide file tree
Showing 260 changed files with 3,830 additions and 2,363 deletions.
12 changes: 6 additions & 6 deletions vuu-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 17 additions & 29 deletions vuu-ui/packages/vuu-data-react/src/hooks/useTypeaheadSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,20 @@ export const getTypeaheadParams = (
// const containSpace = (text: string) => text.indexOf(" ") !== -1;
// const replaceSpace = (text: string) => text.replace(/\s/g, SPECIAL_SPACE);

export const useTypeaheadSuggestions = () => {
const getTypeaheadSuggestions: SuggestionFetcher = useCallback(
async (params: TypeaheadParams) => {
const rpcMessage =
params.length === 2
? ({
method: "getUniqueFieldValues",
params,
...TYPEAHEAD_MESSAGE_CONSTANTS,
} as ClientToServerGetUniqueValues)
: ({
method: "getUniqueFieldValuesStartingWith",
params,
...TYPEAHEAD_MESSAGE_CONSTANTS,
} as ClientToServerGetUniqueValuesStartingWith);

const suggestions = await makeRpcCall<string[]>(rpcMessage);

// TODO replacing space with underscores like this is not being correctly handled elsewhere
return suggestions;
// return suggestions.some(containSpace)
// ? suggestions.map(replaceSpace)
// : suggestions;
},
[]
);

return getTypeaheadSuggestions;
};
export const useTypeaheadSuggestions = () =>
useCallback<SuggestionFetcher>(async (params: TypeaheadParams) => {
const rpcMessage =
params.length === 2
? ({
method: "getUniqueFieldValues",
params,
...TYPEAHEAD_MESSAGE_CONSTANTS,
} as ClientToServerGetUniqueValues)
: ({
method: "getUniqueFieldValuesStartingWith",
params,
...TYPEAHEAD_MESSAGE_CONSTANTS,
} as ClientToServerGetUniqueValuesStartingWith);

return makeRpcCall<string[]>(rpcMessage);
}, []);
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export type VuuServerMenuOptions = {
columnMap: ColumnMap;
columnName: string;
row: DataSourceRow;
selectedRows: DataSourceRow[];
selectedRowsCount: number;
viewport: string;
};

Expand Down Expand Up @@ -373,6 +373,7 @@ export const useVuuMenuActions = ({
`useViewServer handleMenuAction, can't handle action type ${menuId}`
);
}

return false;
},
[clientSideMenuActionHandler, dataSource, onRpcResponse]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArrayDataSource } from "@finos/vuu-data";
import { VuuRange } from "@finos/vuu-protocol-types";
import { random } from "./reference-data";
import { random } from "./simul/reference-data";
import { RowUpdates, UpdateGenerator, UpdateHandler } from "./rowUpdates";

const getNewValue = (value: number) => {
Expand Down
95 changes: 95 additions & 0 deletions vuu-ui/packages/vuu-data-test/src/basket/basket-schemas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { TableSchema } from "@finos/vuu-data";

export type BasketsTableName =
| "algoType"
| "basket"
| "basketConstituent"
| "basketTrading"
| "basketTradingConstituent"
| "priceStrategyType";

export const schemas: Readonly<
Record<BasketsTableName, Readonly<TableSchema>>
> = {
algoType: {
columns: [
{ name: "algoType", serverDataType: "string" },
{ name: "id", serverDataType: "int" },
],
key: "id",
table: { module: "BASKET", table: "algoType" },
},
basket: {
columns: [
{ name: "id", serverDataType: "string" },
{ name: "name", serverDataType: "string" },
{ name: "notionalValue", serverDataType: "double" },
{ name: "notionalValueUsd", serverDataType: "double" },
],
key: "id",
table: { module: "BASKET", table: "basket" },
},
basketConstituent: {
columns: [
{ name: "basketId", serverDataType: "string" },
{ name: "change", serverDataType: "string" },
{ name: "lastTrade", serverDataType: "string" },
{ name: "ric", serverDataType: "string" },
{ name: "ricBasketId", serverDataType: "string" },
{ name: "side", serverDataType: "string" },
{ name: "volume", serverDataType: "string" },
{ name: "weighting", serverDataType: "double" },
],
key: "ricBasketId",
table: { module: "BASKET", table: "basketConstituent" },
},
basketTrading: {
columns: [
{ name: "basketId", serverDataType: "string" },
{ name: "basketName", serverDataType: "string" },
{ name: "filledPct", serverDataType: "double" },
{ name: "fxRateToUsd", serverDataType: "double" },
{ name: "instanceId", serverDataType: "string" },
{ name: "status", serverDataType: "string" },
{ name: "totalNotional", serverDataType: "double" },
{ name: "totalNotionalUsd", serverDataType: "double" },
{ name: "units", serverDataType: "int" },
],
key: "instanceId",
table: { module: "BASKET", table: "basketTrading" },
},
basketTradingConstituent: {
columns: [
{ name: "algo", serverDataType: "string" },
{ name: "algoParams", serverDataType: "string" },
{ name: "basketId", serverDataType: "string" },
{ name: "bid", serverDataType: "double" },
{ name: "description", serverDataType: "string" },
{ name: "instanceId", serverDataType: "string" },
{ name: "instanceIdRic", serverDataType: "string" },
{ name: "last", serverDataType: "double" },
{ name: "limitPrice", serverDataType: "double" },
{ name: "notionalLocal", serverDataType: "double" },
{ name: "notionalUsd", serverDataType: "double" },
{ name: "offer", serverDataType: "double" },
{ name: "pctFilled", serverDataType: "double" },
{ name: "priceSpread", serverDataType: "int" },
{ name: "priceStrategyId", serverDataType: "int" },
{ name: "quantity", serverDataType: "long" },
{ name: "ric", serverDataType: "string" },
{ name: "side", serverDataType: "string" },
{ name: "venue", serverDataType: "string" },
{ name: "weighting", serverDataType: "double" },
],
key: "instanceIdRic",
table: { module: "BASKET", table: "basketTradingConstituent" },
},
priceStrategyType: {
columns: [
{ name: "priceStrategy", serverDataType: "string" },
{ name: "id", serverDataType: "int" },
],
key: "",
table: { module: "BASKET", table: "priceStrategyType" },
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { BasketColumnMap, BasketReferenceData } from "../reference-data";
import { getGenerators } from "../../generatorTemplate";

const [RowGenerator, ColumnGenerator] = getGenerators(
"basket",
BasketColumnMap,
BasketReferenceData
);

export { RowGenerator, ColumnGenerator };
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
BasketConstituentColumnMap,
BasketConstituentReferenceData,
} from "../reference-data";
import { getGenerators } from "../../generatorTemplate";

const [RowGenerator, ColumnGenerator] = getGenerators(
"basketConstituent",
BasketConstituentColumnMap,
BasketConstituentReferenceData
);

export { RowGenerator, ColumnGenerator };
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
BasketTradingColumnMap,
BasketTradingReferenceData,
} from "../reference-data";
import { getGenerators } from "../../generatorTemplate";

const [RowGenerator, ColumnGenerator] = getGenerators(
"basketTrading",
BasketTradingColumnMap,
BasketTradingReferenceData
);

export { RowGenerator, ColumnGenerator };
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
BasketTradingConstituentColumnMap,
BasketTradingConstituentReferenceData,
} from "../reference-data";
import { getGenerators } from "../../generatorTemplate";

const [RowGenerator, ColumnGenerator] = getGenerators(
"basketTradingConstituent",
BasketTradingConstituentColumnMap,
BasketTradingConstituentReferenceData
);

export { RowGenerator, ColumnGenerator };
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * as basket from "./basket-generator";
export * as basketConstituent from "./basketConstituent-generator";
export * as basketTrading from "./basketTrading-generator";
export * as basketTradingConstituent from "./basketTradingConstituent-generator";
22 changes: 22 additions & 0 deletions vuu-ui/packages/vuu-data-test/src/basket/reference-data/basket.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { VuuDataRow } from "@finos/vuu-protocol-types";
import { ColumnMap } from "@finos/vuu-utils";
import { getSchema } from "../../schemas";

const schema = getSchema("basket");

export const BasketColumnMap = Object.values(schema.columns).reduce<ColumnMap>(
(map, col, index) => {
map[col.name] = index;
return map;
},
{}
);

const data: VuuDataRow[] = [
[".NASDAQ100", ".NASDAQ100", 0, 0],
[".HSI", ".HSI", 0, 0],
[".FTSE100", ".FTSE100", 0, 0],
[".SP500", ".SP500", 0, 0],
];

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { VuuDataRow } from "@finos/vuu-protocol-types";
import { getSchema } from "../../schemas";
import { ColumnMap } from "@finos/vuu-utils";
import ftse from "./ftse100";

const schema = getSchema("basketConstituent");

export const BasketConstituentColumnMap = Object.values(
schema.columns
).reduce<ColumnMap>((map, col, index) => {
map[col.name] = index;
return map;
}, {});

const data: VuuDataRow[] = [];

// const start = performance.now();
// Create 100_000 Instruments

for (const row of ftse) {
// prettier-ignore
const [ric, name, lastTrade, change, volume] = row;

const basketId = ".FTSE100";
const side = "BUY";
const weighting = 1;

data.push([
basketId,
change,
lastTrade,
ric,
`${ric}-${basketId}`,
side,
volume,
weighting,
]);
}

// const end = performance.now();
// console.log(`generating 100,000 instrumentPrices took ${end - start} ms`);

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { VuuDataRow } from "@finos/vuu-protocol-types";
import { ColumnMap } from "@finos/vuu-utils";
import { getSchema } from "../../schemas";

const schema = getSchema("basketTrading");

export const BasketTradingColumnMap = Object.values(
schema.columns
).reduce<ColumnMap>((map, col, index) => {
map[col.name] = index;
return map;
}, {});

const data: VuuDataRow[] = [];

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { VuuDataRow } from "@finos/vuu-protocol-types";
import { ColumnMap } from "@finos/vuu-utils";
import { getSchema } from "../../schemas";

const schema = getSchema("basketTradingConstituent");

export const BasketTradingConstituentColumnMap = Object.values(
schema.columns
).reduce<ColumnMap>((map, col, index) => {
map[col.name] = index;
return map;
}, {});

const data: VuuDataRow[] = [];

export default data;
Loading

0 comments on commit e982f34

Please sign in to comment.