bugfix json gui parsing
This commit is contained in:
@ -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]
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user