Example #1
0
        elif action == 'holdingpanel':
            trading_day = self.get_argument('trading_day')
            res = self.manager.get_holding_panel(acc, trading_day)
            self.write({'res': QA_util_to_json_from_pandas(res)})


class QAQIFIS_Handler(QABaseHandler):
    #manager = QA_QIFIMANAGER(mongo_ip)
    manager = QA_QIFISMANAGER(mongo_ip)

    def get(self):
        action = self.get_argument('action', 'acchistory')

        if action == 'accountlist':
            res = self.manager.get_allaccountname()
            self.write({'res': res})
        elif action == 'portfoliolist':
            res = self.manager.get_allportfolio()
            self.write({'res': res})
        elif action == 'accountinportfolio':
            portfolio = self.get_argument('portfolio', 't12')
            res = self.manager.get_portfolio_panel(portfolio)

            self.write({'res': QA_util_to_json_from_pandas(res)})


if __name__ == "__main__":
    start_server([(r"/qifi", QAQIFI_Handler), (r"/qifis", QAQIFIS_Handler)],
                 '0.0.0.0', 8019)
Example #2
0
def run_server():
    start_server([(r"/qifi", QAQIFI_Handler)], '0.0.0.0', 8019)