From e7d03940ff45b509b1b650fa6b684f973dcfe1d6 Mon Sep 17 00:00:00 2001 From: Infernoman Date: Wed, 2 Dec 2015 18:19:56 -0500 Subject: [PATCH] Forgot some things --- src/qt/forms/tradingdialog.ui | 352 ++++++++++++++++++++++++++++------ src/qt/tradingdialog.cpp | 25 ++- 2 files changed, 304 insertions(+), 73 deletions(-) diff --git a/src/qt/forms/tradingdialog.ui b/src/qt/forms/tradingdialog.ui index f5d8490..5d22db0 100644 --- a/src/qt/forms/tradingdialog.ui +++ b/src/qt/forms/tradingdialog.ui @@ -38,7 +38,7 @@ QTabWidget::Rounded - 1 + 0 @@ -47,12 +47,15 @@ - 140 - 240 + 110 + 130 75 - 23 + 27 + + text-align:center; + Buy BSTY @@ -61,7 +64,7 @@ 10 - 110 + 40 46 23 @@ -79,8 +82,8 @@ - 150 - 110 + 120 + 43 101 23 @@ -96,8 +99,8 @@ - 150 - 140 + 120 + 70 101 23 @@ -113,8 +116,8 @@ - 260 - 110 + 230 + 43 31 23 @@ -126,8 +129,8 @@ - 260 - 140 + 230 + 70 21 23 @@ -140,7 +143,7 @@ 10 - 140 + 70 46 23 @@ -155,12 +158,12 @@ Bid - + 10 - 170 - 71 + 100 + 31 16 @@ -177,10 +180,10 @@ - 80 - 110 + 50 + 40 61 - 23 + 27 @@ -188,6 +191,9 @@ 10 + + text-align:center; + Max @@ -195,12 +201,18 @@ - 80 - 140 + 50 + 70 61 23 + + + 0 + 0 + + 10 @@ -210,12 +222,18 @@ - 80 - 170 + 50 + 100 61 23 + + + 0 + 0 + + 10 @@ -225,7 +243,7 @@ - 20 + 50 11 221 16 @@ -694,8 +712,8 @@ - 10 - 300 + 30 + 100 271 16 @@ -1166,7 +1184,7 @@ - 330 + 400 10 221 16 @@ -1635,10 +1653,10 @@ - 380 - 110 + 400 + 40 61 - 23 + 27 @@ -1646,6 +1664,9 @@ 10 + + text-align:center; + Max @@ -1653,8 +1674,8 @@ - 450 - 110 + 470 + 43 101 23 @@ -1670,8 +1691,8 @@ - 560 - 110 + 580 + 43 31 23 @@ -1683,12 +1704,24 @@ - 380 - 140 + 400 + 70 61 23 + + + 0 + 0 + + + + + 16777215 + 16777215 + + 10 @@ -1698,8 +1731,8 @@ - 450 - 140 + 470 + 70 101 23 @@ -1715,8 +1748,8 @@ - 560 - 140 + 580 + 70 21 23 @@ -1728,12 +1761,18 @@ - 380 - 170 + 400 + 100 61 23 + + + 0 + 0 + + 10 @@ -1743,8 +1782,8 @@ - 320 - 300 + 380 + 100 271 16 @@ -2215,18 +2254,47 @@ - 440 - 240 + 460 + 130 75 - 23 + 27 + + Qt::LeftToRight + + + text-align:center; + Sell BSTY + BuyBSTY + label_3 + UnitsInput + label_4 + label_5 + label_6 + OrderTypeL + Buy_Max_Amount + BuyBidcomboBox + buyOrdertypeCombo + layoutWidget + layoutWidget_2 + layoutWidget_3 + Sell_Max_Amount + UnitsInputBSTY + label_22 + SellBidcomboBox + SellBidPriceEdit + label_16 + SellOrdertypeCombo + layoutWidget_4 + SellBSTYBTN + BuyBidPriceEdit - + Send @@ -2794,9 +2862,12 @@ 90 180 75 - 23 + 27 + + text-align:center; + Send @@ -3509,7 +3580,7 @@ - <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Instructions:</span></p><p align="center">To use the cross sending feature you need to have </p><p align="center">BSTY available to spend on Bittrex. If you don't have any </p><p align="center">you can find your deposit address on the &quot;Balance&quot; tab.</p><p align="center">1. Enter the amount you want to receive in Bitcoin.</p><p align="center">2. Enter the Bitcoin address you are sending to.</p><p align="center">3. Check that the Total with fee's is correct.</p><p align="center">4. Press send and watch the magic happen.</p><p align="center"><span style=" font-weight:600; text-decoration: underline;">Notes.</span></p><p align="center"><span style=" font-size:7pt;">Total w/ fees.</span></p><p align="center"><span style=" font-size:7pt;">N/A means you dont have enough BSTY to sell !</span></p><p align="center"><span style=" font-size:7pt;">All trades are done through Bittrex using your own balance and API keys.</span></p><p align="center"><span style=" font-size:7pt;">The only 3rd party that needs to be trusted in this instance is the exchange !</span></p></body></html> + <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Instructions:</span></p><p align="center">To use the cross sending feature you need to have </p><p align="center">BSTY available to spend on Bittrex. If you don't have any </p><p align="center">you can find your deposit address on the &quot;Balance&quot; BSTY.</p><p align="center">1. Enter the amount you want to receive in Bitcoin.</p><p align="center">2. Enter the Bitcoin address you are sending to.</p><p align="center">3. Check that the Total with fee's is correct.</p><p align="center">4. Press send and watch the magic happen.</p><p align="center"><span style=" font-weight:600; text-decoration: underline;">Notes.</span></p><p align="center"><span style=" font-size:7pt;">Total w/ fees.</span></p><p align="center"><span style=" font-size:7pt;">N/A means you dont have enough BSTY to sell !</span></p><p align="center"><span style=" font-size:7pt;">All trades are done through Bittrex using your own balance and API keys.</span></p><p align="center"><span style=" font-size:7pt;">The only 3rd party that needs to be trusted in this instance is the exchange !</span></p></body></html> @@ -3536,7 +3607,7 @@ 180 41 - 72 + 101 16 @@ -3974,7 +4045,7 @@ 10 70 61 - 23 + 27 @@ -3982,10 +4053,33 @@ 10 + + text-align:center; + Max + + + + 10 + 320 + 391 + 21 + + + + + 10 + 75 + true + + + + Written by: Infernoman + + label232_3 BSTYAvailableLabel_3 CSUnitsInput @@ -4009,6 +4103,7 @@ label232_6 label232_7 CS_Max_Amount + label232_18 @@ -4454,9 +4549,12 @@ 20 130 411 - 23 + 27 + + text-align:center; + Generate BSTY Coin Deposit Address @@ -4556,7 +4654,7 @@ 110 280 81 - 23 + 27 @@ -4564,6 +4662,9 @@ 10 + + text-align:center; + Max @@ -4573,7 +4674,7 @@ 20 240 - 81 + 111 16 @@ -4669,7 +4770,7 @@ 110 350 75 - 23 + 27 @@ -4720,7 +4821,7 @@ 30 - 90 + 80 71 20 @@ -4758,7 +4859,7 @@ 200 - 90 + 80 300 23 @@ -4767,21 +4868,146 @@ - 560 - 90 - 191 - 23 + 190 + 150 + 151 + 27 + + text-align:center; + Update API Keys + + + + 350 + 150 + 151 + 27 + + + + + 0 + 0 + + + + text-align:center; + + + Save API Keys + + + + + + 30 + 150 + 151 + 27 + + + + + 0 + 0 + + + + text-align:center; + + + Load API Keys + + + + + + 20 + 200 + 231 + 131 + + + + + 10 + 50 + false + + + + <html><head/><body><p>Saving keys:</p><p>1) Enter in API Keys found at <a href="https://bittrex.com/Account/ManageApiKey"><span style=" text-decoration: underline; color:#0000ff;">Bittrex</span></a></p><p>2) Enter Password</p><p>3) Save API Keys</p><p>4) Start trading on Bittrex</p></body></html> + + + + + + 280 + 190 + 221 + 121 + + + + + 10 + 50 + false + + + + <html><head/><body><p>Loading keys:</p><p>1) Enter Password</p><p>2) Load API Keys</p><p>3) Start trading on Bittrex</p></body></html> + + + + + + 30 + 110 + 71 + 20 + + + + + 75 + true + + + + Password + + + + + + 200 + 110 + 300 + 23 + + + + QLineEdit::Password + + label ApiKeyInput label_2 SecretKeyInput UpdateKeys + SaveKeys + LoadKeys + label232_16 + label232_17 + label_28 + PasswordInput diff --git a/src/qt/tradingdialog.cpp b/src/qt/tradingdialog.cpp index 5e03308..39ba0a1 100644 --- a/src/qt/tradingdialog.cpp +++ b/src/qt/tradingdialog.cpp @@ -115,9 +115,12 @@ tradingDialog::tradingDialog(QWidget *parent) : /*populate static combo values*/ ui->BuyBidcomboBox -> addItems(QStringList()<<"Last"<<"Bid"<<"Ask"); - ui->buyOrdertypeCombo-> addItems(QStringList()<<"Limit"<<"Market"); + //ui->buyOrdertypeCombo-> addItems(QStringList()<<"Limit"<<"Market"); + ui->buyOrdertypeCombo->hide(); ui->SellBidcomboBox -> addItems(QStringList()<<"Last"<<"Bid"<<"Ask"); - ui->SellOrdertypeCombo-> addItems(QStringList()<<"Limit"<<"Market"); + //ui->SellOrdertypeCombo-> addItems(QStringList()<<"Limit"<<"Market"); + ui->SellOrdertypeCombo->hide(); + ui->OrderTypeL->hide(); //ui->BuyTimeInForceCombo-> addItems(QStringList()<<"Good 'Til Cancelled"<<"Immediate Or Cancel"); //ui->BuyConditionCombo-> addItems(QStringList()<<"Greater Than Or Equal To"<<"Less Than Or Equal To"); //ui->BuyConditionCombo->hide(); @@ -860,6 +863,7 @@ void tradingDialog::on_SaveKeys_clicked() } if (fSuccess) { QMessageBox::information(this,"Success !","Saved keys successfully to APIcache.txt"); + on_UpdateKeys_clicked(); } } @@ -900,6 +904,7 @@ void tradingDialog::on_LoadKeys_clicked() } if (fSuccess) { QMessageBox::information(this,"Success !","Loaded keys successfully from APIcache.txt"); + on_UpdateKeys_clicked(); } } @@ -979,8 +984,8 @@ void tradingDialog::on_CS_Max_Amount_clicked() Received += ((Price * Quantity) - ((Price * Quantity / 100) * 0.25)); Qty += Quantity; - if ((Quantity * x) < 0.00055){ - Quantity = (0.00055 / x); + if ((Quantity * x) < 0.00051){ + Quantity = (0.00051 / x); } break; @@ -1113,7 +1118,7 @@ void tradingDialog::on_BuyBSTY_clicked() Rate = ui->BuyBidPriceEdit->text().toDouble(); Quantity = ui->UnitsInput->text().toDouble(); - QString OrderType = ui->buyOrdertypeCombo->currentText(); + QString OrderType = "Limit"; QString Order; if(OrderType == "Limit"){Order = "buylimit";}else if (OrderType == "Market"){ Order = "buymarket";} @@ -1155,7 +1160,7 @@ void tradingDialog::on_SellBSTYBTN_clicked() Rate = ui->SellBidPriceEdit->text().toDouble(); Quantity = ui->UnitsInputBSTY->text().toDouble(); - QString OrderType = ui->SellOrdertypeCombo->currentText(); + QString OrderType = "Limit"; QString Order; if(OrderType == "Limit"){Order = "selllimit";}else if (OrderType == "Market"){ Order = "sellmarket";} @@ -1250,7 +1255,7 @@ void tradingDialog::on_CSUnitsBtn_clicked() if (SellResponseObject["success"].toBool() == false){ if (SellResponseObject["message"] == "DUST_TRADE_DISALLOWED_MIN_VALUE_50K_SAT"){ - Add = y; + Add += y; continue; } QMessageBox::information(this,"sFailed",SellResponse); @@ -1262,9 +1267,9 @@ void tradingDialog::on_CSUnitsBtn_clicked() Price = x; Received += ((Price * (Quantity / x)) - ((Price * (Quantity / x) / 100) * 0.25)); Qty += (Quantity / x); - Quantity += (Add / x); - if (Quantity < 0.00055){ - Quantity = 0.00055; + Quantity += (Add * x); + if (Quantity < 0.00051){ + Quantity = 0.00051; } QString SellResponse = SellBSTY(Order,(Quantity / x),x); QJsonDocument SelljsonResponse = QJsonDocument::fromJson(SellResponse.toUtf8()); //get json from str.