Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
4bc8355310
  1. 1
      iguana/SuperNET.c
  2. 2
      iguana/iguana777.c
  3. 12
      iguana/iguana_instantdex.c
  4. 34
      iguana/index.html
  5. 1
      iguana/tests/events
  6. 1
      iguana/tests/eventsV
  7. 1
      iguana/tests/sellV

1
iguana/SuperNET.c

@ -1469,6 +1469,7 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
if ( (str= SuperNET_encryptjson(IGUANA_CALLARGS,password,myinfo->permanentfile,argstr)) != 0 )
free(str);
free(argstr);
myinfo->expiration = (uint32_t)(time(NULL) + 3600);
return(SuperNET_activehandle(IGUANA_CALLARGS));
} else return(clonestr("{\"error\":\"need passphrase\"}"));
printf("logged into (%s) %s %s\n",myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD);

2
iguana/iguana777.c

@ -145,7 +145,7 @@ double iguana_metric(struct iguana_peer *addr,uint32_t now,double decay)
int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin)
{
struct exchange_info *exchange; int32_t i,n=0; struct iguana_peer *addr;
//printf("peermetrics\n");
printf("iguana_inv2poll\n");
if ( (exchange= exchanges777_find("bitcoin")) != 0 && strcmp(coin->symbol,"BTCD") == 0 )
{
if ( time(NULL) > coin->lastinv2+10 )

12
iguana/iguana_instantdex.c

@ -709,8 +709,11 @@ struct instantdex_accept *instantdex_offerfind(struct supernet_info *ignore,stru
//printf("%d %d find cmps %d %d %d %d %d %d me.%llu vs %llu o.%llu | vs %llu\n",instantdex_bidaskdir(&ap->offer),ap->offer.expiration-now,strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid,(long long)myinfo->myaddr.nxt64bits,(long long)ap->offer.offer64,(long long)ap->orderid,(long long)orderid);
if ( (report == 0 || ap->reported == 0) && (strcmp(base,"*") == 0 || strcmp(base,ap->offer.base) == 0) && (strcmp(rel,"*") == 0 || strcmp(rel,ap->offer.rel) == 0) && (orderid == 0 || orderid == ap->orderid) )
{
if ( report != 0 )
if ( report != 0 && ap->reported == 0 )
{
ap->reported = 1;
printf("MARK as reported %llu\n",(long long)ap->orderid);
}
if ( requeue == 0 && retap != 0 )
queue_enqueue("acceptableQ",&exchange->acceptableQ,&retap->DL,0);
retap = ap;
@ -1505,7 +1508,8 @@ cJSON *instantdex_reportjson(cJSON *item,char *name)
jadd(newjson,"orderid",jduplicate(jobj(item,"orderid")));
jaddnum(newjson,"date",dateval);
jaddnum(newjson,"s",dateval % 60);
jaddnum(newjson,"h",(dateval / 60) % 60);
jaddnum(newjson,"m",(dateval / 60) % 60);
jaddnum(newjson,"h",(dateval / 3600) % 24);
return(newjson);
}
@ -1522,7 +1526,7 @@ TWO_STRINGS(InstantDEX,events,base,rel)
{
for (i=0; i<n; i++)
{
item = jobj(jitem(bids,i),"offer");
item = jitem(bids,i);
jaddi(array,instantdex_reportjson(item,"bid"));
}
}
@ -1530,7 +1534,7 @@ TWO_STRINGS(InstantDEX,events,base,rel)
{
for (i=0; i<n; i++)
{
item = jobj(jitem(asks,i),"offer");
item = jitem(asks,i);
jaddi(array,instantdex_reportjson(item,"ask"));
}
}

34
iguana/index.html

@ -41,14 +41,15 @@ var chart = AmCharts.makeChart("chartdiv",
}}
],
"graphs": [
{ "id": "g1", "lineColor": "#00FFFF", "bullet": "round", "valueField": "bid", "balloonText": "[[category]] [[h]]:[[m]]:[[s]] bid:[[bid]] ask:[[ask]]" },
{ "id": "g2", "lineColor": "#FF8800", "bullet": "round", "valueField": "ask", "balloonText": "[[category]] [[h]]:[[m]]:[[s]] bid:[[bid]] ask:[[ask]]" }],
{ "id": "g1", "lineColor": "#00FFFF", "bullet": "round", "valueField": "bid", "balloonText": "[[category]] [[h]]:[[m]]:[[s]] account:[[offerer]] id:[[orderid]] volume:[[volume]] bid:[[bid]]" },
{ "id": "g2", "lineColor": "#FF8800", "bullet": "round", "valueField": "ask", "balloonText": "[[category]] [[h]]:[[m]]:[[s]] account:[[offerer]] id:[[orderid]] volume:[[volume]] ask:[[ask]]" }],
"categoryField": "date",
"categoryAxis": { "parseDates": true, "equalSpacing": true, "dashLength": 1, "minorGridEnabled": true },
"chartScrollbar": {},
"chartCursor": {},
"dataProvider": chartData
});
var startButton = document.getElementById('start');
var endButton = document.getElementById('stop');
/*
@ -103,16 +104,24 @@ InstantDEXbutton.addEventListener('click', InstantDEXbase);
Tradebotsbutton.addEventListener('click', Tradebotsbase);
NXTprivacybutton.addEventListener('click', NXTprivacybase);
function BTCDbase() { BASE = "BTCD"; }
function VPNbase() { BASE = "VPN"; }
function SYSbase() { BASE = "SYS"; }
function SuperNETbase() { BASE = "SuperNET"; }
function crypto777base() { BASE = "crypto777"; }
function Pangeabase() { BASE = "Pangea"; }
function InstantDEXbase() { BASE = "InstantDEX"; }
function Tradebotsbase() { BASE = "Tradebots"; }
function NXTprivacybase() { BASE = "NXTprivacy"; }
function changebase(newbase)
{
BASE = newbase;
if ( chartData.length > 0 )
{
chartData.splice(0,chartData.length);
chart.validateData();
}
}
function BTCDbase() { changebase("BTCD"); }
function VPNbase() { changebase("VPN"); }
function SYSbase() { changebase("SYS"); }
function SuperNETbase() { changebase("SuperNET"); }
function crypto777base() { changebase("crypto777"); }
function Pangeabase() { changebase("Pangea"); }
function InstantDEXbase() { changebase("InstantDEX"); }
function Tradebotsbase() { changebase("Tradebots"); }
function NXTprivacybase() { changebase("NXTprivacy"); }
function USDrel() { REL = "USD"; }
function EURrel() { REL = "EUR"; }
@ -147,6 +156,7 @@ function getDataFromServer()
newData = JSON.parse(response);
if ( newData.length > 0 )
{
alert(response);
chartData.push.apply(chartData, newData);
if (chartData.length > 50)
chartData.splice(0, chartData.length - 50);

1
iguana/tests/events

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"events\",\"base\":\"BTCD\",\"rel\":\"BTC\"}"

1
iguana/tests/eventsV

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"events\",\"base\":\"VPN\",\"rel\":\"BTC\"}"

1
iguana/tests/sellV

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"sell\",\"base\":\"VPN\",\"rel\":\"BTC\",\"price\":0.000025,\"volume\":1.0}"
Loading…
Cancel
Save