How to Implement the below function points?
How to implement the below function points?
1 List<Order> GetOpeningOrders(string symbol, startDt, endDt = DateTime.Now)
2 Order CancelOrder(int orderId), GetCanceledOrders()
3 List<Order> GetCompletedOrders(startDt, endDt = DateTime.Now)
4 List
thinking, if I can have a sample code, I can implement the rest of the order function , and Pull Request
Thanks
For example, I tested using a paper account. found that
Contract contract = new()
{
SecurityType = ContractSecurityType.Stock,
Symbol = "AMZN",
Currency = "USD",
Exchange = "SMART"
};
int orderId = Client.Request.GetNextId();
Order order = new()
{
Action = OrderAction.Buy,
TotalQuantity = 1,
OrderType = OrderTypes.Limit,
LimitPrice = 1,
TimeInForce = OrderTimeInForce.GoodUntilCancelled
};
Task<Execution?> task1 = Client
.Response
.OfType<Execution>()
.Take(TimeSpan.FromSeconds(5))
.FirstOrDefaultAsync()
.ToTask();
Client.Request.PlaceOrder(orderId, order, contract);
Execution? execution1 = await task1;
The below code is able to create the order, but how to get the response? e.g. created orderId? order creation result? failed or succeed? since the execution1 is null
Client.Request.PlaceOrder(orderId, order, contract);
Added a Pull Request: https://github.com/dshe/InterReact/pull/21 Needs review and some input