Esempio n. 1
0
        public DbMessage GetDbTrades(BitmexUser user, string instrument, int count)
        {
            var args = new Dictionary <string, string>();

            args.Add("account", user.Id);
            args.Add("count", count.ToString());
            args.Add("instrument", instrument);

            var json = _api.GetQuery("/v1/trade", null, RestApiClient.UrlEncode(args));

            return(JsonConvert.DeserializeObject <DbMessage>(json));
        }
Esempio n. 2
0
        public BitstampCandle GetBitstampCandle(DateTime dt, string instrument, int periodSecs)
        {
            var args = new Dictionary <string, string>();

            args.Add("time", dt.ToString());
            args.Add("instrument", instrument);
            args.Add("periodSecs", periodSecs.ToString());
            args.Add("exchange", ExchangeName.Bitstamp.ToString());

            var json = _api.GetQuery("/v1/charts/candle", null, RestApiClient.UrlEncode(args));

            return(JsonConvert.DeserializeObject <BitstampCandle>(json));
        }
Esempio n. 3
0
        public BitmexInstrumentSettings[] GetBitmexInstruments(string accountId)
        {
            var args = new Dictionary <string, string>();

            args.Add("account", accountId);

            var json = _api.GetQuery("/v1/exch/instruments/bitmex", null, RestApiClient.UrlEncode(args));

            return(JsonConvert.DeserializeObject <BitmexInstrumentSettings[]>(json));
        }
Esempio n. 4
0
        public DbPositionState GetPositionState(BitmexUser user, string instrument)
        {
            var args = new Dictionary <string, string>();

            args.Add("account", user.Id);
            args.Add("host_name", Dns.GetHostName());
            args.Add("instrument", instrument);

            var json = _api.GetQuery("/v1/position/state", null, RestApiClient.UrlEncode(args));

            return(JsonConvert.DeserializeObject <DbPositionState>(json));
        }
Esempio n. 5
0
        public DbIndicatorVwapLite[] GetVwapGains(DateTime date, string exchange)
        {
            var args = new Dictionary <string, string>();

            args.Add("date", date.ToShortDateString());
            args.Add("exchange", exchange);

            var json  = _api.GetQuery("/v1/indicator/vwaps", null, RestApiClient.UrlEncode(args));
            var vwaps = JsonConvert.DeserializeObject <DbIndicatorVwapLite[]>(json);

            for (int i = 0; i < vwaps.Length; i++)
            {
                var ts = vwaps[i].Timestamp;
                vwaps[i].Timestamp = new DateTime(ts.Year, ts.Month, ts.Day, ts.Hour, ts.Minute, ts.Second, DateTimeKind.Utc);
            }
            return(vwaps);
        }
Esempio n. 6
0
        public DbPriceLevel[] GetPriceLevels(bool onlyActive = true)
        {
            var json = _api.GetQuery("/v1/pricelevels", null, "only_active=" + onlyActive);

            return(JsonConvert.DeserializeObject <DbPriceLevel[]>(json));
        }
Esempio n. 7
0
        public static ExchangeSettingsData Get(RestApiClient2 api, string exName)
        {
            var json = api.GetQuery("/v1/exch/settings/" + exName);

            return(JsonConvert.DeserializeObject <ExchangeSettingsData>(json));
        }