Code cleaning

This commit is contained in:
7u83
2017-01-15 09:28:26 +01:00
parent 7bf55870b1
commit cee076162c
8 changed files with 90 additions and 268 deletions

View File

@ -109,13 +109,7 @@ public class RandomTrader extends AutoTrader {
// object to generate random numbers
final private Random rand = new Random();
/*public RandomTrader(Exchange se, double money,shares,) {
//super(account, config);
if (config == null) {
config = new RandomTraderConfig_old();
}
myconfig = (RandomTraderConfig_old) config;
}*/
/**
* Get a (long) random number between min an max
*
@ -170,6 +164,10 @@ public class RandomTrader extends AutoTrader {
OrderType type=OrderType.BID;
if (ad==null || myconfig==null) {
System.out.print(ad+"\n");
}
// how much money we ant to envest?
double money = getRandomAmmount(ad.money, myconfig.buy_volume);
@ -192,7 +190,7 @@ public class RandomTrader extends AutoTrader {
se.createOrder(account_id, type, volume, limit);
return getRandom(myconfig.buy_order_wait)*1000;
return getRandom(myconfig.buy_order_wait);
}
@ -204,6 +202,8 @@ public class RandomTrader extends AutoTrader {
OrderType type=OrderType.ASK;
// how much money we ant to envest?
double volume = (long)getRandomAmmount(ad.shares, myconfig.sell_volume);
@ -228,7 +228,7 @@ public class RandomTrader extends AutoTrader {
se.createOrder(account_id, type, volume, limit);
return getRandom(myconfig.sell_order_wait)*1000;
return getRandom(myconfig.sell_order_wait);
}

View File

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