如何使用MarginStocksProvder查询锁券列表?

使用MarginStocksProvder查询融券负债列表,具体用法见示例一:

示例1:使用MarginStocksProvder查询锁券列表

using guosen;

vars:MarginStocksProvider MSP(null);
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
begin
    MSP = new MarginStocksProvider;
    //MSP.Account = getMarginAccount();
    MSP.StateChanged += MSP_StateChanged;
    MSP.Load = TRUE;
end;


Method void MSP_StateChanged(elsystem.object sender,tsdata.common.StateChangedEventArgs args)
vars:int loop;
Begin
    if(args.NewState = tsdata.common.DataState.loaded)then
    Begin
        print("锁券总数:",MSP.Count);
        For loop = 0 to MSP.Count-1
        Begin
            print("可用额度:",MSP[loop].MarginQuotaAvailable);
            print("市场:",MSP[loop].Market);
            print("代码:",MSP[loop].Symbol);
            print("总额度:",MSP[loop].TotalMarginQuota);
        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;

//锁券总数:  27.00
//可用额度:96400.00
//市场:SZSE
//代码:000001.SZ
//总额度:96400.00
//可用额度:94500.00
//...
Copyright © 1998-2018 国信证券股份有限公司 版权所有发布时间: 2018-05-14 14:58:15

results matching ""

    No results matching ""