def get(self):
        """
        采用了get_arguents来获取参数
        默认参数: code-->000001 start-->2017-01-01 09:00:00 end-->now
        accounts?account_cookie=xxx
        """
        account_cookie = self.get_argument('account_cookie', default='admin')

        query_account = QA_fetch_account({'account_cookie': account_cookie})
        #data = [QA_Account().from_message(x) for x in query_account]

        if len(query_account) > 0:
            #data = [QA.QA_Account().from_message(x) for x in query_account]
            def warpper(x):
                return str(x) if isinstance(x, datetime.datetime) else x

            for item in query_account:
                item['trade_index'] = list(map(str, item['trade_index']))
                item['history'] = [
                    list(map(warpper, itemd)) for itemd in item['history']
                ]

            self.write({'result': query_account})
        else:
            self.write('WRONG')
Exemplo n.º 2
0
    def get(self):
        """
        采用了get_arguents来获取参数
        默认参数: code-->000001 start-->2017-01-01 09:00:00 end-->now
        accounts?account_cookie=xxx
        """
        #account_cookie= self.get_argument('account_cookie', default='admin')

        query_account = QA_fetch_account()
        # data = [res for res in query_account]
        if len(query_account) > 0:
            #data = [QA.QA_Account().from_message(x) for x in query_account]
            warpper = lambda x: str(x) if isinstance(x, datetime.datetime
                                                     ) else x
            res = []
            for item in query_account:
                res.append([
                    item['portfolio_cookie'], item['account_cookie'],
                    str(item['start_date']),
                    str(item['end_date']), 'market_type'
                ])

            self.write({'result': res})
        else:
            self.write('WRONG')
Exemplo n.º 3
0
    def get(self):
        """
        采用了get_arguents来获取参数
        默认参数: code-->000001 start-->2017-01-01 09:00:00 end-->now
        accounts?account_cookie=xxx
        """
        account_cookie = self.get_argument('account_cookie', default='admin')

        query_account = QA_fetch_account({'account_cookie': account_cookie})
        data = [QA_Account().from_message(x) for x in query_account]
        if len(query_account) > 0:
            #data = [QA.QA_Account().from_message(x) for x in query_account]

            self.write({'result': [data.message for data in data]})
        else:
            self.write('WRONG')