62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "SessionBase.h"
|
|
#include "lib/md/SecurityPtr.h"
|
|
|
|
#include <quickfix/Message.h>
|
|
#include <quickfix/SessionID.h>
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
|
|
namespace FIX44
|
|
{
|
|
class OrderStatusRequest;
|
|
class SecurityDefinitionRequest;
|
|
}
|
|
|
|
namespace bts {
|
|
|
|
namespace fix {
|
|
|
|
class DropCopySession : public SessionBase
|
|
{
|
|
public:
|
|
DropCopySession(bts::api::ServiceContext&, IFixRouter&, const FIX::SessionID&);
|
|
virtual ~DropCopySession();
|
|
|
|
void onLogon(const FIX::SessionID&);
|
|
void onLogout(const FIX::SessionID&);
|
|
|
|
void fromApp(const FIX::Message &message,const FIX::SessionID &sessionID)
|
|
throw(FIX::FieldNotFound, FIX::IncorrectDataFormat, FIX::IncorrectTagValue, FIX::UnsupportedMessageType);
|
|
|
|
void onMessage(const FIX44::OrderStatusRequest& m, const FIX::SessionID& s);
|
|
void onMessage(const FIX44::SecurityDefinitionRequest& m, const FIX::SessionID& s);
|
|
|
|
protected:
|
|
virtual void subscribe_fills_and_orders(const FIX::SessionID sessionID);
|
|
virtual void process_order_state(const bts::api::orderman::OrderState& state, uint& filled, uint& leaves, double& avgprx,
|
|
FIX::OrdStatus& fstatus, bts::api::orderman::NativeOrderState& native, const bts::api::orderman::Fill* fill = nullptr);
|
|
|
|
md::SecurityPtr resolve_execution_report_security(md::SecurityPtr sec, FIX44::ExecutionReport& report);
|
|
virtual FIX44::ExecutionReport build_fill(const FIX::SessionID& sess, const bts::api::orderman::Fill& fill, bool change = false);
|
|
virtual FIX44::ExecutionReport build_order_status(const FIX::SessionID& sess, const bts::api::orderman::OrderRecord& order, bool change = false);
|
|
|
|
protected:
|
|
bts::api::orderman::OrderService _orderservice;
|
|
|
|
utils::LockBox< std::unordered_map<uint, std::shared_ptr<const bts::api::orderman::OrderRecord>> > _order_cache;
|
|
utils::LockBox< std::unordered_map<uint, std::string> > _fix_clorderids;
|
|
|
|
private:
|
|
struct PImpl;
|
|
std::shared_ptr<PImpl> me;
|
|
|
|
};
|
|
|
|
}}
|