Skip to content

Commit 6f68857

Browse files
committed
Removing backtest from main repo, updating data replay
1 parent 167d414 commit 6f68857

File tree

7 files changed

+20
-128
lines changed

7 files changed

+20
-128
lines changed

code/common/backtest.q

Lines changed: 0 additions & 67 deletions
This file was deleted.

code/common/datareplay.q

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ getBuckets:{[s;e;p](s+p*til(ceiling 1+e%p)-(ceiling s%p))}
88
// params[`tn] is table name
99
// params[`replayinterval] is the data time interval to bucket the messages into.
1010
tableDataToDataStream:{[params]
11-
.dbg.params:params;
1211
// Sort table by time column.
1312
params[`t]:params[`tc] xasc delete date from params[`t];
1413

@@ -42,7 +41,7 @@ tableDataToDataStream:{[params]
4241
// if there is no interval, cut by distinct time.
4342
([]
4443
time:distinct t_times;
45-
msg:{(`upd;x;$[1<count y;flip y;first y])}[params[`tn]] each
44+
msg:{(`upd;x;y)}[params[`tn]] each
4645
(where differ t_times) cut params[`t]
4746
)
4847
]
@@ -53,26 +52,35 @@ tableDataToDataStream:{[params]
5352
// params[`h] is handle to hdb process
5453
// params[`tn] is table name used to query hdb
5554
// params[`syms] is list of instruments to get
56-
// params[`where] is an additional where clause in functional form - Not Reuqired
55+
// params[`where] is an additional where clause in functional form - Not Required
5756
// params[`sts] is start of time window to get
5857
// params[`ets] is end of time window to get
5958
tableToDataStream:{[params]
59+
// Have hdb evaluate select statement.
60+
t:@[params[`h];
61+
(eval;tableSelectStatement params);
62+
{.lg.e[`dataloader;"Failed to evauluate query on hdb: ",x]}
63+
];
6064

65+
tableDataToDataStream[params,enlist[`t]!enlist t]
66+
};
67+
68+
// params[`tn] is table name used to query hdb
69+
// params[`syms] is list of instruments to get
70+
// params[`where] is an additional where clause in functional form - Not Required
71+
// params[`sts] is start of time window to get
72+
// params[`ets] is end of time window to get
73+
tableSelectStatement:{[params]
6174
// Build where clause
6275
wherec:(enlist (within;`date;(enlist;`date$params[`sts];`date$params[`ets]))) // date in daterange
6376
,$[count params[`syms];enlist (in;`sym;enlist params[`syms]);()] //if syms is empty, omit sym in syms
6477
,$[count params[`where];params[`where];()] // custom where clause (optional)
6578
,enlist (within;params[`tc];(enlist;params[`sts];params[`ets])); // time within (sts;ets)
66-
67-
// Have hdb evaluate select statement.
68-
t:@[params[`h];
69-
(eval;.backtest.query:(?;params[`tn];enlist wherec;0b;()));
70-
{.lg.e[`dataloader;"Failed to evauluate query on hdb: ",x]}
71-
];
7279

73-
tableDataToDataStream[params,enlist[`t]!enlist t]
80+
(?;params[`tn];enlist wherec;0b;())
7481
};
7582

83+
7684
// params[`sts] is start of time window to get
7785
// params[`ets] is end of time window to get
7886
// params[`tp] is the increment between times
@@ -94,7 +102,7 @@ getTimers:{[params]
94102
// prarms[`tc] is the time column of the tables specified - Defualt `time
95103
// params[`timerfunc] is the timer function to use in timer messages - Default `.z.ts
96104
tablesToDataStream:{[params]
97-
defaults:`timer`h`syms`replayinterval`timerinterval`tc`timerfunc`where!(0b;0;`symbol$();`timespan$0n;`timespan$0n;`time;`.z.ts;());
105+
defaults:`timer`h`syms`timerinterval`tc`timerfunc`where!(0b;0;`symbol$();`timespan$0n;`time;`.z.ts;());
98106
params:defaults,params;
99107

100108
// check for default parameters `tabs`sts`ets

code/processes/backtestdb.q

Lines changed: 0 additions & 3 deletions
This file was deleted.

code/processes/backtestpub.q

Lines changed: 0 additions & 24 deletions
This file was deleted.

config/settings/backtest.q

Lines changed: 0 additions & 14 deletions
This file was deleted.

config/settings/backtestdb.q

Lines changed: 0 additions & 2 deletions
This file was deleted.

torq.q

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ stdoptionusage:@[value;`stdoptionusage;"Standard options:
5959
[-localtime]:\t\t\tuse local time instead of GMT
6060
[-usage]:\t\t\tprint usage info
6161
[-test]:\t\t\tset to run unit tests
62-
[-jsonlogs]:\t\t\toutput logs in json format
63-
[-backtest]:\t\t\tset to run backtest mode"]
62+
[-jsonlogs]:\t\t\toutput logs in json format"]
6463

6564
// extra info - used to extend the usage info
6665
extrausage:@[value;`extrausage;""]
@@ -712,8 +711,3 @@ if[(`test in key .proc.params);
712711
.lg.e[`init;"environment variable KDBTESTS undefined"]
713712
]
714713
];
715-
716-
// Overwrite pub/sub channels when in backtest mode
717-
if[`backtest in key .proc.params;
718-
.backtest.init[];
719-
];

0 commit comments

Comments
 (0)