Skip to content

Commit

Permalink
Merge pull request #1 from dmytroshch/features/backtest-history
Browse files Browse the repository at this point in the history
Features/backtest history
  • Loading branch information
tekwani authored Aug 15, 2023
2 parents f37cbfe + 0f44165 commit ee511d1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cmds/delete_bt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = async (ds, ws, msg) => {
const [, executionId] = msg

await deleteBt(executionId)
send(ws, ['data.bt.history.deleted', { executionId }])
send(ws, ['data.bt.history.deleted', executionId])
}
2 changes: 1 addition & 1 deletion lib/cmds/get_bt_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = async (ds, ws, msg) => {
const [, executionId] = msg
const btData = await getBtData(executionId)

send(ws, ['data.bt.history.details', btData])
send(ws, ['data.bt.history.details', executionId, btData])
}
2 changes: 1 addition & 1 deletion lib/cmds/get_bt_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = async (ds, ws, msg) => {
const [, strategyId] = msg
const btHistory = await getBtHistory(strategyId)

send(ws, ['data.bt.history.list', btHistory])
send(ws, ['data.bt.history.list', strategyId, btHistory])
}
2 changes: 1 addition & 1 deletion lib/cmds/set_bt_favorite.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = async (ds, ws, msg) => {
const [, executionId, isFavorite] = msg

await setBtFavorite(executionId, isFavorite)
send(ws, ['data.bt.history.favorite', { executionId, isFavorite }])
send(ws, ['data.bt.history.favorite', executionId, isFavorite])
}
5 changes: 4 additions & 1 deletion lib/db/bt_dao.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const getBtData = async (executionId) => {
const query = 'SELECT * FROM bt_history where executionId=?'
const values = [executionId]

return await sqliteDb.getData(query, values)
const btData = await sqliteDb.getData(query, values)
const parsedResult = btData?.btResult ? JSON.parse(btData.btResult) : {}

return { ...btData, btResult: parsedResult }
}

const setBtFavorite = async (executionId, isFavorite) => {
Expand Down

0 comments on commit ee511d1

Please sign in to comment.