vypnuti logu a MA na close misto hlcc4 a dup btn
This commit is contained in:
@ -135,7 +135,7 @@ def next(data, state: StrategyState):
|
|||||||
try:
|
try:
|
||||||
#print(state.vars.MA, "MACKO")
|
#print(state.vars.MA, "MACKO")
|
||||||
#print(state.bars.hlcc4)
|
#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
|
#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]
|
state.indicators.ema = [trunc(i,3) for i in state.indicators.ema]
|
||||||
ic(state.vars.MA, state.vars.Trend, state.indicators.ema[-5:])
|
ic(state.vars.MA, state.vars.Trend, state.indicators.ema[-5:])
|
||||||
|
|||||||
Binary file not shown.
@ -2,7 +2,7 @@ from alpaca.data.enums import DataFeed
|
|||||||
from v2realbot.enums.enums import Mode, Account
|
from v2realbot.enums.enums import Mode, Account
|
||||||
from appdirs import user_data_dir
|
from appdirs import user_data_dir
|
||||||
|
|
||||||
COUNT_API_REQUESTS = True
|
COUNT_API_REQUESTS = False
|
||||||
STRATVARS_UNCHANGEABLES = ['pendingbuys', 'blockbuy', 'jevylozeno', 'limitka']
|
STRATVARS_UNCHANGEABLES = ['pendingbuys', 'blockbuy', 'jevylozeno', 'limitka']
|
||||||
DATA_DIR = user_data_dir("v2realbot")
|
DATA_DIR = user_data_dir("v2realbot")
|
||||||
#BT DELAYS
|
#BT DELAYS
|
||||||
|
|||||||
@ -31,7 +31,7 @@ ic.configureOutput(includeContext=True)
|
|||||||
def threadName():
|
def threadName():
|
||||||
return '%s |> ' % str(current_thread().name)
|
return '%s |> ' % str(current_thread().name)
|
||||||
ic.configureOutput(prefix=threadName)
|
ic.configureOutput(prefix=threadName)
|
||||||
#ic.disable()
|
ic.disable()
|
||||||
"""""
|
"""""
|
||||||
Main entry point of the bot. Starts strategies according to config file, each
|
Main entry point of the bot. Starts strategies according to config file, each
|
||||||
in separate thread.
|
in separate thread.
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="stratin-table" class="flex-items">
|
<div id="stratin-table" class="flex-items">
|
||||||
<div id="stratin-table">
|
<div id="stratin-table">
|
||||||
<button id="button_add" class="btn btn-success">Add</button><button id="button_edit" class="btn btn-success">Edit</button><button id="button_delete" class="btn btn-success">Delete</button><button id="button_run" class="btn btn-success">Run Strategy</button>
|
<button id="button_add" class="btn btn-success">Add</button><button id="button_edit" class="btn btn-success">Edit</button><button id="button_dup" class="btn btn-success">Duplicate</button><button id="button_delete" class="btn btn-success">Delete</button><button id="button_run" class="btn btn-success">Run Strategy</button>
|
||||||
<table id="stratinTable" class="display" style="width:100%">
|
<table id="stratinTable" class="display" style="width:100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -63,6 +63,7 @@ $(document).ready(function () {
|
|||||||
$('#button_pause').attr('disabled','disabled');
|
$('#button_pause').attr('disabled','disabled');
|
||||||
$('#button_stop').attr('disabled','disabled');
|
$('#button_stop').attr('disabled','disabled');
|
||||||
$('#button_edit').attr('disabled','disabled');
|
$('#button_edit').attr('disabled','disabled');
|
||||||
|
$('#button_dup').attr('disabled','disabled');
|
||||||
$('#button_delete').attr('disabled','disabled');
|
$('#button_delete').attr('disabled','disabled');
|
||||||
$('#button_run').attr('disabled','disabled');
|
$('#button_run').attr('disabled','disabled');
|
||||||
|
|
||||||
@ -70,12 +71,14 @@ $(document).ready(function () {
|
|||||||
$('#stratinTable tbody').on('click', 'tr', function () {
|
$('#stratinTable tbody').on('click', 'tr', function () {
|
||||||
if ($(this).hasClass('selected')) {
|
if ($(this).hasClass('selected')) {
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
|
$('#button_dup').attr('disabled','disabled');
|
||||||
$('#button_edit').attr('disabled','disabled');
|
$('#button_edit').attr('disabled','disabled');
|
||||||
$('#button_delete').attr('disabled','disabled');
|
$('#button_delete').attr('disabled','disabled');
|
||||||
$('#button_run').attr('disabled','disabled');
|
$('#button_run').attr('disabled','disabled');
|
||||||
} else {
|
} else {
|
||||||
stratinRecords.$('tr.selected').removeClass('selected');
|
stratinRecords.$('tr.selected').removeClass('selected');
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
|
$('#button_dup').attr('disabled',false);
|
||||||
$('#button_edit').attr('disabled',false);
|
$('#button_edit').attr('disabled',false);
|
||||||
$('#button_delete').attr('disabled',false);
|
$('#button_delete').attr('disabled',false);
|
||||||
$('#button_run').attr('disabled',false);
|
$('#button_run').attr('disabled',false);
|
||||||
@ -102,6 +105,46 @@ $(document).ready(function () {
|
|||||||
stratinRecords.ajax.reload();
|
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
|
||||||
$('#button_pause').click(function () {
|
$('#button_pause').click(function () {
|
||||||
row = runnerRecords.row('.selected').data();
|
row = runnerRecords.row('.selected').data();
|
||||||
@ -191,7 +234,11 @@ $(document).ready(function () {
|
|||||||
$('#button_run').click(function () {
|
$('#button_run').click(function () {
|
||||||
row = stratinRecords.row('.selected').data();
|
row = stratinRecords.row('.selected').data();
|
||||||
window.$('#runModal').modal('show');
|
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);
|
$('#runid').val(row.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -270,6 +317,7 @@ var stratinRecords =
|
|||||||
return '<i class="fas fa-check-circle">'+status+'</i>'
|
return '<i class="fas fa-check-circle">'+status+'</i>'
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
order: [[1, 'asc']],
|
||||||
paging: false,
|
paging: false,
|
||||||
// createdRow: function( row, data, dataIndex){
|
// createdRow: function( row, data, dataIndex){
|
||||||
// if (is_running(data.id) ){
|
// if (is_running(data.id) ){
|
||||||
@ -314,6 +362,11 @@ var runnerRecords =
|
|||||||
|
|
||||||
//modal na run
|
//modal na run
|
||||||
$("#runModal").on('submit','#runForm', function(event){
|
$("#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();
|
event.preventDefault();
|
||||||
$('#run').attr('disabled','disabled');
|
$('#run').attr('disabled','disabled');
|
||||||
var formData = $(this).serializeJSON();
|
var formData = $(this).serializeJSON();
|
||||||
|
|||||||
Reference in New Issue
Block a user