@@ -193,9 +193,6 @@ private void OnRspQryInvestorPosition_callback(object sender, ref PositionField
193193 // UFX中已经过期的持仓也会推送,所以这里过滤一下不显示
194194 if ( IsLogOnRspQryInvestorPosition )
195195 ( sender as XApi ) . GetLog ( ) . Info ( "OnRspQryInvestorPosition:" + position . ToFormattedString ( ) ) ;
196-
197- if ( position . Position > 0 )
198- plog . Info ( $ "{ position . Symbol } ,{ position . Side } ,今+昨=总:{ position . TodayPosition } +{ position . HistoryPosition } ={ position . Position } ") ;
199196 }
200197
201198 // 由策略来收回报
@@ -211,6 +208,8 @@ private void OnRspQryInvestorPosition_callback(object sender, ref PositionField
211208 if ( ! bIsLast )
212209 return ;
213210
211+ PositionsMsg_Long ( _dictPositions_current ) ;
212+
214213 // 比较两次容器的区别
215214 var list = MergePositions ( _dictPositions_current , _dictPositions_last ) ;
216215 _dictPositions_last = _dictPositions_current ;
@@ -366,24 +365,22 @@ private string AccountMsg_Long(AccountField current, AccountField last)
366365 double balance_1 = ( current . Balance - current . Deposit + current . Withdraw ) - current . PreBalance ;
367366 double balance_2 = current . Balance - last . Balance ;
368367
369- string str = "" ;
370-
371- str += string . Format ( "{0:F2}%/{1:F0}/{2:F0}/{3:F0}" , risk , current . PositionProfit , balance_1 , balance_2 ) ;
372- str += string . Format ( "\n {0:F0}/{1:F0}/{2:F0}" , current . CloseProfit , current . Commission , current . Available ) ;
373- str += string . Format ( "\n 风险度/持仓盈亏/日间权益差/区间权益差" ) ;
374- str += string . Format ( "\n 平仓盈亏/手续费/可用资金\n " ) ;
375-
376- str += string . Format ( "\n {0:F0}/{1:F0}" , current . Withdraw , current . Deposit ) ;
377- str += string . Format ( "\n 出/入金\n " ) ;
378-
379- str += string . Format ( "\n {0:F0}-*+*-{1:F0}=*" , current . Balance , current . PreBalance ) ;
380- str += string . Format ( "\n (动态权益-入金+出金)-昨结权益=日间权益差" ) ;
381- str += string . Format ( "\n 动态权益-上期动态权益=区间权益差\n " ) ;
382-
383- str += string . Format ( "\n {0:F0}/*=*" , current . CurrMargin ) ;
384- str += string . Format ( "\n 占用保证金/动态权益=风险度\n " ) ;
385-
386- str += string . Format ( "\n >>AccountID:{0}<<" , current . AccountID ) ;
368+ string str = $ "{ risk : F2} %/{ current . PositionProfit : F0} /{ balance_1 : F0} /{ balance_2 : F0} " +
369+ $ "\n { current . CloseProfit : F0} /{ current . Commission : F0} /{ current . Available : F0} " +
370+ $ "\n 风险度/持仓盈亏/日间权益差/区间权益差" +
371+ $ "\n 平仓盈亏/手续费/可用资金\n " +
372+ $ "\n { current . Withdraw : F0} /{ current . Deposit : F0} " +
373+ $ "\n 出/入金" +
374+ $ "\n " +
375+ $ "\n { current . Balance : F0} -*+*-{ current . PreBalance : F0} =*" +
376+ $ "\n (动态权益-入金+出金)-昨结权益=日间权益差" +
377+ $ "\n 动态权益-上期动态权益=区间权益差" +
378+ $ "\n " +
379+ $ "\n { current . CurrMargin : F0} /*=*" +
380+ $ "\n 占用保证金/动态权益=风险度" +
381+ $ "\n " +
382+ $ "\n >>AccountID:{ current . AccountID } <<" +
383+ $ "\n >>{ DateTime . Now . ToLongTimeString ( ) } <<";
387384
388385 return str ;
389386 }
@@ -406,5 +403,23 @@ private string AccountMsg_Short(AccountField current, AccountField last)
406403
407404 return str ;
408405 }
406+
407+ private string PositionsMsg_Long ( SortedDictionary < string , PositionField > positions )
408+ {
409+ if ( positions . Count == 0 )
410+ return null ;
411+
412+ string str = "" ;
413+ foreach ( var p in positions . Values )
414+ {
415+ str += $ "{ p . Symbol } ,{ p . Side . ToString ( ) } ,{ p . HistoryPosition } +{ p . TodayPosition } ={ p . Position } \n ";
416+
417+ }
418+ str += $ "\n 合约,多空,昨+今=总";
419+ str += $ "\n >>{ DateTime . Now . ToLongTimeString ( ) } <<";
420+ plog . Info ( str ) ;
421+
422+ return str ;
423+ }
409424 }
410425}
0 commit comments