Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/QuikSharp/DataStructures/Transaction/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ internal void OnTransReplyCall(TransactionReply reply)
/// <summary>
/// TransactionReply
/// </summary>
public TransactionReply TransactionReply { get; set; }
volatile TransactionReply _transactionReply;
public TransactionReply TransactionReply { get => _transactionReply; set { _transactionReply = value; } }

/// <summary>
/// Функция вызывается терминалом QUIK при получении новой заявки или при изменении параметров существующей заявки.
Expand Down
26 changes: 18 additions & 8 deletions src/QuikSharp/OrderFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,22 @@ async Task<Order> SendOrder(string classCode, string securityCode, string accoun
{
if (res > 0)
{
try
{
order_result = await Quik.Orders.GetOrder_by_transID(classCode, securityCode, res).ConfigureAwait(false);
}
catch
{
order_result = new Order {RejectReason = "Неудачная попытка получения заявки по ID-транзакции №" + res};
}
if (newOrderTransaction.TransactionReply != null && newOrderTransaction.TransactionReply.ErrorSource != 0)
order_result = new Order
{
RejectReason =
newOrderTransaction.TransactionReply.ResultMsg
?? $"Transaction {res} error: code {newOrderTransaction.TransactionReply.ErrorCode}, source {newOrderTransaction.TransactionReply.ErrorSource}"
};
else
try
{
order_result = await Quik.Orders.GetOrder_by_transID(classCode, securityCode, res).ConfigureAwait(false);
}
catch
{
order_result = new Order {RejectReason = "Неудачная попытка получения заявки по ID-транзакции №" + res};
}
}
else
{
Expand All @@ -131,6 +139,8 @@ async Task<Order> SendOrder(string classCode, string securityCode, string accoun
}

if (order_result != null && (order_result.RejectReason != "" || order_result.OrderNum > 0)) set = true;

Thread.Sleep(10);
}

return order_result;
Expand Down