public Order exit(string description, OrderDetails details, OrderDuration duration) { var order = new Order(description, symbol, details, -direction(), size, duration); order.refersTo(this); return(order); }
public Order(String description, Symbol symbol, OrderDetails details, Direction direction, long size, OrderDuration duration) { this.description = description; this.symbol = symbol; this.details = details; this.size = size; this.duration = duration; this.direction = direction; stack = reDebug() ? Environment.StackTrace : "locked"; Bomb.when(size <= 0, () => "size must be > 0: " + this); Bomb.when(size > MAX_TRADE_SIZE, () => "size must be < 1 trillion (for now - expand if this is not an error): " + this); duration.requireSupported(details); id = nextIdentifier++; }
protected Order sell(string description, OrderDetails details, long size, OrderDuration duration) { return(symbol.sell(description, details, size, duration)); }
public Order sell(string description, OrderDetails details, long size, OrderDuration duration) { return(new Order(description, this, details, Direction.SHORT, size, duration)); }
public Order buy(string description, OrderDetails details, long size, OrderDuration duration) { return(new Order(description, this, details, Direction.LONG, size, duration)); }
public Order buySell(Direction direction, string description, OrderDetails details, long size, OrderDuration duration) { return(direction.order(description, this, details, size, duration)); }
public Order scaleUpShort(string description, OrderDetails details, long tradeSize, OrderDuration duration) { Bomb.when(direction().isLong(), () => "long position cannot be scaled up short!"); return(scaleUp(description, details, tradeSize, duration)); }
public virtual bool canSubmitToFerret(OrderDuration duration) { return(true); }
public Order scaleUp(string description, OrderDetails details, long tradeSize, OrderDuration duration) { var order = new Order(description, symbol, details, direction(), tradeSize, duration); order.refersTo(this); return(order); }
public Order scaleDown(string description, OrderDetails details, long tradeSize, OrderDuration duration) { Bomb.unless( tradeSize < size, () => "trade size must be less than total size in partial exit. trade size: " + tradeSize + ". total size: " + size ); var order = new Order(description, symbol, details, -direction(), tradeSize, duration); order.refersTo(this); return(order); }
public Order exitShort(string description, OrderDetails details, OrderDuration duration) { Bomb.when(direction().isLong(), () => "long position cannot be exited short!"); return(exit(description, details, duration)); }
public Order exitLong(string description, OrderDetails details, OrderDuration duration) { Bomb.unless(direction().isLong(), () => "short position cannot be exited long!"); return(exit(description, details, duration)); }
public Order order(String description, Symbol symbol, OrderDetails details, long size, OrderDuration duration) { return(new Order(description, symbol, details, this, size, duration)); }
public IEnumerable <Order> exits(PairSystem system, string description, OrderDetails leftDetails, OrderDetails rightDetails, OrderDuration duration) { return(list(system.position(left).exit(description, leftDetails, duration), system.position(right).exit(description, rightDetails, duration))); }
public Order scaleUpLong(string description, OrderDetails details, long tradeSize, OrderDuration duration) { Bomb.unless(direction().isLong(), () => "short position cannot be scaled up long!"); return(scaleUp(description, details, tradeSize, duration)); }
public List <Order> sell(string description, OrderDetails detailsLeft, OrderDetails detailsRight, long size, OrderDuration duration) { return(list( new Order(description, left, detailsLeft, Direction.SHORT, size, duration), new Order(description, right, detailsRight, Direction.LONG, size, duration) )); }
public override bool canSubmitToFerret(OrderDuration duration) { return(duration.isOnClose()); }