Ejemplo n.º 1
0
 private static void QTrade_OnAccountsRecieved(object sender, APIAccountsReturnArgs e)
 {
     for (int i = 0; i < e.accounts.accounts.Length; i++)
     {
         Console.WriteLine(string.Format("{0} {1} : {2}"
                                         , e.accounts.accounts[i].clientAccountType, e.accounts.accounts[i].type, e.accounts.accounts[i].number));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrives all accounts accessible by this session
        /// /// <param name="cancellationTokenSource">Cancellation token source</param>
        /// </summary>
        public void GetAccountsAsync(CancellationTokenSource cancellationTokenSource)
        {
            CancellationToken ct = cancellationTokenSource.Token;

            Task.Run(() =>
            {
                ct.ThrowIfCancellationRequested();
                var obj = ApiGet <Accounts>(apiClient, "v1/accounts", ct);

                //obj.Wait(ct);

                if (obj.isSuccess && !ct.IsCancellationRequested)
                {
                    var arg          = new APIAccountsReturnArgs();
                    arg.accounts     = obj.q_obj;
                    arg.NumCallsLeft = obj.NumCallsLeft;
                    arg.RateReset    = obj.RateReset;
                    OnAccountsRecieved(this, arg);
                }
            }, ct);
        }