Skip to content

Commit

Permalink
Add docs' google search verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaz001 committed Sep 8, 2023
1 parent 08216b2 commit 752d49e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/_static/google7643946cbaadbeb0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google-site-verification: google7643946cbaadbeb0.html
10 changes: 8 additions & 2 deletions hftbacktest/models/latencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def entry(self, timestamp, order, proc):
for row_num in range(self.entry_rn, len(self.data) - 1):
req_local_timestamp = self.data[row_num, 0]
next_req_local_timestamp = self.data[row_num + 1, 0]
if timestamp < req_local_timestamp:
raise ValueError('Timestamp is not aligned.')
if req_local_timestamp <= timestamp < next_req_local_timestamp:
self.entry_rn = row_num

Expand All @@ -269,7 +271,8 @@ def entry(self, timestamp, order, proc):

lat1 = exch_timestamp - req_local_timestamp
lat2 = next_exch_timestamp - next_req_local_timestamp
return self.__intp(timestamp, req_local_timestamp, lat1, next_req_local_timestamp, lat2)
#return self.__intp(timestamp, req_local_timestamp, lat1, next_req_local_timestamp, lat2)
return .5 * (lat1 + lat2)
raise ValueError

def response(self, timestamp, order, proc):
Expand All @@ -280,6 +283,8 @@ def response(self, timestamp, order, proc):
for row_num in range(self.resp_rn, len(self.data) - 1):
exch_timestamp = self.data[row_num, 1]
next_exch_timestamp = self.data[row_num + 1, 1]
if timestamp < exch_timestamp:
raise ValueError('Timestamp is not aligned.')
if exch_timestamp <= timestamp < next_exch_timestamp:
self.resp_rn = row_num

Expand All @@ -296,7 +301,8 @@ def response(self, timestamp, order, proc):
elif next_exch_timestamp <= 0:
return lat1

lat = self.__intp(timestamp, exch_timestamp, lat1, next_exch_timestamp, lat2)
#lat = self.__intp(timestamp, exch_timestamp, lat1, next_exch_timestamp, lat2)
lat = .5 * (lat1 + lat2)
if lat < 0:
raise ValueError('Response latency cannot be negative.')
return lat
Expand Down

0 comments on commit 752d49e

Please sign in to comment.