Esempio n. 1
0
        public Order exit(string description, OrderDetails details, OrderDuration duration)
        {
            var order = new Order(description, symbol, details, -direction(), size, duration);

            order.refersTo(this);
            return(order);
        }
Esempio n. 2
0
 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++;
 }
Esempio n. 3
0
 protected Order sell(string description, OrderDetails details, long size, OrderDuration duration)
 {
     return(symbol.sell(description, details, size, duration));
 }
Esempio n. 4
0
 public Order sell(string description, OrderDetails details, long size, OrderDuration duration)
 {
     return(new Order(description, this, details, Direction.SHORT, size, duration));
 }
Esempio n. 5
0
 public Order buy(string description, OrderDetails details, long size, OrderDuration duration)
 {
     return(new Order(description, this, details, Direction.LONG, size, duration));
 }
Esempio n. 6
0
 public Order buySell(Direction direction, string description, OrderDetails details, long size, OrderDuration duration)
 {
     return(direction.order(description, this, details, size, duration));
 }
Esempio n. 7
0
 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));
 }
Esempio n. 8
0
 public virtual bool canSubmitToFerret(OrderDuration duration)
 {
     return(true);
 }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 public Order exitShort(string description, OrderDetails details, OrderDuration duration)
 {
     Bomb.when(direction().isLong(), () => "long position cannot be exited short!");
     return(exit(description, details, duration));
 }
Esempio n. 12
0
 public Order exitLong(string description, OrderDetails details, OrderDuration duration)
 {
     Bomb.unless(direction().isLong(), () => "short position cannot be exited long!");
     return(exit(description, details, duration));
 }
Esempio n. 13
0
 public Order order(String description, Symbol symbol, OrderDetails details, long size, OrderDuration duration)
 {
     return(new Order(description, symbol, details, this, size, duration));
 }
Esempio n. 14
0
 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)));
 }
Esempio n. 15
0
 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));
 }
Esempio n. 16
0
 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)
                ));
 }
Esempio n. 17
0
 public override bool canSubmitToFerret(OrderDuration duration)
 {
     return(duration.isOnClose());
 }