def handle_stockstatus(): c = Creon() c.avoid_reqlimitwarning() stockcode = request.args.get('code') if not stockcode: return '', 400 status = c.get_stockstatus(stockcode) return jsonify(status)
def handle_short(): c = Creon() c.avoid_reqlimitwarning() stockcode = request.args.get('code') n = request.args.get('n') if not stockcode: return '', 400 stockfeatures = c.get_shortstockselling(stockcode, n=n) return jsonify(stockfeatures)
def handle_stockcodes(): c = Creon() c.avoid_reqlimitwarning() market = request.args.get('market') if market == 'kospi': return jsonify(c.get_stockcodes(constants.MARKET_CODE_KOSPI)) elif market == 'kosdaq': return jsonify(c.get_stockcodes(constants.MARKET_CODE_KOSDAQ)) else: return '"market" should be one of "kospi" and "kosdaq".', 400
def handle_stockcandles(): c = Creon() c.avoid_reqlimitwarning() stockcode = request.args.get('code') n = request.args.get('n') date_from = request.args.get('date_from') date_to = request.args.get('date_to') if not (n or date_from): return 'Need to provide "n" or "date_from" argument.', 400 stockcandles = c.get_chart(stockcode, target='A', unit='D', n=n, date_from=date_from, date_to=date_to) return jsonify(stockcandles)