some impürovements

This commit is contained in:
7u83 2017-02-06 08:14:05 +01:00
parent 002c2add2b
commit 5de1ca26c7
12 changed files with 246 additions and 141 deletions

View File

@ -28,6 +28,11 @@
<artifactId>jlfgr</artifactId> <artifactId>jlfgr</artifactId>
<version>1_0</version> <version>1_0</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.arnabk</groupId>
<artifactId>pgslookandfeel</artifactId>
<version>1.1.4</version>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -18,7 +18,7 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" pref="154" max="32767" attributes="0"/> <Component id="jLabel1" pref="153" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -27,7 +27,7 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -41,7 +41,7 @@
<Font bold="true" component="jLabel1" property="font" relativeSize="true" size="6"/> <Font bold="true" component="jLabel1" property="font" relativeSize="true" size="6"/>
</FontInfo> </FontInfo>
</Property> </Property>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="00:00:00"/> <Property name="text" type="java.lang.String" value="00:00:00"/>
</Properties> </Properties>
</Component> </Component>

View File

@ -80,7 +80,7 @@ public class Clock extends javax.swing.JPanel {
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD, jLabel1.getFont().getSize()+6)); jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD, jLabel1.getFont().getSize()+6));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel1.setText("00:00:00"); jLabel1.setText("00:00:00");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -89,14 +89,14 @@ public class Clock extends javax.swing.JPanel {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents

View File

@ -70,12 +70,10 @@ public class EditAutoTraderList extends javax.swing.JPanel {
for (int x = 0; x < model.getColumnCount(); x++) { for (int x = 0; x < model.getColumnCount(); x++) {
Object cw = model.getValueAt(i, x); Object cw = model.getValueAt(i, x);
System.out.printf("CWSaver: %s\n",cw.getClass().toString()); //System.out.printf("CWSaver: %s\n",cw.getClass().toString());
if (cw != null) { if (cw != null) {
jo.put((String) th.getColumnModel().getColumn(x).getHeaderValue(), cw.toString()); jo.put((String) th.getColumnModel().getColumn(x).getHeaderValue(), cw.toString());
} }
//ja.put(Integer.toString(i),jo);
} }
ja.put(jo); ja.put(jo);
@ -83,7 +81,6 @@ public class EditAutoTraderList extends javax.swing.JPanel {
Globals.prefs.put("Traders", ja.toString()); Globals.prefs.put("Traders", ja.toString());
// System.out.printf("Arlist: %s\n", ja.toString());
} }
final void load() { final void load() {
@ -97,7 +94,14 @@ public class EditAutoTraderList extends javax.swing.JPanel {
for (int col = 0; col < list.getColumnCount(); col++) { for (int col = 0; col < list.getColumnCount(); col++) {
String h = this.getColumnHeader(col); String h = this.getColumnHeader(col);
System.out.printf("Doing stuff for %s\n", h); System.out.printf("Doing stuff for %s\n", h);
String val = rowobj.getString(h);
String val = null;
try {
val = rowobj.getString(h);
} catch (Exception e) {
continue;
}
System.out.printf("Want to set (%d,%d): %s\n", row, col, val); System.out.printf("Want to set (%d,%d): %s\n", row, col, val);
//list.getModel().setValueAt(val, row, col); //list.getModel().setValueAt(val, row, col);
@ -133,8 +137,9 @@ public class EditAutoTraderList extends javax.swing.JPanel {
public EditAutoTraderList() { public EditAutoTraderList() {
initComponents(); initComponents();
if (Globals.se==null) if (Globals.se == null) {
return; return;
}
this.load(); this.load();
@ -142,7 +147,6 @@ public class EditAutoTraderList extends javax.swing.JPanel {
Globals.getStrategiesIntoComboBox(comboBox); Globals.getStrategiesIntoComboBox(comboBox);
DefaultTableModel model = (DefaultTableModel) list.getModel(); DefaultTableModel model = (DefaultTableModel) list.getModel();
list.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(comboBox)); list.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(comboBox));
// list.getColumnModel().getColumn(2).setCellRenderer(new javax.swing.table.DefaultTableCellRenderer()); // list.getColumnModel().getColumn(2).setCellRenderer(new javax.swing.table.DefaultTableCellRenderer());
@ -159,18 +163,16 @@ public class EditAutoTraderList extends javax.swing.JPanel {
Double shares = 0.0; Double shares = 0.0;
for (int r = 0; r < model.getRowCount(); r++) { for (int r = 0; r < model.getRowCount(); r++) {
money+=(Double)list.getValueAt( r, list.getColumn("Money").getModelIndex()); // money += (Double) list.getValueAt(r, list.getColumn("Money").getModelIndex());
shares+=(Double)list.getValueAt( r, list.getColumn("Shares").getModelIndex()); // shares += (Double) list.getValueAt(r, list.getColumn("Shares").getModelIndex());
System.out.printf("Row: %d %f %f\n", r, money, shares); System.out.printf("Row: %d %f %f\n", r, money, shares);
} }
this.summary.setText(String.format("Fair Value: %.5f", money / shares)); this.summary.setText(String.format("Fair Value: %.5f", money / shares));
}); });
} }
void add() { void add() {
DefaultTableModel model = (DefaultTableModel) list.getModel(); DefaultTableModel model = (DefaultTableModel) list.getModel();
model.setRowCount(model.getRowCount() + 1); model.setRowCount(model.getRowCount() + 1);

View File

@ -262,7 +262,7 @@
<Component id="jPanel2" min="-2" max="-2" attributes="0"/> <Component id="jPanel2" min="-2" 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="jChartScrollPane" max="32767" attributes="0"/> <Component id="jChartScrollPane" pref="301" max="32767" attributes="0"/>
<Component id="orderBookPanel" max="32767" attributes="0"/> <Component id="orderBookPanel" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -300,39 +300,50 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="jRunButton" min="-2" pref="86" max="-2" attributes="0"/> <Component id="runButton" min="-2" pref="86" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" pref="67" max="-2" attributes="0"/> <Component id="jButton2" min="-2" pref="67" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="63" max="-2" attributes="0"/> <Component id="stopButton" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Component id="clock1" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/> <Component id="clock" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="accelSpinner" min="-2" pref="90" max="-2" attributes="0"/> <Group type="102" alignment="1" attributes="0">
<Component id="jComboBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="accelSpinner" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </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">
<Component id="jRunButton" alignment="0" max="32767" attributes="0"/> <Component id="runButton" alignment="0" max="32767" attributes="0"/>
<Component id="jButton2" alignment="0" max="32767" attributes="0"/> <Component id="jButton2" alignment="0" max="32767" attributes="0"/>
<Component id="jButton1" alignment="0" max="32767" attributes="0"/> <Component id="stopButton" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="clock" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="accelSpinner" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Component id="accelSpinner" min="-2" max="-2" attributes="0"/> <Component id="jComboBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> </Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="clock1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="9" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JButton" name="jButton1"> <Component class="javax.swing.JButton" name="stopButton">
<Properties> <Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/toolbarButtonGraphics/general/Stop24.gif"/> <Image iconType="3" name="/toolbarButtonGraphics/general/Stop24.gif"/>
@ -343,14 +354,14 @@
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="stopButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JButton" name="jRunButton"> <Component class="javax.swing.JButton" name="runButton">
<Properties> <Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor"> <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true"> <FontInfo relative="true">
<Font component="jRunButton" property="font" relativeSize="true" size="0"/> <Font component="runButton" property="font" relativeSize="true" size="0"/>
</FontInfo> </FontInfo>
</Property> </Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
@ -363,7 +374,7 @@
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRunButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="runButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JButton" name="jButton2"> <Component class="javax.swing.JButton" name="jButton2">
@ -390,7 +401,25 @@
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="accelSpinnerStateChanged"/> <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="accelSpinnerStateChanged"/>
</Events> </Events>
</Component> </Component>
<Component class="gui.Clock" name="clock1"> <Component class="gui.Clock" name="clock">
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="7">
<StringItem index="0" value="1x"/>
<StringItem index="1" value="2x"/>
<StringItem index="2" value="4x"/>
<StringItem index="3" value="10x"/>
<StringItem index="4" value="100x"/>
<StringItem index="5" value="1000x"/>
<StringItem index="6" value="max."/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -79,6 +79,10 @@ public class NewMDIApplication extends javax.swing.JFrame {
Double shares = t.getDouble("Shares"); Double shares = t.getDouble("Shares");
Double money = t.getDouble("Money"); Double money = t.getDouble("Money");
Boolean enabled = t.getBoolean("Enabled");
if (!enabled)
continue;
System.out.printf("Count: %d Shares: %f Money %f\n", count,shares,money); System.out.printf("Count: %d Shares: %f Money %f\n", count,shares,money);
@ -98,7 +102,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
Globals.se.fairValue=moneyTotal/sharesTotal; Globals.se.fairValue=moneyTotal/sharesTotal;
Globals.se.fairValue=1.0; Globals.se.fairValue=15.0;
for (int i=0; i<Globals.se.traders.size(); i++){ for (int i=0; i<Globals.se.traders.size(); i++){
Globals.se.traders.get(i).start(); Globals.se.traders.get(i).start();
@ -122,11 +126,12 @@ public class NewMDIApplication extends javax.swing.JFrame {
jChartScrollPane = new javax.swing.JScrollPane(); jChartScrollPane = new javax.swing.JScrollPane();
chart = new chart.Chart(); chart = new chart.Chart();
jPanel2 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton(); stopButton = new javax.swing.JButton();
jRunButton = new javax.swing.JButton(); runButton = new javax.swing.JButton();
jButton2 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
accelSpinner = new javax.swing.JSpinner(); accelSpinner = new javax.swing.JSpinner();
clock1 = new gui.Clock(); clock = new gui.Clock();
jComboBox1 = new javax.swing.JComboBox<>();
menuBar = new javax.swing.JMenuBar(); menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu(); fileMenu = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem();
@ -175,27 +180,27 @@ public class NewMDIApplication extends javax.swing.JFrame {
jChartScrollPane.setViewportView(chart); jChartScrollPane.setViewportView(chart);
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Stop24.gif"))); // NOI18N stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Stop24.gif"))); // NOI18N
jButton1.setText("Stop"); stopButton.setText("Stop");
jButton1.setFocusable(false); stopButton.setFocusable(false);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); stopButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); stopButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton1.addActionListener(new java.awt.event.ActionListener() { stopButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt); stopButtonActionPerformed(evt);
} }
}); });
jRunButton.setFont(jRunButton.getFont()); runButton.setFont(runButton.getFont());
jRunButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/run.gif"))); // NOI18N runButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/run.gif"))); // NOI18N
jRunButton.setText("Run sim!"); runButton.setText("Run sim!");
jRunButton.setToolTipText("Run the simmulation"); runButton.setToolTipText("Run the simmulation");
jRunButton.setFocusable(false); runButton.setFocusable(false);
jRunButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); runButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jRunButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); runButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jRunButton.addActionListener(new java.awt.event.ActionListener() { runButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
jRunButtonActionPerformed(evt); runButtonActionPerformed(evt);
} }
}); });
@ -217,35 +222,44 @@ public class NewMDIApplication extends javax.swing.JFrame {
} }
}); });
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1x", "2x", "4x", "10x", "100x", "1000x", "max." }));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout); jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup( jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jRunButton, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(runButton, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clock1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(17, 17, 17) .addComponent(clock, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap()) .addContainerGap())
); );
jPanel2Layout.setVerticalGroup( jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRunButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(runButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(stopButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap() .addGap(3, 3, 3)
.addComponent(clock1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(clock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(9, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(accelSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())))
); );
fileMenu.setMnemonic('f'); fileMenu.setMnemonic('f');
@ -439,7 +453,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 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(jChartScrollPane) .addComponent(jChartScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)
.addComponent(orderBookPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(orderBookPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap()) .addContainerGap())
); );
@ -463,16 +477,23 @@ public class NewMDIApplication extends javax.swing.JFrame {
} }
void startSim(){ void startSim(){
resetSim(); resetSim();
this.stopButton.setEnabled(true);
this.startTraders(); this.startTraders();
Globals.se.timer.setAcceleration((Double)this.accelSpinner.getValue());
Globals.se.timer.setPause(false); Globals.se.timer.setPause(false);
Globals.se.timer.start(); Globals.se.timer.start();
Globals.se.timer.setAcceleration((Double)this.accelSpinner.getValue());
this.clock.invalidate();
this.clock.repaint();
} }
void stopSim(){ void stopSim(){
Globals.se.timer.terminate(); Globals.se.timer.terminate();
this.stopButton.setEnabled(false);
} }
void resetSim(){ void resetSim(){
@ -487,10 +508,6 @@ public class NewMDIApplication extends javax.swing.JFrame {
} }
private void jRunButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRunButtonActionPerformed
startSim();
}//GEN-LAST:event_jRunButtonActionPerformed
private void editPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPreferencesActionPerformed private void editPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPreferencesActionPerformed
Globals.LOGGER.info("Edit prefs..."); Globals.LOGGER.info("Edit prefs...");
@ -503,10 +520,6 @@ startSim();
d.setVisible(rootPaneCheckingEnabled); d.setVisible(rootPaneCheckingEnabled);
}//GEN-LAST:event_jMenuItem2ActionPerformed }//GEN-LAST:event_jMenuItem2ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Globals.se.timer.pause();
}//GEN-LAST:event_jButton2ActionPerformed
private void deleteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMenuItemActionPerformed private void deleteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMenuItemActionPerformed
EditAutoTraderListDialog ed = new EditAutoTraderListDialog(this, true); EditAutoTraderListDialog ed = new EditAutoTraderListDialog(this, true);
ed.setVisible(rootPaneCheckingEnabled); ed.setVisible(rootPaneCheckingEnabled);
@ -584,11 +597,6 @@ startSim();
}//GEN-LAST:event_viewClockActionPerformed }//GEN-LAST:event_viewClockActionPerformed
private void accelSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_accelSpinnerStateChanged
Double val = (Double)this.accelSpinner.getValue();
Globals.se.timer.setAcceleration(val);
}//GEN-LAST:event_accelSpinnerStateChanged
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_jMenuItem1ActionPerformed }//GEN-LAST:event_jMenuItem1ActionPerformed
@ -597,10 +605,6 @@ startSim();
startSim(); startSim();
}//GEN-LAST:event_simMenuStartActionPerformed }//GEN-LAST:event_simMenuStartActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
stopSim();
}//GEN-LAST:event_jButton1ActionPerformed
private void simMenuPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_simMenuPauseActionPerformed private void simMenuPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_simMenuPauseActionPerformed
pauseSim(); pauseSim();
}//GEN-LAST:event_simMenuPauseActionPerformed }//GEN-LAST:event_simMenuPauseActionPerformed
@ -609,6 +613,23 @@ startSim();
stopSim(); stopSim();
}//GEN-LAST:event_simMenuStopActionPerformed }//GEN-LAST:event_simMenuStopActionPerformed
private void accelSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_accelSpinnerStateChanged
Double val = (Double)this.accelSpinner.getValue();
Globals.se.timer.setAcceleration(val);
}//GEN-LAST:event_accelSpinnerStateChanged
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Globals.se.timer.pause();
}//GEN-LAST:event_jButton2ActionPerformed
private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed
startSim();
}//GEN-LAST:event_runButtonActionPerformed
private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
stopSim();
}//GEN-LAST:event_stopButtonActionPerformed
/** /**
* @param args the command line arguments * @param args the command line arguments
* @throws java.lang.IllegalAccessException * @throws java.lang.IllegalAccessException
@ -667,7 +688,7 @@ startSim();
private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JSpinner accelSpinner; private javax.swing.JSpinner accelSpinner;
private chart.Chart chart; private chart.Chart chart;
private gui.Clock clock1; private gui.Clock clock;
private javax.swing.JMenuItem contentMenuItem; private javax.swing.JMenuItem contentMenuItem;
private javax.swing.JMenuItem deleteMenuItem; private javax.swing.JMenuItem deleteMenuItem;
private javax.swing.JMenuItem editExchangeMenuItem; private javax.swing.JMenuItem editExchangeMenuItem;
@ -676,14 +697,13 @@ startSim();
private javax.swing.JMenuItem exitMenuItem; private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu; private javax.swing.JMenu fileMenu;
private javax.swing.JMenu helpMenu; private javax.swing.JMenu helpMenu;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2; private javax.swing.JButton jButton2;
private javax.swing.JScrollPane jChartScrollPane; private javax.swing.JScrollPane jChartScrollPane;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel2;
private javax.swing.JButton jRunButton;
private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JPopupMenu.Separator jSeparator1; private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator2; private javax.swing.JPopupMenu.Separator jSeparator2;
@ -692,12 +712,14 @@ startSim();
private javax.swing.JMenuItem openMenuItem; private javax.swing.JMenuItem openMenuItem;
private gui.OrderBookPanel orderBookPanel; private gui.OrderBookPanel orderBookPanel;
private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JButton runButton;
private javax.swing.JMenuItem saveAsMenuItem; private javax.swing.JMenuItem saveAsMenuItem;
private javax.swing.JMenuItem saveMenuItem; private javax.swing.JMenuItem saveMenuItem;
private javax.swing.JMenu simMenu; private javax.swing.JMenu simMenu;
private javax.swing.JMenuItem simMenuPause; private javax.swing.JMenuItem simMenuPause;
private javax.swing.JMenuItem simMenuStart; private javax.swing.JMenuItem simMenuStart;
private javax.swing.JMenuItem simMenuStop; private javax.swing.JMenuItem simMenuStop;
private javax.swing.JButton stopButton;
private javax.swing.JMenuItem viewClock; private javax.swing.JMenuItem viewClock;
private javax.swing.JMenu viewMenu; private javax.swing.JMenu viewMenu;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -35,6 +35,12 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JTable" name="orderBookList"> <Component class="javax.swing.JTable" name="orderBookList">
<Properties> <Properties>
<Property name="autoCreateRowSorter" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
<MatteColorBorder/>
</Border>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="30"> <Table columnCount="3" rowCount="30">
<Column editable="false" title="id" type="java.lang.Object"> <Column editable="false" title="id" type="java.lang.Object">
@ -73,8 +79,8 @@
<Column editable="false" title="Title 3" type="java.lang.Object"/> <Column editable="false" title="Title 3" type="java.lang.Object"/>
</Table> </Table>
</Property> </Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
<Property name="opaque" type="boolean" value="false"/>
</Properties> </Properties>
</Component> </Component>
</SubComponents> </SubComponents>

View File

@ -51,22 +51,24 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
abstract ArrayList <Order> getOrderBook(); abstract ArrayList <Order> getOrderBook();
private Color hdr_color = Color.LIGHT_GRAY; // private Color hdr_color = Color.LIGHT_GRAY;
private class OrderBookCellRenderer extends DefaultTableCellRenderer { private class OrderBookCellRenderer extends DefaultTableCellRenderer {
@Override /* @Override
public Component getTableCellRendererComponent(JTable table, public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, Object value, boolean isSelected, boolean hasFocus,
int row, int column) { int row, int column) {
DefaultTableCellRenderer renderer DefaultTableCellRenderer renderer
= (DefaultTableCellRenderer) super.getTableCellRendererComponent( = (DefaultTableCellRenderer) super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column); table, value, isSelected, hasFocus, row, column);
renderer.setBackground(hdr_color); // renderer.setBackground(hdr_color);
return renderer; return renderer;
} }
*/
} }
@Override @Override
public void UpdateOrderBook() { public void UpdateOrderBook() {
@ -169,7 +171,11 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
// Formatter f = new Formatter(); // Formatter f = new Formatter();
switch (c) { switch (c) {
case 0: case 0:
return String.format("#%06x", o.getID()); // o.getAccount().getID();
return o.getAccount().getOwner().getName();
//return String.format("#%06x", o.getID());
case 1: case 1:
//return String.format("%.f",o.getLimit()); //return String.format("%.f",o.getLimit());
@ -196,8 +202,8 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
//System.out.print("init Orderbook]\n"); //System.out.print("init Orderbook]\n");
initComponents(); initComponents();
this.setBorder(BorderFactory.createEmptyBorder()); // this.setBorder(BorderFactory.createEmptyBorder());
this.orderBookScroller.setBorder(BorderFactory.createBevelBorder(0)); // this.orderBookScroller.setBorder(BorderFactory.createBevelBorder(0));
if (Globals.se == null) { if (Globals.se == null) {
return; return;
@ -206,12 +212,12 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
this.model = new OrderBookListModel(); this.model = new OrderBookListModel();
this.orderBookList.setModel(model); this.orderBookList.setModel(model);
orderBookList.setBorder(BorderFactory.createEmptyBorder()); // orderBookList.setBorder(BorderFactory.createEmptyBorder());
JTableHeader h = this.orderBookList.getTableHeader(); JTableHeader h = this.orderBookList.getTableHeader();
h.setBackground(hdr_color); // h.setBackground(hdr_color);
h.setForeground(Color.green); // h.setForeground(Color.green);
h.setDefaultRenderer(new OrderBookCellRenderer()); // h.setDefaultRenderer(new OrderBookCellRenderer());
} }
@ -227,6 +233,8 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
orderBookScroller = new javax.swing.JScrollPane(); orderBookScroller = new javax.swing.JScrollPane();
orderBookList = new javax.swing.JTable(); orderBookList = new javax.swing.JTable();
orderBookList.setAutoCreateRowSorter(true);
orderBookList.setBorder(new javax.swing.border.MatteBorder(null));
orderBookList.setModel(new javax.swing.table.DefaultTableModel( orderBookList.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] { new Object [][] {
{"1", null, null}, {"1", null, null},
@ -272,8 +280,8 @@ public abstract class OrderBook extends javax.swing.JPanel implements Exchange.B
return canEdit [columnIndex]; return canEdit [columnIndex];
} }
}); });
orderBookList.setDoubleBuffered(true);
orderBookList.setFocusable(false); orderBookList.setFocusable(false);
orderBookList.setOpaque(false);
orderBookScroller.setViewportView(orderBookList); orderBookScroller.setViewportView(orderBookList);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);

