Exemplo n.º 1
0
        private static List <string> Order(KrakenClient client)
        {
            var userref = (int)DateTime.UtcNow.Ticks; //user reference id.  32 - bit signed number.  (optional)
            var k       = new KrakenOrder
            {
                Pair      = "XETHZUSD",
                Type      = OrderType.sell.ToString(),
                OrderType = KrakenOrderType.limit.ToString(),
                Price     = 1606,
                Volume    = 0.09m,
                Userref   = userref.ToString()
            };
            //k.OFlags = OFlag.viqc.ToString(); //volume in quote currency
            JsonObject ret = client.AddOrder(k);

            if (((JsonArray)ret["error"]).Count == 0)
            {
                List <string> rettour = new List <string>();
                foreach (string s in (JsonArray)((JsonObject)ret["result"])["txid"])
                {
                    rettour.Add(s);
                }
                return(rettour);
            }
            throw new Exception();
        }
Exemplo n.º 2
0
        internal override bool Execute(Site site)
        {
            // La crypto est la monnaie de base
            string      type   = action.ToString();
            decimal     volume = Convert.ToDecimal(objetRichesse.Quantite);
            KrakenOrder k      = new KrakenOrder
            {
                Pair      = pair.IdName,
                Type      = type,
                OrderType = KrakenOrderType.market.ToString(),
                Volume    = volume,
                Userref   = userref.ToString()
            };
            JsonObject json;

            try
            {
                json = site.AddOrder(k);
            }
            catch (Exception ex)
            {
                return(IsOK(site));
            }
            if (((JsonArray)json["error"]).Count == 0)
            {
                return(true);
            }
            return(false);
        }
 public JsonObject AddOrder(KrakenOrder krakenOrder)
 {
     return(AddOrder(pair: krakenOrder.Pair,
                     type: krakenOrder.Type,
                     ordertype: krakenOrder.OrderType,
                     volume: krakenOrder.Volume,
                     price: krakenOrder.Price,
                     price2: krakenOrder.Price2,
                     leverage: krakenOrder.Leverage ?? "none",
                     position: krakenOrder.Position ?? string.Empty,
                     oflags: krakenOrder.OFlags ?? string.Empty,
                     starttm: krakenOrder.Starttm ?? string.Empty,
                     expiretm: krakenOrder.Expiretm ?? string.Empty,
                     userref: krakenOrder.Userref ?? string.Empty,
                     validate: krakenOrder.Validate,
                     close: krakenOrder.Close));
 }
Exemplo n.º 4
0
 internal JsonObject AddOrder(KrakenOrder k)
 {
     return(client.AddOrder(k));
 }