Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Ermodo committed Apr 20, 2021
1 parent 39dc14f commit 8a7a9c3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/src/agent/brains/random.brain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ export class RandomBrain extends Brain {
this.logger.log(
`Agent ${this.agent.id} with brain ${this.constructor.name} creates an order`,
);

const operation =
Math.random() > 0.5 ? OperationType.BUY : OperationType.SELL;

this.marketService.placeOrder({
aktenId: this.stock,
price: Math.random() + v,
price:
v +
(operation === OperationType.SELL ? Math.random() : -Math.random()),
stockCount: Math.ceil(Math.random() * 100),
operation:
Math.random() > 0.5 ? OperationType.BUY : OperationType.SELL,
operation,

token: this.token,
});
});
Expand Down

0 comments on commit 8a7a9c3

Please sign in to comment.