void HuobiApp::submitLimitOrder(const char *symbol, OrderSide side, double price, double amount, const char *userId) { int ts = timestamp(); FIX44::NewOrderSingle message; message.set(Account(_publicKey)); if (userId) message.set(ClOrdID(userId)); else message.set(ClOrdID("HuobiOrder")); message.set(Price(price)); message.set(MinQty(amount)); message.set(OrdType(OrdType_LIMIT)); message.set(Symbol(symbol)); message.set(Side(side == OrderBuy ? Side_BUY : Side_SELL)); message.set(TransactTime()); message.setField(IntField(957, ts)); message.setField(StringField(958, _publicKey)); char str[1024]; sprintf(str, "access_key=%s&amount=%s&coin_type=%d&created=%d&method=%s&price=%s&secret_key=%s", _publicKey.c_str(), float2str(amount).c_str(), getCoinType(symbol), ts, side == OrderBuy ? "buy" : "sell", float2str(price).c_str(), _privateKey.c_str()); message.setField(StringField(959, md5::MD5String(str, false))); Session *session = Session::lookupSession(_sessionID); if (session) session->send(message); }
void FixProviderImpl::sendOrder(const FreeQuant::Order& order) { FIX44::NewOrderSingle message; message.set(FIX::ClOrdID(FreeQuant::createGuid())); FIX::Side side; if (order.side() == FreeQuant::Order::Buy) { side = FIX::Side_BUY; } else { side = FIX::Side_SELL; } message.set(side); FIX::OrdType type; switch (order.type()) { case FreeQuant::Order::Market: type = FIX::OrdType_MARKET; default: break; } }
void OkcoinApp::submitMarketOrder(const char *symbol, OrderSide side, double amount, const char *userId) { int ts = timestamp(); FIX44::NewOrderSingle message; message.set(Account(_publicKey + "," + _privateKey)); if (userId) message.set(ClOrdID(userId)); else message.set(ClOrdID("OkcoinOrder")); message.set(Price(amount)); message.set(OrderQty(amount)); message.set(OrdType(OrdType_MARKET)); message.set(Symbol(symbol)); message.set(Side(side == OrderBuy ? Side_BUY : Side_SELL)); message.set(TransactTime()); Session *session = Session::lookupSession(_sessionID); if (session) session->send(message); }