Some improvements

This commit is contained in:
7u83 2017-02-02 18:39:55 +01:00
parent 3620fbcb04
commit df6c10ed59
28 changed files with 573 additions and 143 deletions

View File

@ -99,7 +99,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
} }
String getAt(int unit) { String getAt(int unit) {
Date date = new Date(sesim.Scheduler.timeStart + unit * 5000); Date date = new Date(/*sesim.Scheduler.timeStart*/ 0 + unit * 5000);
// DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); // DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS");
DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String dateFormatted = formatter.format(date); String dateFormatted = formatter.format(date);

View File

@ -119,7 +119,7 @@ public class FullChart extends javax.swing.JPanel {
} }
String getAt(int unit) { String getAt(int unit) {
Date date = new Date(sesim.Scheduler.timeStart + unit * 5000); Date date = new Date(0 + unit * 5000);
// DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); // DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS");
DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String dateFormatted = formatter.format(date); String dateFormatted = formatter.format(date);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> <Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties> <Properties>
<Property name="defaultCloseOperation" type="int" value="2"/> <Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
@ -62,6 +62,11 @@
<Component class="javax.swing.JTextPane" name="jTextPane1"> <Component class="javax.swing.JTextPane" name="jTextPane1">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font component="jTextPane1" property="font" relativeSize="true" size="0"/>
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" value="/*&#xa; * Copyright (c) 2017, 7u83 &lt;7u83@mail.ru&gt;&#xa; * All rights reserved.&#xa; *&#xa; * Redistribution and use in source and binary forms, with or without&#xa; * modification, are permitted provided that the following conditions are met:&#xa; *&#xa; * * Redistributions of source code must retain the above copyright notice, this&#xa; * list of conditions and the following disclaimer.&#xa; * * Redistributions in binary form must reproduce the above copyright notice,&#xa; * this list of conditions and the following disclaimer in the documentation&#xa; * and/or other materials provided with the distribution.&#xa; *&#xa; * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#xa; * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#xa; * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE&#xa; * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE&#xa; * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR&#xa; * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF&#xa; * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS&#xa; * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN&#xa; * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)&#xa; * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE&#xa; * POSSIBILITY OF SUCH DAMAGE.&#xa; */"/> <Property name="text" type="java.lang.String" value="/*&#xa; * Copyright (c) 2017, 7u83 &lt;7u83@mail.ru&gt;&#xa; * All rights reserved.&#xa; *&#xa; * Redistribution and use in source and binary forms, with or without&#xa; * modification, are permitted provided that the following conditions are met:&#xa; *&#xa; * * Redistributions of source code must retain the above copyright notice, this&#xa; * list of conditions and the following disclaimer.&#xa; * * Redistributions in binary form must reproduce the above copyright notice,&#xa; * this list of conditions and the following disclaimer in the documentation&#xa; * and/or other materials provided with the distribution.&#xa; *&#xa; * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#xa; * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#xa; * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE&#xa; * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE&#xa; * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR&#xa; * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF&#xa; * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS&#xa; * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN&#xa; * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)&#xa; * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE&#xa; * POSSIBILITY OF SUCH DAMAGE.&#xa; */"/>
</Properties> </Properties>
</Component> </Component>

View File

@ -57,6 +57,7 @@ public class AboutDialog extends javax.swing.JDialog {
setMinimumSize(new java.awt.Dimension(400, 300)); setMinimumSize(new java.awt.Dimension(400, 300));
jTextPane1.setEditable(false); jTextPane1.setEditable(false);
jTextPane1.setFont(jTextPane1.getFont());
jTextPane1.setText("/*\n * Copyright (c) 2017, 7u83 <7u83@mail.ru>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */"); jTextPane1.setText("/*\n * Copyright (c) 2017, 7u83 <7u83@mail.ru>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */");
jScrollPane1.setViewportView(jTextPane1); jScrollPane1.setViewportView(jTextPane1);

View File

@ -16,13 +16,34 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" pref="154" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="true" component="jLabel1" property="font" relativeSize="true" size="6"/>
</FontInfo>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="00:00:00"/>
</Properties>
</Component>
</SubComponents>
</Form> </Form>

View File

@ -25,19 +25,43 @@
*/ */
package gui; package gui;
import java.util.Timer;
import java.util.TimerTask;
import sesim.Scheduler;
/** /**
* *
* @author 7u83 <7u83@mail.ru> * @author 7u83 <7u83@mail.ru>
*/ */
public class Clock extends javax.swing.JPanel { public class Clock extends javax.swing.JPanel {
private final Timer timer;
TimerTask clockUpdater;
/** /**
* Creates new form Clock * Creates new form Clock
*/ */
public Clock() { public Clock() {
initComponents(); initComponents();
this.timer = new Timer();
clockUpdater = new TimerTask() {
@Override
public void run() {
long t = Globals.se.timer.currentTimeMillis();
System.out.printf("The Clock: %d\n",t);
jLabel1.setText(Scheduler.formatTimeMillis(t));
}
};
timer.schedule(clockUpdater, 0, 1000);
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -47,19 +71,32 @@ public class Clock extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD, jLabel1.getFont().getSize()+6));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("00:00:00");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
.addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="clock1" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="clock1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="gui.Clock" name="clock1">
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Ok"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,132 @@
/*
* Copyright (c) 2017, tobias
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package gui;
/**
*
* @author tobias
*/
public class ClockDialog extends javax.swing.JDialog {
/**
* Creates new form ClockDialog
*/
public ClockDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
clock1 = new gui.Clock();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jButton1.setText("Ok");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(clock1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(59, 59, 59))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(clock1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ClockDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ClockDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ClockDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ClockDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
ClockDialog dialog = new ClockDialog(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
@Override
public void dispose(){
super.dispose();
System.out.print("Disposed\n");
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private gui.Clock clock1;
private javax.swing.JButton jButton1;
// End of variables declaration//GEN-END:variables
}

View File

@ -32,6 +32,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel; import javax.swing.table.DefaultTableModel;
@ -147,6 +150,24 @@ public class EditAutoTraderList extends javax.swing.JPanel {
list.setRowHeight(30); list.setRowHeight(30);
list.getModel().addTableModelListener((TableModelEvent e) -> {
System.out.printf("Table has changed\n", "");
// if (summary==null)
// return;
Double money=0.0;
Double shares=0.0;
for (int r = 0; r < model.getRowCount(); r++) {
money+=(Double)list.getValueAt( r, list.getColumn("Money").getModelIndex());
shares+=(Double)list.getValueAt( r, list.getColumn("Shares").getModelIndex());
System.out.printf("Row: %d %f %f\n",r,money,shares);
}
this.summary.setText(String.format("Fair Value: %.5f", money/shares));
});
} }
@ -155,6 +176,8 @@ public class EditAutoTraderList extends javax.swing.JPanel {
model.setRowCount(model.getRowCount()+1); model.setRowCount(model.getRowCount()+1);
} }
JLabel summary=null;
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always

View File

@ -24,7 +24,9 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabelSummary" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/> <Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jOkButton" min="-2" max="-2" attributes="0"/> <Component id="jOkButton" min="-2" max="-2" attributes="0"/>
@ -44,6 +46,7 @@
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jOkButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jOkButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabelSummary" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -80,5 +83,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabelSummary">
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -39,6 +39,7 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
initComponents(); initComponents();
this.setTitle("Edit Auto Traders"); this.setTitle("Edit Auto Traders");
this.setLocationRelativeTo(this.getParent()); this.setLocationRelativeTo(this.getParent());
this.editAutoTraderList1.summary=this.jLabelSummary;
//this.setLocationRelativeTo(MainWin.instance); //this.setLocationRelativeTo(MainWin.instance);
} }
@ -55,6 +56,7 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
jButton1 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();
jOkButton = new javax.swing.JButton(); jOkButton = new javax.swing.JButton();
jButton2 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
jLabelSummary = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -87,7 +89,9 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()
.addComponent(jLabelSummary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2) .addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jOkButton) .addComponent(jOkButton)
@ -104,7 +108,8 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1) .addComponent(jButton1)
.addComponent(jOkButton) .addComponent(jOkButton)
.addComponent(jButton2)) .addComponent(jButton2)
.addComponent(jLabelSummary))
.addContainerGap()) .addContainerGap())
); );
@ -171,6 +176,7 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
private gui.EditAutoTraderList editAutoTraderList1; private gui.EditAutoTraderList editAutoTraderList1;
private javax.swing.JButton jButton1; private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2; private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabelSummary;
private javax.swing.JButton jOkButton; private javax.swing.JButton jOkButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -39,11 +39,8 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/> <Component id="cancelButton" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Component id="jDevleopmentFeaturesCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" alignment="0" min="-2" pref="99" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -59,11 +56,9 @@
<Component id="lafComboBox" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lafComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace pref="178" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/> <Component id="jDevleopmentFeaturesCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="191" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="applyButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="applyButton" alignment="3" min="-2" max="-2" attributes="0"/>
@ -122,18 +117,12 @@
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel1"> <Component class="javax.swing.JLabel" name="jLabel1">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="jLabel1"/> <Property name="text" type="java.lang.String" value="Look and Feel:"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox2"> <Component class="javax.swing.JCheckBox" name="jDevleopmentFeaturesCheckBox">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="jCheckBox2"/> <Property name="text" type="java.lang.String" value="Develeopment"/>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel2"/>
</Properties> </Properties>
</Component> </Component>
</SubComponents> </SubComponents>

