public InvestorInstructionDto(InvestorInstructionIdentifierDto uniqueIdentifier, Way way, int quantity, decimal price, bool allowPartialExecution = false, DateTime? goodTill = null) { this.UniqueIdentifier = uniqueIdentifier; this.Way = way; this.Quantity = quantity; this.Price = price; this.AllowPartialExecution = allowPartialExecution; this.GoodTill = goodTill; }
public void Run() { // initialize the context var sor = BuildSor(); var identifier = sor.RequestUniqueIdentifier(); // instantiate the service var adapter = new SmartOrderRoutingRawInprocAdapter(sor); // initialize our engine adapter.InstructionUpdated += ServiceOnInstructionUpdated; this.instructionIdentifier = adapter.RequestUniqueIdentifier(); // build demo order this.investorInstructionDto = new InvestorInstructionDto(identifier, Way.Buy, 10, 100M, true, null); var stopWatch = new Stopwatch(); // sends the instruction stopWatch.Start(); // Subscribes to the instruction's events OrderExecutedEventArgs orderExecutedEventArgs = null; string failureReason = null; sor.Subscribe(investorInstructionDto.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, (args) => { failureReason = args; }); sor.Route(investorInstructionDto); // wait for the exit condition lock (this.synchro) { if (this.done == false) { Monitor.Wait(this.synchro, 500); } } stopWatch.Stop(); if (this.done) { this.AverageLatency = stopWatch.ElapsedMilliseconds; } }
public InvestorInstruction(InvestorInstructionIdentifierDto identifierDto, Way way, int quantity, decimal price, bool allowPartialExecution, DateTime? goodTill) : base(identifierDto, way, quantity, price, allowPartialExecution, goodTill) { this.IdentifierDto = identifierDto; }
public InvestorInstructionUpdatedDto(InvestorInstructionIdentifierDto identifierDto, InvestorInstructionStatus status) { this.IdentifierDto = identifierDto; this.Status = status; }
protected bool Equals(InvestorInstructionIdentifierDto other) { return this.value == other.value; }
public void Subscribe(InvestorInstructionIdentifierDto investorInstructionIdentifierDto, Action<OrderExecutedEventArgs> executedCallback, Action<string> failureCallback) { // TODO: thread-safe it this.executionCallbacks[investorInstructionIdentifierDto] = executedCallback; this.failureCallbacks[investorInstructionIdentifierDto] = failureCallback; // TODO: regirst failure }
private InvestorInstruction CreateInvestorInstruction(InvestorInstructionIdentifierDto instructionIdentifierDto, InstrumentIdentifier instrumentIdentifier, Way way, int quantity, decimal price, bool allowPartialExecution = false, DateTime? goodTill = null) { return new InvestorInstruction(instructionIdentifierDto, way, quantity, price, allowPartialExecution, goodTill); }