View File

@ -25,6 +25,8 @@
*/ */
package sesim; package sesim;
import sesim.Exchange.Account;
/** /**
* *
* @author 7u83 * @author 7u83
@ -39,6 +41,10 @@ public abstract class AutoTrader implements Scheduler.TimerTask {
public AutoTrader(Exchange se, long id, String name, double money, double shares, AutoTraderConfig config) { public AutoTrader(Exchange se, long id, String name, double money, double shares, AutoTraderConfig config) {
account_id = se.createAccount(money, shares); account_id = se.createAccount(money, shares);
Account a = se.getAccount(account_id);
a.owner=this;
this.se = se; this.se = se;
this.config = config; this.config = config;
this.name = name; this.name = name;

View File

@ -68,6 +68,7 @@ public class Exchange {
private final double id; private final double id;
private double shares; private double shares;
private double money; private double money;
protected AutoTrader owner;
private final HashMap<Long, Order> orders; private final HashMap<Long, Order> orders;
@ -96,6 +97,10 @@ public class Exchange {
return money; return money;
} }
public AutoTrader getOwner(){
return owner;
}
} }
public void createTraders(JSONArray traderdefs) { public void createTraders(JSONArray traderdefs) {

View File

@ -215,7 +215,7 @@ public class Scheduler extends Thread {
} else { } else {
return 0; return 0;
//return (t - currentTimeMillis1())/(long)this.multiplier; //return (t - currentTimeMillis())/(long)this.acceleration;
} }
} }

View File

@ -158,7 +158,11 @@ public class RandomTrader extends AutoTrader {
} }
public long doBuy() { public long doBuy() {
RandomTraderConfig myconfig = (RandomTraderConfig) this.config; RandomTraderConfig myconfig = (RandomTraderConfig) this.config;
AccountData ad = this.se.getAccountData(account_id); AccountData ad = this.se.getAccountData(account_id);
@ -171,26 +175,44 @@ public class RandomTrader extends AutoTrader {
} }
//System.out.printf("%s: calling rand for money\n", this.getName());
// how much money we ant to envest? // how much money we ant to invest?
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 ? getStart() : 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);
// 10
// 24 13
// System.out.printf("MyLimit: %f\n",limit); // System.out.printf("MyLimit: %f\n",limit);
long volume = (long) (money / (limit * 1)); long volume = (long) (money / limit);
if (volume <= 0) { if (volume <= 0) {
return 0;
volume=1;
limit = money;
} }
// double volume = (money / (limit * 1)); // double volume = (money / (limit * 1));
if (volume <= 0) { // if (volume <= 0) {
return 0; // return 0;
} // }
//System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit); //System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit);
@ -220,7 +242,7 @@ public class RandomTrader extends AutoTrader {
// long volume = (long) (money / (limit * 1)); // long volume = (long) (money / (limit * 1));
if (volume <= 0) { if (volume <= 0) {
// System.out.print("SellVolume 0\n"); // System.out.print("SellVolume 0\n");
return 0; return 5000;
} }
// System.out.print("Volume is:"+volume+"\n"); // System.out.print("Volume is:"+volume+"\n");