Merge pull request #1689 from nanoric/xtp_fix

[Mod] use newer autocxxpy (0.2.4) to generate xtp
This commit is contained in:
vn.py 2019-05-13 22:43:24 +08:00 committed by GitHub
commit 4ee6aade5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 226 additions and 94 deletions

View File

@ -1,3 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
python -m autocxxpy vnxtp xtp_trader_api.h xtp_quote_api.h -I vnxtp/include -o vnxtp/generated_files -p . --no-callback-name .*Api # autocxxpy version: 0.2.4
python -m autocxxpy \
vnxtp \
xtp_trader_api.h xtp_quote_api.h \
-I vnxtp/include \
--output-dir vnxtp/generated_files \
--pyi-output-dir .\
--no-clear-pyi-output \
--no-callback-pattern ".*Api"

Binary file not shown.

View File

@ -7,7 +7,7 @@ if typing.TYPE_CHECKING:
from .vnxtp import * from .vnxtp import *
def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], None]): def set_async_callback_exception_handler(handler: Callable[[Exception, object, str], bool]):
""" """
set a customize exception handler for async callback in this module(pyd) set a customize exception handler for async callback in this module(pyd)
\a handler should return True if it handles that exception, \a handler should return True if it handles that exception,
@ -105,10 +105,10 @@ class XTPMarketDataStruct():
qty: int qty: int
turnover: float turnover: float
avg_price: float avg_price: float
bid: Sequence[float] bid: List[float]
ask: Sequence[float] ask: List[float]
bid_qty: Sequence[int] bid_qty: List[int]
ask_qty: Sequence[int] ask_qty: List[int]
trades_count: int trades_count: int
ticker_status: str ticker_status: str
stk: XTPMarketDataStockExData stk: XTPMarketDataStockExData
@ -141,10 +141,10 @@ class OrderBookStruct():
qty: int qty: int
turnover: float turnover: float
trades_count: int trades_count: int
bid: Sequence[float] bid: List[float]
ask: Sequence[float] ask: List[float]
bid_qty: Sequence[int] bid_qty: List[int]
ask_qty: Sequence[int] ask_qty: List[int]
data_time: int data_time: int
@ -320,7 +320,7 @@ class XTPQueryAssetRsp():
captial_asset: float captial_asset: float
force_freeze_amount: float force_freeze_amount: float
preferred_amount: float preferred_amount: float
unknown: Sequence[int] unknown: List[int]
class XTPQueryStkPositionRsp(): class XTPQueryStkPositionRsp():
@ -342,7 +342,7 @@ class XTPQueryStkPositionRsp():
executable_underlying: int executable_underlying: int
locked_position: int locked_position: int
usable_locked_position: int usable_locked_position: int
unknown: Sequence[int] unknown: List[int]
class XTPFundTransferNotice(): class XTPFundTransferNotice():
@ -491,7 +491,7 @@ class XTPQueryOptionAuctionInfoRsp():
sell_margin: float sell_margin: float
margin_ratio_param1: float margin_ratio_param1: float
margin_ratio_param2: float margin_ratio_param2: float
unknown: Sequence[int] unknown: List[int]
class XTPFundTransferReq(): class XTPFundTransferReq():

View File

