買い/売りの注文訂正は以下のように行います。
'注文訂正
Protected Overrides Function ModifyContruct(ByVal buysell As AbstructWebOrder.OrderType, ByVal dt As IDayTrade, ByVal price As Long, Optional ByVal timing As Date = #12:00:00 AM#) As Boolean
Dim order As TradeOrder
If buysell = AbstructWebOrder.OrderType.買付 Then
order = dt.BuyOrder
Else
order = dt.SellOrder
End If
log.InfoFormat("{0}を訂正します。code={1} unit={2} price={3} mod_price={4}", buysell.ToString(), dt.company_id, dt.unit, order.price, price)
If order.price = price Then
log.Info("すでに注文している価格と訂正価格が同じであるため、訂正注文は行いません。")
Return True
End If
Try
Dim goPageNo As Integer = 1
Dim goIndex As Integer = 0
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)
goPageNo = cache.PageNo
goIndex = cache.Index
End If
Else
If timing > DateTime.MinValue Then
timing = _cacheTime
_orderCacheMap.Clear()
End If
End If
_web.GoTop().GoOrderList().Modify(buysell, dt, _orderCacheMap, goPageNo, goIndex).Modify(price)
order.price = price
Catch ex As Exception
log.Warn("例外が発生しました。", ex)
End Try
log.WarnFormat("{0}の訂正に失敗しました。code={1} unit={2} price={3} mod_price={4}", buysell.ToString(), dt.company_id, dt.unit, order.price, price)
Return False
End Function
スポンサーリンク