### MIT/LIT Order Example Configuration Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq_rithmic.md Provides an example of how to configure parameters for a MIT/LIT order, specifically a limit order triggered by a trade price condition. ```plaintext OrderParams::sOrderType - RApi::sORDER_TYPE_LMT_IF_TOUCHED OrderParams::sTriggerTicker - ESH0 OrderParams::sTriggerExchange - CME OrderParams::dTriggerPrice - 1200.00 OrderParams::iTriggerCmpOperator - RApi::OP_GREATER_THAN OrderParams::iTriggerPriceId - RApi::TRADE_PRICE ``` -------------------------------- ### Linux GCC/g++ Compile and Link Example Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/programmers_guide.md Example compile and link command for a C++ application on 64-bit Linux using GCC/g++. It includes optimization, defines, warnings, include paths, output file, source file, library paths, and linked libraries. ```bash g++ -O3 -DLINUX -D_REENTRANT -Wall -Wno-sign-compare -Wno-write-strings -Wpointer-arith -Winline -Wno-deprecated -fno-strict-aliasing -I../include -o SampleMD ../samples/SampleMD.cpp -L../linux-gnu-3.10.0-x86_64/lib -lRApiPlus-optimize -lOmneStreamEngine-optimize -lOmneChannel-optimize -lOmneEngine-optimize -l_api-optimize -l_apipoll-stubs-optimize -l_kit-optimize -lssl -lcrypto -L/usr/lib64 -lz -lpthread -lrt -ldl ``` -------------------------------- ### Start DTC Server with DTCServer::start Source: https://context7.com/gagogago50/sdk1/llms.txt Creates a Winsock TCP socket, sets TCP_NODELAY, binds to a port, and spawns an acceptLoop thread. Each accepted client gets its own clientLoop thread. ```cpp // DTCServer.cpp — start listening bool DTCServer::start(uint16_t port) { m_listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); int flag = 1; setsockopt(m_listenSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int)); // mandatory: disable Nagle sockaddr_in addr = {}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = htons(port); bind(m_listenSocket, (sockaddr*)&addr, sizeof(addr)); listen(m_listenSocket, SOMAXCONN); m_running = true; m_acceptThread = std::thread(&DTCServer::acceptLoop, this); return true; } ``` -------------------------------- ### Bridge Configuration Loading and Usage Source: https://context7.com/gagogago50/sdk1/llms.txt Demonstrates how to load configuration from a file, set specific parameters, and save the updated configuration. Ensure the configuration file path is correct. ```cpp // Usage: load on startup, save on connect Utils::ConfigManager::LoadConfig("bridge_config.ini"); g_Config.rithmicUser = "myUser"; g_Config.rithmicPassword = "myPass"; g_Config.dtcPort = 11099; g_Config.useMBO = true; // enable depth-by-order Utils::ConfigManager::SaveConfig("bridge_config.ini"); ``` -------------------------------- ### Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Initializes a new instance of the REngine class. ```APIDOC ## REngine ### Description Constructor for the REngine class. ### Method REngine (REngineParams *pParams) ### Parameters - **pParams** (REngineParams *) - Pointer to a structure containing parameters for initializing the engine. ``` -------------------------------- ### startTimer Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Starts a specified timer. ```APIDOC ## startTimer() ### Description Starts the timer specified by pTimer. ### Parameters - **pTimer** (*tsNCharcb*const *) - The timer to start. - **aiCode** (*int* *) - Address of an integer to contain the return code of this routine. ### See also REngine::addTimer REngine::removeTimer REngine::stopTimer ``` -------------------------------- ### ProductRmsListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/ProductRmsListInfo.md Initializes all members of the ProductRmsListInfo object. Integer and double members are set to zero, boolean members to false, and pointers to NULL. Specific string members are initialized to empty data items. ```APIDOC ## ProductRmsListInfo() ### Description Initializes all members of the ProductRmsListInfo object. Integer and double members are set to zero, boolean members to false, and pointers to NULL. Specific string members are initialized to empty data items. ### Parameters None ``` -------------------------------- ### Initialize RithmicClient REngine Source: https://context7.com/gagogago50/sdk1/llms.txt Initializes the REngine with required environment variables. Must be called before login. Throws OmneException on failure. ```cpp // From RithmicClient.cpp — init() builds the fake envp and constructs REngine bool RithmicClient::init(const BridgeConfig& config) { if (m_engine) return true; // idempotent m_admCallbacks = new MyAdmCallbacks(this); static std::string userEnv = "USER=" + config.rithmicUser; static std::string sslEnv = "MML_SSL_CLNT_AUTH_FILE=" + config.sslCertPath; // Environment variables required by Rithmic SDK (Rithmic Test system) static char* envp[] = { (char*)"MML_DMN_SRVR_ADDR=rituz00100.00.rithmic.com:65000~rituz00100.00.rithmic.net:65000", (char*)"MML_DOMAIN_NAME=rithmic_uat_dmz_domain", (char*)"MML_LIC_SRVR_ADDR=rituz00100.00.rithmic.com:56000~rituz00100.00.rithmic.net:56000", (char*)"MML_LOC_BROK_ADDR=rituz00100.00.rithmic.com:64100", (char*)"MML_LOGGER_ADDR=rituz00100.00.rithmic.com:45454~rituz00100.00.rithmic.net:45454", (char*)"MML_LOG_TYPE=log_net", (char*)"RAPI_MD_ENCODING=4", (char*)"RAPI_IH_ENCODING=4", (char*)sslEnv.c_str(), (char*)userEnv.c_str(), nullptr }; RApi::REngineParams reParams = {}; reParams.sAppName.pData = (char*)"RithmicDTCBridge"; reParams.sAppName.iDataLen = (int)strlen(reParams.sAppName.pData); reParams.sAppVersion.pData = (char*)"1.0"; reParams.sAppVersion.iDataLen = 3; reParams.envp = envp; reParams.pAdmCallbacks = m_admCallbacks; reParams.sLogFilePath.pData = (char*)"bridge_rithmic.log"; reParams.sLogFilePath.iDataLen = (int)strlen(reParams.sLogFilePath.pData); try { m_engine = new RApi::REngine(&reParams); // throws OmneException on failure m_callbacks = new MyCallbacks(this); } catch (OmneException& e) { Utils::Logger::Log("Engine init failed: " + std::to_string(e.getErrorCode())); return false; // caller checks return value } return true; } // Typical startup sequence RithmicClient client; if (client.init(g_Config)) { client.login(); } else { // check bridge_rithmic.log for OmneException error code } ``` -------------------------------- ### Compact JSON Encoding Example Source: https://github.com/gagogago50/sdk1/blob/main/DTC doc/14_DTCProtocol.md Example of a s_MarketDataUpdateTrade message using Compact JSON Encoding. The 'Type' field must be first, followed by the 'F' field containing an array of message values in the order of the DTC Binary Encoding. ```json {"Type":107, "F":[1, 0, 2058.75, 12, 1456736458]} ``` -------------------------------- ### ProductRmsInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/ProductRmsInfo.md Initializes all members of the ProductRmsInfo class. Numeric members are set to zero, boolean members to false, and pointers to NULL. String members are initialized with empty data. ```APIDOC ## ProductRmsInfo() ### Description Initializes all members of the ProductRmsInfo class. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Signature ProductRmsInfo::ProductRmsInfo() ``` -------------------------------- ### iStartUsecs Member Data Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/BarInfo.md The start time in microseconds for the bar. ```APIDOC ## iStartUsecs ### Description The start time in microseconds for the bar. ``` -------------------------------- ### Context and Configuration Methods Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Methods for setting context and environment variables. ```APIDOC ## setContext ### Description Sets the user-defined context for operations. ### Method int setContext (void *pContext, int *aiCode) ### Parameters - **pContext** (void *) - Pointer to the user-defined context. - **aiCode** (int *) - Pointer to an integer for returning status codes. ``` ```APIDOC ## setEnvironmentVariable ### Description Sets an environment variable within the Rithmic system. ### Method int setEnvironmentVariable (tsNCharcb *pKey, tsNCharcb *pVariable, tsNCharcb *pValue, int *aiCode) ### Parameters - **pKey** (tsNCharcb *) - The key of the environment variable. - **pVariable** (tsNCharcb *) - The variable name. - **pValue** (tsNCharcb *) - The value to set. - **aiCode** (int *) - Pointer to an integer for returning status codes. ``` ```APIDOC ## setOrderContext ### Description Sets the user-defined context for a specific order. ### Method int setOrderContext (tsNCharcb *pOrderNum, void *pContext, int *aiCode) ### Parameters - **pOrderNum** (tsNCharcb *) - The order number. - **pContext** (void *) - Pointer to the user-defined context. - **aiCode** (int *) - Pointer to an integer for returning status codes. ``` -------------------------------- ### BarReplayInfo::sStartDate Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/replay/BarReplayInfo.md The start date that was provided in the initial replay call. ```APIDOC ## BarReplayInfo::sStartDate ### Description The start date passed in the initial call. ``` -------------------------------- ### sTradeRoute Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/params/LimitOrderParams.md Specifies the trade route. This parameter is required starting with version 6.1.0.0. ```APIDOC ## sTradeRoute | RApi::LimitOrderParams::sTradeRoute | | --- | Specifies the trade route. Beginning with version 6.1.0.0 this parameter is required. ``` -------------------------------- ### BarInfo::iStartUsecs Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/BarInfo.md Identifies the microseconds portion of the time of the start time of the bar. ```APIDOC ## BarInfo::iStartUsecs | BarInfo::iStartUsecs | | --- | Identifies the microseconds portion of the time of the start time of the bar. ``` -------------------------------- ### EquityOptionStrategyListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/EquityOptionStrategyListInfo.md Initializes all members of the EquityOptionStrategyListInfo object. Sets default values for data structures and pointers. ```APIDOC ## EquityOptionStrategyListInfo() ### Description Initializes all members of the EquityOptionStrategyListInfo object. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Method EquityOptionStrategyListInfo::EquityOptionStrategyListInfo() ``` -------------------------------- ### StrategyListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/StrategyListInfo.md Initializes all members of the StrategyListInfo object. Data pointers are set to MNM_EMPTY_DATA_ITEM, lengths to MNM_EMPTY_DATA_ITEM_LEN, numeric types to zero, and pointers to NULL. ```APIDOC ## StrategyListInfo() ### Description Initializes all members of the StrategyListInfo object. Data pointers are set to MNM_EMPTY_DATA_ITEM, lengths to MNM_EMPTY_DATA_ITEM_LEN, numeric types to zero, and pointers to NULL. ### Method StrategyListInfo::StrategyListInfo() ``` -------------------------------- ### BarInfo::iStartSsboe Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/BarInfo.md Identifies the second (in ssboe format) of the start time of the bar. ```APIDOC ## BarInfo::iStartSsboe | BarInfo::iStartSsboe | | --- | Identifies the second (in ssboe format) of the start time of the bar. ``` -------------------------------- ### DboBookRebuildInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/DboBookRebuildInfo.md Initializes all members of the DboBookRebuildInfo object. String members are initialized to empty, and numeric and boolean members are set to zero and false, respectively. ```APIDOC ## DboBookRebuildInfo() ### Description Initializes all members of the DboBookRebuildInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method `DboBookRebuildInfo::DboBookRebuildInfo()` ``` -------------------------------- ### iStartSsboe Member Data Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/BarInfo.md The start SSBOE (Systematic Sampling Based On Exchange) value for the bar. ```APIDOC ## iStartSsboe ### Description The start SSBOE (Systematic Sampling Based On Exchange) value for the bar. ``` -------------------------------- ### DTC_VLS Namespace Example Source: https://github.com/gagogago50/sdk1/blob/main/DTC doc/01_DTCMessageDocumentation.md Illustrates the namespace used for DTC Binary Encoding with Variable Length Strings. ```c++ DTC_VLS::s_LogonRequest ``` -------------------------------- ### listEnvironments Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Lists available environments. ```APIDOC ## listEnvironments ### Description Lists available environments. ### Signature `int listEnvironments(void *pContext, int *aiCode)` ### Parameters - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Output parameter for the operation code. ``` -------------------------------- ### UserInfo::sLastLoginRemarks Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/UserInfo.md Provides remarks pertaining to the last login result. For example, 'invalid credentials' if the login result was 'rejected'. ```APIDOC ## UserInfo::sLastLoginRemarks ### Description Remarks pertaining to the last login result, such as "invalid credentials" for a result of "rejected". ### Type string ``` -------------------------------- ### REngine::listEnvironments Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Retrieves a list of all available environment keys, including the default environment. The list is returned via the AdmCallbacks::EnvironmentList() callback. ```APIDOC ## REngine::listEnvironments() ### Description Retrieves a list of all available environment keys, including the default environment of "system" from REngineParams::envp. The list will be returned via AdmCallbacks::EnvironmentList(). ### Parameters - **pContext** (void *) - Optional. Specifies a context pointer that will be returned with the callback conveying the results. - **aiCode** (int *) - Required. Address of an integer to contain the return code of this routine. ### See also AdmCallbacks::EnvironmentList(), EnvironmentListInfo, REngine::getEnvironment(), REngine::setEnvironmentVariable(), REngine::unsetEnvironmentVariable(), Connecting to Multiple Rithmic Systems Simultaneously Using Environments ``` -------------------------------- ### StrategyLegInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/StrategyLegInfo.md Initializes all members of the StrategyLegInfo object. Numeric and boolean members are set to zero/false, and pointers are set to NULL. String data items are initialized to empty. ```APIDOC ## StrategyLegInfo() ### Description Initializes all of the members. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Parameters None ``` -------------------------------- ### OrderHistoryDates Callback Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/RCallbacks.md Callback for retrieving order history dates. This method is invoked to get the available dates for order history. ```APIDOC ## OrderHistoryDates ### Description Callback for retrieving order history dates. ### Signature virtual int OrderHistoryDates (OrderHistoryDatesInfo *pInfo, void *pContext, int *aiCode) ### Parameters - **pInfo** (OrderHistoryDatesInfo *) - Pointer to the OrderHistoryDatesInfo structure containing the dates. - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Pointer to an integer code indicating the status or result. ``` -------------------------------- ### RithmicClient::init Source: https://context7.com/gagogago50/sdk1/llms.txt Initializes the REngine with required environment variables for Rithmic connectivity. This method must be called once before login(). It handles potential initialization failures by returning false. ```APIDOC ## RithmicClient::init — Initialize the REngine `RithmicClient::init` constructs the `RApi::REngine` with the environment variables required for Rithmic connectivity (domain server, license server, SSL cert path, logger). It must be called once before `login()`. Throws `OmneException` on failure; the wrapper catches it and returns `false`. ### Method bool ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp RithmicClient client; if (client.init(g_Config)) { // Initialization successful, proceed to login } else { // Handle initialization failure, check logs } ``` ### Response #### Success Response (true) Returns `true` if the engine was initialized successfully. #### Failure Response (false) Returns `false` if initialization fails. Error details can be found in `bridge_rithmic.log`. ### Error Handling Throws `OmneException` on failure, which is caught internally and results in a `false` return value. ``` -------------------------------- ### JSON Encoding Example Source: https://github.com/gagogago50/sdk1/blob/main/DTC doc/14_DTCProtocol.md Illustrates a s_MarketDataUpdateTrade message encoded in JSON format. The 'Type' field should be first, but other field orders do not matter. ```json {"Type":107, "SymbolID":1, "AtBidOrAsk":0, "Price":2058.75, "Volume":12, "DateTime":1456736458} ``` -------------------------------- ### InstrumentByUnderlying Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/RCallbacks.md Callback function to get instruments by their underlying symbol. It takes an InstrumentByUnderlyingInfo structure, a context pointer, and an integer pointer for status code. ```APIDOC ## InstrumentByUnderlying ### Description Callback function to get instruments by their underlying symbol. ### Method Signature virtual int InstrumentByUnderlying (InstrumentByUnderlyingInfo *pInfo, void *pContext, int *aiCode) ### Parameters - **pInfo** (InstrumentByUnderlyingInfo *) - Pointer to a structure containing instrument information by underlying. - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Pointer to an integer for status code. ``` -------------------------------- ### AccountInfo() Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/AccountInfo.md Initializes all members of the AccountInfo class. Integer and double members are set to zero, pointers are set to NULL, and string data lengths are set to zero. ```APIDOC ## AccountInfo() ### Description Initializes all members of the AccountInfo class. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Pointers to arrays are initialized to NULL, and their lengths are set to zero. ### Signature AccountInfo::AccountInfo() ``` -------------------------------- ### REngine Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Initializes the REngine class, setting up internal data structures and connecting to the Rithmic infrastructure. The provided parameters are copied, so they do not need to be preserved after the call. An OmneException is thrown on failure. ```cpp REngine::REngine( REngineParams * pParams ) ``` -------------------------------- ### BestBidQuote Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/RCallbacks.md Callback function to get the best bid quote. It uses a BidInfo structure, a context pointer, and an integer pointer for status code. ```APIDOC ## BestBidQuote ### Description Callback function to get the best bid quote. ### Method Signature virtual int BestBidQuote (BidInfo *pInfo, void *pContext, int *aiCode) ### Parameters - **pInfo** (BidInfo *) - Pointer to a structure containing the best bid quote information. - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Pointer to an integer for status code. ``` -------------------------------- ### BestAskQuote Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/RCallbacks.md Callback function to get the best ask quote. It uses an AskInfo structure, a context pointer, and an integer pointer for status code. ```APIDOC ## BestAskQuote ### Description Callback function to get the best ask quote. ### Method Signature virtual int BestAskQuote (AskInfo *pInfo, void *pContext, int *aiCode) ### Parameters - **pInfo** (AskInfo *) - Pointer to a structure containing the best ask quote information. - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Pointer to an integer for status code. ``` -------------------------------- ### Replay All Orders Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq_rithmic.md Use replayAllOrders to get a snapshot of all orders from the current trading session. Call subscribeOrder first to ensure no updates are missed. ```cpp REngine::replayAllOrders() ``` -------------------------------- ### LowPriceLimitInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/LowPriceLimitInfo.md Initializes all members of the LowPriceLimitInfo object. Integer and double members are set to zero, boolean members to false, and the pData of tsNCharcb members to NULL with a length of zero. ```APIDOC ## LowPriceLimitInfo() ### Description This constructor initializes all of the members. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method LowPriceLimitInfo::LowPriceLimitInfo() ``` -------------------------------- ### Replay Open Orders Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq_rithmic.md Use replayOpenOrders to get a snapshot of only the open orders at the current moment. Call subscribeOrder first to ensure no updates are missed. ```cpp REngine::replayOpenOrders() ``` -------------------------------- ### EasyToBorrowInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/EasyToBorrowInfo.md Initializes all members of the EasyToBorrowInfo object. Sets pData of tsNCharcb to NULL, iDataLen to zero, numeric members to zero, and boolean members to false. ```APIDOC ## EasyToBorrowInfo() ### Description Initializes all of the members. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method EasyToBorrowInfo::EasyToBorrowInfo() ``` -------------------------------- ### clearHandles() Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/ProductRmsInfo.md Initializes all members of the ProductRmsInfo class, similar to the constructor. It resets string data and lengths, and sets the size member to zero. ```APIDOC ## clearHandles() ### Description This routine initializes all of the members. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. The lSize member variable is initialized to zero. ### Signature int ProductRmsInfo::clearHandles(int *aiCode) ``` -------------------------------- ### BestBidAskQuote Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/RCallbacks.md Callback function to get the best bid and ask quotes. It takes BidInfo and AskInfo structures, a context pointer, and an integer pointer for status code. ```APIDOC ## BestBidAskQuote ### Description Callback function to get the best bid and ask quotes. ### Method Signature virtual int BestBidAskQuote (BidInfo *pBid, AskInfo *pAsk, void *pContext, int *aiCode) ### Parameters - **pBid** (BidInfo *) - Pointer to a structure containing the best bid quote information. - **pAsk** (AskInfo *) - Pointer to a structure containing the best ask quote information. - **pContext** (void *) - User-defined context pointer. - **aiCode** (int *) - Pointer to an integer for status code. ``` -------------------------------- ### Get Reference Data for Instrument Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq_rithmic.md Use getRefData to verify symbol and ticker information for an instrument. This method works even without market data permissions. ```cpp REngine::getRefData() ``` -------------------------------- ### BidInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/BidInfo.md Initializes all members of the BidInfo object. Integer and double members are set to zero, boolean members to false, and tsNCharcb data pointers to NULL with zero length. ```APIDOC ## BidInfo() ### Description Initializes all members of the BidInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method BidInfo::BidInfo() ``` -------------------------------- ### iTrailByPriceId Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/params/BracketParams.md Indicates the price type used for trailing stops, used with BracketParams::bTrailingStop. For example, 'trade price' makes the trailing stop follow the most recent trade price. ```APIDOC ## iTrailByPriceId | BracketParams::iTrailByPriceId | | --- | Indicates the price type used by the trailing stop. This setting is used in conjunction with BracketParams::bTrailingStop. For example, specifying trade price will cause the trailing stop to follow the most recent trade price. **See also** BracketParams::bTrailingStop RApi::BEST_ASK_PRICE RApi::BEST_BID_PRICE RApi::TRADE_PRICE ``` -------------------------------- ### AccountListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/AccountListInfo.md Initializes all members of the AccountListInfo object. Integer and double members are set to zero, boolean members to false, and pointers to NULL. ```APIDOC ## AccountListInfo() ### Description Initializes all members of the AccountListInfo object. Pointers are set to NULL, numeric types to zero, and booleans to false. ### Method AccountListInfo::AccountListInfo() ``` -------------------------------- ### REngine::listBinaryContracts Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Requests a list of binary contracts. This method allows for progressively detailed retrieval of binary contract information, starting from a list of exchanges to specific contracts within a product code. ```APIDOC ## REngine::listBinaryContracts() ### Description Requests a list of binary contracts. This method allows for progressively detailed retrieval of binary contract information, starting from a list of exchanges to specific contracts within a product code. - If no exchange is passed, the callback will return a list of exchanges for which supported binary contracts exist. (BinaryContractListInfo::pExchangeArray) - If an exchange is passed, the callback will return a list of product codes within the specified exchange for which supported binary contracts exist (BinaryContractListInfo::pProductCodeArray). - If an exchange and product code are passed into the method, the callback will return a list of RefDataInfo objects representing all matching binary contracts in that product code within that exchange. (BinaryContractListInfo::asRefDataInfoArray). The intent of this method is to "drill down" to discover a list of binary contracts that are available. ### Parameters - **pExchange** (tsNCharcb *) - Exchange identifier for filtering binary contracts. - **pProductCode** (tsNCharcb *) - Product code identifier for filtering binary contracts. - **pContext** (void *) - Optional. Specifies a context pointer that will be returned with the callback conveying the results. - **aiCode** (int *) - Required. Address of an integer to contain the return code of this routine. ### See also BinaryContractListInfo, RCallbacks::BinaryContractList, REngine::subscribeByUnderlying ``` -------------------------------- ### getOptionList() Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Requests a list of options, allowing for drill-down by exchange, product code, and expiration date. ```APIDOC ## getOptionList() ### Description Requests a list of options. The method allows for progressively specific requests by providing exchange, product code, and expiration date. - If no exchange is passed, the callback will return a list of exchanges for which supported options exist. - If an exchange is passed, the callback will return a list of product codes within the specified exchange. - If an exchange and product code are passed, the callback will return a list of expiration dates. - If an exchange, product code, and expiration date are passed, the callback will return an array of RefDataInfos. ### Signature `int REngine::getOptionList(tsNCharcb *pExchange, tsNCharcb *pProductCode, tsNCharcb *pExpirationCCYYMM, void *pContext, int *aiCode)` ``` -------------------------------- ### DTCServer::start / stop — TCP DTC Server Lifecycle Source: https://context7.com/gagogago50/sdk1/llms.txt Manages the lifecycle of the TCP DTC Server. `start` initializes the server and begins listening for connections, while `stop` provides a thread-safe shutdown. ```APIDOC ## DTCServer::start / stop — TCP DTC Server Lifecycle ### Description `DTCServer::start` creates a Winsock TCP socket, sets `TCP_NODELAY`, binds to the given port, and spawns an `acceptLoop` thread. Each accepted client gets its own `clientLoop` thread. `stop` is thread-safe and joins all client threads. ### Method: `start` #### Description Initializes and starts the DTC server, listening on the specified port. #### Signature ```cpp bool DTCServer::start(uint16_t port) ``` #### Parameters - **port** (uint16_t) - The TCP port number to listen on. ### Method: `stop` #### Description Stops the DTC server gracefully, closing the listening socket and joining all client threads. #### Signature ```cpp void DTCServer::stop() ``` ### Usage Example ```cpp // Typical usage from main.cpp DTCServer server; server.setTranslator(&translator); // Assuming a translator is set server.start(g_Config.dtcPort); // starts listening on port 11099 // ... run application loop ... server.stop(); // clean shutdown ``` ``` -------------------------------- ### OptionListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/OptionListInfo.md Initializes all members of the OptionListInfo object. Sets string data pointers to MNM_EMPTY_DATA_ITEM, lengths to MNM_EMPTY_DATA_ITEM_LEN, numeric members to zero, and pointers to NULL. ```APIDOC ## OptionListInfo() ### Description Initializes all members of the OptionListInfo object. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Signature OptionListInfo::OptionListInfo() ``` -------------------------------- ### StrategyInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/StrategyInfo.md Initializes all members of the StrategyInfo object. Sets string data pointers and lengths to empty, numeric members to zero, boolean members to false, and pointers to NULL. ```APIDOC ## StrategyInfo() ### Description Initializes all members of the StrategyInfo object. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Method Constructor ``` -------------------------------- ### Get Instrument Reference Data C++ Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq_rithmic.md Explicitly retrieve instrument-specific reference data before placing orders in C++ to avoid API_MINOR_ERROR. This involves calling REngine::getPriceIncrInfo() and checking the PriceIncrInfo::iRpCode callback. ```cpp Call REngine::getPriceIncrInfo(), which will cause RCallbacks::PriceIncrUpdate() to fire. Check the value of PriceIncrInfo::iRpCode in the callback. If the value of iRpCode is API_OK (0), then you have this reference data necessary for placing orders. ``` -------------------------------- ### LowPriceInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/LowPriceInfo.md Initializes all members of the LowPriceInfo object. Integer and double members are set to zero, and boolean members to false. String data members are initialized to empty. ```APIDOC ## LowPriceInfo() ### Description Initializes all members of the LowPriceInfo object. Integer and double members are set to zero, and boolean members to false. String data members are initialized to empty. ### Parameters None ``` -------------------------------- ### asFillReportArray Member Data Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/replay/ExecutionReplayInfo.md An array of OrderFillReport objects representing the set of fills. 'sod' (start of day) fill reports indicate positions carried over from a prior trading session, with their size and price reflecting the carried-over position. ```APIDOC ## asFillReportArray ### Description An array of OrderFillReport objects representing the set of fills. 'sod' fill reports indicate positions carried over from a prior trading session. ### Type OrderFillReport * ``` -------------------------------- ### sendBracketOrder Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md This routine is used to place bracket orders. A bracket order consists of one entry order and N exit orders. As the entry order gets filled (or partially filled), R | Trade Execution Platform automatically places the configured exit order(s). ```APIDOC ## sendBracketOrder() ### Description Places bracket orders, which include an entry order and associated exit orders (profit target and stop loss). ### Method Signature int REngine::sendBracketOrder(OrderParams *pEntry, BracketParams *pBracketParams, int *aiCode) ### Parameters - **pEntry** (OrderParams *) - Specifies the entry order details. - **pBracketParams** (BracketParams *) - Conveys bracket-specific functionality and parameters. - **aiCode** (int *) - Output parameter for error code. ### Bracket Order Types - target and stop - target only - stop only - target and stop static - target only static - stop only static ### Notes - The quantity of bracket entry orders cannot be increased after placement. - For 'target and stop' types, the sum of exit quantities must equal the entry quantity. - For other types, if exit quantities are less than entry quantity, undefined quantities will not have exit orders. If exit quantities exceed entry quantity, excess tiers will be ignored. ``` -------------------------------- ### REngine Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/REngine.md Initializes the REngine class, setting up internal data structures and connecting to the Rithmic infrastructure. The provided parameters are copied, so the original object can be discarded after initialization. ```APIDOC ## REngine() ### Description Initializes the REngine class, creating internal data structures including an OmneEngine. Parameters passed are copied, so the original object does not need to be preserved. ### Parameters * **pParams** (REngineParams *) - Contains the necessary information to instantiate a REngine object. ### Exceptions * OmneException - Thrown if the instance could not be instantiated. ``` -------------------------------- ### Constructing a Fake Environment (envp) for REngine Constructor (C++) Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/faq.md When not using a command-line application, you can construct a fake envp array to satisfy the REngine constructor's requirement. Ensure all necessary Rithmic environment variables are included and the array is NULL-terminated. ```cpp char * fake_envp[9]; fake_envp[0] = "MML_DOMAIN_NAME=a_rithmic_domain"; fake_envp[1] = "MML_LIC_SRVR_ADDR=server1.rithmic.com:56000"; fake_envp[2] = "MML_LOC_BROK_ADDR=server1.rithmic.com:64100"; fake_envp[3] = "MML_DMN_SRVR_ADDR=server1.rithmic.com:65000"; fake_envp[4] = "MML_LOGGER_ADDR=server1.rithmic.com:45454"; fake_envp[5] = "MML_LOG_TYPE=log_net"; fake_envp[6] = "MML_SSL_CLNT_AUTH_FILE=rithmic_ssl_cert_auth_params"; fake_envp[7] = "USER=my_user_name"; fake_envp[8] = NULL; ``` -------------------------------- ### UserListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/UserListInfo.md Initializes all members of the UserListInfo class. Sets tsNCharcb pData to NULL and iDataLen to zero, initializes integer and double members to zero, and boolean members to false. Pointer values are set to NULL. ```APIDOC ## UserListInfo() ### Description Initializes all members of the UserListInfo class. ### Parameters None ### Returns None ``` -------------------------------- ### EnvironmentListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/engine/EnvironmentListInfo.md Initializes all members of the EnvironmentListInfo object. Internal data pointers are set to NULL and lengths to zero. Numeric members are initialized to zero, boolean members to false, and pointers to NULL. ```APIDOC ## EnvironmentListInfo() ### Description Initializes all members of the EnvironmentListInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Constructor Signature `EnvironmentListInfo::EnvironmentListInfo()` ``` -------------------------------- ### dump() Member Function Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/DboBookRebuildInfo.md Prints the current values of the DboBookRebuildInfo object to standard output. ```APIDOC ## dump() ### Description This routine will print the current values of the object to stdout. ### Method `int DboBookRebuildInfo::dump(int *aiCode)` ``` -------------------------------- ### HighPriceLimitInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/HighPriceLimitInfo.md Initializes all members of the HighPriceLimitInfo object. Integer and double members are set to zero, boolean members to false, and tsNCharcb members have their pData set to NULL and iDataLen to zero. ```APIDOC ## HighPriceLimitInfo() ### Description Initializes all members of the HighPriceLimitInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method HighPriceLimitInfo::HighPriceLimitInfo() ``` -------------------------------- ### EasyToBorrowListInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/EasyToBorrowListInfo.md Initializes all members of the EasyToBorrowListInfo object. Integer and double members are set to zero, boolean members to false, and internal data pointers to NULL with zero length. ```APIDOC ## EasyToBorrowListInfo() ### Description Initializes all members of the EasyToBorrowListInfo object. Integer and double members are set to zero, boolean members to false, and internal data pointers to NULL with zero length. ### Method Constructor ``` -------------------------------- ### Link C++ Application on Darwin (64-bit) Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/programmers_guide.md Compile and link line for a C++ application on 64-bit Darwin. Ensure the working directory is ./samples. ```bash g++ -O3 -D_REENTRANT -Wall -Wno-sign-compare -fno-strict-aliasing -Wpointer-arith -Winline -Wno-deprecated -Wno-write-strings -I../include -o ./SampleMD ../samples/SampleMD.cpp -L../darwin-10/lib -lRApiPlus-optimize -lOmneStreamEngine-optimize -lOmneChannel-optimize -lOmneEngine-optimize -l_api-optimize -l_apipoll-stubs-optimize -l_kit-optimize -lssl -lcrypto -L/usr/lib -lz -Wl,-search_paths_first ``` -------------------------------- ### dump() Member Function Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/PasswordChangeInfo.md Prints the instance information of PasswordChangeInfo to stdout. It handles the display of empty strings based on the iDataLen value. ```APIDOC ## dump(int *aiCode) ### Description This routine prints instance information to stdout. If a tsNCharcb has an iDataLen value of MNM_EMPTY_DATA_ITEM_LEN, then the string "" will be printed. ### Parameters * **aiCode** (int *) - A pointer to an integer that may be used for error code reporting. ### Returns An integer representing the status of the dump operation. ``` -------------------------------- ### PnlInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/account/PnlInfo.md Initializes all members of the PnlInfo object. Integer and double members are set to zero, boolean members to false, and pointers to NULL. ```APIDOC ## PnlInfo() ### Description Initializes all members of the PnlInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Method Constructor ``` -------------------------------- ### LineInfo() Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/LineInfo.md Initializes all members of the LineInfo object using LineInfo::clearHandles(). ```APIDOC ## LineInfo() ### Description This constructor initializes all of the members using LineInfo::clearHandles(). ### Signature `LineInfo::LineInfo()` ``` -------------------------------- ### MarketModeInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/MarketModeInfo.md Initializes all members of the MarketModeInfo object. Integer and double members are set to zero, boolean members to false, and tsNCharcb members have their pData set to NULL and iDataLen to zero. ```APIDOC ## MarketModeInfo() ### Description Initializes all members of the MarketModeInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method MarketModeInfo::MarketModeInfo() ``` -------------------------------- ### HighBidPriceInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/HighBidPriceInfo.md Initializes all members of the HighBidPriceInfo object. Integer and double members are set to zero, and boolean members are set to false. tsNCharcb members have their pData set to NULL and iDataLen set to zero. ```APIDOC ## HighBidPriceInfo() ### Description Initializes all members of the HighBidPriceInfo object. Integer and double members are set to zero, and boolean members are set to false. tsNCharcb members have their pData set to NULL and iDataLen set to zero. ### Method HighBidPriceInfo::HighBidPriceInfo() ``` -------------------------------- ### dump() Member Function Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/LowPriceLimitInfo.md Prints the current values of the LowPriceLimitInfo object to standard output. ```APIDOC ## dump() ### Description This routine will print the current values of the object to stdout. ### Method int LowPriceLimitInfo::dump(int *aiCode) ``` -------------------------------- ### PriceIncrInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/PriceIncrInfo.md Initializes all members of the PriceIncrInfo object. String members are initialized to empty, numeric members to zero, and pointers to NULL. ```APIDOC ## PriceIncrInfo() ### Description Initializes all members of the PriceIncrInfo object. String members are initialized to empty, numeric members to zero, and pointers to NULL. ### Method PriceIncrInfo::PriceIncrInfo() ``` -------------------------------- ### clearHandles() Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/info/EquityOptionStrategyListInfo.md Initializes all members of the EquityOptionStrategyListInfo object, similar to the constructor. ```APIDOC ## clearHandles() ### Description This routine initializes all of the members. The pData of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM and the iDataLen of each tsNCharcb is set to MNM_EMPTY_DATA_ITEM_LEN. Integer members and double members are initialized to zero. Boolean members are set to false. Pointers (and pointers to arrays) are set to NULL. ### Method int EquityOptionStrategyListInfo::clearHandles(int *aiCode) ``` -------------------------------- ### SingleOrderReplayInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/order/SingleOrderReplayInfo.md Initializes all members of the SingleOrderReplayInfo object. Integer and double members are set to zero, boolean members to false, and pointer values to NULL. The pData of tsNCharcb members are set to NULL and their iDataLen to zero. ```APIDOC ## SingleOrderReplayInfo() ### Description Initializes all members of the SingleOrderReplayInfo object. ### Parameters None ### Returns None ``` -------------------------------- ### AskInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/AskInfo.md Initializes all members of the AskInfo object. Integer and double members are set to zero, and boolean members are set to false. tsNCharcb members have their pData set to NULL and iDataLen set to zero. ```APIDOC ## AskInfo() ### Description Initializes all members of the AskInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method Constructor ``` -------------------------------- ### MidPriceInfo Constructor Source: https://github.com/gagogago50/sdk1/blob/main/Rithmic SDK documentation/classes/market/MidPriceInfo.md Initializes all members of the MidPriceInfo object. String members are initialized to empty, integer and double members to zero, and boolean members to false. ```APIDOC ## MidPriceInfo() ### Description Initializes all members of the MidPriceInfo object. The pData of each tsNCharcb is set to NULL and the iDataLen of each tsNCharcb is set to zero. Integer members and double members are initialized to zero. Boolean members are set to false. ### Method MidPriceInfo::MidPriceInfo() ```