def testAccounts(self):
        print "--------------------------"
        print "Testing Accounts accounts"

        r = account.accounts()
        self.assertIsNotNone(r, "response not found")
        print r

        a = r.get('accounts')
        self.assertIsNotNone(a, "accounts not found")
        print a
    def testExecutions(self):
        print "--------------------------"
        print "Testing Accounts executions"

        r = account.accounts()
        a = r.get('accounts')

        for i in a:
            id_ = i.get('number')
            self.assertIsNotNone(id_, "Account id not found")

            r = account.accounts_executions(id_)
            self.assertIsNotNone(r, "response not found")
            print r

            e = r.get('executions')
            self.assertIsNotNone(e, "executions not found")
            print e
    def testBalances(self):
        print "--------------------------"
        print "Testing Accounts balances"

        r = account.accounts()
        a = r.get('accounts')

        for i in a:
            id_ = i.get('number')
            self.assertIsNotNone(id_, "Account id not found")

            r = account.accounts_balances(id_)
            self.assertIsNotNone(r, "response not found")
            print r

            b = r.get('perCurrencyBalances')
            self.assertIsNotNone(b, "perCurrencyBalances not found")
            print b
    def testPositions(self):
        print "--------------------------"
        print "Testing Accounts positions"

        r = account.accounts()
        a = r.get('accounts')

        for i in a:
            id_ = i.get('number')
            self.assertIsNotNone(id_, "Account id not found")

            r = account.accounts_positions(id_)
            self.assertIsNotNone(r, "response not found")
            print r

            p = r.get('positions')
            self.assertIsNotNone(p, "positions not found")
            print p
    def testActivities(self):
        print "--------------------------"
        print "Testing Accounts activities"

        r = account.accounts()
        a = r.get('accounts')

        for i in a:
            id_ = i.get('number')
            self.assertIsNotNone(id_, "Account id not found")

            r = account.accounts_orders(id_)
            self.assertIsNotNone(r, "response not found")
            print r

            ac = r.get('orders')
            self.assertIsNotNone(ac, "activities not found")
            print ac
    def testOrders(self):
        print "--------------------------"
        print "Testing Accounts orders"

        r = account.accounts()
        a = r.get('accounts')

        for i in a:
            id_ = i.get('number')
            self.assertIsNotNone(id_, "Account id not found")

            r = account.accounts_orders(id_)
            self.assertIsNotNone(r, "response not found")
            print r

            o = r.get('orders')
            self.assertIsNotNone(o, "orders not found")
            print o
Esempio n. 7
0
def xw_GetAccounts(headers):
    r = api_account.accounts()
    accounts = r.get('accounts')

    return __table__(accounts, headers)
Esempio n. 8
0
def xw_GetAccountsUserid():
    r = api_account.accounts()
    return r.get('userId')
Esempio n. 9
0
'''
    raw_input("\nPress enter key to continue... ")
    r = account.time()
    print "Questrade API responded with JSON:\n%s\n" % r
    t = r.get('time', 'unknown')
    print "The date time is: %s" % datetime_utils.print_datetime(
        datetime_utils.iso_to_datetime(t))

    print '''
Next let's list the types of accounts you have with Questrade.  To do so
we make the following call:
\taccount.accounts()
'''
    raw_input("\nPress enter key to continue... ")

    r = account.accounts()
    print "Questrade API responded with JSON:\n%s\n" % r
    print "Your User Id is: %s" % r.get('userId', 'unknown')
    print "Your Account Numbers and Types are as follows:"
    accs = r.get('accounts', [])
    for a in accs:
        n = a.get('number', 'unknown')
        t = a.get('type', 'unknown')
        print "\t%s %s" % (n, t)

    print '''
This concludes our getting started module on Questrade API calls. Now that
you have a basic understanding of how you can make Questreade API calls,
you can explore many of the other features this package provides.
'''