working ...
This commit is contained in:
parent
456be84413
commit
14127f08b5
@ -3,4 +3,4 @@ do.depend=false
|
|||||||
do.jar=true
|
do.jar=true
|
||||||
javac.debug=true
|
javac.debug=true
|
||||||
javadoc.preview=true
|
javadoc.preview=true
|
||||||
user.properties.file=/home/tube/.netbeans/8.1/build.properties
|
user.properties.file=/home/tobias/.netbeans/8.1/build.properties
|
||||||
|
@ -3,38 +3,17 @@
|
|||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/additional/README.txt</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/Gui/AskBook.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Trader.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/Traders/RandomTraderConfig.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Locker.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/Gui/Chart.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Order.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/Traders/RandomTrader.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/ControlPanel.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/Gui/MainWin.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Quote.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/SeSim/Exchange.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/MainWin.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/nbproject/configs/Sesim.properties</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/OrderBook.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/nbproject/configs/JWS_generated.properties</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/manifest.mf</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/SeSim/AutoTraderLIst.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/TraderConfig.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/src/SeSim/SellOrder.java</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Account.java</file>
|
<file>file:/home/tobias/NetBeansProjects/SeSim/nbproject/build-impl.xml</file>
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/QuotePanel.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Exchange.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/NewPanel.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/Chart.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Traders/RandomTraderConfig.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/AskBook.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/AutoTrader.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/BidBook.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Traders/SwitchingTrader.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/build.xml</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/OrderBookPanel.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Traders/RandomTrader.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/AutoTraderLIst.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/BuyOrder.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Traders/ManTrader.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/README.md</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/CandlestickDemo.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Logger.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Traders/SwitchingTraderConfig.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/SellOrder.java</file>
|
|
||||||
<file>file:/home/tube/NetBeansProjects/SeSim/LICENSE</file>
|
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
@ -118,13 +118,30 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected OHLCDataItem getOhlcData(long first, long last, TreeSet quotes ){
|
protected OHLCDataItem getOhlcData(long first, long last, SortedSet <Quote> quotes ){
|
||||||
Quote e=new Quote();
|
Quote e=new Quote();
|
||||||
e.time=first;
|
e.time=first;
|
||||||
e.id=0;
|
e.id=0;
|
||||||
|
|
||||||
|
Quote qq = quotes.first();
|
||||||
|
System.out.print(String.format
|
||||||
|
("Quote First %f %d %d \n", qq.price,qq.time,qq.id)
|
||||||
|
);
|
||||||
|
|
||||||
SortedSet<Quote> l = quotes.tailSet(e);
|
|
||||||
|
System.out.print("Qzitesn"+quotes.size() +"\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quote z = new Quote();
|
||||||
|
z.id=-1;
|
||||||
|
z.time=0;
|
||||||
|
|
||||||
|
|
||||||
|
SortedSet<Quote> l = quotes.tailSet(z);
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
|
||||||
double open=0;
|
double open=0;
|
||||||
double high=0;
|
double high=0;
|
||||||
@ -169,11 +186,15 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
protected OHLCDataItem[] getData() {
|
protected OHLCDataItem[] getData() {
|
||||||
List<OHLCDataItem> data = new ArrayList<>();
|
List<OHLCDataItem> data = new ArrayList<>();
|
||||||
|
|
||||||
TreeSet <Quote>s = MainWin.se.getQuoteHistory(60);
|
SortedSet <Quote>s = MainWin.se.getQuoteHistory(60);
|
||||||
|
this.getOhlcData(0, System.currentTimeMillis(), s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Iterator <Quote>i = s.iterator();
|
Iterator <Quote>i = s.iterator();
|
||||||
|
|
||||||
|
|
||||||
this.getOhlcData(0, System.currentTimeMillis(), s);
|
|
||||||
|
|
||||||
|
|
||||||
// OHLCDataItem item = new OHLCDataItem();
|
// OHLCDataItem item = new OHLCDataItem();
|
||||||
|
49
src/Gui/test.java
Normal file
49
src/Gui/test.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author tobias
|
||||||
|
*/
|
||||||
|
public class test {
|
||||||
|
public static void main(String args[]){
|
||||||
|
SortedSet <String>s = new TreeSet<>();
|
||||||
|
s.add("b");
|
||||||
|
s.add("e");
|
||||||
|
s.add("z");
|
||||||
|
|
||||||
|
SortedSet <String> ts = s.tailSet("d");
|
||||||
|
|
||||||
|
SortedSet <String> ts2 = ts.tailSet("n");
|
||||||
|
|
||||||
|
|
||||||
|
System.out.print(String.format("First: %s\n", ts2.first()));
|
||||||
|
}
|
||||||
|
}
|
@ -27,13 +27,27 @@ public class Exchange extends Thread {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeSet <Quote> getQuoteHistory(int seconds){
|
public SortedSet <Quote> getQuoteHistory(int seconds){
|
||||||
Quote last = quoteHistory.last();
|
Quote last = quoteHistory.last();
|
||||||
long ct = last.time - seconds * 1000;
|
long ct = last.time - seconds * 1000;
|
||||||
Quote e = new Quote();
|
Quote e = new Quote();
|
||||||
e.time=ct;
|
e.time=ct;
|
||||||
|
e.time=-1;
|
||||||
|
e.id=3;
|
||||||
|
SortedSet <Quote> qqq =this.quoteHistory;
|
||||||
|
|
||||||
|
|
||||||
SortedSet<Quote> l = quoteHistory.tailSet(e);
|
SortedSet<Quote> l = quoteHistory.tailSet(e);
|
||||||
return (TreeSet)l;
|
e.id=-1;
|
||||||
|
SortedSet<Quote> ll = l.tailSet(e);
|
||||||
|
|
||||||
|
int size = qqq.size();
|
||||||
|
long fid = qqq.first().id;
|
||||||
|
|
||||||
|
System.out.print("SS0: "+qqq.first().id+"\n");
|
||||||
|
|
||||||
|
|
||||||
|
return ll;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,10 @@ public class Quote implements Comparable {
|
|||||||
int ret;
|
int ret;
|
||||||
Quote q = (Quote)o;
|
Quote q = (Quote)o;
|
||||||
|
|
||||||
ret = (int)(this.time-q.time);
|
/* ret = (int)(this.time-q.time);
|
||||||
if (ret !=0)
|
if (ret !=0)
|
||||||
return ret;
|
return ret;
|
||||||
|
*/
|
||||||
return (int)(this.id-q.id);
|
return (int)(this.id-q.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,15 +48,15 @@ public class RandomTraderConfig extends TraderConfig {
|
|||||||
* the minimum and maximum volume to be selled
|
* the minimum and maximum volume to be selled
|
||||||
*/
|
*/
|
||||||
public float[] sell_volume= {100,100};
|
public float[] sell_volume= {100,100};
|
||||||
public float[] sell_limit = {-15,100};
|
public float[] sell_limit = {-15,15};
|
||||||
public int[] sell_order_wait = {5,33};
|
public int[] sell_order_wait = {15,33};
|
||||||
public int[] wait_after_sell = {2,10};
|
public int[] wait_after_sell = {10,30};
|
||||||
|
|
||||||
|
|
||||||
public float[] buy_volume={100,100};
|
public float[] buy_volume={100,100};
|
||||||
public float[] buy_limit = {-5,115};
|
public float[] buy_limit = {-15,15};
|
||||||
public int[] buy_order_wait = {15,33};
|
public int[] buy_order_wait = {15,33};
|
||||||
public int[] wait_after_buy = {20,33};
|
public int[] wait_after_buy = {10,30};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user