#include "bind_td_api.h"

void bind_td_api(nb::module_ &m) {
    nb::class_<TdApi, PyTdApi> td_api(m, "TdApi");
    td_api
            .def(nb::init<>())
            .def("CreateTraderApi", &TdApi::CreateTraderApi)
            .def("Destroy", &TdApi::Destroy)
            .def("GetTradingDay", &TdApi::GetTradingDay)
            .def("GetApiVersion", &TdApi::GetApiVersion)
            .def("GetApiLastError", &TdApi::GetApiLastError)
            .def("GetClientIDByXTPID", &TdApi::GetClientIDByXTPID)
            .def("GetAccountByXTPID", &TdApi::GetAccountByXTPID)
            .def("SubscribePublicTopic", &TdApi::SubscribePublicTopic)
            .def("SetSoftwareVersion", &TdApi::SetSoftwareVersion)
            .def("SetSoftwareKey", &TdApi::SetSoftwareKey)
            .def("SetHeartBeatInterval", &TdApi::SetHeartBeatInterval)
            .def("Login", &TdApi::Login)
            .def("Logout", &TdApi::Logout)
            .def("IsServerRestart", &TdApi::IsServerRestart)
            .def("ModifyUserTerminalInfo", &TdApi::ModifyUserTerminalInfo)
            .def("QueryAccountTradeMarket", &TdApi::QueryAccountTradeMarket)
            .def("GetANewOrderXTPID", &TdApi::GetANewOrderXTPID)
            .def("InsertOrder", &TdApi::InsertOrder)
            .def("InsertOrderExtra", &TdApi::InsertOrderExtra)
            .def("CancelOrder", &TdApi::CancelOrder)
            .def("QueryOrderByXTPID", &TdApi::QueryOrderByXTPID)
            .def("QueryOrders", &TdApi::QueryOrders)
            .def("QueryUnfinishedOrders", &TdApi::QueryUnfinishedOrders)
            .def("QueryOrdersByPage", &TdApi::QueryOrdersByPage)
            .def("QueryOrderByXTPIDEx", &TdApi::QueryOrderByXTPIDEx)
            .def("QueryOrdersEx", &TdApi::QueryOrdersEx)
            .def("QueryUnfinishedOrdersEx", &TdApi::QueryUnfinishedOrdersEx)
            .def("QueryOrdersByPageEx", &TdApi::QueryOrdersByPageEx)
            .def("QueryTradesByXTPID", &TdApi::QueryTradesByXTPID)
            .def("QueryTrades", &TdApi::QueryTrades)
            .def("QueryTradesByPage", &TdApi::QueryTradesByPage)
            .def("QueryPosition", &TdApi::QueryPosition)
            .def("QueryAsset", &TdApi::QueryAsset)
            .def("QueryStructuredFund", &TdApi::QueryStructuredFund)
            .def("FundTransfer", &TdApi::FundTransfer)
            .def("QueryFundTransfer", &TdApi::QueryFundTransfer)
            .def("QueryOtherServerFund", &TdApi::QueryOtherServerFund)
            .def("QueryETF", &TdApi::QueryETF)
            .def("QueryETFTickerBasket", &TdApi::QueryETFTickerBasket)
            .def("QueryIPOInfoList", &TdApi::QueryIPOInfoList)
            .def("QueryIPOQuotaInfo", &TdApi::QueryIPOQuotaInfo)
            .def("QueryBondSwapStockInfo", &TdApi::QueryBondSwapStockInfo)
            .def("QueryOptionAuctionInfo", &TdApi::QueryOptionAuctionInfo)
            .def("CreditCashRepay", &TdApi::CreditCashRepay)
            .def("CreditCashRepayDebtInterestFee", &TdApi::CreditCashRepayDebtInterestFee)
            .def("CreditSellStockRepayDebtInterestFee", &TdApi::CreditSellStockRepayDebtInterestFee)
            .def("QueryCreditCashRepayInfo", &TdApi::QueryCreditCashRepayInfo)
            .def("QueryCreditFundInfo", &TdApi::QueryCreditFundInfo)
            .def("QueryCreditDebtInfo", &TdApi::QueryCreditDebtInfo)
            .def("QueryCreditTickerDebtInfo", &TdApi::QueryCreditTickerDebtInfo)
            .def("QueryCreditAssetDebtInfo", &TdApi::QueryCreditAssetDebtInfo)
            .def("QueryCreditTickerAssignInfo", &TdApi::QueryCreditTickerAssignInfo)
            .def("QueryCreditExcessStock", &TdApi::QueryCreditExcessStock)
            .def("QueryMulCreditExcessStock", &TdApi::QueryMulCreditExcessStock)
            .def("CreditExtendDebtDate", &TdApi::CreditExtendDebtDate)
            .def("QueryCreditExtendDebtDateOrders", &TdApi::QueryCreditExtendDebtDateOrders)
            .def("QueryCreditFundExtraInfo", &TdApi::QueryCreditFundExtraInfo)
            .def("QueryCreditPositionExtraInfo", &TdApi::QueryCreditPositionExtraInfo)
            .def("InsertOptionCombinedOrder", &TdApi::InsertOptionCombinedOrder)
            .def("InsertOptionCombinedOrderExtra", &TdApi::InsertOptionCombinedOrderExtra)
            .def("CancelOptionCombinedOrder", &TdApi::CancelOptionCombinedOrder)
            .def("QueryOptionCombinedUnfinishedOrders", &TdApi::QueryOptionCombinedUnfinishedOrders)
            .def("QueryOptionCombinedOrderByXTPID", &TdApi::QueryOptionCombinedOrderByXTPID)
            .def("QueryOptionCombinedOrders", &TdApi::QueryOptionCombinedOrders)
            .def("QueryOptionCombinedOrdersByPage", &TdApi::QueryOptionCombinedOrdersByPage)
            .def("QueryOptionCombinedUnfinishedOrdersEx", &TdApi::QueryOptionCombinedUnfinishedOrdersEx)
            .def("QueryOptionCombinedOrderByXTPIDEx", &TdApi::QueryOptionCombinedOrderByXTPIDEx)
            .def("QueryOptionCombinedOrdersEx", &TdApi::QueryOptionCombinedOrdersEx)
            .def("QueryOptionCombinedOrdersByPageEx", &TdApi::QueryOptionCombinedOrdersByPageEx)
            .def("QueryOptionCombinedTradesByXTPID", &TdApi::QueryOptionCombinedTradesByXTPID)
            .def("QueryOptionCombinedTrades", &TdApi::QueryOptionCombinedTrades)
            .def("QueryOptionCombinedTradesByPage", &TdApi::QueryOptionCombinedTradesByPage)
            .def("QueryOptionCombinedPosition", &TdApi::QueryOptionCombinedPosition)
            .def("QueryOptionCombinedStrategyInfo", &TdApi::QueryOptionCombinedStrategyInfo)
            .def("QueryOptionCombinedExecPosition", &TdApi::QueryOptionCombinedExecPosition)
            .def("LoginALGO", &TdApi::LoginALGO)
            .def("QueryStrategy", &TdApi::QueryStrategy)
            .def("ALGOUserEstablishChannel", &TdApi::ALGOUserEstablishChannel)
            .def("InsertAlgoOrder", &TdApi::InsertAlgoOrder)
            .def("CancelAlgoOrder", &TdApi::CancelAlgoOrder)
            .def("GetAlgorithmIDByOrder", &TdApi::GetAlgorithmIDByOrder)
            .def("StrategyRecommendation", &TdApi::StrategyRecommendation)

            // On Methods
            .def("OnDisconnected", &TdApi::PyOnDisconnected)
            .def("OnError", &TdApi::PyOnError)
            .def("OnQueryAccountTradeMarket", &TdApi::PyOnQueryAccountTradeMarket)
            .def("OnOrderEvent", &TdApi::PyOnOrderEvent)
            .def("OnTradeEvent", &TdApi::PyOnTradeEvent)
            .def("OnCancelOrderError", &TdApi::PyOnCancelOrderError)
            .def("OnQueryOrder", &TdApi::PyOnQueryOrder)
            .def("OnQueryOrderEx", &TdApi::PyOnQueryOrderEx)
            .def("OnQueryOrderByPage", &TdApi::PyOnQueryOrderByPage)
            .def("OnQueryOrderByPageEx", &TdApi::PyOnQueryOrderByPageEx)
            .def("OnQueryTrade", &TdApi::PyOnQueryTrade)
            .def("OnQueryTradeByPage", &TdApi::PyOnQueryTradeByPage)
            .def("OnQueryPosition", &TdApi::PyOnQueryPosition)
            .def("OnQueryAsset", &TdApi::PyOnQueryAsset)
            .def("OnQueryStructuredFund", &TdApi::PyOnQueryStructuredFund)
            .def("OnQueryFundTransfer", &TdApi::PyOnQueryFundTransfer)
            .def("OnFundTransfer", &TdApi::PyOnFundTransfer)
            .def("OnQueryOtherServerFund", &TdApi::PyOnQueryOtherServerFund)
            .def("OnQueryETF", &TdApi::PyOnQueryETF)
            .def("OnQueryETFBasket", &TdApi::PyOnQueryETFBasket)
            .def("OnQueryIPOInfoList", &TdApi::PyOnQueryIPOInfoList)
            .def("OnQueryIPOQuotaInfo", &TdApi::PyOnQueryIPOQuotaInfo)
            .def("OnQueryBondSwapStockInfo", &TdApi::OnQueryBondSwapStockInfo)
            .def("OnQueryOptionAuctionInfo", &TdApi::PyOnQueryOptionAuctionInfo)
            .def("OnCreditCashRepay", &TdApi::PyOnCreditCashRepay)
            .def("OnCreditCashRepayDebtInterestFee", &TdApi::PyOnCreditCashRepayDebtInterestFee)
            .def("OnQueryCreditCashRepayInfo", &TdApi::PyOnQueryCreditCashRepayInfo)
            .def("OnQueryCreditFundInfo", &TdApi::PyOnQueryCreditFundInfo)
            .def("OnQueryCreditDebtInfo", &TdApi::PyOnQueryCreditDebtInfo)
            .def("OnQueryCreditTickerDebtInfo", &TdApi::PyOnQueryCreditTickerDebtInfo)
            .def("OnQueryCreditAssetDebtInfo", &TdApi::PyOnQueryCreditAssetDebtInfo)
            .def("OnQueryCreditTickerAssignInfo", &TdApi::PyOnQueryCreditTickerAssignInfo)
            .def("OnQueryCreditExcessStock", &TdApi::PyOnQueryCreditExcessStock)
            .def("OnQueryMulCreditExcessStock", &TdApi::PyOnQueryMulCreditExcessStock)
            .def("OnCreditExtendDebtDate", &TdApi::PyOnCreditExtendDebtDate)
            .def("OnQueryCreditExtendDebtDateOrders", &TdApi::PyOnQueryCreditExtendDebtDateOrders)
            .def("OnQueryCreditFundExtraInfo", &TdApi::PyOnQueryCreditFundExtraInfo)
            .def("OnQueryCreditPositionExtraInfo", &TdApi::PyOnQueryCreditPositionExtraInfo)
            .def("OnOptionCombinedOrderEvent", &TdApi::PyOnOptionCombinedOrderEvent)
            .def("OnOptionCombinedTradeEvent", &TdApi::PyOnOptionCombinedTradeEvent)
            .def("OnCancelOptionCombinedOrderError", &TdApi::PyOnCancelOptionCombinedOrderError)
            .def("OnQueryOptionCombinedOrders", &TdApi::PyOnQueryOptionCombinedOrders)
            .def("OnQueryOptionCombinedOrdersEx", &TdApi::PyOnQueryOptionCombinedOrdersEx)
            .def("OnQueryOptionCombinedOrdersByPage", &TdApi::PyOnQueryOptionCombinedOrdersByPage)
            .def("OnQueryOptionCombinedOrdersByPageEx", &TdApi::PyOnQueryOptionCombinedOrdersByPageEx)
            .def("OnQueryOptionCombinedTrades", &TdApi::PyOnQueryOptionCombinedTrades)
            .def("OnQueryOptionCombinedTradesByPage", &TdApi::PyOnQueryOptionCombinedTradesByPage)
            .def("OnQueryOptionCombinedPosition", &TdApi::PyOnQueryOptionCombinedPosition)
            .def("OnQueryOptionCombinedStrategyInfo", &TdApi::PyOnQueryOptionCombinedStrategyInfo)
            .def("OnQueryOptionCombinedExecPosition", &TdApi::PyOnQueryOptionCombinedExecPosition)
            .def("OnQueryStrategy", &TdApi::PyOnQueryStrategy)
            .def("OnStrategyStateReport", &TdApi::PyOnStrategyStateReport)
            .def("OnALGOUserEstablishChannel", &TdApi::PyOnALGOUserEstablishChannel)
            .def("OnInsertAlgoOrder", &TdApi::PyOnInsertAlgoOrder)
            .def("OnCancelAlgoOrder", &TdApi::PyOnCancelAlgoOrder)
            .def("OnAlgoDisconnected", &TdApi::PyOnAlgoDisconnected)
            .def("OnAlgoConnected", &TdApi::PyOnAlgoConnected)
            .def("OnStrategySymbolStateReport", &TdApi::PyOnStrategySymbolStateReport)
            .def("OnNewStrategyCreateReport", &TdApi::PyOnNewStrategyCreateReport)
            .def("OnStrategyRecommendation", &TdApi::PyOnStrategyRecommendation)
            ;
}
