Browse Source

BOTS and MGW

dev
jl777 7 years ago
parent
commit
fc83ddb523
  1. 14
      iguana/exchanges/LP_portfolio.c
  2. 16
      iguana/exchanges/prices/autoprice

14
iguana/exchanges/LP_portfolio.c

@ -533,12 +533,12 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{ {
if ( (fundjson= LP_fundvalue(argjson)) != 0 ) if ( (fundjson= LP_fundvalue(argjson)) != 0 )
{ {
printf("%s\n",jprint(fundjson,0)); //printf("%s\n",jprint(fundjson,0));
if ( jint(fundjson,"missing") == 0 ) if ( jint(fundjson,"missing") == 0 )
{ {
if ( LP_autorefs[i].fundbid[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundbid)) > SMALLVAL ) if ( LP_autorefs[i].fundbid[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundbid)) > SMALLVAL )
{ {
printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundbid,price); //printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundbid,price);
if ( tickerjson != 0 && LP_autorefs[i].count == 0 ) if ( tickerjson != 0 && LP_autorefs[i].count == 0 )
price = LP_tickered_price(0,base,rel,price,tickerjson); price = LP_tickered_price(0,base,rel,price,tickerjson);
newprice = (1. / price) * (1. + buymargin); newprice = (1. / price) * (1. + buymargin);
@ -548,11 +548,11 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
newprice = LP_autorefs[i].lastbid; newprice = LP_autorefs[i].lastbid;
LP_mypriceset(&changed,rel,base,newprice); LP_mypriceset(&changed,rel,base,newprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice);
printf("fundbid %.8f margin %.8f newprice %.8f\n",price,buymargin,newprice); //printf("fundbid %.8f margin %.8f newprice %.8f\n",price,buymargin,newprice);
} }
if ( LP_autorefs[i].fundask[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundask)) > SMALLVAL ) if ( LP_autorefs[i].fundask[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundask)) > SMALLVAL )
{ {
printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundask,price); //printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundask,price);
if ( tickerjson != 0 && LP_autorefs[i].count == 0 ) if ( tickerjson != 0 && LP_autorefs[i].count == 0 )
price = LP_tickered_price(1,base,rel,price,tickerjson); price = LP_tickered_price(1,base,rel,price,tickerjson);
newprice = (price * (1. + sellmargin)); newprice = (price * (1. + sellmargin));
@ -562,7 +562,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
newprice = LP_autorefs[i].lastask; newprice = LP_autorefs[i].lastask;
LP_mypriceset(&changed,base,rel,newprice); LP_mypriceset(&changed,base,rel,newprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice);
printf("fundask %.8f margin %.8f newprice %.8f\n",price,sellmargin,newprice); //printf("fundask %.8f margin %.8f newprice %.8f\n",price,sellmargin,newprice);
} }
LP_autorefs[i].count++; LP_autorefs[i].count++;
} }
@ -623,7 +623,7 @@ void LP_autoprices_update(char *method,char *base,double basevol,char *rel,doubl
{ {
if ( strcmp(LP_autorefs[i].rel,rel) == 0 && strcmp(base,LP_autorefs[i].base) == 0 ) if ( strcmp(LP_autorefs[i].rel,rel) == 0 && strcmp(base,LP_autorefs[i].base) == 0 )
{ {
newprice = (LP_autorefs[i].lastask * 0.99) + (0.01 * price); newprice = (LP_autorefs[i].lastask * 0.9) + (0.1 * price);
if ( LP_autorefs[i].lastask > 0 ) if ( LP_autorefs[i].lastask > 0 )
{ {
//printf("%s: autoprice ask update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice); //printf("%s: autoprice ask update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice);
@ -632,7 +632,7 @@ void LP_autoprices_update(char *method,char *base,double basevol,char *rel,doubl
} }
else if ( strcmp(LP_autorefs[i].rel,base) == 0 && strcmp(rel,LP_autorefs[i].base) == 0 ) else if ( strcmp(LP_autorefs[i].rel,base) == 0 && strcmp(rel,LP_autorefs[i].base) == 0 )
{ {
newprice = (LP_autorefs[i].lastbid * 0.99) + (0.01 * price); newprice = (LP_autorefs[i].lastbid * 0.9) + (0.1 * price);
if ( LP_autorefs[i].lastbid > 0 ) if ( LP_autorefs[i].lastbid > 0 )
{ {
//printf("%s: autoprice bid update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice); //printf("%s: autoprice bid update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice);

16
iguana/exchanges/prices/autoprice

@ -12,7 +12,6 @@ curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"BTCH\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"HUSH\",\"factor\":1.44,\"buymargin\":0.01,\"sellmargin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"BTCH\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"HUSH\",\"factor\":1.44,\"buymargin\":0.01,\"sellmargin\":0.01}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"BTCH\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"HUSH\",\"refrel\":\"KMD\",\"factor\":0.7,\"buymargin\":0.01,\"sellmargin\":0.01}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"BTCH\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"HUSH\",\"refrel\":\"KMD\",\"factor\":0.7,\"buymargin\":0.01,\"sellmargin\":0.01}"
source crypto source crypto
source trackbtc source trackbtc
@ -22,21 +21,12 @@ source trackbtc
source pangea source pangea
source trackbtc source trackbtc
source bots
source trackbtc
source bet source bet
source trackbtc source trackbtc
source revs source revs
source trackbtc source trackbtc
source mgw
source trackbtc
source revs
source trackbtc
sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":145}" sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":145}"
curl --url "http://127.0.0.1:7783" --data "{\"base\":\"MSHARK\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[$sharkholdings],\"divisor\":1400000}" curl --url "http://127.0.0.1:7783" --data "{\"base\":\"MSHARK\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[$sharkholdings],\"divisor\":1400000}"
@ -47,3 +37,9 @@ curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"HODL\"
dexholdings="{\"coin\":\"blocknet\",\"balance\":4975836}" dexholdings="{\"coin\":\"blocknet\",\"balance\":4975836}"
curl --url "http://127.0.0.1:7783" --data "{\"base\":\"DEX\",\"rel\":\"KMD\",\"margin\":$margin,\"fundvalue_bid\":\"assetNAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RThtXup6Zo7LZAi8kRWgjAyi1s4u6U9Cpf\",\"holdings\":[$dexholdings],\"divisor\":1000000}" curl --url "http://127.0.0.1:7783" --data "{\"base\":\"DEX\",\"rel\":\"KMD\",\"margin\":$margin,\"fundvalue_bid\":\"assetNAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RThtXup6Zo7LZAi8kRWgjAyi1s4u6U9Cpf\",\"holdings\":[$dexholdings],\"divisor\":1000000}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"BOTS\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"DEX\",\"factor\":3.33,\"buymargin\":0.05,\"sellmargin\":0.05}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"BOTS\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"DEX\",\"refrel\":\"KMD\",\"factor\":0.3,\"buymargin\":0.05,\"sellmargin\":0.05}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"MGW\",\"offset\":0.0,\"refbase\":\"KMD\",\"refrel\":\"DEX\",\"factor\":10,\"buymargin\":0.05,\"sellmargin\":0.05}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"MGW\",\"rel\":\"KMD\",\"offset\":0.0,\"refbase\":\"DEX\",\"refrel\":\"KMD\",\"factor\":0.1,\"buymargin\":0.05,\"sellmargin\":0.05}"

Loading…
Cancel
Save