chore: init qmt_bridge repo (HTTP+WS bridge, MCP endpoint, docs, references)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
"""Optional xtquant import shim backed by Big QMT Redis RPC.
|
||||
|
||||
Put this package before the real xtquant package on PYTHONPATH only when the
|
||||
caller intentionally wants Big QMT RPC compatibility.
|
||||
"""
|
||||
|
||||
from . import xtconstant, xtdata, xttrader, xttype
|
||||
|
||||
__all__ = ["xtconstant", "xtdata", "xttrader", "xttype"]
|
||||
@@ -0,0 +1,128 @@
|
||||
"""MiniQMT-compatible constant definitions (xtconstant).
|
||||
|
||||
Mirrors the native ``xtquant/xtconstant.py`` so code that does
|
||||
``from xtquant.xtconstant import STOCK_BUY`` keeps working against the
|
||||
Big QMT bridge. Values are defined once in
|
||||
``bigqmt_signal_trader.xtquant_compat`` and re-exported here.
|
||||
"""
|
||||
|
||||
from bigqmt_signal_trader.xtquant_compat import (
|
||||
# 账号类型
|
||||
CREDIT_ACCOUNT,
|
||||
FUTURE_ACCOUNT,
|
||||
FUTURE_OPTION_ACCOUNT,
|
||||
HUGANGTONG_ACCOUNT,
|
||||
SECURITY_ACCOUNT,
|
||||
SHENGANGTONG_ACCOUNT,
|
||||
STOCK_OPTION_ACCOUNT,
|
||||
# 委托类型 - 期货
|
||||
FUTURE_ARBITRAGE_CLOSE_HISTORY_FIRST,
|
||||
FUTURE_ARBITRAGE_CLOSE_TODAY_FIRST,
|
||||
FUTURE_ARBITRAGE_OPEN,
|
||||
FUTURE_CLOSE,
|
||||
FUTURE_CLOSE_LONG_HISTORY,
|
||||
FUTURE_CLOSE_LONG_HISTORY_FIRST,
|
||||
FUTURE_CLOSE_LONG_HISTORY_TODAY_THEN_OPEN_SHORT,
|
||||
FUTURE_CLOSE_LONG_TODAY,
|
||||
FUTURE_CLOSE_LONG_TODAY_FIRST,
|
||||
FUTURE_CLOSE_LONG_TODAY_HISTORY_THEN_OPEN_SHORT,
|
||||
FUTURE_CLOSE_SHORT_HISTORY,
|
||||
FUTURE_CLOSE_SHORT_HISTORY_FIRST,
|
||||
FUTURE_CLOSE_SHORT_HISTORY_TODAY_THEN_OPEN_LONG,
|
||||
FUTURE_CLOSE_SHORT_TODAY,
|
||||
FUTURE_CLOSE_SHORT_TODAY_FIRST,
|
||||
FUTURE_CLOSE_SHORT_TODAY_HISTORY_THEN_OPEN_LONG,
|
||||
FUTURE_OPEN,
|
||||
FUTURE_OPEN_LONG,
|
||||
FUTURE_OPEN_SHORT,
|
||||
FUTURE_RENEW_LONG_CLOSE_HISTORY_FIRST,
|
||||
FUTURE_RENEW_LONG_CLOSE_TODAY_FIRST,
|
||||
FUTURE_RENEW_SHORT_CLOSE_HISTORY_FIRST,
|
||||
FUTURE_RENEW_SHORT_CLOSE_TODAY_FIRST,
|
||||
# 委托类型 - 股票 / 信用
|
||||
CREDIT_BUY,
|
||||
CREDIT_BUY_SECU_REPAY,
|
||||
CREDIT_BUY_SECU_REPAY_SPECIAL,
|
||||
CREDIT_DIRECT_CASH_REPAY,
|
||||
CREDIT_DIRECT_CASH_REPAY_SPECIAL,
|
||||
CREDIT_DIRECT_SECU_REPAY,
|
||||
CREDIT_DIRECT_SECU_REPAY_SPECIAL,
|
||||
CREDIT_FIN_BUY,
|
||||
CREDIT_FIN_BUY_SPECIAL,
|
||||
CREDIT_SELL,
|
||||
CREDIT_SELL_SECU_REPAY,
|
||||
CREDIT_SELL_SECU_REPAY_SPECIAL,
|
||||
CREDIT_SLO_SELL,
|
||||
CREDIT_SLO_SELL_SPECIAL,
|
||||
STOCK_BUY,
|
||||
STOCK_SELL,
|
||||
# 委托类型 - 股票期权 / 期货期权
|
||||
OPTION_FUTURE_OPTION_EXERCISE,
|
||||
STOCK_OPTION_BUY_CLOSE,
|
||||
STOCK_OPTION_BUY_OPEN,
|
||||
STOCK_OPTION_CALL_EXERCISE,
|
||||
STOCK_OPTION_COVERED_CLOSE,
|
||||
STOCK_OPTION_COVERED_OPEN,
|
||||
STOCK_OPTION_PUT_EXERCISE,
|
||||
STOCK_OPTION_SECU_LOCK,
|
||||
STOCK_OPTION_SECU_UNLOCK,
|
||||
STOCK_OPTION_SELL_CLOSE,
|
||||
STOCK_OPTION_SELL_OPEN,
|
||||
# 报价类型(市价)
|
||||
FIX_PRICE,
|
||||
LATEST_PRICE,
|
||||
MARKET_MINE_PRICE_FIRST,
|
||||
MARKET_PEER_PRICE_FIRST,
|
||||
MARKET_SH_CONVERT_5_CANCEL,
|
||||
MARKET_SH_CONVERT_5_LIMIT,
|
||||
MARKET_SZ_CONVERT_5_CANCEL,
|
||||
MARKET_SZ_FULL_OR_CANCEL,
|
||||
MARKET_SZ_INSTBUSI_RESTCANCEL,
|
||||
# 市场代码
|
||||
SH_MARKET,
|
||||
SZ_MARKET,
|
||||
# 委托状态
|
||||
ORDER_CANCELED,
|
||||
ORDER_JUNK,
|
||||
ORDER_PARTSUCC_CANCEL,
|
||||
ORDER_PART_CANCEL,
|
||||
ORDER_PART_SUCC,
|
||||
ORDER_REPORTED,
|
||||
ORDER_REPORTED_CANCEL,
|
||||
ORDER_SUCCEEDED,
|
||||
ORDER_UNKNOWN,
|
||||
ORDER_UNREPORTED,
|
||||
ORDER_WAIT_REPORTING,
|
||||
# 账号状态
|
||||
ACCOUNT_STATUS_ASSIS_FAIL,
|
||||
ACCOUNT_STATUS_CLOSED,
|
||||
ACCOUNT_STATUS_CORRECTING,
|
||||
ACCOUNT_STATUS_DISABLEBYSYS,
|
||||
ACCOUNT_STATUS_DISABLEBYUSER,
|
||||
ACCOUNT_STATUS_FAIL,
|
||||
ACCOUNT_STATUS_INITING,
|
||||
ACCOUNT_STATUS_INVALID,
|
||||
ACCOUNT_STATUS_OK,
|
||||
ACCOUNT_STATUS_WAITING_LOGIN,
|
||||
ACCOUNT_STATUSING,
|
||||
)
|
||||
|
||||
# 合法委托类型集合(对齐原生 ORDER_TYPE_SET)
|
||||
ORDER_TYPE_SET = {
|
||||
STOCK_BUY,
|
||||
STOCK_SELL,
|
||||
CREDIT_BUY,
|
||||
CREDIT_SELL,
|
||||
CREDIT_FIN_BUY,
|
||||
CREDIT_SLO_SELL,
|
||||
CREDIT_BUY_SECU_REPAY,
|
||||
CREDIT_DIRECT_SECU_REPAY,
|
||||
CREDIT_SELL_SECU_REPAY,
|
||||
CREDIT_DIRECT_CASH_REPAY,
|
||||
CREDIT_FIN_BUY_SPECIAL,
|
||||
CREDIT_SLO_SELL_SPECIAL,
|
||||
CREDIT_BUY_SECU_REPAY_SPECIAL,
|
||||
CREDIT_DIRECT_SECU_REPAY_SPECIAL,
|
||||
CREDIT_SELL_SECU_REPAY_SPECIAL,
|
||||
CREDIT_DIRECT_CASH_REPAY_SPECIAL,
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import bigqmt_signal_trader.xtquant_compat as _compat
|
||||
|
||||
|
||||
def __getattr__(name):
|
||||
return getattr(_compat.xtdata, name)
|
||||
|
||||
|
||||
def get_full_tick(code_list):
|
||||
return _compat.xtdata.get_full_tick(code_list)
|
||||
|
||||
|
||||
def get_market_data(field_list=[], stock_list=[], period="1d", start_time="", end_time="", count=-1, dividend_type="none", fill_data=True):
|
||||
return _compat.xtdata.get_market_data(field_list, stock_list, period, start_time, end_time, count, dividend_type, fill_data)
|
||||
|
||||
|
||||
def get_market_data_ex(field_list=[], stock_list=[], period="1d", start_time="", end_time="", count=-1, dividend_type="none", fill_data=True):
|
||||
return _compat.xtdata.get_market_data_ex(field_list, stock_list, period, start_time, end_time, count, dividend_type, fill_data)
|
||||
|
||||
|
||||
def get_local_data(field_list=[], stock_list=[], period="1d", start_time="", end_time="", count=-1, dividend_type="none", fill_data=True, data_dir=None):
|
||||
return _compat.xtdata.get_local_data(field_list, stock_list, period, start_time, end_time, count, dividend_type, fill_data, data_dir)
|
||||
|
||||
|
||||
def get_instrument_detail(stock_code):
|
||||
return _compat.xtdata.get_instrument_detail(stock_code)
|
||||
|
||||
|
||||
def get_instrumentdetail(stock_code):
|
||||
return _compat.xtdata.get_instrumentdetail(stock_code)
|
||||
|
||||
|
||||
def get_instrument_type(stock_code, variety_list=None):
|
||||
return _compat.xtdata.get_instrument_type(stock_code, variety_list)
|
||||
|
||||
|
||||
def get_stock_list_in_sector(sector_name, real_timetag=-1):
|
||||
return _compat.xtdata.get_stock_list_in_sector(sector_name, real_timetag=real_timetag)
|
||||
|
||||
|
||||
def get_sector_list():
|
||||
return _compat.xtdata.get_sector_list()
|
||||
|
||||
|
||||
def get_sector_info(sector_name=""):
|
||||
return _compat.xtdata.get_sector_info(sector_name)
|
||||
|
||||
|
||||
def subscribe_quote(stock_code, period="1d", start_time="", end_time="", count=0, callback=None):
|
||||
return _compat.xtdata.subscribe_quote(stock_code, period, start_time, end_time, count, callback)
|
||||
|
||||
|
||||
def subscribe_quote2(stock_code, period="1d", start_time="", end_time="", count=0, dividend_type=None, callback=None):
|
||||
return _compat.xtdata.subscribe_quote2(stock_code, period, start_time, end_time, count, dividend_type, callback)
|
||||
|
||||
|
||||
def subscribe_whole_quote(code_list, callback=None):
|
||||
return _compat.xtdata.subscribe_whole_quote(code_list, callback=callback)
|
||||
|
||||
|
||||
def unsubscribe_quote(seq):
|
||||
return _compat.xtdata.unsubscribe_quote(seq)
|
||||
|
||||
|
||||
def run():
|
||||
return _compat.xtdata.run()
|
||||
|
||||
|
||||
def get_divid_factors(stock_code, start_time="", end_time=""):
|
||||
return _compat.xtdata.get_divid_factors(stock_code, start_time, end_time)
|
||||
|
||||
|
||||
def getDividFactors(*args, **kwargs):
|
||||
return _compat.xtdata.get_divid_factors(*args, **kwargs)
|
||||
|
||||
|
||||
def submit_download_history_data(stock_code, period, start_time="", end_time="", incrementally=None):
|
||||
return _compat.xtdata.submit_download_history_data(stock_code, period, start_time, end_time, incrementally)
|
||||
|
||||
|
||||
def submit_download_history_data2(stock_list, period, start_time="", end_time="", incrementally=None):
|
||||
return _compat.xtdata.submit_download_history_data2(stock_list, period, start_time, end_time, incrementally)
|
||||
|
||||
|
||||
def get_download_status(job_id):
|
||||
return _compat.xtdata.get_download_status(job_id)
|
||||
|
||||
|
||||
def wait_download(job_id, timeout=None, poll_interval=None, callback=None):
|
||||
return _compat.xtdata.wait_download(job_id, timeout, poll_interval, callback)
|
||||
|
||||
|
||||
def download_history_data(stock_code, period, start_time="", end_time="", incrementally=None):
|
||||
return _compat.xtdata.download_history_data(stock_code, period, start_time, end_time, incrementally)
|
||||
|
||||
|
||||
def download_history_data2(stock_list, period, start_time="", end_time="", callback=None, incrementally=None):
|
||||
return _compat.xtdata.download_history_data2(stock_list, period, start_time, end_time, callback, incrementally)
|
||||
|
||||
|
||||
def get_trading_dates(market, start_time="", end_time="", count=-1):
|
||||
return _compat.xtdata.get_trading_dates(market, start_time, end_time, count)
|
||||
|
||||
|
||||
def get_holidays():
|
||||
return _compat.xtdata.get_holidays()
|
||||
|
||||
|
||||
def download_holiday_data(incrementally=True):
|
||||
return _compat.xtdata.download_holiday_data(incrementally)
|
||||
|
||||
|
||||
def get_ipo_info(start_time="", end_time=""):
|
||||
return _compat.xtdata.get_ipo_info(start_time, end_time)
|
||||
|
||||
|
||||
def get_etf_info():
|
||||
return _compat.xtdata.get_etf_info()
|
||||
|
||||
|
||||
def download_etf_info():
|
||||
return _compat.xtdata.download_etf_info()
|
||||
|
||||
|
||||
def get_option_list(undl_code, dedate, opttype="", isavailavle=False):
|
||||
return _compat.xtdata.get_option_list(undl_code, dedate, opttype, isavailavle)
|
||||
|
||||
|
||||
def get_his_option_list(undl_code, dedate):
|
||||
return _compat.xtdata.get_his_option_list(undl_code, dedate)
|
||||
|
||||
|
||||
def get_his_option_list_batch(undl_code, start_time="", end_time=""):
|
||||
return _compat.xtdata.get_his_option_list_batch(undl_code, start_time, end_time)
|
||||
|
||||
|
||||
def get_financial_data(stock_list, table_list=[], start_time="", end_time="", report_type="report_time"):
|
||||
return _compat.xtdata.get_financial_data(stock_list, table_list, start_time, end_time, report_type)
|
||||
|
||||
|
||||
def download_financial_data(stock_list, table_list=[], start_time="", end_time="", incrementally=None):
|
||||
return _compat.xtdata.download_financial_data(stock_list, table_list, start_time, end_time, incrementally)
|
||||
|
||||
|
||||
def download_financial_data2(stock_list, table_list=[], start_time="", end_time="", callback=None):
|
||||
return _compat.xtdata.download_financial_data2(stock_list, table_list, start_time, end_time, callback)
|
||||
|
||||
|
||||
def call_formula(formula_name, stock_code, period, start_time="", end_time="", count=-1, dividend_type=None, extend_param={}):
|
||||
return _compat.xtdata.call_formula(formula_name, stock_code, period, start_time, end_time, count, dividend_type, extend_param)
|
||||
|
||||
|
||||
def subscribe_formula(formula_name, stock_code, period, start_time="", end_time="", count=-1, dividend_type=None, extend_param={}, callback=None):
|
||||
return _compat.xtdata.subscribe_formula(formula_name, stock_code, period, start_time, end_time, count, dividend_type, extend_param, callback)
|
||||
|
||||
|
||||
def unsubscribe_formula(request_id):
|
||||
return _compat.xtdata.unsubscribe_formula(request_id)
|
||||
|
||||
|
||||
def get_formula_result(request_id, start_time="", end_time="", count=-1, timeout_second=-1):
|
||||
return _compat.xtdata.get_formula_result(request_id, start_time, end_time, count, timeout_second)
|
||||
|
||||
|
||||
def gen_factor_index(data_name, formula_name, vars, sector_list, start_time="", end_time="", period="1d", dividend_type="none"):
|
||||
return _compat.xtdata.gen_factor_index(data_name, formula_name, vars, sector_list, start_time, end_time, period, dividend_type)
|
||||
@@ -0,0 +1,7 @@
|
||||
from bigqmt_signal_trader.xtquant_compat import (
|
||||
BigQmtXtTrader,
|
||||
XtQuantTrader,
|
||||
XtQuantTraderCallback,
|
||||
)
|
||||
|
||||
__all__ = ["BigQmtXtTrader", "XtQuantTrader", "XtQuantTraderCallback"]
|
||||
@@ -0,0 +1,3 @@
|
||||
from bigqmt_signal_trader.xtquant_compat import StockAccount
|
||||
|
||||
__all__ = ["StockAccount"]
|
||||
Reference in New Issue
Block a user