diff --git a/v2realbot/ENTRY_backtest_strategyVykladaci.py b/v2realbot/ENTRY_backtest_strategyVykladaci.py
index 49dfe44..65cfcf5 100644
--- a/v2realbot/ENTRY_backtest_strategyVykladaci.py
+++ b/v2realbot/ENTRY_backtest_strategyVykladaci.py
@@ -135,7 +135,7 @@ def next(data, state: StrategyState):
try:
#print(state.vars.MA, "MACKO")
#print(state.bars.hlcc4)
- state.indicators.ema = ema(state.bars.hlcc4, state.vars.MA) #state.bars.vwap
+ state.indicators.ema = ema(state.bars.close, state.vars.MA) #state.bars.vwap
#trochu prasarna, EMAcko trunc na 3 mista - kdyz se osvedci, tak udelat efektivne
state.indicators.ema = [trunc(i,3) for i in state.indicators.ema]
ic(state.vars.MA, state.vars.Trend, state.indicators.ema[-5:])
diff --git a/v2realbot/__pycache__/config.cpython-310.pyc b/v2realbot/__pycache__/config.cpython-310.pyc
index 0f906ea..519e911 100644
Binary files a/v2realbot/__pycache__/config.cpython-310.pyc and b/v2realbot/__pycache__/config.cpython-310.pyc differ
diff --git a/v2realbot/config.py b/v2realbot/config.py
index 2665b4f..2c7298c 100644
--- a/v2realbot/config.py
+++ b/v2realbot/config.py
@@ -2,7 +2,7 @@ from alpaca.data.enums import DataFeed
from v2realbot.enums.enums import Mode, Account
from appdirs import user_data_dir
-COUNT_API_REQUESTS = True
+COUNT_API_REQUESTS = False
STRATVARS_UNCHANGEABLES = ['pendingbuys', 'blockbuy', 'jevylozeno', 'limitka']
DATA_DIR = user_data_dir("v2realbot")
#BT DELAYS
diff --git a/v2realbot/main.py b/v2realbot/main.py
index 0cf90d0..5ecc708 100644
--- a/v2realbot/main.py
+++ b/v2realbot/main.py
@@ -31,7 +31,7 @@ ic.configureOutput(includeContext=True)
def threadName():
return '%s |> ' % str(current_thread().name)
ic.configureOutput(prefix=threadName)
-#ic.disable()
+ic.disable()
"""""
Main entry point of the bot. Starts strategies according to config file, each
in separate thread.
diff --git a/v2realbot/static/index.html b/v2realbot/static/index.html
index ef6bb27..5f13f39 100644
--- a/v2realbot/static/index.html
+++ b/v2realbot/static/index.html
@@ -79,7 +79,7 @@
-
+
diff --git a/v2realbot/static/js/mytables.js b/v2realbot/static/js/mytables.js
index 0d48055..c2e0b2d 100644
--- a/v2realbot/static/js/mytables.js
+++ b/v2realbot/static/js/mytables.js
@@ -63,6 +63,7 @@ $(document).ready(function () {
$('#button_pause').attr('disabled','disabled');
$('#button_stop').attr('disabled','disabled');
$('#button_edit').attr('disabled','disabled');
+ $('#button_dup').attr('disabled','disabled');
$('#button_delete').attr('disabled','disabled');
$('#button_run').attr('disabled','disabled');
@@ -70,12 +71,14 @@ $(document).ready(function () {
$('#stratinTable tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
+ $('#button_dup').attr('disabled','disabled');
$('#button_edit').attr('disabled','disabled');
$('#button_delete').attr('disabled','disabled');
$('#button_run').attr('disabled','disabled');
} else {
stratinRecords.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
+ $('#button_dup').attr('disabled',false);
$('#button_edit').attr('disabled',false);
$('#button_delete').attr('disabled',false);
$('#button_run').attr('disabled',false);
@@ -102,6 +105,46 @@ $(document).ready(function () {
stratinRecords.ajax.reload();
})
+ //button duplicate
+ $('#button_dup').click(function () {
+ row = stratinRecords.row('.selected').data();
+ event.preventDefault();
+ $('#button_dup').attr('disabled','disabled');
+ const rec = new Object()
+ rec.id2 = parseInt(row.id2) + 1;
+ rec.name = row.name + " copy";
+ rec.symbol = row.symbol;
+ rec.class_name = row.class_name;
+ rec.script = row.script;
+ rec.open_rush = row.open_rush;
+ rec.close_rush = row.close_rush;
+ rec.stratvars_conf = row.stratvars_conf;
+ rec.add_data_conf = row.add_data_conf;
+ rec.note = row.note;
+ rec.history = "";
+ jsonString = JSON.stringify(rec);
+ $.ajax({
+ url:"/stratins/",
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('X-API-Key',
+ API_KEY); },
+ method:"POST",
+ contentType: "application/json",
+ dataType: "json",
+ data: jsonString,
+ success:function(data){
+ $('#button_dup').attr('disabled', false);
+ stratinRecords.ajax.reload();
+ },
+ error: function(xhr, status, error) {
+ var err = eval("(" + xhr.responseText + ")");
+ window.alert(JSON.stringify(xhr));
+ console.log(JSON.stringify(xhr));
+ $('#button_dup').attr('disabled', false);
+ }
+ })
+});
+
//button pause
$('#button_pause').click(function () {
row = runnerRecords.row('.selected').data();
@@ -191,7 +234,11 @@ $(document).ready(function () {
$('#button_run').click(function () {
row = stratinRecords.row('.selected').data();
window.$('#runModal').modal('show');
- //$('#runForm')[0].reset();
+ $('#bt_from').val(localStorage.getItem("bt_from"));
+ $('#bt_to').val(localStorage.getItem("bt_to"));
+ $('#mode').val(localStorage.getItem("mode"));
+ $('#account').val(localStorage.getItem("account"));
+ $('#debug').val(localStorage.getItem("debug"));
$('#runid').val(row.id);
});
@@ -270,6 +317,7 @@ var stratinRecords =
return ''+status+''
},
}],
+ order: [[1, 'asc']],
paging: false,
// createdRow: function( row, data, dataIndex){
// if (is_running(data.id) ){
@@ -314,6 +362,11 @@ var runnerRecords =
//modal na run
$("#runModal").on('submit','#runForm', function(event){
+ localStorage.setItem("bt_from", $('#bt_from').val());
+ localStorage.setItem("bt_to", $('#bt_to').val());
+ localStorage.setItem("mode", $('#mode').val());
+ localStorage.setItem("account", $('#account').val());
+ localStorage.setItem("debug", $('#debug').val());
event.preventDefault();
$('#run').attr('disabled','disabled');
var formData = $(this).serializeJSON();