@ -149,7 +149,7 @@ void generate_sub_namespace_XTP_API(pybind11::module & parent)
void generate_class_XTP_API_TraderSpi(pybind11::object & parent) void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
{ {
pybind11::class_<XTP::API::TraderSpi, PyTraderSpi> c(parent, "TraderSpi"); pybind11::class_<XTP::API::TraderSpi, PyTraderSpi> c(parent, "TraderSpi");
if constexpr (std::is_default_constructible_v<XTP::API::TraderSpi>) if constexpr (std::is_default_constructible_v<PyTraderSpi>)
c.def(pybind11::init<>()); c.def(pybind11::init<>());
c.def("OnDisconnected", c.def("OnDisconnected",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
@ -159,6 +159,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnError", c.def("OnError",
@ -169,6 +170,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnOrderEvent", c.def("OnOrderEvent",
@ -179,6 +181,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnTradeEvent", c.def("OnTradeEvent",
@ -189,6 +192,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnCancelOrderError", c.def("OnCancelOrderError",
@ -199,6 +203,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryOrder", c.def("OnQueryOrder",
@ -209,6 +214,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryTrade", c.def("OnQueryTrade",
@ -219,6 +225,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryPosition", c.def("OnQueryPosition",
@ -229,6 +236,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryAsset", c.def("OnQueryAsset",
@ -239,6 +247,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryStructuredFund", c.def("OnQueryStructuredFund",
@ -249,6 +258,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryFundTransfer", c.def("OnQueryFundTransfer",
@ -259,6 +269,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnFundTransfer", c.def("OnFundTransfer",
@ -269,6 +280,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryETF", c.def("OnQueryETF",
@ -279,6 +291,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryETFBasket", c.def("OnQueryETFBasket",
@ -289,6 +302,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryIPOInfoList", c.def("OnQueryIPOInfoList",
@ -299,6 +313,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryIPOQuotaInfo", c.def("OnQueryIPOQuotaInfo",
@ -309,6 +324,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryOptionAuctionInfo", c.def("OnQueryOptionAuctionInfo",
@ -319,6 +335,7 @@ void generate_class_XTP_API_TraderSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::TraderSpi, c); AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::TraderSpi, c);
@ -331,6 +348,8 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
std::unique_ptr<XTP::API::TraderApi, pybind11::nodelete>, std::unique_ptr<XTP::API::TraderApi, pybind11::nodelete>,
PyTraderApi PyTraderApi
> c(parent, "TraderApi"); > c(parent, "TraderApi");
if constexpr (std::is_default_constructible_v<PyTraderApi>)
c.def(pybind11::init<>());
c.def_static("CreateTraderApi", c.def_static("CreateTraderApi",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
autocxxpy::function_constant< autocxxpy::function_constant<
@ -339,6 +358,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Release", c.def("Release",
@ -349,6 +369,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetTradingDay", c.def("GetTradingDay",
@ -359,6 +380,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("RegisterSpi", c.def("RegisterSpi",
@ -369,6 +391,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetApiLastError", c.def("GetApiLastError",
@ -379,8 +402,8 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::return_value_policy::reference,
pybind11::return_value_policy::reference pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetApiVersion", c.def("GetApiVersion",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
@ -390,6 +413,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetClientIDByXTPID", c.def("GetClientIDByXTPID",
@ -400,6 +424,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetAccountByXTPID", c.def("GetAccountByXTPID",
@ -410,6 +435,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribePublicTopic", c.def("SubscribePublicTopic",
@ -420,6 +446,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SetSoftwareVersion", c.def("SetSoftwareVersion",
@ -430,6 +457,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SetSoftwareKey", c.def("SetSoftwareKey",
@ -440,6 +468,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SetHeartBeatInterval", c.def("SetHeartBeatInterval",
@ -450,6 +479,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Login", c.def("Login",
@ -460,6 +490,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Logout", c.def("Logout",
@ -470,6 +501,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("InsertOrder", c.def("InsertOrder",
@ -480,6 +512,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("CancelOrder", c.def("CancelOrder",
@ -490,6 +523,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryOrderByXTPID", c.def("QueryOrderByXTPID",
@ -500,6 +534,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryOrders", c.def("QueryOrders",
@ -510,6 +545,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryTradesByXTPID", c.def("QueryTradesByXTPID",
@ -520,6 +556,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryTrades", c.def("QueryTrades",
@ -530,6 +567,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryPosition", c.def("QueryPosition",
@ -540,6 +578,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryAsset", c.def("QueryAsset",
@ -550,6 +589,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryStructuredFund", c.def("QueryStructuredFund",
@ -560,6 +600,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("FundTransfer", c.def("FundTransfer",
@ -570,6 +611,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryFundTransfer", c.def("QueryFundTransfer",
@ -580,6 +622,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryETF", c.def("QueryETF",
@ -590,6 +633,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryETFTickerBasket", c.def("QueryETFTickerBasket",
@ -600,6 +644,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryIPOInfoList", c.def("QueryIPOInfoList",
@ -610,6 +655,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryIPOQuotaInfo", c.def("QueryIPOQuotaInfo",
@ -620,6 +666,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryOptionAuctionInfo", c.def("QueryOptionAuctionInfo",
@ -630,6 +677,7 @@ void generate_class_XTP_API_TraderApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::TraderApi, c); AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::TraderApi, c);

View File

@ -14,7 +14,7 @@
void generate_class_XTP_API_QuoteSpi(pybind11::object & parent) void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
{ {
pybind11::class_<XTP::API::QuoteSpi, PyQuoteSpi> c(parent, "QuoteSpi"); pybind11::class_<XTP::API::QuoteSpi, PyQuoteSpi> c(parent, "QuoteSpi");
if constexpr (std::is_default_constructible_v<XTP::API::QuoteSpi>) if constexpr (std::is_default_constructible_v<PyQuoteSpi>)
c.def(pybind11::init<>()); c.def(pybind11::init<>());
c.def("OnDisconnected", c.def("OnDisconnected",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
@ -24,6 +24,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnError", c.def("OnError",
@ -34,6 +35,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubMarketData", c.def("OnSubMarketData",
@ -44,6 +46,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubMarketData", c.def("OnUnSubMarketData",
@ -54,6 +57,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnDepthMarketData", c.def("OnDepthMarketData",
@ -64,6 +68,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubOrderBook", c.def("OnSubOrderBook",
@ -74,6 +79,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubOrderBook", c.def("OnUnSubOrderBook",
@ -84,6 +90,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnOrderBook", c.def("OnOrderBook",
@ -94,6 +101,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubTickByTick", c.def("OnSubTickByTick",
@ -104,6 +112,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubTickByTick", c.def("OnUnSubTickByTick",
@ -114,6 +123,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnTickByTick", c.def("OnTickByTick",
@ -124,6 +134,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllMarketData", c.def("OnSubscribeAllMarketData",
@ -134,6 +145,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllMarketData", c.def("OnUnSubscribeAllMarketData",
@ -144,6 +156,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllOrderBook", c.def("OnSubscribeAllOrderBook",
@ -154,6 +167,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllOrderBook", c.def("OnUnSubscribeAllOrderBook",
@ -164,6 +178,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllTickByTick", c.def("OnSubscribeAllTickByTick",
@ -174,6 +189,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllTickByTick", c.def("OnUnSubscribeAllTickByTick",
@ -184,6 +200,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryAllTickers", c.def("OnQueryAllTickers",
@ -194,6 +211,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnQueryTickersPriceInfo", c.def("OnQueryTickersPriceInfo",
@ -204,6 +222,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllOptionMarketData", c.def("OnSubscribeAllOptionMarketData",
@ -214,6 +233,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllOptionMarketData", c.def("OnUnSubscribeAllOptionMarketData",
@ -224,6 +244,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllOptionOrderBook", c.def("OnSubscribeAllOptionOrderBook",
@ -234,6 +255,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllOptionOrderBook", c.def("OnUnSubscribeAllOptionOrderBook",
@ -244,6 +266,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnSubscribeAllOptionTickByTick", c.def("OnSubscribeAllOptionTickByTick",
@ -254,6 +277,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("OnUnSubscribeAllOptionTickByTick", c.def("OnUnSubscribeAllOptionTickByTick",
@ -264,6 +288,7 @@ void generate_class_XTP_API_QuoteSpi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::QuoteSpi, c); AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::QuoteSpi, c);
@ -276,6 +301,8 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
std::unique_ptr<XTP::API::QuoteApi, pybind11::nodelete>, std::unique_ptr<XTP::API::QuoteApi, pybind11::nodelete>,
PyQuoteApi PyQuoteApi
> c(parent, "QuoteApi"); > c(parent, "QuoteApi");
if constexpr (std::is_default_constructible_v<PyQuoteApi>)
c.def(pybind11::init<>());
c.def_static("CreateQuoteApi", c.def_static("CreateQuoteApi",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
autocxxpy::function_constant< autocxxpy::function_constant<
@ -284,6 +311,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Release", c.def("Release",
@ -294,6 +322,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetTradingDay", c.def("GetTradingDay",
@ -304,6 +333,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetApiVersion", c.def("GetApiVersion",
@ -314,6 +344,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("GetApiLastError", c.def("GetApiLastError",
@ -324,8 +355,8 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::return_value_policy::reference,
pybind11::return_value_policy::reference pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SetUDPBufferSize", c.def("SetUDPBufferSize",
autocxxpy::apply_function_transform< autocxxpy::apply_function_transform<
@ -335,6 +366,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("RegisterSpi", c.def("RegisterSpi",
@ -345,6 +377,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SetHeartBeatInterval", c.def("SetHeartBeatInterval",
@ -355,6 +388,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeMarketData", c.def("SubscribeMarketData",
@ -363,9 +397,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::SubscribeMarketData &XTP::API::QuoteApi::SubscribeMarketData
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeMarketData", c.def("UnSubscribeMarketData",
@ -374,9 +409,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::UnSubscribeMarketData &XTP::API::QuoteApi::UnSubscribeMarketData
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeOrderBook", c.def("SubscribeOrderBook",
@ -385,9 +421,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::SubscribeOrderBook &XTP::API::QuoteApi::SubscribeOrderBook
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeOrderBook", c.def("UnSubscribeOrderBook",
@ -396,9 +433,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::UnSubscribeOrderBook &XTP::API::QuoteApi::UnSubscribeOrderBook
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeTickByTick", c.def("SubscribeTickByTick",
@ -407,9 +445,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::SubscribeTickByTick &XTP::API::QuoteApi::SubscribeTickByTick
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeTickByTick", c.def("UnSubscribeTickByTick",
@ -418,9 +457,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::UnSubscribeTickByTick &XTP::API::QuoteApi::UnSubscribeTickByTick
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllMarketData", c.def("SubscribeAllMarketData",
@ -431,6 +471,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllMarketData", c.def("UnSubscribeAllMarketData",
@ -441,6 +482,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllOrderBook", c.def("SubscribeAllOrderBook",
@ -451,6 +493,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllOrderBook", c.def("UnSubscribeAllOrderBook",
@ -461,6 +504,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllTickByTick", c.def("SubscribeAllTickByTick",
@ -471,6 +515,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllTickByTick", c.def("UnSubscribeAllTickByTick",
@ -481,6 +526,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Login", c.def("Login",
@ -491,6 +537,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("Logout", c.def("Logout",
@ -501,6 +548,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryAllTickers", c.def("QueryAllTickers",
@ -511,6 +559,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryTickersPriceInfo", c.def("QueryTickersPriceInfo",
@ -519,9 +568,10 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
&XTP::API::QuoteApi::QueryTickersPriceInfo &XTP::API::QuoteApi::QueryTickersPriceInfo
>, >,
brigand::list< brigand::list<
autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 1> autocxxpy::indexed_transform_holder<autocxxpy::string_array_transform, 0 + 1/*self*/>
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("QueryAllTickersPriceInfo", c.def("QueryAllTickersPriceInfo",
@ -532,6 +582,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllOptionMarketData", c.def("SubscribeAllOptionMarketData",
@ -542,6 +593,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllOptionMarketData", c.def("UnSubscribeAllOptionMarketData",
@ -552,6 +604,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllOptionOrderBook", c.def("SubscribeAllOptionOrderBook",
@ -562,6 +615,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllOptionOrderBook", c.def("UnSubscribeAllOptionOrderBook",
@ -572,6 +626,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("SubscribeAllOptionTickByTick", c.def("SubscribeAllOptionTickByTick",
@ -582,6 +637,7 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
c.def("UnSubscribeAllOptionTickByTick", c.def("UnSubscribeAllOptionTickByTick",
@ -592,32 +648,9 @@ void generate_class_XTP_API_QuoteApi(pybind11::object & parent)
brigand::list< brigand::list<
> >
>::value, >::value,
pybind11::return_value_policy::reference,
pybind11::call_guard<pybind11::gil_scoped_release>() pybind11::call_guard<pybind11::gil_scoped_release>()
); );
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::QuoteApi, c); AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTP::API::QuoteApi, c);
module_vnxtp::objects.emplace("XTP::API::QuoteApi", c); module_vnxtp::objects.emplace("XTP::API::QuoteApi", c);
} }
void generate_caster_XTP_API(pybind11::object & parent)
{
struct caster: autocxxpy::caster{};
auto c = autocxxpy::caster::bind<caster>(parent, "caster");
autocxxpy::caster::try_generate<XTP::API::TraderSpi>(c, "toTraderSpi)");
autocxxpy::caster::try_generate<XTP::API::TraderApi>(c, "toTraderApi)");
autocxxpy::caster::try_generate<XTP::API::QuoteSpi>(c, "toQuoteSpi)");
autocxxpy::caster::try_generate<XTP::API::QuoteApi>(c, "toQuoteApi)");
}
void generate_caster_XTP(pybind11::object & parent)
{
struct caster: autocxxpy::caster{};
auto c = autocxxpy::caster::bind<caster>(parent, "caster");
}
void generate_class_XTPRspInfoStruct(pybind11::object & parent)
{
pybind11::class_<XTPRspInfoStruct> c(parent, "XTPRspInfoStruct");
if constexpr (std::is_default_constructible_v<XTPRspInfoStruct>)
c.def(pybind11::init<>());
c.AUTOCXXPY_DEF_PROPERTY(tag_vnxtp, XTPRspInfoStruct, "error_id", error_id);
c.AUTOCXXPY_DEF_PROPERTY(tag_vnxtp, XTPRspInfoStruct, "error_msg", error_msg);
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTPRspInfoStruct, c);
module_vnxtp::objects.emplace("XTPRspInfoStruct", c);
}

View File

@ -11,6 +11,30 @@
#include "xtp_quote_api.h" #include "xtp_quote_api.h"
void generate_caster_XTP_API(pybind11::object & parent)
{
struct caster: autocxxpy::caster{};
auto c = autocxxpy::caster::bind<caster>(parent, "caster");
autocxxpy::caster::try_generate<XTP::API::TraderSpi>(c, "toTraderSpi)");
autocxxpy::caster::try_generate<XTP::API::TraderApi>(c, "toTraderApi)");
autocxxpy::caster::try_generate<XTP::API::QuoteSpi>(c, "toQuoteSpi)");
autocxxpy::caster::try_generate<XTP::API::QuoteApi>(c, "toQuoteApi)");
}
void generate_caster_XTP(pybind11::object & parent)
{
struct caster: autocxxpy::caster{};
auto c = autocxxpy::caster::bind<caster>(parent, "caster");
}
void generate_class_XTPRspInfoStruct(pybind11::object & parent)
{
pybind11::class_<XTPRspInfoStruct> c(parent, "XTPRspInfoStruct");
if constexpr (std::is_default_constructible_v<XTPRspInfoStruct>)
c.def(pybind11::init<>());
c.AUTOCXXPY_DEF_PROPERTY(tag_vnxtp, XTPRspInfoStruct, "error_id", error_id);
c.AUTOCXXPY_DEF_PROPERTY(tag_vnxtp, XTPRspInfoStruct, "error_msg", error_msg);
AUTOCXXPY_POST_REGISTER_CLASS(tag_vnxtp, XTPRspInfoStruct, c);
module_vnxtp::objects.emplace("XTPRspInfoStruct", c);
}
void generate_class_XTPSpecificTickerStruct(pybind11::object & parent) void generate_class_XTPSpecificTickerStruct(pybind11::object & parent)
{ {
pybind11::class_<XTPSpecificTickerStruct> c(parent, "XTPSpecificTickerStruct"); pybind11::class_<XTPSpecificTickerStruct> c(parent, "XTPSpecificTickerStruct");
@ -658,3 +682,15 @@ void generate_enum_XTP_ORDER_STATUS_TYPE(pybind11::object & parent)
e.export_values(); e.export_values();
module_vnxtp::objects.emplace("XTP_ORDER_STATUS_TYPE", e); module_vnxtp::objects.emplace("XTP_ORDER_STATUS_TYPE", e);
} }
void generate_enum_XTP_ORDER_SUBMIT_STATUS_TYPE(pybind11::object & parent)
{
pybind11::enum_<XTP_ORDER_SUBMIT_STATUS_TYPE> e(parent, "XTP_ORDER_SUBMIT_STATUS_TYPE", pybind11::arithmetic());
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_SUBMITTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_SUBMITTED);
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_ACCEPTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_ACCEPTED);
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_REJECTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_REJECTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_SUBMITTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_SUBMITTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_REJECTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_REJECTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_ACCEPTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_ACCEPTED);
e.export_values();
module_vnxtp::objects.emplace("XTP_ORDER_SUBMIT_STATUS_TYPE", e);
}

View File

@ -11,18 +11,6 @@
#include "xtp_quote_api.h" #include "xtp_quote_api.h"
void generate_enum_XTP_ORDER_SUBMIT_STATUS_TYPE(pybind11::object & parent)
{
pybind11::enum_<XTP_ORDER_SUBMIT_STATUS_TYPE> e(parent, "XTP_ORDER_SUBMIT_STATUS_TYPE", pybind11::arithmetic());
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_SUBMITTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_SUBMITTED);
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_ACCEPTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_ACCEPTED);
e.value("XTP_ORDER_SUBMIT_STATUS_INSERT_REJECTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_INSERT_REJECTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_SUBMITTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_SUBMITTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_REJECTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_REJECTED);
e.value("XTP_ORDER_SUBMIT_STATUS_CANCEL_ACCEPTED", XTP_ORDER_SUBMIT_STATUS_TYPE::XTP_ORDER_SUBMIT_STATUS_CANCEL_ACCEPTED);
e.export_values();
module_vnxtp::objects.emplace("XTP_ORDER_SUBMIT_STATUS_TYPE", e);
}
void generate_enum_XTP_TE_RESUME_TYPE(pybind11::object & parent) void generate_enum_XTP_TE_RESUME_TYPE(pybind11::object & parent)
{ {
pybind11::enum_<XTP_TE_RESUME_TYPE> e(parent, "XTP_TE_RESUME_TYPE", pybind11::arithmetic()); pybind11::enum_<XTP_TE_RESUME_TYPE> e(parent, "XTP_TE_RESUME_TYPE", pybind11::arithmetic());

View File

@ -22,6 +22,7 @@ void additional_init(pybind11::module &m)
void init_dispatcher(pybind11::module &m) void init_dispatcher(pybind11::module &m)
{ {
m.def("set_async_callback_exception_handler", &autocxxpy::async_callback_exception_handler::set_handler); m.def("set_async_callback_exception_handler", &autocxxpy::async_callback_exception_handler::set_handler);
pybind11::class_<autocxxpy::async_dispatch_exception> c(m, "AsyncDispatchException"); pybind11::class_<autocxxpy::async_dispatch_exception> c(m, "AsyncDispatchException");
c.def_property("what", &autocxxpy::async_dispatch_exception::what, nullptr); c.def_property("what", &autocxxpy::async_dispatch_exception::what, nullptr);
c.def_readonly("instance", &autocxxpy::async_dispatch_exception::instance); c.def_readonly("instance", &autocxxpy::async_dispatch_exception::instance);

View File

@ -9,6 +9,8 @@ struct module_vnxtp{
static inline void process_post_assign() static inline void process_post_assign()
{ {
cross.process_assign(objects); cross.process_assign(objects);
cross.clear();
objects.clear();
} }
}; };
using module_tag=tag_vnxtp; using module_tag=tag_vnxtp;

View File

@ -91,7 +91,7 @@ namespace autocxxpy
struct async_callback_exception_handler struct async_callback_exception_handler
{ {
using handler_type = std::function<void(const async_dispatch_exception&)>; using handler_type = std::function<bool(const async_dispatch_exception&)>;
static handler_type custom_handler; static handler_type custom_handler;
inline static void handle_excepiton(const async_dispatch_exception&e) inline static void handle_excepiton(const async_dispatch_exception&e)
@ -153,19 +153,19 @@ namespace autocxxpy
} }
template <class T> template <class T>
inline std::optional<T>& save(const T * val) inline std::optional<T> save(const T * val)
{ // match const pointer { // match const pointer
if (nullptr == val) AUTOCXXPY_UNLIKELY if (nullptr == val) AUTOCXXPY_UNLIKELY
{ {
return std::nullopt; return std::nullopt;
} }
return const_cast<T&>(*val); return *val;
} }
template <class T> template <class T>
inline T& save(const T & val) inline T save(const T & val)
{ // match everything else : just use original type { // match everything else : just use original type
return const_cast<T&>(val); return val;
} }

View File

@ -40,6 +40,11 @@ namespace autocxxpy
} }
} }
} }
void clear()
{
_delay_assings.clear();
}
private: private:
std::vector<std::tuple<pybind11::object, std::string, std::string, std::string>> _delay_assings; std::vector<std::tuple<pybind11::object, std::string, std::string, std::string>> _delay_assings;
}; };

View File

@ -2,6 +2,7 @@
#include "../base/type.h" #include "../base/type.h"
#include "../base/check.h" #include "../base/check.h"
#include "../utils/type_traits.hpp"
#include <boost/callable_traits.hpp> #include <boost/callable_traits.hpp>
#include "../brigand.hpp" #include "../brigand.hpp"
@ -14,6 +15,7 @@
#include <type_traits> #include <type_traits>
#include "./utils.hpp" #include "./utils.hpp"
#include <functional>
namespace autocxxpy namespace autocxxpy
{ {
@ -24,19 +26,22 @@ namespace autocxxpy
return [](Ls ... ls, base_t &arg, Rs ... rs) return [](Ls ... ls, base_t &arg, Rs ... rs)
{ {
constexpr auto method = method_constant::value; constexpr auto method = method_constant::value;
//using func_t = ct::function_type_t<decltype(method)>;
//using args_t = wrap<ct::args_t<func_t>, list>;
//using ret_t = ct::return_type_t<func_t>;
auto stdmethod = std::function<ct::function_type_t<decltype(method)>>(method);
if constexpr (std::is_void_v<ret_t>) if constexpr (std::is_void_v<ret_t>)
{ {
method(ls..., &arg, rs...); stdmethod(std::forward<Ls>(ls)..., &arg, std::forward<Rs>(rs)...);
return std::move(arg); return std::move(arg);
} }
else else
{ {
return append_as_tuple(method( return append_as_tuple(stdmethod(
ls..., std::forward<Ls>(ls)...,
&arg, &arg,
rs... std::forward<Rs>(rs)...
), std::move(arg)); ), std::move(arg));
} }
}; };
} }
@ -44,20 +49,21 @@ namespace autocxxpy
inline constexpr auto wrap_reference_argument_as_inout_impl(brigand::list<Ls...>, brigand::list <Rs...>) inline constexpr auto wrap_reference_argument_as_inout_impl(brigand::list<Ls...>, brigand::list <Rs...>)
{ {
namespace ct = boost::callable_traits; namespace ct = boost::callable_traits;
return [](Ls ... ls, base_t &arg, Rs ... rs) return [](Ls ... ls, base_t arg, Rs ... rs)
{ {
constexpr auto method = method_constant::value; constexpr auto method = method_constant::value;
auto stdmethod = std::function<ct::function_type_t<decltype(method)>>(method);
if constexpr (std::is_void_v<ret_t>) if constexpr (std::is_void_v<ret_t>)
{ {
method(ls..., arg, rs...); stdmethod(std::forward<Ls>(ls)..., arg, std::forward<Rs>(rs)...);
return arg; return arg;
} }
else else
{ {
return append_as_tuple(method( return append_as_tuple(stdmethod(
ls..., std::forward<Ls>(ls)...,
arg, arg,
rs... std::forward<Rs>(rs)...
), arg); ), arg);
} }

View File

@ -25,17 +25,18 @@ namespace autocxxpy
{ {
base_t arg; base_t arg;
constexpr auto method = method_constant::value; constexpr auto method = method_constant::value;
auto stdmethod = std::function<ct::function_type_t<decltype(method)>>(method);
if constexpr (std::is_void_v<ret_t>) if constexpr (std::is_void_v<ret_t>)
{ {
method(ls..., &arg, rs...); stdmethod(std::forward<Ls>(ls)..., &arg, std::forward<Rs>(rs)...);
return std::move(arg); return std::move(arg);
} }
else else
{ {
return append_as_tuple(method( return append_as_tuple(stdmethod(
ls..., std::forward<Ls>(ls)...,
&arg, &arg,
rs... std::forward<Rs>(rs)...
), std::move(arg)); ), std::move(arg));
} }
@ -49,17 +50,18 @@ namespace autocxxpy
{ {
base_t arg; base_t arg;
constexpr auto method = method_constant::value; constexpr auto method = method_constant::value;
auto stdmethod = std::function<ct::function_type_t<decltype(method)>>(method);
if constexpr (std::is_void_v<ret_t>) if constexpr (std::is_void_v<ret_t>)
{ {
method(ls..., arg, rs...); stdmethod(std::forward<Ls>(ls)..., arg, std::forward<Rs>(rs)...);
return arg; return arg;
} }
else else
{ {
return append_as_tuple(method( return append_as_tuple(stdmethod(
ls..., std::forward<Ls>(ls)...,
arg, arg,
rs... std::forward<Rs>(rs)...
), arg); ), arg);
} }

View File

@ -1,10 +1,13 @@
#pragma once #pragma once
#include "../utils/type_traits.hpp"
namespace autocxxpy namespace autocxxpy
{ {
template <class T, class T2> template <class T, class T2>
auto append_as_tuple(T&& v1, T2&& v2) auto append_as_tuple(T&& v1, T2&& v2)
{ {
return std::make_tuple<T, T2>(std::move(v1), std::move(v2)); return std::make_tuple<T, remove_cvref_t<T2>>(std::move(v1), std::move(v2));
} }
template <class ... Ts, class T2, size_t ... idx> template <class ... Ts, class T2, size_t ... idx>

View File

@ -140,7 +140,7 @@ class QuoteSpi():
... ...
def OnUnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any: def OnUnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
... ...
def OnDepthMarketData(self, market_data: XTPMarketDataStruct, bid1_qty: Sequence[int], bid1_count: int, max_bid1_count: int, ask1_qty: Sequence[int], ask1_count: int, max_ask1_count: int)->Any: def OnDepthMarketData(self, market_data: XTPMarketDataStruct, bid1_qty: List[int], bid1_count: int, max_bid1_count: int, ask1_qty: List[int], ask1_count: int, max_ask1_count: int)->Any:
... ...
def OnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any: def OnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->Any:
... ...
@ -204,17 +204,17 @@ class QuoteApi():
... ...
def SetHeartBeatInterval(self, interval: int)->Any: def SetHeartBeatInterval(self, interval: int)->Any:
... ...
def SubscribeMarketData(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def SubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def UnSubscribeMarketData(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def UnSubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def SubscribeOrderBook(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def SubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def UnSubscribeOrderBook(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def UnSubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def SubscribeTickByTick(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def SubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def UnSubscribeTickByTick(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def UnSubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def SubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int: def SubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
@ -234,7 +234,7 @@ class QuoteApi():
... ...
def QueryAllTickers(self, exchange_id: XTP_EXCHANGE_TYPE)->int: def QueryAllTickers(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def QueryTickersPriceInfo(self, ticker: Sequence[str], exchange_id: XTP_EXCHANGE_TYPE)->int: def QueryTickersPriceInfo(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
... ...
def QueryAllTickersPriceInfo(self, )->int: def QueryAllTickersPriceInfo(self, )->int:
... ...