買い/売りの注文確認と注文取消確認は以下のように行います。
'注文約定/キャンセル確認
Protected Overrides Function ConfirmContruct(ByVal buysell As AbstructWebOrder.OrderType, ByVal confType As AbstructWebOrder.ConfirmType, ByVal dt As IDayTrade, _
Optional ByRef contructUnit As Integer = 0, Optional ByVal timing As Date = #12:00:00 AM#) As Boolean
Dim order As KabuCommonLib.Entity.DB.TradeOrder
If buysell = AbstructWebOrder.OrderType.買付 Then
order = dt.BuyOrder
Else
order = dt.SellOrder
End If
log.InfoFormat("{0}の注文確認({1})をします。code={2} unit={3} price={4}", buysell.ToString(), confType.ToString(), dt.company_id, dt.unit, order.price)
Try
Dim strContructState As String = ""
If timing = _cacheTime Then
Dim key As String = OrderCache.CreateKey(buysell, dt, order)
If _orderCacheMap.ContainsKey(key) Then
Dim cache As OrderCache = _orderCacheMap.Item(key)
'約定数量が0のときは、order_noは入れない。
If cache.ContructUnit > 0 Then
order.order_no = cache.OrderNo
End If
strContructState = cache.StrContructState
contructUnit = cache.ContructUnit
End If
Else
If timing > DateTime.MinValue Then
timing = _cacheTime
_orderCacheMap.Clear()
End If
End If
Return _web.GoTop().GoOrderList().ConfirmContruct(buysell, confType, dt, contructUnit, _orderCacheMap, strContructState)
Catch ex As Exception
log.Warn("例外が発生しました。", ex)
End Try
log.WarnFormat("{0}の注文確認({1})に失敗しました。code={2} unit={3} price={4}", buysell.ToString(), confType.ToString(), dt.company_id, dt.unit, order.price)
Return False
End Function
スポンサーリンク