예제 #1
0
import pandas as pd
import numpy as np
import logging
from datetime import datetime, date
from direstplus.exceptions import RequestError
import iFinDPy as ifind
from direstplus.config import config

logger = logging.getLogger(__name__)
STR_FORMAT_DATE = '%Y-%m-%d'
STR_FORMAT_DATETIME_WIND = '%Y-%m-%d %H:%M:%S'  # 2017-03-06 00:00:00
UN_AVAILABLE_DATETIME = datetime.strptime('1900-01-01', STR_FORMAT_DATE)
UN_AVAILABLE_DATE = UN_AVAILABLE_DATETIME.date()

header = {'Content-Type': 'application/json'}
rec = api.namespace('iFind', description='同花顺iFind接口')

# parser
data_serial_parser = reqparse.RequestParser().add_argument(
    'thscode',
    type=str,
    help="同花顺代码,可以是单个代码也可以是多个代码,代码之间用逗号(‘,’)隔开。例如 600004.SH,600007.SH"
).add_argument(
    'jsonIndicator',
    type=str,
    help=
    "指标,可以是单个指标也可以是多个指标,指标指标用 分号(‘;’)隔开。例如 ths_close_price_stock;ths_open_price_stock"
).add_argument(
    'jsonparam',
    type=str,
    help=
예제 #2
0
from direstplus import api
from flask_restplus import Resource, reqparse
from WindPy import w
import pandas as pd
import logging
from datetime import datetime, date
from direstplus.exceptions import RequestError

logger = logging.getLogger(__name__)
STR_FORMAT_DATE = '%Y-%m-%d'
STR_FORMAT_DATETIME_WIND = '%Y-%m-%d %H:%M:%S'  # 2017-03-06 00:00:00
UN_AVAILABLE_DATETIME = datetime.strptime('1900-01-01', STR_FORMAT_DATE)
UN_AVAILABLE_DATE = UN_AVAILABLE_DATETIME.date()

header = {'Content-Type': 'application/json'}
rec = api.namespace('wind', description='wind接口')

ERROR_CODE_MSG_DIC = {
    -40522005: "不支持的万得代码",
    -40522003: "非法请求",
    -40521004: "请求发送失败。无法发送请求,请连接网络",
    -40520007: "没有可用数据",
    -40521009: "数据解码失败。检查输入参数是否正确,如:日期参数注意大小月月末及短二月",
    -40521010: "网络超时",
    -40522017: "数据提取量超限",
    -40522006: "指标语法错误。请检查代码中的相关指标是否正确,无缺失或重复",
}

# parser
receive_wset_parser = reqparse.RequestParser().add_argument(
    'tablename', type=str, required=True,