diff --git a/v2realbot/controller/services.py b/v2realbot/controller/services.py index 4529bc3..03114a0 100644 --- a/v2realbot/controller/services.py +++ b/v2realbot/controller/services.py @@ -1360,7 +1360,7 @@ def get_archived_runner_details_byID(id: UUID, parsed: bool = True): else: # Return the JSON string directly if parsed: - orjson.loads(res[0]) + return 0, orjson.loads(res[0]) else: return 0, res[0] diff --git a/v2realbot/main.py b/v2realbot/main.py index 1658d84..449f8d1 100644 --- a/v2realbot/main.py +++ b/v2realbot/main.py @@ -13,7 +13,7 @@ import v2realbot.controller.services as cs from v2realbot.utils.ilog import get_log_window from v2realbot.common.model import StrategyInstance, RunnerView, RunRequest, Trade, RunArchive, RunArchiveView, RunArchiveViewPagination, RunArchiveDetail, Bar, RunArchiveChange, TestList, ConfigItem, InstantIndicator, DataTablesRequest, AnalyzerInputs from fastapi import FastAPI, WebSocket, WebSocketDisconnect, Depends, HTTPException, status, WebSocketException, Cookie, Query -from fastapi.responses import FileResponse, StreamingResponse +from fastapi.responses import FileResponse, StreamingResponse, JSONResponse from fastapi.staticfiles import StaticFiles from fastapi.security import HTTPBasic, HTTPBasicCredentials from v2realbot.enums.enums import Env, Mode diff --git a/v2realbot/static/js/archivechart.js b/v2realbot/static/js/archivechart.js index dcf2d81..93e7296 100644 --- a/v2realbot/static/js/archivechart.js +++ b/v2realbot/static/js/archivechart.js @@ -16,6 +16,7 @@ var slLine = [] //input array object bars = { high: [1,2,3], time: [1,2,3], close: [2,2,2]...} //output array [{ time: 111, open: 11, high: 33, low: 333, close: 333},..] function transform_data(data) { + //console.log(data) var SHOW_SL_DIGITS = get_from_config("SHOW_SL_DIGITS", true) transformed = [] //get basic bars, volume and vvwap @@ -174,7 +175,9 @@ function transform_data(data) { data.trades.forEach((trade, index, array) => { obj = {}; a_markers = {} - timestamp = Date.parse(trade.order.filled_at)/1000 + //tady z predchozi verze muze byt string (pak je to date v iso) a nebo v novejsi uz mame timestamp + + timestamp = (typeof trade.order.filled_at === 'string') ? Date.parse(trade.order.filled_at)/1000 : trade.order.filled_at //light chart neumi vice zaznamu ve stejny cas //protoze v BT se muze stat vice tradu v jeden cas, testujeme stejne hodnoty a pripadne pricteme jednu ms //tradu s jednim casem muze byt za sebou vic, proto iterator @@ -266,9 +269,10 @@ function transform_data(data) { markers.push(marker) //prevedeme iso data na timestampy - trade.order.submitted_at = Date.parse(trade.order.submitted_at)/1000 - trade.order.filled_at = Date.parse(trade.order.filled_at)/1000 - trade.timestamp = Date.parse(trade.order.timestamp)/1000 + //open bud zde je iso string (predchozi verze) nebo rovnou float - podporime oboji + trade.order.submitted_at = (typeof trade.order.submitted_at === 'string') ? Date.parse(trade.order.submitted_at)/1000 : trade.order.submitted_at + trade.order.filled_at = (typeof trade.order.filled_at === 'string') ? Date.parse(trade.order.filled_at)/1000 : trade.order.filled_at + trade.timestamp = (typeof trade.timestamp === 'string') ? Date.parse(trade.order.timestamp)/1000 : trade.order.timestamp tradeDetails.set(timestamp, trade) //line pro buy/sell markery diff --git a/v2realbot/static/js/tables/archivetable/functions.js b/v2realbot/static/js/tables/archivetable/functions.js index 90dd244..b3e61b5 100644 --- a/v2realbot/static/js/tables/archivetable/functions.js +++ b/v2realbot/static/js/tables/archivetable/functions.js @@ -63,6 +63,10 @@ function get_detail_and_chart(row) { //console.log(JSON.stringify(data,null,2)); //if lower res is required call prepare_data otherwise call chart_archived_run() //get other base resolutions + + // console.log("received detail", data) + // data = JSON.parse(data) + // console.log("parsed detail", data) prepare_data(row, 1, "Min", data) }, error: function(xhr, status, error) {