如何使用DebtsProvider查询融券负债列表?

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

示例1:使用DebtsProvider查询融券负债列表

using guosen;

vars:DebtsProvider DP(null);
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args ) 
begin
    DP = new DebtsProvider;
    //DP.Accounts += getMarginAccount();
    DP.StateChanged += DP_StateChanged;
    DP.Load = TRUE;
end;

Method void DP_StateChanged(elsystem.object sender,tsdata.common.StateChangedEventArgs args)
vars:int loop;
Begin
    if(args.NewState = tsdata.common.DataState.loaded)then
    Begin
        print("Debts总数:",DP.Count);
        For loop = 0 to DP.Count-1
        Begin
            print("账户:",DP[loop].Account);
            print("可还数量:",DP[loop].DebtPayable);
            print("总数量:",DP[loop].DebtTotal);
            print("名称:",DP[loop].Description);
            print("市场:",DP[loop].Market);
            print("代码:",DP[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;

//Debts总数:  14.00
//账户:110060035046
//可还数量: 100.00
//总数量: 100.00
//名称:浦发银行
//市场:SH
//代码:600000.SH
Copyright © 1998-2018 国信证券股份有限公司 版权所有发布时间: 2018-05-14 14:58:15

results matching ""

    No results matching ""