Skip to content

Commit

Permalink
rollback testing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Oct 30, 2023
1 parent f05ef89 commit 171f862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ class TokenHistoricalDailyRecord(id: EntityID<DateTime>) : Entity<DateTime>(id)
.limit(1)
.firstOrNull()
}

fun deleteByDate(date: DateTime) = transaction {
TokenHistoricalDailyTable.deleteWhere { TokenHistoricalDailyTable.timestamp eq date.startOfDay() }
}
}

var timestamp by TokenHistoricalDailyTable.timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,11 @@ class AsyncService(
@Scheduled(cron = "0 0 1 * * ?") // Every day at 1 am
fun updateTokenHistorical() {
val today = DateTime.now().startOfDay()
// var startDate = today.minusMonths(1)
// val latest = TokenHistoricalDailyRecord.getLatestDateEntry()
// if (latest != null) {
// startDate = latest.timestamp.minusDays(1).startOfDay()
// }
val startDate = DateTime(2023, 8, 4, 0, 0, 0).startOfDay()
var startDate = today.minusMonths(1)
val latest = TokenHistoricalDailyRecord.getLatestDateEntry()
if (latest != null) {
startDate = latest.timestamp.minusDays(1).startOfDay()
}
val dlobRes = tokenService.getHistoricalFromDlob(startDate) ?: return
logger.info("Updating token historical data starting from $startDate with ${dlobRes.buy.size} buy records for roll-up.")

Expand Down Expand Up @@ -341,9 +340,7 @@ class AsyncService(
)
)
).also { prevPrice = close }
TokenHistoricalDailyRecord.deleteByDate(record.time_open.startOfDay())
val id = TokenHistoricalDailyRecord.save(record.time_open.startOfDay(), record)
logger.info("saving record ${record.time_open.startOfDay()} $record insert count ${id.insertedCount}")
TokenHistoricalDailyRecord.save(record.time_open.startOfDay(), record)
}
}

Expand Down

0 comments on commit 171f862

Please sign in to comment.