Interface improved

This commit is contained in:
7u83 2017-01-13 21:49:09 +01:00
parent ad854804fc
commit 2818a32f06
8 changed files with 48 additions and 69 deletions

15
endless.php Normal file
View File

@ -0,0 +1,15 @@
<?php
function doNothing(&$param){
echo "I am really doing nothing\n";
}
$params = array(
"hello" => "world"
);
for ($i=0; $i<count($params); $i++){
doNothing($params[$i]);
}

View File

@ -41,14 +41,19 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver {
OHLCData data = new OHLCData();
OHLCDataItem current = null;
/* long rasterTime(long time) {
long rt = time / 5000;
return rt * 5000;
int getY(float Y){
return 0;
}
*/
void drawCandle(Graphics2D g, OHLCData d, int x, int y){
}
void drawXLegend(Graphics2D g) {
int xl_height = 30;
Dimension dim = this.getSize();

View File

@ -18,9 +18,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="763" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="legend1" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="844" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -29,36 +27,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="legend1" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="321" max="32767" attributes="0"/>
</Group>
<Component id="jScrollPane1" pref="321" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="chart.Legend" name="legend1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="ff" type="rgb"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="75" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
@ -68,12 +43,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="737" max="32767" attributes="0"/>
<EmptySpace min="0" pref="3480" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="295" max="32767" attributes="0"/>
<EmptySpace min="0" pref="280" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -47,32 +47,18 @@ public class FullChart extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
legend1 = new chart.Legend();
jScrollPane1 = new javax.swing.JScrollPane();
chart1 = new chart.Chart();
legend1.setBackground(new java.awt.Color(255, 204, 204));
javax.swing.GroupLayout legend1Layout = new javax.swing.GroupLayout(legend1);
legend1.setLayout(legend1Layout);
legend1Layout.setHorizontalGroup(
legend1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 75, Short.MAX_VALUE)
);
legend1Layout.setVerticalGroup(
legend1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
javax.swing.GroupLayout chart1Layout = new javax.swing.GroupLayout(chart1);
chart1.setLayout(chart1Layout);
chart1Layout.setHorizontalGroup(
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 737, Short.MAX_VALUE)
.addGap(0, 3480, Short.MAX_VALUE)
);
chart1Layout.setVerticalGroup(
chart1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 295, Short.MAX_VALUE)
.addGap(0, 280, Short.MAX_VALUE)
);
jScrollPane1.setViewportView(chart1);
@ -83,18 +69,14 @@ public class FullChart extends javax.swing.JPanel {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 763, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(legend1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 844, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(legend1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@ -103,6 +85,5 @@ public class FullChart extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private chart.Chart chart1;
private javax.swing.JScrollPane jScrollPane1;
private chart.Legend legend1;
// End of variables declaration//GEN-END:variables
}

View File

@ -36,7 +36,7 @@ public class OHLCData { //extends ArrayList <OHLCDataItem> {
float max=0;
float min=0;
int ras=60000;
int ras=60000/10;
long time_start;

View File

@ -207,13 +207,13 @@ public class MainWin extends javax.swing.JFrame {
RandomTraderConfig rcfg1 = new RandomTraderConfig();
AutoTrader rt1 = rcfg1.createTrader(se, 1000000, 0);
rt1.start();
AutoTrader rt2 = rcfg1.createTrader(se, 1, 100);
rt2.start();
//AutoTrader rt2 = rcfg1.createTrader(se, 1, 100);
//rt2.start();
RandomTraderConfig cfg = new RandomTraderConfig();
for (int i=0; i<10000; i++){
AutoTrader randt = cfg.createTrader(se, 1, 100);
for (int i=0; i<100; i++){
AutoTrader randt = cfg.createTrader(se, 100, 100);
randt.start();
}

View File

@ -64,10 +64,12 @@ public class RandomTrader extends AutoTrader {
public Event event;
public long time;
NextEvent(Event e, long time) {
/* NextEvent(Event e, long time) {
this.event = e;
this.time = time;
}
*/
}
public RandomTrader(Exchange se, double money, double shares, RandomTraderConfig config) {
@ -171,7 +173,7 @@ public class RandomTrader extends AutoTrader {
double money = getRandomAmmount(ad.money, myconfig.buy_volume);
Quote q = se.getCurrentPrice();
double lp = q == null ? 0.0001 : q.price;
double lp = q == null ? 1.0 : q.price;
@ -208,7 +210,7 @@ public class RandomTrader extends AutoTrader {
// double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice();
double lp = q == null ? 0.1 : q.price;
double lp = q == null ? 1.0 : q.price;
double limit;
@ -263,6 +265,7 @@ public class RandomTrader extends AutoTrader {
public void run() {
long time = trader.event();
time/=50;
this.cancel();
Exchange.timer.schedule(new TimerTaskImpl(trader), time);

View File

@ -36,12 +36,12 @@ import sesim.Exchange;
public class RandomTraderConfig extends AutoTraderConfig {
public float[] sell_volume = {100, 100};
public float[] sell_limit = {-1, 0};
public float[] sell_limit = {-1.0f, 1.0f};
public int[] sell_order_wait = {1, 5};
public int[] wait_after_sell = {10, 30};
public float[] buy_volume = {100, 100};
public float[] buy_limit = {0, 1};
public float[] buy_limit = {-1.0f, 1f};
public int[] buy_order_wait = {1, 5};
public int[] wait_after_buy = {10, 30};