当前位置: 首页>>代码示例>>C++>>正文


C++ O2G2Ptr::setDouble方法代码示例

本文整理汇总了C++中O2G2Ptr::setDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ O2G2Ptr::setDouble方法的具体用法?C++ O2G2Ptr::setDouble怎么用?C++ O2G2Ptr::setDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在O2G2Ptr的用法示例。


在下文中一共展示了O2G2Ptr::setDouble方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

IO2GRequest *createEntryOrderRequest(IO2GSession *session, const char *sOfferID, const char *sAccountID, int iAmount, double dRate, const char *sBuySell, const char *sOrderType, const char *expDate)
{
    O2G2Ptr<IO2GRequestFactory> requestFactory = session->getRequestFactory();
    if (!requestFactory)
    {
        std::cout << "Cannot create request factory" << std::endl;
        return NULL;
    }
    O2G2Ptr<IO2GValueMap> valuemap = requestFactory->createValueMap();
    valuemap->setString(Command, O2G2::Commands::CreateOrder);
    valuemap->setString(OrderType, sOrderType);
    valuemap->setString(AccountID, sAccountID);
    valuemap->setString(OfferID, sOfferID);
    valuemap->setString(BuySell, sBuySell);
    valuemap->setInt(Amount, iAmount);
    valuemap->setDouble(Rate, dRate);
    valuemap->setString(CustomID, "EntryOrder");

    if(strcmp(expDate, "") != 0)
    {
        valuemap->setString(TimeInForce, "GTD"); // 'Good till Date'
        valuemap->setString(ExpireDateTime, expDate); //  FIX UTCTimestamp format: "yyyyMMdd- HH:mm:ss.SSS" (milliseconds are optional)
    }

    O2G2Ptr<IO2GRequest> request = requestFactory->createOrderRequest(valuemap);
    if (!request)
    {
        std::cout << requestFactory->getLastError() << std::endl;
        return NULL;
    }
    return request.Detach();
}
开发者ID:mmarti3600,项目名称:FXCM-ForexConnect-win32-cpp,代码行数:32,代码来源:main.cpp

示例2:

IO2GRequest *createNetEntryOrderRequest(IO2GSession *session, const char *sOfferID,
        const char *sAccountID, double dRate, const char *sBuySell, const char *sOrderType)
{
    O2G2Ptr<IO2GRequestFactory> requestFactory = session->getRequestFactory();
    if (!requestFactory)
    {
        std::cout << "Cannot create request factory" << std::endl;
        return NULL;
    }
    O2G2Ptr<IO2GValueMap> valuemap = requestFactory->createValueMap();
    valuemap->setString(Command, O2G2::Commands::CreateOrder);
    valuemap->setString(OrderType, sOrderType);
    valuemap->setString(AccountID, sAccountID);
    valuemap->setString(OfferID, sOfferID);
    valuemap->setString(BuySell, sBuySell);
    valuemap->setString(NetQuantity, "Y");
    valuemap->setDouble(Rate, dRate);
    valuemap->setString(CustomID, "EntryOrder");
    O2G2Ptr<IO2GRequest> request = requestFactory->createOrderRequest(valuemap);
    if (!request)
    {
        std::cout << requestFactory->getLastError() << std::endl;
        return NULL;
    }
    return request.Detach();
}
开发者ID:BryanFletcher,项目名称:FXCM,代码行数:26,代码来源:main.cpp

示例3:

IO2GRequest *createOTORequest(IO2GSession *session, const char *sOfferID, const char *sAccountID, int iAmount, double dRatePrimary, double dRateSecondary)
{
    O2G2Ptr<IO2GRequestFactory> requestFactory = session->getRequestFactory();
    if (!requestFactory)
    {
        std::cout << "Cannot create request factory" << std::endl;
        return NULL;
    }
    O2G2Ptr<IO2GValueMap> valuemap = requestFactory->createValueMap();
    valuemap->setString(Command, O2G2::Commands::CreateOTO);

    O2G2Ptr<IO2GValueMap> valuemapPrimary = requestFactory->createValueMap();
    valuemapPrimary->setString(Command, O2G2::Commands::CreateOrder);
    valuemapPrimary->setString(OrderType, O2G2::Orders::StopEntry);
    valuemapPrimary->setString(AccountID, sAccountID);
    valuemapPrimary->setString(OfferID, sOfferID);
    valuemapPrimary->setString(BuySell, O2G2::Sell);
    valuemapPrimary->setInt(Amount, iAmount);
    valuemapPrimary->setDouble(Rate, dRatePrimary);
    valuemap->appendChild(valuemapPrimary);

    O2G2Ptr<IO2GValueMap> valuemapSecondary = requestFactory->createValueMap();
    valuemapSecondary->setString(Command, O2G2::Commands::CreateOrder);
    valuemapSecondary->setString(OrderType, O2G2::Orders::StopEntry);
    valuemapSecondary->setString(AccountID, sAccountID);
    valuemapSecondary->setString(OfferID, sOfferID);
    valuemapSecondary->setString(BuySell, O2G2::Buy);
    valuemapSecondary->setInt(Amount, iAmount);
    valuemapSecondary->setDouble(Rate, dRateSecondary);
    valuemap->appendChild(valuemapSecondary);

    O2G2Ptr<IO2GRequest> request = requestFactory->createOrderRequest(valuemap);
    if (!request)
    {
        std::cout << requestFactory->getLastError() << std::endl;
        return NULL;
    }
    return request.Detach();
}
开发者ID:BryanFletcher,项目名称:FXCM,代码行数:39,代码来源:main.cpp

