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 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));
            }
        }