Add: Taifex after hours ip change config
This commit is contained in:
1 parent
50c7764ef7
commit
7d775afc4c
2 files changed
+15
-9
No files matched your search
@@ -22,6 +22,7 @@ message TaifexMarketDataConfig {
|
||||
string realtime_data_file_name = 22;
|
||||
TaifexConnectionDetails regular_hours_connection_details = 30;
|
||||
TaifexConnectionDetails after_hours_connection_details = 31;
|
||||
bool use_after_hours = 40;
|
||||
bts.api.domain.SecurityCriteria security_criteria = 3;
|
||||
|
||||
}
|
||||
@@ -504,23 +504,29 @@ void HandleReferenceFeed(
|
||||
void runLive(
|
||||
std::shared_ptr<bts::md::IMarketDataListener> listener,
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store,
|
||||
std::shared_ptr<TaifexSecurityDetailsMapper> security_details) {
|
||||
std::shared_ptr<TaifexSecurityDetailsMapper> security_details,
|
||||
const api::md::TaifexMarketDataConfig &config) {
|
||||
long reset_counter = -1;
|
||||
LIVE_DATA_STATES state = START;
|
||||
TaifexSecurityDetailsMapper sec_details;
|
||||
std::set<int> sockets;
|
||||
unsigned long last_seq_num;
|
||||
//load from config
|
||||
const std::string live_data_ip = "225.1.140.140";
|
||||
std::string live_data_ip = "225.1.140.140";
|
||||
const int live_data_port = 14000;
|
||||
// Local IP for futures market data
|
||||
const std::string futures_market_data_ip =
|
||||
"192.168.201.94"; // Replace with actual IP
|
||||
// Multicast IP and Port for reference data feed
|
||||
const std::string reference_data_ip = "225.1.140.141"; // Placeholder
|
||||
std::string reference_data_ip = "225.1.140.141"; // Placeholder
|
||||
const int reference_data_port = 14100; // Placeholder
|
||||
const std::string refresh_data_ip = "225.1.140.147"; // Placeholder
|
||||
std::string refresh_data_ip = "225.1.140.147"; // Placeholder
|
||||
const int refresh_data_port = 14700; // Placeholder
|
||||
if(config.use_after_hours()){
|
||||
live_data_ip = "225.10.140.140";
|
||||
reference_data_ip = "225.10.140.141"; // Placeholder
|
||||
refresh_data_ip = "225.10.140.147"; // Placeholder
|
||||
}
|
||||
std::vector<TaifexMessages::I083Data> refresh_messages;
|
||||
std::queue<std::vector<unsigned char>> buffered_messages;
|
||||
int live_socket = -1;
|
||||
@@ -536,10 +542,6 @@ void runLive(
|
||||
TaifexUtils::close_sockets(sockets);
|
||||
last_seq_num = 0;
|
||||
|
||||
live_socket = TaifexUtils::create_multicast_socket_assert(
|
||||
live_data_ip, live_data_port, futures_market_data_ip);
|
||||
|
||||
sockets.insert(live_socket);
|
||||
state = WAITING_FOR_REFRESH_DATA;
|
||||
break;
|
||||
}
|
||||
@@ -560,6 +562,9 @@ void runLive(
|
||||
"State: WAITING_FOR_REFRESH_DATA Reference thread started");
|
||||
|
||||
std::string desc = "WAITING_FOR_REFRESH_DATA Live data";
|
||||
live_socket = TaifexUtils::create_multicast_socket_assert(
|
||||
live_data_ip, live_data_port, futures_market_data_ip);
|
||||
sockets.insert(live_socket);
|
||||
std::vector<unsigned char> buffer(FEED_BUFFER_SIZE);
|
||||
size_t bytes_received = TaifexUtils::recv_socket_data(
|
||||
live_socket, buffer, FEED_BUFFER_SIZE, desc);
|
||||
@@ -726,7 +731,7 @@ void bts::md::taifex::TaifexDataGateway::run(
|
||||
} else {
|
||||
runLive(
|
||||
listner, sec_id_store,
|
||||
sec_details); //regular_hours_connection_details,after_hours_connection_details);
|
||||
sec_details,config); //regular_hours_connection_details,after_hours_connection_details);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user