示例4:

IO2GRequest *createOTOCORequest(IO2GSession *session, const char *sOfferID, const char *sAccountID, int iAmount, double dRatePrimary, double dRateOcoFirst, double dRateOcoSecond)
{
	O2G2Ptr<IO2GRequestFactory> requestFactory = session->getRequestFactory();
	if (requestFactory)
	{
		// Create OTO command
		O2G2Ptr<IO2GValueMap> valuemapMain = requestFactory->createValueMap();
		valuemapMain->setString(Command, O2G2::Commands::CreateOTO);

		// Create Entry order
		O2G2Ptr<IO2GValueMap> valuemapPrimary = requestFactory->createValueMap();
		valuemapPrimary->setString(Command, O2G2::Commands::CreateOrder);
		valuemapPrimary->setString(OrderType, O2G2::Orders::StopEntry);
		valuemapPrimary->setString(AccountID, sAccountID);
		valuemapPrimary->setString(OfferID, sOfferID);
		valuemapPrimary->setString(BuySell, O2G2::Sell);
		valuemapPrimary->setInt(Amount, iAmount);
		valuemapPrimary->setDouble(Rate, dRatePrimary);

		// Create OCO group of orders
		O2G2Ptr<IO2GValueMap> valuemapOCO = requestFactory->createValueMap();
		valuemapOCO->setString(Command, O2G2::Commands::CreateOCO);

		// Create Entry orders to OCO
		O2G2Ptr<IO2GValueMap> valuemapOCOFirst = requestFactory->createValueMap();
		valuemapOCOFirst->setString(Command, O2G2::Commands::CreateOrder);
		valuemapOCOFirst->setString(OrderType, O2G2::Orders::StopEntry);
		valuemapOCOFirst->setString(AccountID, sAccountID);
		valuemapOCOFirst->setString(OfferID, sOfferID);
		valuemapOCOFirst->setString(BuySell, O2G2::Buy);
		valuemapOCOFirst->setInt(Amount, iAmount);
		valuemapOCOFirst->setDouble(Rate, dRateOcoFirst);

		O2G2Ptr<IO2GValueMap> valuemapOCOSecond = requestFactory->createValueMap();
		valuemapOCOSecond->setString(Command, O2G2::Commands::CreateOrder);
		valuemapOCOSecond->setString(OrderType, O2G2::Orders::StopEntry);
		valuemapOCOSecond->setString(AccountID, sAccountID);
		valuemapOCOSecond->setString(OfferID, sOfferID);
		valuemapOCOSecond->setString(BuySell, O2G2::Buy);
		valuemapOCOSecond->setInt(Amount, iAmount);
		valuemapOCOSecond->setDouble(Rate, dRateOcoSecond);

		// Fill the created groups. Please note, first you should add an entry order to OTO order and then OCO group of orders
		valuemapMain->appendChild(valuemapPrimary);;
		valuemapOCO->appendChild(valuemapOCOFirst);
		valuemapOCO->appendChild(valuemapOCOSecond);
		valuemapMain->appendChild(valuemapOCO);

		O2G2Ptr<IO2GRequest> request = requestFactory->createOrderRequest(valuemapMain);
		if (!request)
		{
			std::cout << requestFactory->getLastError() << std::endl;
			return NULL;
		}
		return request.Detach();
	}
	else
	{
		std::cout << "Cannot create request factory" << std::endl;
		return NULL;
	}
}
开发者ID:QuantumNinja92,项目名称:ForexConnectAPI-1.4.1-Linux-i686,代码行数:62,代码来源:main.cpp


注:本文中的O2G2Ptr::setDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。