Browse Source

test

etomic
jl777 8 years ago
parent
commit
b9e5d71052
  1. 45
      basilisk/tradebots_liquidity.c
  2. 2
      iguana/iguana777.c
  3. 4
      iguana/iguana_notary.c
  4. 1
      iguana/main.c
  5. 2
      iguana/tests/arbinit

45
basilisk/tradebots_liquidity.c

@ -501,7 +501,7 @@ float *get_features(int32_t numfeatures,int32_t refc,int32_t ind)
return(svmf); return(svmf);
} }
double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer) /*double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer)
{ {
int32_t i,nonz=0; int32_t i,nonz=0;
for (i=0; i<numfeatures; i++) for (i=0; i<numfeatures; i++)
@ -509,19 +509,18 @@ double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures
nonz++;//, printf("%.6f ",W[i]); nonz++;//, printf("%.6f ",W[i]);
printf("model.%d W0 %.7f numfeatures.%d nonz.%d\n",answerind,W0,numfeatures,nonz); printf("model.%d W0 %.7f numfeatures.%d nonz.%d\n",answerind,W0,numfeatures,nonz);
return(W0); return(W0);
}*/
void tradebots_modelfname(char *modelname,char *base,char *rel,int32_t answerind,int32_t numfeatures)
{
sprintf(modelname,"%s/SVM/models/%s_%s_%d.A%d",GLOBAL_DBDIR,base,rel,numfeatures,answerind);
OS_portable_path(modelname);
} }
/*double load_model(register int *posAp,register int *negAp,register double *W,register int refc,register int answerind,register int numfeatures) double load_model(register int *posAp,register int *negAp,register double *W,register int refc,register int answerind,register int numfeatures)
{ {
int j; int32_t j; FILE *fp; double perc; char modelname[512];
FILE *fp; tradebots_modelfname(modelname,Arbpairs[refc].base,Arbpairs[refc].rel,answerind,numfeatures);
double perc;
char modelname[512];
#ifdef __APPLE__
sprintf(modelname,"/Volumes/SSD/models/%s_%d.A%c%c",CONTRACTS[refc],numfeatures,(answerind/10)+'0',(answerind%10)+'0');
#else
sprintf(modelname,"/media/raptor/models/%s_%d.A%c%c",CONTRACTS[refc],numfeatures,(answerind/10)+'0',(answerind%10)+'0');
#endif
if ( (fp= fopen(modelname,"rb")) != 0 ) if ( (fp= fopen(modelname,"rb")) != 0 )
{ {
//printf("load file\n"); //printf("load file\n");
@ -540,7 +539,7 @@ double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures
#ifndef DISABLE_EXISTINGMODEL #ifndef DISABLE_EXISTINGMODEL
else if ( 0 ) else if ( 0 )
{ {
sprintf(modelname,"/media/raptor/models/%s_%d.A%c%c",CONTRACTS[0],numfeatures,(answerind/10)+'0',(answerind%10)+'0'); tradebots_modelfname(modelname,Arbpairs[refc].base,Arbpairs[refc].rel,answerind,numfeatures);
if ( (fp= fopen(modelname,"rb")) != 0 ) if ( (fp= fopen(modelname,"rb")) != 0 )
{ {
j = (int)fread(W,sizeof(*W),numfeatures+1,fp); j = (int)fread(W,sizeof(*W),numfeatures+1,fp);
@ -551,7 +550,7 @@ double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures
if ( fread(negAp,1,sizeof(*negAp),fp) == sizeof(*negAp) ) if ( fread(negAp,1,sizeof(*negAp),fp) == sizeof(*negAp) )
j++; j++;
fclose(fp); fclose(fp);
printf("Using backup model for %s loaded %s bias %9.6f | %5.2f%%\n",CONTRACTS[refc],modelname,W[numfeatures],perc); printf("Using backup model for %s/%s loaded %s bias %9.6f | %5.2f%%\n",Arbpairs[refc].base,Arbpairs[refc].rel,modelname,W[numfeatures],perc);
return(perc * .9); return(perc * .9);
} }
} }
@ -562,9 +561,8 @@ double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures
int save_model(int refc,int answerind,double *W,int numfeatures,double W0,double perc,int posA,int negA) int save_model(int refc,int answerind,double *W,int numfeatures,double W0,double perc,int posA,int negA)
{ {
FILE *fp; FILE *fp; char modelname[512];
char modelname[512]; tradebots_modelfname(modelname,Arbpairs[refc].base,Arbpairs[refc].rel,answerind,numfeatures);
sprintf(modelname,"/media/raptor/models/%s_%d.A%c%c",CONTRACTS[refc],numfeatures,(answerind/10)+'0',(answerind%10)+'0');
//printf("modelname.%s m.%p predabs %f\n",modelname,m,predabs); //printf("modelname.%s m.%p predabs %f\n",modelname,m,predabs);
if ( (fp= fopen(modelname,"wb")) != 0 ) if ( (fp= fopen(modelname,"wb")) != 0 )
{ {
@ -582,23 +580,26 @@ int save_model(int refc,int answerind,double *W,int numfeatures,double W0,double
double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer) double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer)
{ {
double fileperc,perc = (100. * (double)(len - bad)) / len; double perc = (100. * (double)(len - bad)) / len;
#ifndef DISABLE_EXISTINGMODEL #ifndef DISABLE_EXISTINGMODEL
int _posA,_negA; int32_t _posA,_negA; double *tmpW,fileperc;
double tmpW[MAX_OCAS_FEATURES+2],fileperc; tmpW = calloc(numfeatures+2,sizeof(*tmpW));
if ( (fileperc= load_model(&_posA,&_negA,tmpW,refc_to_c(refc),answerind,numfeatures)) > perc ) if ( (fileperc= load_model(&_posA,&_negA,tmpW,refc,answerind,numfeatures)) > perc )
{ {
if ( (_posA+_negA) != 0 && _posA >= posA && _negA >= negA ) if ( (_posA+_negA) != 0 && _posA >= posA && _negA >= negA )
{ {
memcpy(W,tmpW,sizeof(*W)*numfeatures); memcpy(W,tmpW,sizeof(*W)*numfeatures);
printf("%s.A%02d numfeatures.%d posA.%d negA.%d saved model %f is better than %f +A%d -A%d\n",CONTRACTS[refc],answerind,numfeatures,_posA,_negA,fileperc,perc,posA,negA); printf("%s/%s.A%02d numfeatures.%d posA.%d negA.%d saved model %f is better than %f +A%d -A%d\n",Arbpairs[refc].base,Arbpairs[refc].rel,answerind,numfeatures,_posA,_negA,fileperc,perc,posA,negA);
W0 = tmpW[numfeatures];
free(tmpW);
return(tmpW[numfeatures]); return(tmpW[numfeatures]);
} }
} }
free(tmpW);
#endif #endif
save_model(refc,answerind,W,numfeatures,W0,perc,posA,negA); save_model(refc,answerind,W,numfeatures,W0,perc,posA,negA);
return(W0); return(W0);
}*/ }
#ifndef _WIN #ifndef _WIN
#include "tradebots_SVM.h" #include "tradebots_SVM.h"

