Esempio n. 1
0
        private void btnCurrentTradingInfo_Click(object sender, EventArgs e)
        {
            QuadrigaAPI api = new QuadrigaAPI();

            try
            {
                var tradinginfo         = api.GetCurrentTradingInformation(txtOrderBook.Text, chkUseLocalTime.Checked);
                frmObjectVisualizer frm = new frmObjectVisualizer(tradinginfo);
                frm.Show();
            }
            catch (QuadrigaResultError ex)
            {
                MessageBox.Show(String.Format("Code: {0}, Message: {1}", ex.QuadrigaErrorCode, ex.Message));
            }
        }
Esempio n. 2
0
        private void LoadMarketSummaryAsync(IObjectSpace space)
        {
            QuadrigaAPI api = new QuadrigaAPI();
            CurrentTradingInformation market;


            market = api.GetCurrentTradingInformation("btc_cad", true);



            //      var orderbook = api.GetOrderBook("btc_cad", true, true);
            //      textBox1.Text = orderbook.asks[0].Price.ToString();
            //    textBox2.Text = orderbook.bids[0].Price.ToString();


            //     var market = await bitstampClient.Market.GetSummaryAsync();

            //  CurrentExchange
            if (market != null)
            {
                CurrentExchange.Last = Convert.ToDecimal(market.last);
                CurrentExchange.Bid  = Convert.ToDecimal(market.bid);
                CurrentExchange.Ask  = Convert.ToDecimal(market.ask);
                CurrentExchange.Low  = Convert.ToDecimal(market.low);
                CurrentExchange.High = Convert.ToDecimal(market.high);


                CurrentExchange.ServerResponseTimestamp = market.timestamp;
                CurrentExchange.Volume = Convert.ToDecimal(market.volume);
                space.CommitChanges();
                // Console.WriteLine(String.Format("{0}Quadrigacx Current Ask: {1} Current Bid: {2}", market.timestamp.ToLongTimeString(), market.bid.ToString(), market.ask.ToString()));
            }
            else
            {
                Console.WriteLine("didnt get it");
            }

            LoadMarketSummaryAsync(space);



            //   TextBlockPriceLast.Text = "$" + market.PriceLast.ToStringNormalized();
        }
Esempio n. 3
0
        private void btnSellLimit_Click(object sender, EventArgs e)
        {
            QuadrigaAPI api = new QuadrigaAPI(Convert.ToInt32(txtClientID.Text), txtAPIKey.Text, txtAPISecret.Text);

            try
            {
                var    tradinginfo = api.GetCurrentTradingInformation(txtOrderBook.Text, chkUseLocalTime.Checked);
                string msg         =
                    String.Format(
                        "You will actually be putting a trade order on your account at a price of {0} - the current vwap is {1} ",
                        txtOrderPrice.Text, tradinginfo.vwap);
                DialogResult dr;
                if (Convert.ToDecimal(txtOrderPrice.Text) >= tradinginfo.vwap)
                {
                    msg = msg + "this is probably favorable, so this is only a confirmation";
                    dr  = MessageBox.Show(msg, "Are you sure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                }
                else
                {
                    msg = "WARNING: " + msg +
                          "this is probably UNfavorable, so you should really consider cancelling...";
                    dr = MessageBox.Show(msg, "Are you sure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                }
                if (dr == DialogResult.OK)
                {
                    var order = api.SellOrderLimit(Convert.ToDecimal(txtOrderAmount.Text),
                                                   Convert.ToDecimal(txtOrderPrice.Text), txtOrderBook.Text);
                    frmObjectVisualizer frm = new frmObjectVisualizer(order);
                    frm.Show();
                }
            }
            catch (QuadrigaResultError ex)
            {
                MessageBox.Show(String.Format("Code: {0}, Message: {1}", ex.QuadrigaErrorCode, ex.Message));
            }
        }