added assets for testing equivalents values
This commit is contained in:
parent
ab1157faad
commit
90efd6604c
3 changed files with 34 additions and 7 deletions
|
@ -666,7 +666,7 @@ public abstract class GrapheneApiGenerator {
|
||||||
Converter converter = new Converter();
|
Converter converter = new Converter();
|
||||||
order.getSellPrice().base.getAsset().setPrecision(baseAsset.getPrecision());
|
order.getSellPrice().base.getAsset().setPrecision(baseAsset.getPrecision());
|
||||||
order.getSellPrice().quote.getAsset().setPrecision(quoteAsset.getPrecision());
|
order.getSellPrice().quote.getAsset().setPrecision(quoteAsset.getPrecision());
|
||||||
double equiValue = converter.getConversionRate(order.getSellPrice(), Converter.BASE_TO_QUOTE);
|
double equiValue = converter.getConversionRate(order.getSellPrice(), Converter.QUOTE_TO_BASE);
|
||||||
CryptoCurrencyEquivalence equivalence = new CryptoCurrencyEquivalence(baseAsset.getId(), quoteAsset.getId(), (int) (Math.pow(10, baseAsset.getPrecision()) * equiValue), new Date());
|
CryptoCurrencyEquivalence equivalence = new CryptoCurrencyEquivalence(baseAsset.getId(), quoteAsset.getId(), (int) (Math.pow(10, baseAsset.getPrecision()) * equiValue), new Date());
|
||||||
CrystalDatabase.getAppDatabase(context).cryptoCurrencyEquivalenceDao().insertCryptoCurrencyEquivalence(equivalence);
|
CrystalDatabase.getAppDatabase(context).cryptoCurrencyEquivalenceDao().insertCryptoCurrencyEquivalence(equivalence);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,6 +7,9 @@ import com.idescout.sql.SqlScoutServer;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
|
import cy.agorise.crystalwallet.models.BitsharesAsset;
|
||||||
|
import cy.agorise.crystalwallet.models.BitsharesAssetInfo;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoCurrencyEquivalence;
|
||||||
import cy.agorise.crystalwallet.network.CryptoNetManager;
|
import cy.agorise.crystalwallet.network.CryptoNetManager;
|
||||||
import cy.agorise.crystalwallet.service.CrystalWalletService;
|
import cy.agorise.crystalwallet.service.CrystalWalletService;
|
||||||
|
|
||||||
|
@ -32,6 +35,11 @@ public class CrystalApplication extends Application {
|
||||||
"http://185.208.208.147:11012", // Openledger node
|
"http://185.208.208.147:11012", // Openledger node
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//This is for testing the equivalent values on the testnet TODO remove
|
||||||
|
public static BitsharesAsset bitUSDAsset = new BitsharesAsset("USD",4,"1.3.121",BitsharesAsset.Type.SMART_COIN);
|
||||||
|
//This is for testing the equivalent values on the testnet TODO remove
|
||||||
|
public static BitsharesAsset bitEURAsset = new BitsharesAsset("EUR",4,"1.3.120",BitsharesAsset.Type.SMART_COIN);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
@ -42,6 +50,31 @@ public class CrystalApplication extends Application {
|
||||||
|
|
||||||
//Using Bitshares Agorise Testnet
|
//Using Bitshares Agorise Testnet
|
||||||
CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_TESTNET_URL);
|
CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_TESTNET_URL);
|
||||||
|
|
||||||
|
//This is for testing the equivalent values on the testnet TODO remove
|
||||||
|
if(db.bitsharesAssetDao().getBitsharesAssetInfoById(bitEURAsset.getBitsharesId())== null){
|
||||||
|
if(db.cryptoCurrencyDao().getByName(bitEURAsset.getName())== null){
|
||||||
|
db.cryptoCurrencyDao().insertCryptoCurrency(bitEURAsset);
|
||||||
|
}
|
||||||
|
long idCurrency = db.cryptoCurrencyDao().getByName(bitEURAsset.getName()).getId();
|
||||||
|
BitsharesAssetInfo info = new BitsharesAssetInfo(bitEURAsset);
|
||||||
|
info.setCryptoCurrencyId(idCurrency);
|
||||||
|
db.bitsharesAssetDao().insertBitsharesAssetInfo(info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is for testing the equivalent values on the testnet TODO remove
|
||||||
|
if(db.bitsharesAssetDao().getBitsharesAssetInfoById(bitUSDAsset.getBitsharesId())== null){
|
||||||
|
if(db.cryptoCurrencyDao().getByName(bitUSDAsset.getName())== null){
|
||||||
|
db.cryptoCurrencyDao().insertCryptoCurrency(bitUSDAsset);
|
||||||
|
}
|
||||||
|
long idCurrency = db.cryptoCurrencyDao().getByName(bitUSDAsset.getName()).getId();
|
||||||
|
BitsharesAssetInfo info = new BitsharesAssetInfo(bitUSDAsset);
|
||||||
|
info.setCryptoCurrencyId(idCurrency);
|
||||||
|
db.bitsharesAssetDao().insertBitsharesAssetInfo(info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Next line is for use the bitshares main net
|
//Next line is for use the bitshares main net
|
||||||
//CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL);
|
//CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL);
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,6 @@ public abstract class CryptoNetManager {
|
||||||
|
|
||||||
public static String getURL(CryptoNet crypto, int index){
|
public static String getURL(CryptoNet crypto, int index){
|
||||||
if(TestedURLs.containsKey(crypto) && TestedURLs.get(crypto).size()>index){
|
if(TestedURLs.containsKey(crypto) && TestedURLs.get(crypto).size()>index){
|
||||||
StringBuilder debugString = new StringBuilder("CryptoNetManager urls times: ");
|
|
||||||
for(TestedURL url : TestedURLs.get(crypto)){
|
|
||||||
debugString.append("\r\n ").append(url.getTime()).append(" ").append(url.getUrl());
|
|
||||||
}
|
|
||||||
System.out.println(debugString.toString());
|
|
||||||
|
|
||||||
return TestedURLs.get(crypto).get(index).getUrl();
|
return TestedURLs.get(crypto).get(index).getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue