Exemplo n.º 1
0
 public bool Equals(GroupOrder token)
 {
     return this == token;
 }
Exemplo n.º 2
0
        public List<OrderResult> SendGroupOrder(GroupOrder orders, int timeout = TimeoutDefault)
        {
            //if (!IsAuthorized) throw new ClientAuthorizationException();
            Uri uri = new Uri(root, "/v2/orders/groups");
            string postData = JsonConvert.SerializeObject(orders, new OrderConverter(), new StringEnumConverter());

            string response = TryPost(uri, postData, timeout);
            return JsonConvert.DeserializeObject<List<OrderResult>>(response);
        }
Exemplo n.º 3
0
 public bool Equals(GroupOrder token)
 {
     return(this == token);
 }
Exemplo n.º 4
0
        public List<OrderConfirmation> ConfirmGroupOrder(GroupOrder orders, int timeout = TimeoutDefault)
        {
            // TODO: TEST THIS
            if (orders == null) throw new ArgumentException("NULL Order passed to OrderConfirm", "orders");
            if (orders.Orders == null) throw new ArgumentException("GroupOrder with null orders", "orders");
            if (orders.Orders.Count == 0) return new List<OrderConfirmation>(0);

            Uri uri = new Uri(root, "/v2/orders/groups/confirm");
            List<OrderConfirmation> confirmationList = new List<OrderConfirmation>(1);

            string postData = JsonConvert.SerializeObject(orders, new OrderConverter(), new StringEnumConverter() );
            string response = TryPost(uri, postData, timeout);

            switch (orders.Orders[0].AssetType)
            {
                case AssetType.FU:
                    List<FuturesOrderConfirmation> futuresConfirmationList = JsonConvert.DeserializeObject<List<FuturesOrderConfirmation>>(response);
                    if (futuresConfirmationList != null) confirmationList.AddRange(futuresConfirmationList);
                    break;
                case AssetType.FX:
                    List<ForexOrderConfirmation> forexConfirmationList = JsonConvert.DeserializeObject<List<ForexOrderConfirmation>>(response);
                    if (forexConfirmationList != null) confirmationList.AddRange(forexConfirmationList);
                    break;
                default:
                    List<EquityOrderConfirmation> equityConfirmationList = JsonConvert.DeserializeObject<List<EquityOrderConfirmation>>(response);
                    if (equityConfirmationList != null) confirmationList.AddRange(equityConfirmationList);
                    break;
            }

            return confirmationList;
        }