View File

@ -62,6 +62,10 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
lafComboBox.addItem(lafInfo1.getName()); lafComboBox.addItem(lafInfo1.getName());
} }
lafComboBox.setSelectedItem(Globals.prefs.get("laf", "Nimbus")); lafComboBox.setSelectedItem(Globals.prefs.get("laf", "Nimbus"));
String selstr = Globals.prefs.get(Globals.DEVELSTATUS,"false");
this.jDevleopmentFeaturesCheckBox.setSelected(selstr.equals("true"));
} }
/** /**
@ -78,8 +82,7 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
applyButton = new javax.swing.JButton(); applyButton = new javax.swing.JButton();
okButton = new javax.swing.JButton(); okButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jCheckBox2 = new javax.swing.JCheckBox(); jDevleopmentFeaturesCheckBox = new javax.swing.JCheckBox();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -114,12 +117,9 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
} }
}); });
jLabel1.setText("jLabel1"); jLabel1.setText("Look and Feel:");
jCheckBox2.setText("jCheckBox2"); jDevleopmentFeaturesCheckBox.setText("Develeopment");
jCheckBox2.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
jLabel2.setText("jLabel2");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
@ -140,9 +140,7 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)) .addComponent(cancelButton))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jDevleopmentFeaturesCheckBox)
.addComponent(jLabel2)
.addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))) .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap()) .addContainerGap())
); );
@ -153,11 +151,9 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lafComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lafComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)) .addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 178, Short.MAX_VALUE)
.addComponent(jLabel2) .addComponent(jDevleopmentFeaturesCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGap(40, 40, 40)
.addComponent(jCheckBox2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 191, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton) .addComponent(cancelButton)
.addComponent(applyButton) .addComponent(applyButton)
@ -207,6 +203,8 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
this.applyButtonActionPerformed(evt); this.applyButtonActionPerformed(evt);
String selected = (String) this.lafComboBox.getSelectedItem(); String selected = (String) this.lafComboBox.getSelectedItem();
Globals.prefs.put("laf", selected); Globals.prefs.put("laf", selected);
String sel = this.jDevleopmentFeaturesCheckBox.isSelected() == true ? "true" : "false";
Globals.prefs.put(Globals.DEVELSTATUS,sel);
this.dispose(); this.dispose();
}//GEN-LAST:event_okButtonActionPerformed }//GEN-LAST:event_okButtonActionPerformed
@ -255,9 +253,8 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton applyButton; private javax.swing.JButton applyButton;
private javax.swing.JButton cancelButton; private javax.swing.JButton cancelButton;
private javax.swing.JCheckBox jCheckBox2; private javax.swing.JCheckBox jDevleopmentFeaturesCheckBox;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JComboBox<String> lafComboBox; private javax.swing.JComboBox<String> lafComboBox;
private javax.swing.JButton okButton; private javax.swing.JButton okButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -48,6 +48,8 @@ public class Globals {
static final String STRATEGYPREFS = "Strategies"; static final String STRATEGYPREFS = "Strategies";
static final String TRADERPREFS = "Traders"; static final String TRADERPREFS = "Traders";
static final String DEVELSTATUS = "devel_status";
static public sesim.Exchange se; static public sesim.Exchange se;
static public Preferences prefs; static public Preferences prefs;

View File

@ -110,7 +110,7 @@
</MenuItem> </MenuItem>
</SubComponents> </SubComponents>
</Menu> </Menu>
<Menu class="javax.swing.JMenu" name="jMenu1"> <Menu class="javax.swing.JMenu" name="viewMenu">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="View"/> <Property name="text" type="java.lang.String" value="View"/>
</Properties> </Properties>
@ -131,6 +131,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem3ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem3ActionPerformed"/>
</Events> </Events>
</MenuItem> </MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="viewClock">
<Properties>
<Property name="text" type="java.lang.String" value="Clock"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="viewClockActionPerformed"/>
</Events>
</MenuItem>
</SubComponents> </SubComponents>
</Menu> </Menu>
<Menu class="javax.swing.JMenu" name="helpMenu"> <Menu class="javax.swing.JMenu" name="helpMenu">
@ -188,12 +196,16 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" pref="798" max="32767" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Component id="orderBookPanel1" min="-2" pref="233" max="-2" attributes="0"/> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/> <Component id="orderBookPanel1" min="-2" pref="233" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
<Component id="jToolBar1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -204,7 +216,7 @@
<Component id="jToolBar1" min="-2" pref="60" max="-2" attributes="0"/> <Component id="jToolBar1" min="-2" pref="60" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="orderBookPanel1" pref="466" max="32767" attributes="0"/> <Component id="orderBookPanel1" max="32767" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/> <Component id="jScrollPane1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>

View File

@ -28,6 +28,7 @@ package gui;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
import java.io.File; import java.io.File;
import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
@ -61,6 +62,10 @@ public class NewMDIApplication extends javax.swing.JFrame {
public void startTraders() { public void startTraders() {
JSONArray tlist = Globals.getTraders(); JSONArray tlist = Globals.getTraders();
Double moneyTotal=0.0;
Double sharesTotal=0.0;
for (int i=0; i<tlist.length();i++){ for (int i=0; i<tlist.length();i++){
JSONObject t=tlist.getJSONObject(i); JSONObject t=tlist.getJSONObject(i);
String strategy_name = t.getString("Strategy"); String strategy_name = t.getString("Strategy");
@ -81,15 +86,20 @@ public class NewMDIApplication extends javax.swing.JFrame {
for (int i1=0;i1<count;i1++){ for (int i1=0;i1<count;i1++){
AutoTrader trader = ac.createTrader(Globals.se, strategy, money, shares); AutoTrader trader = ac.createTrader(Globals.se, strategy, money, shares);
Globals.se.traders.add(trader); Globals.se.traders.add(trader);
trader.setName(t.getString("Name")); trader.setName(t.getString("Name")+i1);
trader.start();
moneyTotal+=money;
sharesTotal+=shares;
// trader.start();
} }
}
Globals.se.fairValue=moneyTotal/sharesTotal;
//AutoTraderConfig ac = Globals.tloader.getStrategyBase(t.getString("base")); for (int i=0; i<Globals.se.traders.size(); i++){
//ac.putConfig(t); Globals.se.traders.get(i).start();
} }
// System.exit(0); // System.exit(0);
@ -146,9 +156,10 @@ public class NewMDIApplication extends javax.swing.JFrame {
deleteMenuItem = new javax.swing.JMenuItem(); deleteMenuItem = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JPopupMenu.Separator(); jSeparator2 = new javax.swing.JPopupMenu.Separator();
editPreferences = new javax.swing.JMenuItem(); editPreferences = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu(); viewMenu = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem();
viewClock = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu(); helpMenu = new javax.swing.JMenu();
contentMenuItem = new javax.swing.JMenuItem(); contentMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem(); aboutMenuItem = new javax.swing.JMenuItem();
@ -283,7 +294,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
menuBar.add(editMenu); menuBar.add(editMenu);
jMenu1.setText("View"); viewMenu.setText("View");
jMenuItem2.setText("Traders"); jMenuItem2.setText("Traders");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() { jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
@ -291,7 +302,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
jMenuItem2ActionPerformed(evt); jMenuItem2ActionPerformed(evt);
} }
}); });
jMenu1.add(jMenuItem2); viewMenu.add(jMenuItem2);
jMenuItem3.setText("LogWindow"); jMenuItem3.setText("LogWindow");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() { jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
@ -299,9 +310,17 @@ public class NewMDIApplication extends javax.swing.JFrame {
jMenuItem3ActionPerformed(evt); jMenuItem3ActionPerformed(evt);
} }
}); });
jMenu1.add(jMenuItem3); viewMenu.add(jMenuItem3);
menuBar.add(jMenu1); viewClock.setText("Clock");
viewClock.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewClockActionPerformed(evt);
}
});
viewMenu.add(viewClock);
menuBar.add(viewMenu);
helpMenu.setMnemonic('h'); helpMenu.setMnemonic('h');
helpMenu.setText("Help"); helpMenu.setText("Help");
@ -327,12 +346,14 @@ public class NewMDIApplication extends javax.swing.JFrame {
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(orderBookPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addContainerGap()
.addComponent(jScrollPane1) .addComponent(orderBookPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1))
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
@ -341,7 +362,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(orderBookPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE) .addComponent(orderBookPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)) .addComponent(jScrollPane1))
.addContainerGap()) .addContainerGap())
); );
@ -415,7 +436,9 @@ public class NewMDIApplication extends javax.swing.JFrame {
FileNameExtensionFilter filter = new FileNameExtensionFilter("SeSim Files","sesim"); FileNameExtensionFilter filter = new FileNameExtensionFilter("SeSim Files","sesim");
fc.setFileFilter(filter); fc.setFileFilter(filter);
if (fc.showSaveDialog(this.getParent()) != JFileChooser.APPROVE_OPTION){
if (fc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION){
return; return;
} }
@ -449,6 +472,12 @@ public class NewMDIApplication extends javax.swing.JFrame {
}//GEN-LAST:event_editExchangeMenuItemActionPerformed }//GEN-LAST:event_editExchangeMenuItemActionPerformed
private void viewClockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewClockActionPerformed
ClockDialog cd = new ClockDialog(this,true);
cd.setVisible(rootPaneCheckingEnabled);
}//GEN-LAST:event_viewClockActionPerformed
/** /**
* @param args the command line arguments * @param args the command line arguments
* @throws java.lang.IllegalAccessException * @throws java.lang.IllegalAccessException
@ -484,6 +513,11 @@ public class NewMDIApplication extends javax.swing.JFrame {
} }
for (Class<AutoTraderConfig> at_class : traders) { for (Class<AutoTraderConfig> at_class : traders) {
System.out.printf("Class = %s\n",at_class.getName());
if (Modifier.isAbstract(at_class.getModifiers())) {
continue;
}
AutoTraderConfig cfg = at_class.newInstance(); AutoTraderConfig cfg = at_class.newInstance();
System.out.printf("Have a Trader with name: %s\n", cfg.getDisplayName()); System.out.printf("Have a Trader with name: %s\n", cfg.getDisplayName());
} }
@ -510,7 +544,6 @@ public class NewMDIApplication extends javax.swing.JFrame {
private javax.swing.JMenu fileMenu; private javax.swing.JMenu fileMenu;
private javax.swing.JMenu helpMenu; private javax.swing.JMenu helpMenu;
private javax.swing.JButton jButton2; private javax.swing.JButton jButton2;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JButton jRunButton; private javax.swing.JButton jRunButton;
@ -526,6 +559,8 @@ public class NewMDIApplication extends javax.swing.JFrame {
private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JMenuItem saveAsMenuItem; private javax.swing.JMenuItem saveAsMenuItem;
private javax.swing.JMenuItem saveMenuItem; private javax.swing.JMenuItem saveMenuItem;
private javax.swing.JMenuItem viewClock;
private javax.swing.JMenu viewMenu;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -41,7 +41,8 @@ public class NewStrategyDialog extends EscDialog {
super(parent, modal); super(parent, modal);
initComponents(); initComponents();
this.setLocationRelativeTo(this.getParent()); this.setLocationRelativeTo(this.getParent());
ArrayList <String> names = Globals.tloader.getDefaultStrategyNames(); boolean devel = Globals.prefs.get(Globals.DEVELSTATUS, "false").equals("true");
ArrayList <String> names = Globals.tloader.getDefaultStrategyNames(devel);
this.jStrategyComboBox.removeAllItems(); this.jStrategyComboBox.removeAllItems();
names.stream().forEach((s) -> { names.stream().forEach((s) -> {
this.jStrategyComboBox.addItem(s); this.jStrategyComboBox.addItem(s);

View File

@ -178,7 +178,7 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
case 2: case 2:
double v = o.getVolume(); double v = o.getVolume();
if(v<=0){ if(v<=0){
System.out.printf("Order: %s %f %f\n",o.getType().toString(),o.getVolume(),o.getLimit()); // System.out.printf("Order: %s %f %f\n",o.getType().toString(),o.getVolume(),o.getLimit());
// System.exit(0); // System.exit(0);
} }

View File

@ -164,7 +164,7 @@ public class TraderListPanel extends javax.swing.JPanel
case 3: case 3:
return "Shares"; return "Shares";
case 4: case 4:
return "Welth"; return "Wealth";
} }
return ""; return "";
} }
@ -202,7 +202,7 @@ public class TraderListPanel extends javax.swing.JPanel
case 3: case 3:
return String.format("%.2f", ti.shares); return String.format("%.2f", ti.shares);
case 4: case 4:
return String.format("%.2f", ti.welth); return ti.welth; //String.format("%.2f", ti.welth);
} }
return "x"; return "x";

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, tobias
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package sesim;
import org.json.JSONObject;
/**
*
* @author tobias
*/
public abstract class AutoTraderBase implements AutoTraderConfig{
@Override
public boolean getDevelStatus() {
return true;
}
}

