forked from keyianpai/hft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3e2e49
commit ceadc20
Showing
22 changed files
with
1,106 additions
and
323 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
time_controller : | ||
{ | ||
sleep_time = [ "10:14:20-10:30:00", "11:29:20-13:00:00", "03:58:20-08:55:00" ]; | ||
close_time = [ "14:00:59-14:59:00", "23:00:00-23:59:59" ]; | ||
force_close_time = [ "16:59:59-17:30:00" ]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef TIMECONTROLLER_H_ | ||
#define TIMECONTROLLER_H_ | ||
|
||
#include "market_snapshot.h" | ||
#include "order.h" | ||
#include "sender.h" | ||
#include "exchange_info.h" | ||
#include "order_status.h" | ||
#include "useful_function.h" | ||
#include "time_status.h" | ||
#include <unordered_map> | ||
#include <time.h> | ||
#include <sys/time.h> | ||
|
||
#include <cmath> | ||
#include <vector> | ||
#include <iostream> | ||
#include <string> | ||
|
||
class TimeController { | ||
public: | ||
TimeController(std::vector<std::string>sleep_time, std::vector<std::string> close_time, std::vector<std::string> force_close, const std::string & mode="real"); | ||
TimeController(); | ||
TimeController(const TimeController & t); | ||
|
||
~TimeController(); | ||
|
||
TimeStatus::Enum CheckCurrentTime(const MarketSnapshot& shot); | ||
|
||
TimeStatus::Enum CheckTime(int check_time) const; | ||
|
||
int GetTodaySec(); | ||
int GetSec(timeval t = {0,0}) const; | ||
bool IsMix(int s1, int e1, int s2, int e2) const; | ||
void StartTimer(); | ||
void EndTimer(const std::string & label=""); | ||
int GetStratSec(timeval t = {0, 0}) const; | ||
std::string TimeToStr(timeval t = {0, 0}, bool show_time = false) const; | ||
|
||
private: | ||
int last_sec; | ||
int timezone_diff; | ||
std::vector<int>sleep_start; | ||
std::vector<int>sleep_stop; | ||
std::vector<int>close_start; | ||
std::vector<int>close_stop; | ||
std::vector<int>force_close_start; | ||
std::vector<int>force_close_stop; | ||
std::string mode; | ||
long int timer_sec; | ||
long int timer_usec; | ||
bool is_timer_on; | ||
|
||
int Translate(const std::string & time) const; | ||
bool Check() const; | ||
void Push(std::vector<std::string> timestr, std::vector<int>& a, std::vector<int>& b); | ||
}; | ||
|
||
#endif // TIMECONTROLLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.