From a41cecce5bb74b892ce76c6a13310824338b4212 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sat, 3 Feb 2018 23:22:18 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=E5=A2=9E=E5=8A=A0=E8=8B=A5=E5=B9=B2WebTra?= =?UTF-8?q?der=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/WebTrader/run.py | 6 ++++-- requirements.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/WebTrader/run.py b/examples/WebTrader/run.py index 012eeca4..c43f08ac 100644 --- a/examples/WebTrader/run.py +++ b/examples/WebTrader/run.py @@ -47,10 +47,12 @@ with open("WEB_setting.json") as f: from flask import Flask from flask.ext.restful import Api, Resource, reqparse from flask.ext.socketio import SocketIO +from flask.ext.cors import CORS app = Flask(__name__) api = Api(app) socketio = SocketIO(app) +cors = CORS(app, supports_credentials=True) # 创建资源 @@ -156,7 +158,7 @@ class Order(Resource): #---------------------------------------------------------------------- def post(self): """发单""" - args = self.deleteParser.parse_args() + args = self.postParser.parse_args() token = args['token'] if token != TOKEN: return None @@ -176,7 +178,7 @@ class Order(Resource): req.symbol = contract.symbol req.exchange = contract.exchange req.price = float(price) - req.volume = int(symbol) + req.volume = int(volume) req.priceType = priceType req.direction = direction req.offset = offset diff --git a/requirements.txt b/requirements.txt index 39186dbd..97bdf730 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ wmi future flask-socketio flask-restful +flask-cors gevent-websocket \ No newline at end of file