View File

@ -38,5 +38,6 @@ public abstract interface AutoTraderConfig {
public abstract AutoTraderGui getGui(); public abstract AutoTraderGui getGui();
public abstract JSONObject getConfig(); public abstract JSONObject getConfig();
public abstract void putConfig(JSONObject cfg); public abstract void putConfig(JSONObject cfg);
public abstract boolean getDevelStatus();
} }

View File

@ -146,7 +146,7 @@ public class AutoTraderLoader {
} }
public ArrayList<String> getDefaultStrategyNames() { public ArrayList<String> getDefaultStrategyNames(boolean devel) {
ArrayList<Class<AutoTraderConfig>> trclasses; ArrayList<Class<AutoTraderConfig>> trclasses;
trclasses = this.getTraders(); trclasses = this.getTraders();
ArrayList<String> ret = new ArrayList<>(); ArrayList<String> ret = new ArrayList<>();
@ -154,9 +154,13 @@ public class AutoTraderLoader {
for (int i = 0; i < trclasses.size(); i++) { for (int i = 0; i < trclasses.size(); i++) {
try { try {
AutoTraderConfig ac = trclasses.get(i).newInstance(); AutoTraderConfig ac = trclasses.get(i).newInstance();
if (ac.getDevelStatus() && devel==false){
continue;
}
ret.add(ac.getClass().getCanonicalName()); ret.add(ac.getClass().getCanonicalName());
} catch (Exception ex) { } catch (InstantiationException | IllegalAccessException ex) {
} }
@ -165,6 +169,10 @@ public class AutoTraderLoader {
return ret; return ret;
} }
public ArrayList<String> getDefaultStrategyNames() {
return this.getDefaultStrategyNames(true);
}
public AutoTraderConfig getStrategyBase(String name) { public AutoTraderConfig getStrategyBase(String name) {
ArrayList<Class<AutoTraderConfig>> traders = this.getTraders(); ArrayList<Class<AutoTraderConfig>> traders = this.getTraders();
for (int i = 0; i < traders.size(); i++) { for (int i = 0; i < traders.size(); i++) {

View File

@ -23,18 +23,17 @@ public class Exchange { //extends Thread {
shares_df = Math.pow(10, n); shares_df = Math.pow(10, n);
} }
public double roundToDecimals(double val,double f){ public double roundToDecimals(double val, double f) {
return Math.floor(val*f)/f; return Math.floor(val * f) / f;
} }
public double roundShares(double shares){ public double roundShares(double shares) {
return roundToDecimals(shares,shares_df); return roundToDecimals(shares, shares_df);
}
public double roundMoney(double money){
return roundToDecimals(money,money_df);
} }
public double roundMoney(double money) {
return roundToDecimals(money, money_df);
}
public enum OrderType { public enum OrderType {
BID, ASK BID, ASK
@ -132,8 +131,8 @@ public class Exchange { //extends Thread {
return d > 0 ? 1 : -1; return d > 0 ? 1 : -1;
} }
d=right.initial_volume-left.initial_volume; d = right.initial_volume - left.initial_volume;
if (d!=0){ if (d != 0) {
return d > 0 ? 1 : -1; return d > 0 ? 1 : -1;
} }
@ -377,16 +376,15 @@ public class Exchange { //extends Thread {
Iterator<Order> it = book.iterator(); Iterator<Order> it = book.iterator();
for (int i = 0; i < depth && it.hasNext(); i++) { for (int i = 0; i < depth && it.hasNext(); i++) {
Order o=it.next(); Order o = it.next();
// System.out.print(o.volume); // System.out.print(o.volume);
if (o.volume<=0) if (o.volume <= 0) {
System.exit(0); System.exit(0);
}
ret.add(o); ret.add(o);
} }
// System.out.println(); // System.out.println();
tradelock.unlock(); tradelock.unlock();
return ret; return ret;
} }
@ -429,12 +427,29 @@ public class Exchange { //extends Thread {
return ret; return ret;
} }
Random random = new Random();
public int randNextInt() {
return random.nextInt();
}
public int randNextInt(int bounds) {
return random.nextInt(bounds);
}
public double randNextDouble() {
return random.nextDouble();
}
/** /**
* *
* @param o * @param o
*/ */
long nextQuoteId = 0; long nextQuoteId = 0;
public double fairValue = 0;
private void removeOrderIfExecuted(Order o) { private void removeOrderIfExecuted(Order o) {
if (o.volume != 0) { if (o.volume != 0) {
return; return;
@ -465,8 +480,6 @@ public class Exchange { //extends Thread {
Order a = ask.first(); Order a = ask.first();
//System.out.printf("In %f (%f) < %f (%f)\n",b.limit,b.volume,a.limit,a.volume); //System.out.printf("In %f (%f) < %f (%f)\n",b.limit,b.volume,a.limit,a.volume);
if (b.limit < a.limit) { if (b.limit < a.limit) {
break; break;
} }
@ -476,7 +489,6 @@ public class Exchange { //extends Thread {
double volume = b.volume >= a.volume ? a.volume : b.volume; double volume = b.volume >= a.volume ? a.volume : b.volume;
//System.out.printf("Price %f Vol %f\n", price,volume); //System.out.printf("Price %f Vol %f\n", price,volume);
// Transfer money and shares // Transfer money and shares
transferMoneyAndShares(b.account, a.account, volume * price, -volume); transferMoneyAndShares(b.account, a.account, volume * price, -volume);
//System.out.print("Transfer Shares was called with volume "+volume+"\n"); //System.out.print("Transfer Shares was called with volume "+volume+"\n");
@ -485,7 +497,6 @@ public class Exchange { //extends Thread {
a.volume -= volume; a.volume -= volume;
//System.out.printf("In %f (%f) < %f (%f)\n",b.limit,b.volume,a.limit,a.volume); //System.out.printf("In %f (%f) < %f (%f)\n",b.limit,b.volume,a.limit,a.volume);
volume_total += volume; volume_total += volume;
money_total += price * volume; money_total += price * volume;
@ -530,9 +541,9 @@ public class Exchange { //extends Thread {
} }
Order o = new Order(a, type, volume, limit); Order o = new Order(a, type, volume, limit);
if (o.volume<=0 || o.limit<=0){ if (o.volume <= 0 || o.limit <= 0) {
System.out.print("binweg\n"); System.out.print("binweg\n");
return -1; return -1;
} }
tradelock.lock(); tradelock.lock();

View File

@ -25,7 +25,11 @@
*/ */
package sesim; package sesim;
import static com.sun.org.apache.xalan.internal.lib.ExsltDatetime.date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.SortedSet; import java.util.SortedSet;
@ -48,7 +52,8 @@ public class Scheduler extends Thread {
long timerTask(); long timerTask();
} }
/**\ /**
* \
* *
*/ */
public void halt() { public void halt() {
@ -69,18 +74,30 @@ public class Scheduler extends Thread {
} }
} }
long last_time_millis = System.currentTimeMillis();
double current_time_millis = 0.0;
/** /**
* *
* @return * @return
*/ */
public static long currentTimeMillis() { public long currentTimeMillis() {
return System.currentTimeMillis(); long diff = System.currentTimeMillis() - last_time_millis;
last_time_millis += diff;
this.current_time_millis += diff * 1;
return (long) this.current_time_millis;
} }
public static long timeStart=Scheduler.currentTimeMillis(); static public String formatTimeMillis(long t) {
Date date = new Date(t);
DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String dateFormatted = formatter.format(date);
return dateFormatted;
}
/** /**
* *
@ -97,11 +114,11 @@ public class Scheduler extends Thread {
} }
} }
private boolean pause=false; private boolean pause = false;
public void pause(){ public void pause() {
pause=!pause; pause = !pause;
synchronized(this){ synchronized (this) {
this.notify(); this.notify();
} }
@ -150,11 +167,11 @@ public class Scheduler extends Thread {
@Override @Override
public void run() { public void run() {
while (!halt) { while (!halt) {
long wtime = runEvents(); long wtime = runEvents();
if (wtime == 0) { if (wtime == 0) {
continue; continue;
} }

View File

@ -25,6 +25,7 @@
*/ */
package traders; package traders;
import gui.Globals;
import java.util.*; import java.util.*;
import java.util.Random; import java.util.Random;
//import java.util.TimerTask; //import java.util.TimerTask;
@ -46,7 +47,7 @@ public class RandomTrader extends AutoTrader {
sesim.Exchange.Account a = se.getAccount(account_id); sesim.Exchange.Account a = se.getAccount(account_id);
long rc = this.doTrade(); long rc = this.doTrade();
return rc/80 ; return rc ;
} }
@ -66,7 +67,7 @@ public class RandomTrader extends AutoTrader {
public long timerTask() { public long timerTask() {
sesim.Exchange.Account a = se.getAccount(account_id); sesim.Exchange.Account a = se.getAccount(account_id);
long rc = this.doTrade(); long rc = this.doTrade();
return rc /100; return rc / 1;
// return this.event(); // return this.event();
} }
@ -76,7 +77,7 @@ public class RandomTrader extends AutoTrader {
} }
protected Action getAction() { protected Action getAction() {
if (rand.nextInt(2) == 0) { if (se.randNextInt(2) == 0) {
return Action.BUY; return Action.BUY;
} else { } else {
return Action.SELL; return Action.SELL;
@ -84,7 +85,10 @@ public class RandomTrader extends AutoTrader {
} }
double start = 0.1; double getStart (){
return Globals.se.fairValue;
}
//Timer timer = new Timer(); //Timer timer = new Timer();
@Override @Override
@ -99,7 +103,7 @@ public class RandomTrader extends AutoTrader {
// config for this trader // config for this trader
//final private RandomTraderConfig_old myconfig; //final private RandomTraderConfig_old myconfig;
// object to generate random numbers // object to generate random numbers
final private Random rand = new Random(); //final private Random rand = new Random();
/** /**
* Get a (long) random number between min an max * Get a (long) random number between min an max
@ -109,7 +113,8 @@ public class RandomTrader extends AutoTrader {
* @return the number * @return the number
*/ */
protected double getRandom(double min, double max) { protected double getRandom(double min, double max) {
double r = rand.nextDouble(); double r = se.randNextDouble();
return (max - min) * r + min; return (max - min) * r + min;
} }
@ -117,6 +122,7 @@ public class RandomTrader extends AutoTrader {
return (int) Math.round(getRandom(minmax[0], minmax[1])); return (int) Math.round(getRandom(minmax[0], minmax[1]));
} }
/** /**
* *
* @param val * @param val
@ -124,6 +130,8 @@ public class RandomTrader extends AutoTrader {
* @return * @return
*/ */
protected double getRandomAmmount(double val, Float[] minmax) { protected double getRandomAmmount(double val, Float[] minmax) {
//System.out.printf("RandomAmmount: %f (%f,%f)\n",val, minmax[0], minmax[1]);
double min = val * minmax[0] / 100.0; double min = val * minmax[0] / 100.0;
double max = val * minmax[1] / 100.0; double max = val * minmax[1] / 100.0;
return getRandom(min, max); return getRandom(min, max);
@ -163,11 +171,13 @@ public class RandomTrader extends AutoTrader {
double money = getRandomAmmount(ad.money, myconfig.buy_volume); double money = getRandomAmmount(ad.money, myconfig.buy_volume);
Quote q = se.getCurrentPrice(); Quote q = se.getCurrentPrice();
double lp = q == null ? start : q.price; double lp = q == null ? getStart() : q.price;
double limit; double limit;
limit = lp + getRandomAmmount(lp, myconfig.buy_limit); limit = lp + getRandomAmmount(lp, myconfig.buy_limit);
// System.out.printf("MyLimit: %f\n",limit);
long volume = (long) (money / (limit * 1)); long volume = (long) (money / (limit * 1));
if (volume <= 0) { if (volume <= 0) {
@ -196,7 +206,7 @@ public class RandomTrader extends AutoTrader {
// double lp = 100.0; //se.getBestLimit(type); // double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice(); Quote q = se.getCurrentPrice();
double lp = q == null ? start : q.price; double lp = q == null ? getStart() : q.price;
double limit; double limit;
limit = lp + getRandomAmmount(lp, myconfig.sell_limit); limit = lp + getRandomAmmount(lp, myconfig.sell_limit);

View File

@ -31,6 +31,7 @@ import javax.swing.JPanel;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import sesim.AutoTrader; import sesim.AutoTrader;
import sesim.AutoTraderBase;
import sesim.AutoTraderConfig; import sesim.AutoTraderConfig;
import sesim.AutoTraderGui; import sesim.AutoTraderGui;
import sesim.Exchange; import sesim.Exchange;
@ -39,7 +40,7 @@ import sesim.Exchange;
* *
* @author 7u83 * @author 7u83
*/ */
public class RandomTraderConfig implements AutoTraderConfig { public class RandomTraderConfig extends AutoTraderBase implements AutoTraderConfig {
public Float[] sell_volume = {100f, 100f}; public Float[] sell_volume = {100f, 100f};
public Float[] sell_limit = {-0.1f, 0.10101f}; public Float[] sell_limit = {-0.1f, 0.10101f};
@ -154,4 +155,10 @@ public class RandomTraderConfig implements AutoTraderConfig {
wait_after_buy = to_integer(cfg.getJSONArray(WAIT_AFTER_BUY)); wait_after_buy = to_integer(cfg.getJSONArray(WAIT_AFTER_BUY));
} }
@Override
public boolean getDevelStatus() {
return false;
}
} }

View File

@ -68,4 +68,9 @@ public class SuperTraderConfig implements AutoTraderConfig{
} }
@Override
public boolean getDevelStatus() {
return true;
}
} }

View File

@ -34,7 +34,7 @@ import sesim.Exchange;
* *
* @author 7u83 <7u83@mail.ru> * @author 7u83 <7u83@mail.ru>
*/ */
public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTraderConfig{ public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTraderConfig {
@Override @Override
public AutoTrader createTrader(Exchange se, JSONObject cfg, double money, double shares) { public AutoTrader createTrader(Exchange se, JSONObject cfg, double money, double shares) {
@ -57,7 +57,13 @@ public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTra
} }
@Override @Override
public String getDisplayName(){ public String getDisplayName() {
return "SwitchingTrader"; return "SwitchingTrader";
} }
@Override
public boolean getDevelStatus() {
return true;
}
} }