如何使用CollateralStocksProvider查询担保品标的列表?
使用CollateralStocksProvider
查询担保品标的列表,具体用法见示例一:
示例1:使用CollateralStocksProvider
查询担保品标的列表
using guosen;
vars:CollateralStocksProvider CSP(null);
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
begin
CSP = new CollateralStocksProvider;
CSP.StateChanged += CSP_StateChanged;
CSP.Load = TRUE;
end;
Method void CSP_StateChanged(elsystem.object sender,tsdata.common.StateChangedEventArgs args)
vars:int loop;
Begin
if(args.NewState = tsdata.common.DataState.loaded)then
Begin
print("担保品标的列表总数:",CSP.Count);
For loop = 0 to CSP.Count-1
Begin
print("折算比例:",CSP[loop].ConversionRatio);
print("名称:",CSP[loop].Description);
print("市场:",CSP[loop].Market);
print("代码:",CSP[loop].Symbol);
End;
End;
End;
//获取信用账户//
Method string getMarginAccount()
vars:string acct, int loop, int count;
Begin
count = getnumaccounts();
For loop = 1 to count
Begin
acct = getaccount(loop);
if(Getaccounttype(acct) = 2)then
Begin
Return acct;
End;
End;
Return "";
End;
//担保品标的列表总数:5680.00
//折算比例: 0.70
//名称:深发展A
//市场:SZSE
//代码:000001.SZ
//折算比例: 0.70
//名称:万 科A
//市场:SZSE
//代码:000002.SZ