diff --git a/apps/batch-sim/index.js b/apps/batch-sim/index.js index a4e34282e485218cb614565512f8d4b87496be8e..e6fabc576d8ec3b0f3d6f489546c94f1698a7f54 100644 --- a/apps/batch-sim/index.js +++ b/apps/batch-sim/index.js @@ -42,26 +42,34 @@ const simulateCycle = async (arg1, cmd) => { await signInAs(apiClient, otherArgs.sidenorUser, password) - let batchId = await createAssetAndSendToCone(apiClient, "simulated asset 1") - //batchId = await createAssetAndSendToCone(apiClient, "simulated asset 2") - //batchId = await createAssetAndSendToCone(apiClient, "simulated asset 3") + let stockId + for (let simId of [1, 2, 3]) { + const batchId = await createAssetAndSendToCone( + apiClient, + `simulated asset ${simId}` + ) + let mergedStock = await sendToStock(apiClient, { + assetId: batchId, + // The first time the user should select the stock as it is not provided + stockId + }) + stockId = mergedStock.id + } - const mergedStock = await sendToStock(apiClient, { assetId: batchId }) - const selectedStockId = await discardStock(apiClient, { - assetId: mergedStock.id - }) + const selectedStockId = await discardStock(apiClient, { assetId: stockId }) const selectedStock = await apiClient.getAsset(selectedStockId) await signInAs(apiClient, otherArgs.cement1User, password) await bidAsset(apiClient, { assetId: selectedStockId, + quantity: faker.datatype.number({ min: 200, max: selectedStock.quantity }), price: faker.datatype.number({ min: 50, max: 150 }) }) await signInAs(apiClient, otherArgs.cement2User, password) await bidAsset(apiClient, { assetId: selectedStockId, - quantity: selectedStock.quantity - 500, + quantity: faker.datatype.number({ min: 100, max: selectedStock.quantity }), price: faker.datatype.number({ min: 25, max: 200 }) })