2
iguana/iguana777.c

@ -841,7 +841,7 @@ void iguana_callcoinstart(struct supernet_info *myinfo,struct iguana_info *coin)
{ {
char NOTARYCHAINS[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies char NOTARYCHAINS[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
"KMD", "BTC", "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW" }; "KMD", "BTC", "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW", "MVP" };
struct iguana_bundle *bp; struct iguana_peer *addr; int32_t i,bundlei; bits256 zero; char dirname[512],*symbol; struct iguana_bundle *bp; struct iguana_peer *addr; int32_t i,bundlei; bits256 zero; char dirname[512],*symbol;
iguana_rwiAddrind(coin,0,0,0); iguana_rwiAddrind(coin,0,0,0);
//for (i=0; i<sizeof(*coin->chain); i++) //for (i=0; i<sizeof(*coin->chain); i++)

4
iguana/iguana_notary.c

@ -437,7 +437,7 @@ STRING_AND_INT(dpow,fundnotaries,symbol,numblocks)
int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height); int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height);
char CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies char CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW" }; "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW", "MVP" };
uint8_t pubkeys[64][33]; cJSON *infojson; char coinaddr[64],cmd[1024]; uint64_t signedmask; int32_t i,j,sendflag=0,current=0,height; FILE *fp; double vals[64],sum,val = 0.01; uint8_t pubkeys[64][33]; cJSON *infojson; char coinaddr[64],cmd[1024]; uint64_t signedmask; int32_t i,j,sendflag=0,current=0,height; FILE *fp; double vals[64],sum,val = 0.01;
int32_t n = komodo_notaries("KMD",pubkeys,114000); int32_t n = komodo_notaries("KMD",pubkeys,114000);
if ( symbol != 0 && strcmp(symbol,"BTC") == 0 && (coin= iguana_coinfind("KMD")) != 0 ) if ( symbol != 0 && strcmp(symbol,"BTC") == 0 && (coin= iguana_coinfind("KMD")) != 0 )
@ -490,7 +490,7 @@ STRING_AND_INT(dpow,fundnotaries,symbol,numblocks)
} }
else return(clonestr("{\"error\":\"cant find BTC\"}")); else return(clonestr("{\"error\":\"cant find BTC\"}"));
} }
for (i=0; i<sizeof(CURRENCIES)/sizeof(*CURRENCIES); i++) for (i=32; i<sizeof(CURRENCIES)/sizeof(*CURRENCIES); i++)
{ {
if ( symbol == 0 || symbol[0] == 0 || strcmp(symbol,CURRENCIES[i]) == 0 ) if ( symbol == 0 || symbol[0] == 0 || strcmp(symbol,CURRENCIES[i]) == 0 )
{ {

1
iguana/main.c

@ -678,6 +678,7 @@ void iguana_ensuredirs()
sprintf(dirname,"%s/BTCD",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname); sprintf(dirname,"%s/BTCD",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname);
sprintf(dirname,"SVM"), OS_ensure_directory(dirname); sprintf(dirname,"SVM"), OS_ensure_directory(dirname);
sprintf(dirname,"SVM/rawfeatures"), OS_ensure_directory(dirname); sprintf(dirname,"SVM/rawfeatures"), OS_ensure_directory(dirname);
sprintf(dirname,"SVM/models"), OS_ensure_directory(dirname);
} }
void iguana_Qinit() void iguana_Qinit()

2
iguana/tests/arbinit

@ -3,7 +3,7 @@ curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"poloniex\"}}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"coinbase\"}}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"coinbase\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"lakebtc\"}}" #curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"lakebtc\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"quadriga\"}}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"quadriga\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"btcd\"}}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"btcd\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"bitstamp\"}}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"bitstamp\"}}"

Loading…
Cancel
Save