Skip to content

Commit

Permalink
deploy debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhuangxinyu1 committed May 20, 2020
1 parent 4db8a43 commit e9f6045
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
4 changes: 1 addition & 3 deletions external/common/include/core/base_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ class BaseStrategy {
virtual void Clear();
void debug() const;
double GetMid(const std::string & ticker);
// void UpdateCT(const HistoryWorker& ct);
virtual void UpdateTicker();
virtual void HandleCommand(const Command& shot);
protected:
// void RegisterTicker(const std::vector<std::string> & tickers);
// BaseStrategy(const std::string& contract_config_path);
void UpdateAvgCost(const std::string & ticker, double trade_price, int size);
std::string GenUniqueId();
Order* NewOrder(const std::string & ticker, OrderSide::Enum side, int size, bool control_price, bool sleep_order, const std::string & tbd, bool no_today = false);
Order* PlaceOrder(const std::string & ticker, double price, int size, bool no_today = false, const std::string & orderinfo = "");
void ModOrder(Order* o, bool sleep=false);
void ReplaceOrder(Order* o);
void CancelAll(const std::string & ticker);
void CancelAll();
void CancelOrder(Order* o);
Expand Down
17 changes: 12 additions & 5 deletions external/common/include/struct/order.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <sys/time.h>
#include <fstream>

Expand All @@ -18,13 +20,15 @@ struct Order {
timeval send_time;
char ticker[MAX_CONTRACT_LENGTH];
double price;
int size;
int traded_size;
int32_t size;
int32_t traded_size;
OrderSide::Enum side;
char order_ref[MAX_ORDERREF_SIZE];
OrderAction::Enum action;
OrderStatus::Enum status;
Offset::Enum offset;
double target_price;
double shot_latency;
char tbd[96];
char exchange[32];

Expand All @@ -33,7 +37,9 @@ struct Order {
price(0.0),
size(0),
traded_size(0),
offset(Offset::UNINITED) {
offset(Offset::UNINITED),
target_price(0.0),
shot_latency(0.0) {
snprintf(ticker, sizeof(ticker), "%s", "");
snprintf(order_ref, sizeof(order_ref), "%s", "");
snprintf(tbd, sizeof(tbd), "%s", "");
Expand All @@ -58,7 +64,7 @@ struct Order {
char send_time_s[32];
snprintf(send_time_s, sizeof(send_time_s), "%ld.%ld", send_time.tv_sec, send_time.tv_usec);
double send_time_sec = atof(send_time_s);
fprintf(stream, "%lf,%lf,%s,%lf,%d,%d,%s,%s,%s,%s,%s,%s,%s\n",shot_time_sec,send_time_sec,ticker,price,size,traded_size,OrderSide::ToString(side),order_ref,OrderAction::ToString(action),OrderStatus::ToString(status),Offset::ToString(offset),exchange,tbd);
fprintf(stream, "%lf,%lf,%s,%lf,%d,%d,%s,%s,%s,%s,%s,%.2f,%lf,%s,%s\n",shot_time_sec,send_time_sec,ticker,price,size,traded_size,OrderSide::ToString(side),order_ref,OrderAction::ToString(action),OrderStatus::ToString(status),Offset::ToString(offset), shot_latency, target_price, exchange, tbd);
}

void Show(std::ostream& stream) const {
Expand All @@ -67,6 +73,7 @@ struct Order {
stream << "Order " << ticker << " " << price << "@" << size << " ";
stream << traded_size << " " << OrderSide::ToString(side) << " " << order_ref << " ";
stream << OrderAction::ToString(action) << " " << OrderStatus::ToString(status) << " ";
stream << shot_latency << " " << target_price << " ";
stream << Offset::ToString(offset) << " " << exchange << " " << tbd << std::endl;
}

Expand All @@ -76,7 +83,7 @@ struct Order {
fprintf(stream, "%ld %04ld %ld %04ld Order %s |",
send_time.tv_sec, send_time.tv_usec, shot_time.tv_sec, shot_time.tv_usec, ticker);

fprintf(stream, " %lf@%d %d %s %s %s %s %s %s %s\n", price, size, traded_size, OrderSide::ToString(side), order_ref, OrderAction::ToString(action), OrderStatus::ToString(status), Offset::ToString(offset), exchange, tbd);
fprintf(stream, " %lf@%d %d %s %s %s %s %s %.2f %lf %s %s\n", price, size, traded_size, OrderSide::ToString(side), order_ref, OrderAction::ToString(action), OrderStatus::ToString(status), Offset::ToString(offset), shot_latency, target_price, exchange, tbd);
}
};

Expand Down
Binary file modified external/common/lib/libnick.so
Binary file not shown.
2 changes: 1 addition & 1 deletion lib-hft
10 changes: 5 additions & 5 deletions scripts/root/crontab.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
20 08 * * 1-5 ~/deploy/BuildRunEnv.sh
export LD_LIBRARY_PATH=/usr/local/lib
55 20 * * 1-5 ~/deploy/StartData.sh >> ~/script-log/datanight.log
56 20 * * 1-5 ~/deploy/StartOrder.sh >> ~/script-log/ordernight.log
58 20 * * 1-5 ~/deploy/StartStrat.sh >> ~/script-log/stratnight.log
55 20 * * 1-5 ~/deploy/StartData_night.sh >> ~/script-log/datanight.log
56 20 * * 1-5 ~/deploy/StartOrder_night.sh >> ~/script-log/ordernight.log
58 20 * * 1-5 ~/deploy/StartSimpleArb_night.sh >> ~/script-log/stratnight.log
07 03 * * 2-6 ~/deploy/stop.sh >> ~/script-log/stopnight.log

17 03 * * 2-6 ~/deploy/zip_data.sh >> ~/script-log/zipdata.log
20 20 * * 1-5 ~/deploy/BuildRunEnv.sh

55 08 * * 1-5 ~/deploy/StartData.sh >> ~/script-log/data.log
56 08 * * 1-5 ~/deploy/StartOrder.sh >> ~/script-log/order.log
58 08 * * 1-5 ~/deploy/StartStrat.sh >> ~/script-log/strat.log
58 20 * * 1-5 ~/deploy/StartSimpleArb.sh >> ~/script-log/strat.log
07 15 * * 1-5 ~/deploy/stop.sh >> ~/script-log/stop.log
1 change: 1 addition & 0 deletions scripts/root/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pkill -u root mid_data
pkill -u root simplearb
pkill -u root functional_test
pkill -u root getins
pkill -u root functional_test
5 changes: 4 additions & 1 deletion scripts/root/zip_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
export LD_LIBRARY_PATH=/usr/local/lib

cd /today
gzip data_binary.dat
gzip future*.dat

cd /root/huatai/build/
gzip stock*.dat

cd /today/log

Expand Down

0 comments on commit e9f6045

Please sign in to comment.