Browse Source

Test

etomic
jl777 7 years ago
parent
commit
94a36855ed
  1. 7
      iguana/exchanges/LP_nativeDEX.c
  2. 2
      iguana/exchanges/LP_ordermatch.c
  3. 27
      iguana/exchanges/LP_portfolio.c
  4. 32
      iguana/exchanges/LP_statemachine.c

7
iguana/exchanges/LP_nativeDEX.c

@ -18,7 +18,7 @@
// LP_nativeDEX.c
// marketmaker
//
// verify portfolio, interest to KMD withdraw, pricebroadcast loop, trade to pubkey
// verify portfolio, interest to KMD withdraw, pricebroadcast loop
// dPoW security -> 4: KMD notarized, 5: BTC notarized, after next notary elections
// bigendian architectures need to use little endian for sighash calcs
@ -1010,11 +1010,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_swapsloop for port.%u\n",myport);
exit(-1);
}
if ( 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_price_broadcastloop,(void *)ctx) != 0 )
{
printf("error launching LP_swapsloop for port.%u\n",myport);
exit(-1);
}
int32_t nonz;
while ( 1 )
{

2
iguana/exchanges/LP_ordermatch.c

@ -853,7 +853,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i
if ( *ordermatchpricep == 0. || *bestdestsatoshisp == 0 )
return(0);
int32_t changed;
LP_mypriceset(&changed,autxo->coin,base,1. / *ordermatchpricep);
//LP_mypriceset(&changed,autxo->coin,base,1. / *ordermatchpricep);
return(bestutxo);
}

27
iguana/exchanges/LP_portfolio.c

@ -309,33 +309,6 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP
}
}
void LP_price_broadcastloop(void *ctx)
{
struct LP_priceinfo *basepp,*relpp; double price; int32_t baseind,relind;
sleep(30);
while ( 1 )
{
for (baseind=0; baseind<LP_MAXPRICEINFOS; baseind++)
{
basepp = LP_priceinfo(baseind);
if ( basepp->symbol[0] == 0 )
continue;
for (relind=0; relind<LP_MAXPRICEINFOS; relind++)
{
relpp = LP_priceinfo(relind);
if ( relpp->symbol[0] == 0 )
continue;
if ( basepp != 0 && relpp != 0 && (price= relpp->myprices[basepp->ind]) > SMALLVAL)
{
//printf("automated price broadcast %s/%s %.8f\n",relpp->symbol,basepp->symbol,price);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,price);
}
}
}
sleep(LP_ORDERBOOK_DURATION * .9);
}
}
double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinfo *btcpp)
{
//{"success":true,"message":"","result":[{"MarketName":"BTC-KMD","High":0.00040840,"Low":0.00034900,"Volume":328042.46061669,"Last":0.00037236,"BaseVolume":123.36439511,"TimeStamp":"2017-07-15T13:50:21.87","Bid":0.00035721,"Ask":0.00037069,"OpenBuyOrders":343,"OpenSellOrders":1690,"PrevDay":0.00040875,"Created":"2017-02-11T23:04:01.853"},

32
iguana/exchanges/LP_statemachine.c

@ -2219,6 +2219,38 @@ if ( 0 && (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,"")
LP_utxo_clientpublish(utxo);
}
}*/
void LP_price_broadcastloop(void *ctx)
{
struct LP_priceinfo *basepp,*relpp; double price; int32_t baseind,relind;
sleep(30);
while ( 1 )
{
for (baseind=0; baseind<LP_MAXPRICEINFOS; baseind++)
{
basepp = LP_priceinfo(baseind);
if ( basepp->symbol[0] == 0 )
continue;
for (relind=0; relind<LP_MAXPRICEINFOS; relind++)
{
relpp = LP_priceinfo(relind);
if ( relpp->symbol[0] == 0 )
continue;
if ( basepp != 0 && relpp != 0 && (price= relpp->myprices[basepp->ind]) > SMALLVAL)
{
//printf("automated price broadcast %s/%s %.8f\n",relpp->symbol,basepp->symbol,price);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,price);
}
}
}
sleep(LP_ORDERBOOK_DURATION * .9);
}
}
if ( 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_price_broadcastloop,(void *)ctx) != 0 )
{
printf("error launching LP_swapsloop for port.%u\n",myport);
exit(-1);
}
#ifdef oldway
struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestsatoshisp,int64_t *bestdestsatoshisp,struct LP_utxoinfo *autxo,char *base,double maxprice,int32_t duration,uint64_t txfee,uint64_t desttxfee,uint64_t maxdestsatoshis)

Loading…
Cancel
Save