mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
Some constants for the btc addr, email and site url..
+ missing .gitignore / folder git keepers
This commit is contained in:
parent
4d8a873075
commit
d8fe695a46
50 changed files with 804 additions and 810 deletions
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.o
|
||||
*.a
|
||||
stratum/stratum
|
||||
stratum/blocknotify
|
||||
*.log
|
||||
web/yaamp/runtime/*
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#yaamp
|
||||
#yiimp - yaamp fork
|
||||
|
||||
Required:
|
||||
|
||||
linux, mysql, php, web engine, memcached
|
||||
linux, mysql, php, memcached
|
||||
|
||||
Config for nginx:
|
||||
|
||||
|
@ -20,7 +20,7 @@ Config for nginx:
|
|||
include fastcgi_params;
|
||||
}
|
||||
|
||||
If you use apache, it should be something like:
|
||||
If you use apache, it should be something like (set in web/.htaccess):
|
||||
|
||||
RewriteEngine on
|
||||
|
||||
|
@ -57,7 +57,7 @@ All your coin's config files need to blocknotify their corresponding stratum usi
|
|||
|
||||
blocknotify=/var/stratum/blocknotify yaamp.com:port coinid %s
|
||||
|
||||
On the website, go to http://server.com/site/frottedessus to login as admin. You have to change it to something different in the code (web/yaamp/modules/site/SiteController.php).
|
||||
On the website, go to http://server.com/site/admintest to login as admin. You have to change it to something different in the code (web/yaamp/modules/site/SiteController.php).
|
||||
|
||||
There are logs generated in the /var/stratum folder and /var/log/stratum/debug.log for the php log.
|
||||
|
||||
|
|
25
blocknotify/Makefile
Normal file
25
blocknotify/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
CC=gcc
|
||||
|
||||
CFLAGS=-c -g -I /usr/include/mysql -march=native
|
||||
LDFLAGS=-g
|
||||
|
||||
#CFLAGS=-c -O2 -I /usr/include/mysql
|
||||
#LDFLAGS=-O2
|
||||
|
||||
LDLIBS=-lstdc++
|
||||
|
||||
SOURCES=blocknotify.cpp
|
||||
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
OUTPUT=blocknotify
|
||||
|
||||
all: $(SOURCES) $(OUTPUT)
|
||||
|
||||
install: all
|
||||
strip -s $(OUTPUT)
|
||||
cp $(OUTPUT) /usr/local/bin/
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(OUTPUT)
|
0
blocknotify/blocknotify.cpp
Executable file → Normal file
0
blocknotify/blocknotify.cpp
Executable file → Normal file
0
log/.gitignore
vendored
Normal file
0
log/.gitignore
vendored
Normal file
|
@ -1,53 +0,0 @@
|
|||
|
||||
CC=gcc
|
||||
|
||||
CFLAGS=-c -g -I /usr/include/mysql
|
||||
LDFLAGS=-g
|
||||
|
||||
#CFLAGS=-c -O2 -I /usr/include/mysql
|
||||
#LDFLAGS=-O2
|
||||
|
||||
LDLIBS=iniparser/libiniparser.a algos/libalgos.a sha3/libhash.a -lmysqlclient -lpthread -lm -lstdc++
|
||||
|
||||
SOURCES=stratum.cpp db.cpp coind.cpp coind_aux.cpp coind_template.cpp coind_submit.cpp util.cpp list.cpp \
|
||||
rpc.cpp job.cpp job_send.cpp job_core.cpp merkle.cpp share.cpp socket.cpp coinbase.cpp \
|
||||
client.cpp client_submit.cpp client_core.cpp client_difficulty.cpp remote.cpp remote_template.cpp \
|
||||
user.cpp object.cpp json.cpp base58.cpp
|
||||
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
OUTPUT=stratum
|
||||
|
||||
CODEDIR1=algos
|
||||
CODEDIR2=sha3
|
||||
|
||||
.PHONY: projectcode1 projectcode2
|
||||
|
||||
all: projectcode1 projectcode2 $(SOURCES) $(OUTPUT)
|
||||
|
||||
projectcode1:
|
||||
$(MAKE) -C $(CODEDIR1)
|
||||
|
||||
projectcode2:
|
||||
$(MAKE) -C $(CODEDIR2)
|
||||
|
||||
$(SOURCES): stratum.h util.h
|
||||
|
||||
$(OUTPUT): $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
clean:
|
||||
rm *.o
|
||||
# rm algos/*.o
|
||||
# rm sha3/*.o
|
||||
|
||||
install: all
|
||||
cp stratum release
|
||||
strip release/stratum
|
||||
|
||||
|
10
web/.htaccess
Normal file
10
web/.htaccess
Normal file
|
@ -0,0 +1,10 @@
|
|||
RewriteEngine On
|
||||
|
||||
#RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
#RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
#RewriteCond %{REQUEST_FILENAME} -d
|
||||
#RewriteRule ^.*$ - [NC,L]
|
||||
#RewriteRule ^.*$ index.php [NC,L]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*) index.php?r=$1 [QSA]
|
22
web/.project
22
web/.project
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>web</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.dltk.core.scriptbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.php.core.PHPNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -295,7 +295,7 @@ class CErrorHandler extends CApplicationComponent
|
|||
{
|
||||
if(YII_DEBUG)
|
||||
{
|
||||
$version='<a href="http://yaamp.com/">yaamp.com</a>';
|
||||
$version='<a href="http://yiimp.ccminer.org/">yiimp.ccminer.org</a>';
|
||||
if(isset($_SERVER['SERVER_SOFTWARE']))
|
||||
$version=$_SERVER['SERVER_SOFTWARE'].' '.$version;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
<?php
|
||||
|
||||
//define('YII_DEBUG', true);
|
||||
|
||||
require_once('serverconfig.php');
|
||||
require_once('yaamp/ui/app.php');
|
||||
|
||||
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
|
||||
//$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
if(0)
|
||||
{
|
||||
debuglog("{$_SERVER['REMOTE_ADDR']}, {$_SERVER['REQUEST_URI']}");
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
ini_set('date.timezone', 'Canada/Eastern');
|
||||
|
||||
define('YAAMP_LOGS', '/var/log/yaamp');
|
||||
define('YAAMP_HTDOCS', '/var/web');
|
||||
|
||||
define('YAAMP_DBHOST', 'localhost');
|
||||
define('YAAMP_DBNAME', 'yaamp');
|
||||
define('YAAMP_DBUSER', 'root');
|
||||
define('YAAMP_DBPASSWORD', 'password');
|
||||
|
||||
define('YAAMP_PRODUCTION', true);
|
||||
define('YAAMP_RENTAL', true);
|
||||
define('YAAMP_LIMIT_ESTIMATE', false);
|
||||
|
||||
define('YAAMP_FEES_MINING', 0.5);
|
||||
define('YAAMP_FEES_EXCHANGE', 2);
|
||||
define('YAAMP_FEES_RENTING', 2);
|
||||
define('YAAMP_PAYMENTS_FREQ', 3*60*60);
|
||||
|
||||
$cold_wallet_table = array(
|
||||
'1C23KmLeCaQSLLyKVykHEUse1R7jRDv9j9' => 0.10,
|
||||
);
|
||||
|
||||
|
1
web/serverconfig.php
Symbolic link
1
web/serverconfig.php
Symbolic link
|
@ -0,0 +1 @@
|
|||
/etc/yamp/serverconfig.php
|
30
web/serverconfig.sample.php
Normal file
30
web/serverconfig.sample.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
ini_set('date.timezone', 'Canada/Eastern');
|
||||
|
||||
define('YAAMP_LOGS', '/var/log/yaamp');
|
||||
define('YAAMP_HTDOCS', '/var/web');
|
||||
|
||||
define('YAAMP_DBHOST', 'localhost');
|
||||
define('YAAMP_DBNAME', 'yaamp');
|
||||
define('YAAMP_DBUSER', 'root');
|
||||
define('YAAMP_DBPASSWORD', 'password');
|
||||
|
||||
define('YAAMP_PRODUCTION', true);
|
||||
define('YAAMP_RENTAL', true);
|
||||
define('YAAMP_LIMIT_ESTIMATE', false);
|
||||
|
||||
define('YAAMP_FEES_MINING', 0.5);
|
||||
define('YAAMP_FEES_EXCHANGE', 2);
|
||||
define('YAAMP_FEES_RENTING', 2);
|
||||
define('YAAMP_PAYMENTS_FREQ', 3*60*60);
|
||||
|
||||
define('YAAMP_BTCADDRESS', '1Auhps1mHZQpoX4mCcVL8odU81VakZQ6dR');
|
||||
define('YAAMP_SITE_URL', 'yiimp.ccminer.org');
|
||||
define('YAAMP_ADMIN_EMAIL', 'yiimp@spam.la');
|
||||
|
||||
$cold_wallet_table = array(
|
||||
'1C23KmLeCaQSLLyKVykHEUse1R7jRDv9j9' => 0.10,
|
||||
);
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
return array(
|
||||
'name'=>'yaamp.com',
|
||||
'name'=>YAAMP_SITE_URL,
|
||||
|
||||
'defaultController'=>'site',
|
||||
'layout'=>'main',
|
||||
|
@ -14,25 +14,31 @@ return array(
|
|||
'preload'=>array('log'),
|
||||
'import'=>array('application.components.*'),
|
||||
// 'params'=>require("siteconfig.php"),
|
||||
|
||||
|
||||
'components'=>array(
|
||||
|
||||
'urlManager'=>array(
|
||||
'urlFormat'=>'path',
|
||||
'showScriptName'=>false,
|
||||
'appendParams'=>false,
|
||||
'caseSensitive'=>false,
|
||||
'rules'=>array(
|
||||
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
|
||||
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
|
||||
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
|
||||
),
|
||||
),
|
||||
|
||||
'assetManager'=>array(
|
||||
'basePath'=>YAAMP_HTDOCS."/assets"),
|
||||
|
||||
|
||||
'log'=>array(
|
||||
'class'=>'CLogRouter',
|
||||
'routes'=>array(
|
||||
array(
|
||||
'class'=>'CFileLogRoute',
|
||||
'levels'=>'error, warning',
|
||||
// 'levels'=>'trace, error, warning',
|
||||
// 'levels'=>'debug, trace, error, warning',
|
||||
),
|
||||
// array(
|
||||
// 'class'=>'CProfileLogRoute',
|
||||
|
@ -49,16 +55,16 @@ return array(
|
|||
'db'=>array(
|
||||
'class'=>'CDbConnection',
|
||||
'connectionString'=>"mysql:host=".YAAMP_DBHOST.";dbname=".YAAMP_DBNAME,
|
||||
|
||||
|
||||
'username'=>YAAMP_DBUSER,
|
||||
'password'=>YAAMP_DBPASSWORD,
|
||||
|
||||
|
||||
'enableProfiling'=>false,
|
||||
'charset'=>'utf8',
|
||||
'schemaCachingDuration'=>3600,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ function MonitorBTC()
|
|||
|
||||
$txurl = "https://blockchain.info/tx/{$transaction['txid']}";
|
||||
|
||||
$b = mail('yaamp201@gmail.com', "withdraw {$transaction['amount']}",
|
||||
$b = mail(YAAMP_ADMIN_EMAIL, "withdraw {$transaction['amount']}",
|
||||
"<a href='$txurl'>{$transaction['address']}</a>");
|
||||
|
||||
if(!$b) debuglog('error sending email');
|
||||
|
|
|
@ -96,7 +96,7 @@ function updateRawCoin($marketname, $symbol, $name='unknown')
|
|||
$coin->created = time();
|
||||
$coin->save();
|
||||
|
||||
mail('yaamp201@gmail.com', "New coin $symbol", "new coin $symbol ($name) on $marketname");
|
||||
mail(YAAMP_ADMIN_EMAIL, "New coin $symbol", "new coin $symbol ($name) on $marketname");
|
||||
sleep(30);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,18 @@ function BackendUpdateServices()
|
|||
2=>'scryptn',
|
||||
3=>'x11',
|
||||
4=>'x13',
|
||||
5=>'keccak',
|
||||
6=>'x15',
|
||||
7=>'nist5',
|
||||
8=>'neoscrypt',
|
||||
9=>'lyra2',
|
||||
10=>'whirlx',
|
||||
11=>'qubit',
|
||||
12=>'quark',
|
||||
|
||||
111=>'c11',
|
||||
);
|
||||
|
||||
|
||||
$res = fetch_url('https://www.nicehash.com/api?method=stats.global.current');
|
||||
if(!$res) return;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ function BackendRunCoinActions()
|
|||
// fclose($file);
|
||||
|
||||
// controller()->memcache->set('stratum_log_size', $filesize);
|
||||
// system("echo \"$data\" | mail -s \"yaamp server\" yaamp201@gmail.com");
|
||||
// system("echo \"$data\" | mail -s \"yiimp server\" ".YAAMP_ADMIN_EMAIL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ function bu($url=null)
|
|||
{
|
||||
static $baseUrl;
|
||||
if ($baseUrl===null)
|
||||
$baseUrl=Yii::app()->request->baseUrl;
|
||||
$baseUrl=Yii::app()->request->baseUrl;
|
||||
return $url===null ? $baseUrl : $baseUrl.'/'.ltrim($url,'/');
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,11 @@ function user()
|
|||
{
|
||||
return Yii::app()->user;
|
||||
}
|
||||
|
||||
function now()
|
||||
{
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
function now()
|
||||
{
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -72,6 +72,6 @@ function JavascriptReady($javascript)
|
|||
{
|
||||
echo "<script>$(function(){ $javascript})</script>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ function send_email_alert($name, $title, $message, $t=10)
|
|||
$last = memcache_get(controller()->memcache->memcache, "last_email_sent_$name");
|
||||
if($last + $t*60 > time()) return;
|
||||
|
||||
debuglog("mail('yaamp201@gmail.com', $title, ...)");
|
||||
debuglog("mail('".YAAMP_ADMIN_EMAIL."', $title, ...)");
|
||||
|
||||
$b = mail('yaamp201@gmail.com', $title, $message);
|
||||
$b = mail(YAAMP_ADMIN_EMAIL, $title, $message);
|
||||
if(!$b) debuglog('error sending email');
|
||||
|
||||
memcache_set(controller()->memcache->memcache, "last_email_sent_$name", time());
|
||||
|
|
0
web/yaamp/core/exchange/bittrex.php
Executable file → Normal file
0
web/yaamp/core/exchange/bittrex.php
Executable file → Normal file
0
web/yaamp/core/exchange/bleutrade.php
Executable file → Normal file
0
web/yaamp/core/exchange/bleutrade.php
Executable file → Normal file
0
web/yaamp/core/exchange/ccexapi.php
Executable file → Normal file
0
web/yaamp/core/exchange/ccexapi.php
Executable file → Normal file
0
web/yaamp/core/exchange/cryptsy.php
Executable file → Normal file
0
web/yaamp/core/exchange/cryptsy.php
Executable file → Normal file
0
web/yaamp/core/exchange/jubi.php
Executable file → Normal file
0
web/yaamp/core/exchange/jubi.php
Executable file → Normal file
0
web/yaamp/core/exchange/poloniex.php
Executable file → Normal file
0
web/yaamp/core/exchange/poloniex.php
Executable file → Normal file
0
web/yaamp/core/exchange/yobit.php
Executable file → Normal file
0
web/yaamp/core/exchange/yobit.php
Executable file → Normal file
|
@ -1,198 +1,199 @@
|
|||
<?php
|
||||
|
||||
// $order
|
||||
// orderid
|
||||
// price
|
||||
// amount
|
||||
// marketid (cryptsy)
|
||||
//
|
||||
|
||||
class CExchange
|
||||
{
|
||||
protected $marketname;
|
||||
|
||||
protected $orders;
|
||||
protected $balances;
|
||||
|
||||
protected $balance_btc;
|
||||
protected $balance_ltc;
|
||||
|
||||
abstract protected function loadOrders();
|
||||
abstract protected function loadBalances();
|
||||
abstract protected function withdraw();
|
||||
|
||||
protected function get_mintrade() {return 0.00050000;}
|
||||
protected function get_minwithdraw() {return 0.25000000;}
|
||||
|
||||
public function __construct($marketname)
|
||||
{
|
||||
$this->marketname = $marketname;
|
||||
}
|
||||
|
||||
public function doTrading()
|
||||
{
|
||||
$this->orders = $this->loadOrders();
|
||||
foreach($this->orders as $order)
|
||||
{
|
||||
$cexcoin = new CExchangeCoin($order->coin, $this->marketname);
|
||||
// cancel if too high
|
||||
// add to our db if not there already
|
||||
}
|
||||
|
||||
$list = getdbolist('db_orders', "market='$this->marketname'");
|
||||
foreach($list as $db_order)
|
||||
{
|
||||
$found = false;
|
||||
foreach($this->orders as $order)
|
||||
{
|
||||
if($order->orderid == $db_order->uuid)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found)
|
||||
{
|
||||
debuglog("$this->marketname deleting order");
|
||||
$db_order->delete();
|
||||
}
|
||||
}
|
||||
|
||||
$savebalance = getdbosql('db_balances', "name='cryptsy'");
|
||||
$savebalance->balance = 0;
|
||||
|
||||
$this->balances = $this->loadBalances();
|
||||
foreach($this->balances as $balance)
|
||||
{
|
||||
if($balance->amount <= 0) continue;
|
||||
$cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
|
||||
|
||||
foreach($cexcoin->bids as $bid)
|
||||
{
|
||||
if($balance->amount*1.5 < $bid->amount && !$coin->sellonbid) break;
|
||||
|
||||
$sellamount = min($balance->amount, $bid->price);
|
||||
if($sellamount*$bid->price < $this->get_mintrade()) continue;
|
||||
|
||||
$cex->sell($sellamount, $bid->price);
|
||||
$balance->amount -= $sellamount;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
$cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
|
||||
if($balance->amount*$cexcoin->ask < $this->get_mintrade()) continue;
|
||||
|
||||
$cex->sell($balance->amount, $cexcoin->ask);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if($this->balance_btc >= $this->get_minwithdraw())
|
||||
{
|
||||
debuglog("withdraw $this->marketname $this->balance_btc");
|
||||
$this->withdraw($this->balance_btc);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CExchangeCryptsy extends CExchange
|
||||
{
|
||||
protected function loadOrders()
|
||||
{
|
||||
$ordertab = array();
|
||||
|
||||
$orders = cryptsy_api_query('allmyorders');
|
||||
if(!$orders) return $ordertab;
|
||||
if(!isset($orders['return'])) return $ordertab;
|
||||
|
||||
foreach($orders['return'] as $order)
|
||||
{
|
||||
if(!isset($order['marketid'])) continue;
|
||||
if(!isset($order['orderid'])) continue;
|
||||
|
||||
$object = new object();
|
||||
$object->orderid = $order['orderid'];
|
||||
$object->price = $order['price'];
|
||||
$object->amount = $order['quantity'];
|
||||
$object->marketid = $order['marketid'];
|
||||
|
||||
$market = getdbosql('db_markets', "marketid=$object->marketid");
|
||||
if(!$market) continue;
|
||||
|
||||
$object->coin = getdbo('db_coins', $market->coinid);
|
||||
if(!$object->coin) continue;
|
||||
|
||||
$ordertab[] = $object;
|
||||
}
|
||||
|
||||
return $ordertab;
|
||||
}
|
||||
|
||||
protected function loadBalances()
|
||||
{
|
||||
$balancetab = array();
|
||||
|
||||
$balances = cryptsy_api_query('getinfo');
|
||||
if(!$balances) return;
|
||||
if(!isset($balances['return']))
|
||||
{
|
||||
debuglog($balances);
|
||||
return $balancetab;
|
||||
}
|
||||
|
||||
foreach($balances['return']['balances_available'] as $symbol=>$balance)
|
||||
{
|
||||
$balance = floatval($balance);
|
||||
|
||||
if($symbol == 'Points') continue;
|
||||
if($symbol == 'BTC')
|
||||
{
|
||||
$this->balance_btc = floatval($balance);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($symbol == 'LTC')
|
||||
{
|
||||
$this->balance_ltc = floatval($balance);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$balance) continue;
|
||||
|
||||
$object = new object();
|
||||
$object->balance = $balance;
|
||||
|
||||
$object->coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$object->coin) continue;
|
||||
|
||||
$balancetab[] = $object;
|
||||
}
|
||||
|
||||
return $balancetab;
|
||||
}
|
||||
|
||||
protected function withdraw($amount)
|
||||
{
|
||||
$res = cryptsy_api_query('makewithdrawal', array('address'=>'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9', 'amount'=>$amount));
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res['success'])
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'cryptsy';
|
||||
$withdraw->address = '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
$withdraw->save();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
// $order
|
||||
// orderid
|
||||
// price
|
||||
// amount
|
||||
// marketid (cryptsy)
|
||||
//
|
||||
|
||||
class CExchange
|
||||
{
|
||||
protected $marketname;
|
||||
|
||||
protected $orders;
|
||||
protected $balances;
|
||||
|
||||
protected $balance_btc;
|
||||
protected $balance_ltc;
|
||||
|
||||
abstract protected function loadOrders();
|
||||
abstract protected function loadBalances();
|
||||
abstract protected function withdraw();
|
||||
|
||||
protected function get_mintrade() {return 0.00050000;}
|
||||
protected function get_minwithdraw() {return 0.25000000;}
|
||||
|
||||
public function __construct($marketname)
|
||||
{
|
||||
$this->marketname = $marketname;
|
||||
}
|
||||
|
||||
public function doTrading()
|
||||
{
|
||||
$this->orders = $this->loadOrders();
|
||||
foreach($this->orders as $order)
|
||||
{
|
||||
$cexcoin = new CExchangeCoin($order->coin, $this->marketname);
|
||||
// cancel if too high
|
||||
// add to our db if not there already
|
||||
}
|
||||
|
||||
$list = getdbolist('db_orders', "market='$this->marketname'");
|
||||
foreach($list as $db_order)
|
||||
{
|
||||
$found = false;
|
||||
foreach($this->orders as $order)
|
||||
{
|
||||
if($order->orderid == $db_order->uuid)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found)
|
||||
{
|
||||
debuglog("$this->marketname deleting order");
|
||||
$db_order->delete();
|
||||
}
|
||||
}
|
||||
|
||||
$savebalance = getdbosql('db_balances', "name='cryptsy'");
|
||||
$savebalance->balance = 0;
|
||||
|
||||
$this->balances = $this->loadBalances();
|
||||
foreach($this->balances as $balance)
|
||||
{
|
||||
if($balance->amount <= 0) continue;
|
||||
$cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
|
||||
|
||||
foreach($cexcoin->bids as $bid)
|
||||
{
|
||||
if($balance->amount*1.5 < $bid->amount && !$coin->sellonbid) break;
|
||||
|
||||
$sellamount = min($balance->amount, $bid->price);
|
||||
if($sellamount*$bid->price < $this->get_mintrade()) continue;
|
||||
|
||||
$cex->sell($sellamount, $bid->price);
|
||||
$balance->amount -= $sellamount;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
$cexcoin = new CExchangeCoin($balance->coin, $this->marketname);
|
||||
if($balance->amount*$cexcoin->ask < $this->get_mintrade()) continue;
|
||||
|
||||
$cex->sell($balance->amount, $cexcoin->ask);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if($this->balance_btc >= $this->get_minwithdraw())
|
||||
{
|
||||
debuglog("withdraw $this->marketname $this->balance_btc");
|
||||
$this->withdraw($this->balance_btc);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CExchangeCryptsy extends CExchange
|
||||
{
|
||||
protected function loadOrders()
|
||||
{
|
||||
$ordertab = array();
|
||||
|
||||
$orders = cryptsy_api_query('allmyorders');
|
||||
if(!$orders) return $ordertab;
|
||||
if(!isset($orders['return'])) return $ordertab;
|
||||
|
||||
foreach($orders['return'] as $order)
|
||||
{
|
||||
if(!isset($order['marketid'])) continue;
|
||||
if(!isset($order['orderid'])) continue;
|
||||
|
||||
$object = new object();
|
||||
$object->orderid = $order['orderid'];
|
||||
$object->price = $order['price'];
|
||||
$object->amount = $order['quantity'];
|
||||
$object->marketid = $order['marketid'];
|
||||
|
||||
$market = getdbosql('db_markets', "marketid=$object->marketid");
|
||||
if(!$market) continue;
|
||||
|
||||
$object->coin = getdbo('db_coins', $market->coinid);
|
||||
if(!$object->coin) continue;
|
||||
|
||||
$ordertab[] = $object;
|
||||
}
|
||||
|
||||
return $ordertab;
|
||||
}
|
||||
|
||||
protected function loadBalances()
|
||||
{
|
||||
$balancetab = array();
|
||||
|
||||
$balances = cryptsy_api_query('getinfo');
|
||||
if(!$balances) return;
|
||||
if(!isset($balances['return']))
|
||||
{
|
||||
debuglog($balances);
|
||||
return $balancetab;
|
||||
}
|
||||
|
||||
foreach($balances['return']['balances_available'] as $symbol=>$balance)
|
||||
{
|
||||
$balance = floatval($balance);
|
||||
|
||||
if($symbol == 'Points') continue;
|
||||
if($symbol == 'BTC')
|
||||
{
|
||||
$this->balance_btc = floatval($balance);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($symbol == 'LTC')
|
||||
{
|
||||
$this->balance_ltc = floatval($balance);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$balance) continue;
|
||||
|
||||
$object = new object();
|
||||
$object->balance = $balance;
|
||||
|
||||
$object->coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$object->coin) continue;
|
||||
|
||||
$balancetab[] = $object;
|
||||
}
|
||||
|
||||
return $balancetab;
|
||||
}
|
||||
|
||||
protected function withdraw($amount)
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$res = cryptsy_api_query('makewithdrawal', array('address'=>$btcaddr, 'amount'=>$amount));
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res['success'])
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'cryptsy';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
$withdraw->save();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,84 +1,84 @@
|
|||
<?php
|
||||
|
||||
class CExchangeCoin
|
||||
{
|
||||
public $marketname;
|
||||
|
||||
public $coin;
|
||||
public $market;
|
||||
|
||||
public $bid;
|
||||
public $ask;
|
||||
|
||||
public $bids;
|
||||
public $asks;
|
||||
|
||||
abstract protected function load();
|
||||
abstract protected function sell($amount, $price);
|
||||
abstract protected function cancel();
|
||||
|
||||
//////
|
||||
|
||||
public function __construct($coin, $marketname)
|
||||
{
|
||||
$this->coin = $coin;
|
||||
$this->marketname = $marketname;
|
||||
|
||||
$this->market = getdbosql('db_markets', "coinid=$coin->id and name='$marketname'");
|
||||
if(!$this->market) return;
|
||||
}
|
||||
|
||||
public static function create($coin, $marketname)
|
||||
{
|
||||
switch($marketname)
|
||||
{
|
||||
case 'cryptsy':
|
||||
$cexcoin = new CExchangeCoinCryptsy($coin, $marketname);
|
||||
break;
|
||||
}
|
||||
|
||||
$cexcoin->load();
|
||||
return $cexcoin;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class CExchangeCoinCryptsy extends CExchangeCoin
|
||||
{
|
||||
private $marketid;
|
||||
|
||||
protected function load()
|
||||
{
|
||||
$ticker = getCryptsyTicker($market->marketid);
|
||||
if(!$ticker || !isset($ticker->return->$symbol->sellorders[0])) continue;
|
||||
|
||||
///
|
||||
}
|
||||
|
||||
protected function sell($amount, $price)
|
||||
{
|
||||
$res = cryptsy_api_query('createorder',
|
||||
array('marketid'=>$this->marketid, 'ordertype'=>'Sell', 'quantity'=>$amount, 'price'=>$price));
|
||||
if(!$res || !isset($res['orderid'])) return;
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'cryptsy';
|
||||
$db_order->coinid = $this->coin->id;
|
||||
$db_order->amount = $balance;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $price;
|
||||
$db_order->bid = $price;
|
||||
$db_order->uuid = $res['orderid'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
|
||||
protected function cancel($amount, $price)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
class CExchangeCoin
|
||||
{
|
||||
public $marketname;
|
||||
|
||||
public $coin;
|
||||
public $market;
|
||||
|
||||
public $bid;
|
||||
public $ask;
|
||||
|
||||
public $bids;
|
||||
public $asks;
|
||||
|
||||
abstract protected function load();
|
||||
abstract protected function sell($amount, $price);
|
||||
abstract protected function cancel();
|
||||
|
||||
//////
|
||||
|
||||
public function __construct($coin, $marketname)
|
||||
{
|
||||
$this->coin = $coin;
|
||||
$this->marketname = $marketname;
|
||||
|
||||
$this->market = getdbosql('db_markets', "coinid=$coin->id and name='$marketname'");
|
||||
if(!$this->market) return;
|
||||
}
|
||||
|
||||
public static function create($coin, $marketname)
|
||||
{
|
||||
switch($marketname)
|
||||
{
|
||||
case 'cryptsy':
|
||||
$cexcoin = new CExchangeCoinCryptsy($coin, $marketname);
|
||||
break;
|
||||
}
|
||||
|
||||
$cexcoin->load();
|
||||
return $cexcoin;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class CExchangeCoinCryptsy extends CExchangeCoin
|
||||
{
|
||||
private $marketid;
|
||||
|
||||
protected function load()
|
||||
{
|
||||
$ticker = getCryptsyTicker($market->marketid);
|
||||
if(!$ticker || !isset($ticker->return->$symbol->sellorders[0])) continue;
|
||||
|
||||
///
|
||||
}
|
||||
|
||||
protected function sell($amount, $price)
|
||||
{
|
||||
$res = cryptsy_api_query('createorder',
|
||||
array('marketid'=>$this->marketid, 'ordertype'=>'Sell', 'quantity'=>$amount, 'price'=>$price));
|
||||
if(!$res || !isset($res['orderid'])) return;
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'cryptsy';
|
||||
$db_order->coinid = $this->coin->id;
|
||||
$db_order->amount = $balance;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $price;
|
||||
$db_order->bid = $price;
|
||||
$db_order->uuid = $res['orderid'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
|
||||
protected function cancel($amount, $price)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once("CExchange.php");
|
||||
require_once("CExchangeCoin.php");
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
require_once("CExchange.php");
|
||||
require_once("CExchangeCoin.php");
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function processUrlKeyword($meta, $keyname, $fieldname, $attribute,
|
|||
function processUrl($url)
|
||||
{
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
|
||||
$html = @file_get_contents_curl($url);
|
||||
if(!$html)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
function yaamp_get_algos()
|
||||
{
|
||||
return array('sha256', 'scrypt', 'scryptn', 'neoscrypt', 'quark', 'lyra2', 'qubit', 'x11', 'x13', 'x15');
|
||||
return array('sha256', 'scrypt', 'scryptn', 'neoscrypt', 'quark', 'lyra2', 'qubit', 'c11', 'x11', 'x13', 'x15');
|
||||
}
|
||||
|
||||
function yaamp_get_algo_norm($algo)
|
||||
|
@ -11,6 +11,7 @@ function yaamp_get_algo_norm($algo)
|
|||
// 'sha256' => 1,
|
||||
'scrypt' => 1,
|
||||
'scryptn' => 0.5,
|
||||
'c11' => 5.5,
|
||||
'x11' => 5.5,
|
||||
'x13' => 3.9,
|
||||
'x14' => 3.7,
|
||||
|
@ -41,6 +42,7 @@ function getAlgoColors($algo)
|
|||
'scrypt' => '#c0c0e0',
|
||||
'neoscrypt' => '#a0d0f0',
|
||||
'scryptn' => '#d0d0d0',
|
||||
'c11' => '#f0b0b0',
|
||||
'x11' => '#f0f0a0',
|
||||
'x13' => '#d0f0c0',
|
||||
'x14' => '#a0f0c0',
|
||||
|
@ -62,6 +64,7 @@ function getAlgoPort($algo)
|
|||
$a = array(
|
||||
'sha256' => 3333,
|
||||
'scrypt' => 3433,
|
||||
'c11' => 3573,
|
||||
'x11' => 3533,
|
||||
'x13' => 3633,
|
||||
'x15' => 3733,
|
||||
|
|
|
@ -187,19 +187,20 @@ function doBittrexTrading($quick=false)
|
|||
|
||||
if($savebalance->balance >= 0.3)
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$amount = $savebalance->balance; // - 0.0002;
|
||||
debuglog("bittrex withdraw $amount to 14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
debuglog("bittrex withdraw $amount to $btcaddr");
|
||||
|
||||
sleep(1);
|
||||
|
||||
$res = bittrex_api_query('account/withdraw', "¤cy=BTC&quantity=$amount&address=14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
$res = bittrex_api_query('account/withdraw', "¤cy=BTC&quantity=$amount&address=$btcaddr");
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res->success)
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'bittrex';
|
||||
$withdraw->address = '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
$withdraw->uuid = $res->result->uuid;
|
||||
|
|
|
@ -184,19 +184,21 @@ function doBleutradeTrading($quick=false)
|
|||
|
||||
if($savebalance->balance >= 0.2)
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
|
||||
$amount = $savebalance->balance; // - 0.0002;
|
||||
debuglog("bleutrade withdraw $amount to 14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
debuglog("bleutrade withdraw $amount to $btcaddr");
|
||||
|
||||
sleep(1);
|
||||
|
||||
$res = bleutrade_api_query('account/withdraw', "¤cy=BTC&quantity=$amount&address=14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
$res = bleutrade_api_query('account/withdraw', "¤cy=BTC&quantity=$amount&address=$btcaddr");
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res->success)
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'bleutrade';
|
||||
$withdraw->address = '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
$withdraw->uuid = $res->result->orderid;
|
||||
|
|
|
@ -196,20 +196,22 @@ function doCryptsyTrading($quick=false)
|
|||
|
||||
if($savebalance->balance >= 0.3)
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
|
||||
$amount = $savebalance->balance; // - 0.001;
|
||||
debuglog("cryptsy withdraw $amount to 14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
debuglog("cryptsy withdraw $amount to $btcaddr");
|
||||
|
||||
sleep(1);
|
||||
|
||||
$res = cryptsy_api_query('makewithdrawal',
|
||||
array('address'=>'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9', 'amount'=>$amount));
|
||||
array('address'=>$btcaddr, 'amount'=>$amount));
|
||||
|
||||
debuglog($res);
|
||||
if($res && $res['success'])
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'cryptsy';
|
||||
$withdraw->address = '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
// $withdraw->uuid = $res->result->uuid;
|
||||
|
|
|
@ -1,179 +1,181 @@
|
|||
<?php
|
||||
|
||||
function doPoloniexTrading()
|
||||
{
|
||||
// debuglog('-------------- doPoloniexTrading()');
|
||||
|
||||
$flushall = rand(0, 4) == 0;
|
||||
$poloniex = new poloniex;
|
||||
|
||||
$tickers = $poloniex->get_ticker();
|
||||
if(!$tickers) return;
|
||||
|
||||
// upgrade orders
|
||||
$coins = getdbolist('db_coins', "enable and id in (select distinct coinid from markets where name='poloniex')");
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
if($coin->dontsell) continue;
|
||||
$pair = "BTC_$coin->symbol";
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$orders = $poloniex->get_open_orders($pair);
|
||||
if(!$orders || !isset($orders[0]))
|
||||
{
|
||||
dborun("delete from orders where coinid=$coin->id and market='poloniex'");
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if(!isset($order['orderNumber']))
|
||||
{
|
||||
debuglog($order);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($order['rate'] > $tickers[$pair]['lowestAsk']+0.00000005 || $flushall)
|
||||
{
|
||||
// debuglog("poloniex cancel order for $pair {$order['orderNumber']}");
|
||||
$poloniex->cancel_order($pair, $order['orderNumber']);
|
||||
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderNumber']));
|
||||
if($db_order) $db_order->delete();
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderNumber']));
|
||||
if($db_order) continue;
|
||||
|
||||
debuglog("poloniex adding order $coin->symbol");
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'poloniex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order['amount'];
|
||||
$db_order->price = $order['rate'];
|
||||
$db_order->ask = $tickers[$pair]['lowestAsk'];
|
||||
$db_order->bid = $tickers[$pair]['highestBid'];
|
||||
$db_order->uuid = $order['orderNumber'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
|
||||
$list = getdbolist('db_orders', "coinid=$coin->id and market='poloniex'");
|
||||
foreach($list as $db_order)
|
||||
{
|
||||
$found = false;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if(!isset($order['orderNumber']))
|
||||
{
|
||||
debuglog($order);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($order['orderNumber'] == $db_order->uuid)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found)
|
||||
{
|
||||
debuglog("poloniex deleting order $coin->name $db_order->amount");
|
||||
$db_order->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add orders
|
||||
$savebalance = getdbosql('db_balances', "name='poloniex'");
|
||||
$balances = $poloniex->get_balances();
|
||||
|
||||
foreach($balances as $symbol=>$balance)
|
||||
{
|
||||
if(!$balance) continue;
|
||||
if($symbol == 'BTC')
|
||||
{
|
||||
$savebalance->balance = $balance;
|
||||
$savebalance->save();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin || $coin->dontsell) continue;
|
||||
|
||||
$market = getdbosql('db_markets', "coinid=$coin->id and name='poloniex'");
|
||||
if($market)
|
||||
{
|
||||
$market->lasttraded = time();
|
||||
$market->save();
|
||||
}
|
||||
|
||||
$pair = "BTC_$symbol";
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$sellprice = $tickers[$pair]['highestBid'];
|
||||
if($balance * $sellprice < 0.0001) continue;
|
||||
|
||||
// debuglog("poloniex selling $pair, $sellprice, $balance");
|
||||
$res = $poloniex->sell($pair, $sellprice, $balance);
|
||||
|
||||
if(!isset($res['orderNumber']))
|
||||
{
|
||||
debuglog($res, 5);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin) continue;
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'poloniex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $balance;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $tickers[$pair]['lowestAsk'];
|
||||
$db_order->bid = $tickers[$pair]['highestBid'];
|
||||
$db_order->uuid = $res['orderNumber'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
|
||||
if($savebalance->balance >= 0.2)
|
||||
{
|
||||
$amount = $savebalance->balance; // - 0.0002;
|
||||
debuglog("poloniex withdraw $amount to 14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9");
|
||||
|
||||
sleep(1);
|
||||
|
||||
$res = $poloniex->withdraw('BTC', $amount, '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9');
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res->success)
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'poloniex';
|
||||
$withdraw->address = '14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
// $withdraw->uuid = $res->result->uuid;
|
||||
$withdraw->save();
|
||||
}
|
||||
}
|
||||
|
||||
// debuglog('-------------- doPoloniexTrading() done');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
function doPoloniexTrading()
|
||||
{
|
||||
// debuglog('-------------- doPoloniexTrading()');
|
||||
|
||||
$flushall = rand(0, 4) == 0;
|
||||
$poloniex = new poloniex;
|
||||
|
||||
$tickers = $poloniex->get_ticker();
|
||||
if(!$tickers) return;
|
||||
|
||||
// upgrade orders
|
||||
$coins = getdbolist('db_coins', "enable and id in (select distinct coinid from markets where name='poloniex')");
|
||||
foreach($coins as $coin)
|
||||
{
|
||||
if($coin->dontsell) continue;
|
||||
$pair = "BTC_$coin->symbol";
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$orders = $poloniex->get_open_orders($pair);
|
||||
if(!$orders || !isset($orders[0]))
|
||||
{
|
||||
dborun("delete from orders where coinid=$coin->id and market='poloniex'");
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if(!isset($order['orderNumber']))
|
||||
{
|
||||
debuglog($order);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($order['rate'] > $tickers[$pair]['lowestAsk']+0.00000005 || $flushall)
|
||||
{
|
||||
// debuglog("poloniex cancel order for $pair {$order['orderNumber']}");
|
||||
$poloniex->cancel_order($pair, $order['orderNumber']);
|
||||
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderNumber']));
|
||||
if($db_order) $db_order->delete();
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid'=>$order['orderNumber']));
|
||||
if($db_order) continue;
|
||||
|
||||
debuglog("poloniex adding order $coin->symbol");
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'poloniex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $order['amount'];
|
||||
$db_order->price = $order['rate'];
|
||||
$db_order->ask = $tickers[$pair]['lowestAsk'];
|
||||
$db_order->bid = $tickers[$pair]['highestBid'];
|
||||
$db_order->uuid = $order['orderNumber'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
}
|
||||
|
||||
$list = getdbolist('db_orders', "coinid=$coin->id and market='poloniex'");
|
||||
foreach($list as $db_order)
|
||||
{
|
||||
$found = false;
|
||||
foreach($orders as $order)
|
||||
{
|
||||
if(!isset($order['orderNumber']))
|
||||
{
|
||||
debuglog($order);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($order['orderNumber'] == $db_order->uuid)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found)
|
||||
{
|
||||
debuglog("poloniex deleting order $coin->name $db_order->amount");
|
||||
$db_order->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add orders
|
||||
$savebalance = getdbosql('db_balances', "name='poloniex'");
|
||||
$balances = $poloniex->get_balances();
|
||||
|
||||
foreach($balances as $symbol=>$balance)
|
||||
{
|
||||
if(!$balance) continue;
|
||||
if($symbol == 'BTC')
|
||||
{
|
||||
$savebalance->balance = $balance;
|
||||
$savebalance->save();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin || $coin->dontsell) continue;
|
||||
|
||||
$market = getdbosql('db_markets', "coinid=$coin->id and name='poloniex'");
|
||||
if($market)
|
||||
{
|
||||
$market->lasttraded = time();
|
||||
$market->save();
|
||||
}
|
||||
|
||||
$pair = "BTC_$symbol";
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$sellprice = $tickers[$pair]['highestBid'];
|
||||
if($balance * $sellprice < 0.0001) continue;
|
||||
|
||||
// debuglog("poloniex selling $pair, $sellprice, $balance");
|
||||
$res = $poloniex->sell($pair, $sellprice, $balance);
|
||||
|
||||
if(!isset($res['orderNumber']))
|
||||
{
|
||||
debuglog($res, 5);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!isset($tickers[$pair])) continue;
|
||||
|
||||
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
|
||||
if(!$coin) continue;
|
||||
|
||||
$db_order = new db_orders;
|
||||
$db_order->market = 'poloniex';
|
||||
$db_order->coinid = $coin->id;
|
||||
$db_order->amount = $balance;
|
||||
$db_order->price = $sellprice;
|
||||
$db_order->ask = $tickers[$pair]['lowestAsk'];
|
||||
$db_order->bid = $tickers[$pair]['highestBid'];
|
||||
$db_order->uuid = $res['orderNumber'];
|
||||
$db_order->created = time();
|
||||
$db_order->save();
|
||||
}
|
||||
|
||||
if($savebalance->balance >= 0.2)
|
||||
{
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
|
||||
$amount = $savebalance->balance; // - 0.0002;
|
||||
debuglog("poloniex withdraw $amount to $btcaddr");
|
||||
|
||||
sleep(1);
|
||||
|
||||
$res = $poloniex->withdraw('BTC', $amount, $btcaddr);
|
||||
debuglog($res);
|
||||
|
||||
if($res && $res->success)
|
||||
{
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'poloniex';
|
||||
$withdraw->address = $btcaddr;
|
||||
$withdraw->amount = $amount;
|
||||
$withdraw->time = time();
|
||||
// $withdraw->uuid = $res->result->uuid;
|
||||
$withdraw->save();
|
||||
}
|
||||
}
|
||||
|
||||
// debuglog('-------------- doPoloniexTrading() done');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class ApiController extends CommonController
|
|||
// $uptime = system('uptime');
|
||||
// $name = system('hostname');
|
||||
|
||||
// fetch_url("http://yaamp.com/api/nodereport?name=$name&uptime=$uptime");
|
||||
// fetch_url("http://yiimp.ccminer.org/api/nodereport?name=$name&uptime=$uptime");
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ class CommonController extends CController
|
|||
{
|
||||
public $admin = false;
|
||||
public $memcache;
|
||||
|
||||
|
||||
private $t1;
|
||||
|
||||
|
||||
public function goback($count=-1)
|
||||
{
|
||||
Javascript("window.history.go($count)");
|
||||
|
@ -16,40 +16,40 @@ class CommonController extends CController
|
|||
public function beforeAction($action)
|
||||
{
|
||||
// session_start();
|
||||
|
||||
|
||||
$this->memcache = new YaampMemcache;
|
||||
$this->t1 = microtime(true);
|
||||
|
||||
|
||||
if(user()->getState('yaamp_admin'))
|
||||
$this->admin = true;
|
||||
|
||||
|
||||
$algo = user()->getState('yaamp-algo');
|
||||
if(!$algo) user()->setState('yaamp-algo', 'x11');
|
||||
|
||||
|
||||
//$um = app()->getComponent('urlManager');
|
||||
//var_dump($um); die;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function afterAction($action)
|
||||
{
|
||||
// debuglog("after action");
|
||||
|
||||
// debuglog("after action ".$action->getId());
|
||||
|
||||
$t2 = microtime(true);
|
||||
$d1 = $t2 - $this->t1;
|
||||
|
||||
|
||||
$url = "$this->id/{$this->action->id}";
|
||||
$this->memcache->add_monitoring_function($url, $d1);
|
||||
|
||||
//$um = app()->getComponent('urlManager');
|
||||
//var_dump($um); die;
|
||||
}
|
||||
|
||||
|
||||
public function actionMaintenance()
|
||||
{
|
||||
$this->render('maintenance');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<br>
|
||||
|
||||
GOTO <a href='http://yaamp.com'>YAAMP.COM</a>
|
||||
GOTO <a href='http://yiimp.ccminer.org'>YIIMP</a>
|
||||
|
||||
<br><br><br><br><br>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require dirname(__FILE__).'/../../ui/lib/pageheader.php';
|
|||
$renter = getrenterparam(getparam('address'));
|
||||
if(!$renter) return;
|
||||
|
||||
$this->pageTitle = "$renter->address | yaamp.com";
|
||||
$this->pageTitle = "$renter->address | yiimp";
|
||||
|
||||
echo "<div class='main-left-box'>";
|
||||
echo "<div class='main-left-title'>Transactions from $renter->address</div>";
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
class SiteController extends CommonController
|
||||
{
|
||||
public $defaultAction='index';
|
||||
|
||||
public $defaultAction='index';
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
public function actionfrottedessus()
|
||||
public function actionAdmintest()
|
||||
{
|
||||
debuglog("admin login {$_SERVER['REMOTE_ADDR']}");
|
||||
|
||||
|
||||
user()->setState('yaamp_admin', true);
|
||||
$this->redirect("/site/common");
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionCreate()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$coin = new db_coins;
|
||||
$coin->txmessage = true;
|
||||
$coin->created = time();
|
||||
|
@ -27,17 +27,17 @@ class SiteController extends CommonController
|
|||
$coin->difficulty = 1;
|
||||
$coin->installed = 1;
|
||||
$coin->visible = 1;
|
||||
|
||||
|
||||
// $coin->deposit_minimum = 1;
|
||||
$coin->lastblock = '';
|
||||
|
||||
|
||||
if(isset($_POST['db_coins']))
|
||||
{
|
||||
$coin->attributes = $_POST['db_coins'];
|
||||
if($coin->save())
|
||||
$this->redirect(array('admin'));
|
||||
}
|
||||
|
||||
|
||||
$this->render('coin_form', array('update'=>false, 'coin'=>$coin));
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', getiparam('id'));
|
||||
$txfee = $coin->txfee;
|
||||
|
||||
|
||||
if(isset($_POST['db_coins']))
|
||||
{
|
||||
$coin->attributes = $_POST['db_coins'];
|
||||
|
@ -57,17 +57,17 @@ class SiteController extends CommonController
|
|||
$remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
|
||||
$remote->settxfee($coin->txfee);
|
||||
}
|
||||
|
||||
|
||||
// $this->redirect(array('admin'));
|
||||
$this->goback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->render('coin_form', array('update'=>true, 'coin'=>$coin));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
if(isset($_GET['address']))
|
||||
|
@ -102,87 +102,87 @@ class SiteController extends CommonController
|
|||
}
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
|
||||
public function actionCurrent_results()
|
||||
{
|
||||
$this->renderPartial('results/current_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionHistory_results()
|
||||
{
|
||||
$this->renderPartial('results/history_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionMining_results()
|
||||
{
|
||||
$this->renderPartial('results/mining_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionMiners_results()
|
||||
{
|
||||
$this->renderPartial('results/miners_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionWallet_results()
|
||||
{
|
||||
$this->renderPartial('results/wallet_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionWallet_miners_results()
|
||||
{
|
||||
$this->renderPartial('results/wallet_miners_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionWallet_graphs_results()
|
||||
{
|
||||
$this->renderPartial('results/wallet_graphs_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_earnings_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_earnings_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionFound_results()
|
||||
{
|
||||
$this->renderPartial('results/found_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionUser_earning_results()
|
||||
{
|
||||
$this->renderPartial('results/user_earning_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_hashrate_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_hashrate_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_user_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_user_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_price_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_price_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_assets_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_assets_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_negative_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_negative_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionGraph_profit_results()
|
||||
{
|
||||
$this->renderPartial('results/graph_profit_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionTitle_results()
|
||||
{
|
||||
$user = getuserparam(getparam('address'));
|
||||
|
@ -190,30 +190,30 @@ class SiteController extends CommonController
|
|||
{
|
||||
$balance = bitcoinvaluetoa($user->balance);
|
||||
$coin = getdbo('db_coins', $user->coinid);
|
||||
|
||||
|
||||
if($coin)
|
||||
echo "$balance $coin->symbol - yaamp.com";
|
||||
echo "$balance $coin->symbol - yiimp";
|
||||
else
|
||||
echo "$balance - yaamp.com";
|
||||
echo "$balance - yiimp";
|
||||
}
|
||||
else
|
||||
echo "yaamp.com";
|
||||
echo YAAMP_SITE_URL;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionAbout()
|
||||
{
|
||||
$this->render('about');
|
||||
}
|
||||
|
||||
|
||||
public function actionTerms()
|
||||
{
|
||||
$this->render('terms');
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionAdmin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -225,9 +225,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('admin_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionConnections()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -239,9 +239,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('connections_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionBlock()
|
||||
{
|
||||
$this->render('block');
|
||||
|
@ -251,9 +251,9 @@ class SiteController extends CommonController
|
|||
{
|
||||
$this->renderPartial('block_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionEarning()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -265,9 +265,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('earning_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionPayments()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -279,9 +279,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('payments_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionUser()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -293,9 +293,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('user_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionWorker()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -307,9 +307,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('worker_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionVersion()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -321,9 +321,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('version_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionCommon()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -335,9 +335,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('common_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionExchange()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -349,9 +349,9 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('exchange_results');
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionCoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -363,46 +363,46 @@ class SiteController extends CommonController
|
|||
if(!$this->admin) return;
|
||||
$this->renderPartial('coin_results');
|
||||
}
|
||||
|
||||
|
||||
public function actionMemcached()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$this->render('memcached');
|
||||
}
|
||||
|
||||
|
||||
public function actionMonsters()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$this->render('monsters');
|
||||
}
|
||||
|
||||
|
||||
public function actionEmptyMarkets()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$this->render('emptymarkets');
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionTx()
|
||||
{
|
||||
$this->renderPartial('tx');
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionResetBlockchain()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', $_GET['id']);
|
||||
$coin->action = 3;
|
||||
$coin->save();
|
||||
|
||||
|
||||
$this->redirect("/site/coin?id=$coin->id");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionRestartCoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -414,11 +414,11 @@ class SiteController extends CommonController
|
|||
$coin->installed = true;
|
||||
$coin->connections = 0;
|
||||
$coin->save();
|
||||
|
||||
|
||||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionStartCoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
@ -430,16 +430,16 @@ class SiteController extends CommonController
|
|||
$coin->installed = true;
|
||||
$coin->connections = 0;
|
||||
$coin->save();
|
||||
|
||||
|
||||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionStopCoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', $_GET['id']);
|
||||
|
||||
|
||||
$coin->action = 2;
|
||||
$coin->enable = false;
|
||||
$coin->auto_ready = false;
|
||||
|
@ -449,12 +449,12 @@ class SiteController extends CommonController
|
|||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionMakeConfigfile()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', $_GET['id']);
|
||||
|
||||
|
||||
$coin->action = 5;
|
||||
$coin->installed = true;
|
||||
$coin->save();
|
||||
|
@ -462,79 +462,79 @@ class SiteController extends CommonController
|
|||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public function actionSetauto()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', $_GET['id']);
|
||||
|
||||
|
||||
$coin->auto_ready = true;
|
||||
$coin->save();
|
||||
|
||||
|
||||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionUnsetauto()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', $_GET['id']);
|
||||
|
||||
|
||||
$coin->auto_ready = false;
|
||||
$coin->save();
|
||||
|
||||
|
||||
$this->redirect('/site/admin');
|
||||
// $this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionSellBalance()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$coin = getdbo('db_coins', getiparam('id'));
|
||||
$amount = getparam('amount');
|
||||
|
||||
|
||||
$res = $this->doSellBalance($coin, $amount);
|
||||
|
||||
|
||||
if(!$res)
|
||||
$this->redirect('/site/admin');
|
||||
else
|
||||
$this->redirect('/site/exchange');
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public function actionBlockuser()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$wallet = getparam('wallet');
|
||||
$user = getuserparam($wallet);
|
||||
|
||||
|
||||
$user->is_locked = true;
|
||||
$user->save();
|
||||
|
||||
|
||||
$this->redirect('/site/monsters');
|
||||
}
|
||||
|
||||
|
||||
public function actionUnblockuser()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$wallet = getparam('wallet');
|
||||
$user = getuserparam($wallet);
|
||||
|
||||
|
||||
$user->is_locked = false;
|
||||
$user->save();
|
||||
|
||||
|
||||
$this->redirect('/site/monsters');
|
||||
}
|
||||
|
||||
|
||||
public function actionPayuserscoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$coin = getdbo('db_coins', getiparam('id'));
|
||||
if(!$coin)
|
||||
{
|
||||
|
@ -545,13 +545,13 @@ class SiteController extends CommonController
|
|||
BackendCoinPayments($coin);
|
||||
$this->goback();
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
|
||||
|
||||
public function actionDeleteEarnings()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$coin = getdbo('db_coins', getiparam('id'));
|
||||
if(!$coin)
|
||||
{
|
||||
|
@ -565,37 +565,37 @@ class SiteController extends CommonController
|
|||
dborun("delete from earnings where coinid=$coin->id");
|
||||
$this->redirect("/site/admin");
|
||||
}
|
||||
|
||||
|
||||
public function actionDeleteEarning()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
$earning = getdbo('db_earnings', $_GET['id']);
|
||||
$earning->delete();
|
||||
|
||||
|
||||
$this->redirect('/site/earning');
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public function actionDeleteExchange()
|
||||
{
|
||||
$exchange = getdbo('db_exchange', getiparam('id'));
|
||||
$unspent = $exchange->quantity;
|
||||
|
||||
|
||||
$exchange->status = 'deleted';
|
||||
$exchange->price = 0;
|
||||
$exchange->receive_time = time();
|
||||
$exchange->save();
|
||||
|
||||
|
||||
// $earnings = getdbolist('db_earnings', "coinid=$exchange->coinid and not cleared order by create_time");
|
||||
// foreach($earnings as $earning)
|
||||
// {
|
||||
// $unspent -= $earning->amount;
|
||||
// $earning->delete();
|
||||
|
||||
|
||||
// if($unspent <= 0) break;
|
||||
// }
|
||||
|
||||
|
||||
$this->redirect('/site/exchange');
|
||||
}
|
||||
|
||||
|
@ -603,16 +603,16 @@ class SiteController extends CommonController
|
|||
{
|
||||
$id = getiparam('id');
|
||||
$market = getdbo('db_markets', $id);
|
||||
|
||||
|
||||
if($market)
|
||||
{
|
||||
$market->lastsent = null;
|
||||
$market->save();
|
||||
}
|
||||
|
||||
|
||||
$this->redirect('/site/common');
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public function actionAlgo()
|
||||
|
@ -627,7 +627,7 @@ class SiteController extends CommonController
|
|||
|
||||
$this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionGomining()
|
||||
{
|
||||
user()->setState('yaamp-algo', getparam('algo'));
|
||||
|
@ -640,11 +640,11 @@ class SiteController extends CommonController
|
|||
BackendPricesUpdate();
|
||||
$this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionUninstallCoin()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$coin = getdbo('db_coins', getiparam('id'));
|
||||
if($coin)
|
||||
{
|
||||
|
@ -654,7 +654,7 @@ class SiteController extends CommonController
|
|||
// dborun("delete from markets where coinid=$coin->id");
|
||||
dborun("delete from orders where coinid=$coin->id");
|
||||
dborun("delete from shares where coinid=$coin->id");
|
||||
|
||||
|
||||
$coin->enable = false;
|
||||
$coin->installed = false;
|
||||
$coin->auto_ready = false;
|
||||
|
@ -663,14 +663,14 @@ class SiteController extends CommonController
|
|||
$coin->balance = 0;
|
||||
$coin->save();
|
||||
}
|
||||
|
||||
|
||||
$this->redirect("/site/admin");
|
||||
}
|
||||
|
||||
public function actionBanUser()
|
||||
{
|
||||
if(!$this->admin) return;
|
||||
|
||||
|
||||
$user = getdbo('db_accounts', getiparam('id'));
|
||||
if($user)
|
||||
{
|
||||
|
@ -678,60 +678,60 @@ class SiteController extends CommonController
|
|||
$user->balance = 0;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
|
||||
$this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionOptimize()
|
||||
{
|
||||
BackendOptimizeTables();
|
||||
$this->goback();
|
||||
}
|
||||
|
||||
|
||||
public function actionRunExchange()
|
||||
{
|
||||
$id = getiparam('id');
|
||||
$balance = getdbo('db_balances', $id);
|
||||
|
||||
|
||||
if($balance) switch($balance->name)
|
||||
{
|
||||
case 'cryptsy':
|
||||
doCryptsyTrading(true);
|
||||
updateCryptsyMarkets();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'bittrex':
|
||||
doBittrexTrading(true);
|
||||
updateBittrexMarkets();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'c-cex':
|
||||
doCCexTrading(true);
|
||||
updateCCexMarkets();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'yobit':
|
||||
doYobitTrading(true);
|
||||
updateYobitMarkets();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'bleutrade':
|
||||
doBleutradeTrading(true);
|
||||
updateBleutradeMarkets();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'poloniex':
|
||||
doPoloniexTrading(true);
|
||||
updatePoloniexMarkets();
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
debuglog("runexchange done");
|
||||
$this->redirect("/site/common");
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ class SiteController extends CommonController
|
|||
// $param = getparam('param');
|
||||
// if($param) eval($param);
|
||||
// else $param = '';
|
||||
|
||||
|
||||
// $this->render('eval', array('param'=>$param));
|
||||
}
|
||||
|
||||
|
@ -752,7 +752,7 @@ class SiteController extends CommonController
|
|||
debuglog(__METHOD__);
|
||||
setcookie('mainbtc', '1', time()+60*60*24, '/');
|
||||
}
|
||||
|
||||
|
||||
public function actionTest()
|
||||
{
|
||||
// if(!$this->admin) return;
|
||||
|
@ -760,13 +760,8 @@ class SiteController extends CommonController
|
|||
|
||||
$ticker = jubi_api_query('ticker', "?coin=sak");
|
||||
debuglog($ticker);
|
||||
|
||||
|
||||
debuglog("action test end");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -478,8 +478,10 @@ $immature = bitcoinvaluetoa($immature);
|
|||
$mints = bitcoinvaluetoa($mints);
|
||||
$off = bitcoinvaluetoa($off);
|
||||
|
||||
$btcaddr = YAAMP_BTCADDRESS; //'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
|
||||
|
||||
echo "<a href='https://www.okcoin.com/market.do' target=_blank>Bitstamp $mining->usdbtc</a>, ";
|
||||
echo "<a href='https://blockchain.info/address/14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9' target=_blank>wallet $btc->balance</a>, next payout $topay2<br>";
|
||||
echo "<a href='https://blockchain.info/address/$btcaddr' target=_blank>wallet $btc->balance</a>, next payout $topay2<br>";
|
||||
echo "pay $topay, renter $renter, marg $margin, $margin2<br>";
|
||||
echo "mint $mints immature $immature off $off<br>";
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ you have from 5 to 15 submits per minute. It's a good trade off between bandwidt
|
|||
if you want to set the difficulty to 64, you would use:</p>
|
||||
|
||||
<pre class="main-left-box" style='padding: 3px; font-size: .9em; background-color: #ffffee; font-family: monospace;'>
|
||||
-o stratum+tcp://yaamp.com:3433 -u wallet_adress -p d=64
|
||||
-o stratum+tcp://yiimp.ccminer.org:3433 -u wallet_adress -p d=64
|
||||
</pre>
|
||||
|
||||
<p style="width: 700px;">Here are the accepted values for the custom diff:</p>
|
||||
|
|
|
@ -24,12 +24,12 @@ echo <<<END
|
|||
<!-- -->
|
||||
|
||||
<div class="main-left-box">
|
||||
<div class="main-left-title">YET ANOTHER ANONYMOUS MINING POOL</div>
|
||||
<div class="main-left-title">YII MINING POOL</div>
|
||||
<div class="main-left-inner">
|
||||
|
||||
<ul>
|
||||
|
||||
<li>YAAMP is multipool multialgo with auto exchange to Bitcoin or any coin we mine.</li>
|
||||
<li>YIIMP is multipool multialgo with auto exchange to Bitcoin or any coin we mine.</li>
|
||||
<li>We distribute hashpower in real time among the best coins.</li>
|
||||
<li>No registration required.</li>
|
||||
<li>Just plug in your stratum miner using your bitcoin wallet address as the username.</li>
|
||||
|
@ -53,7 +53,7 @@ echo <<<END
|
|||
|
||||
<li>
|
||||
<p class="main-left-box" style='padding: 3px; font-size: .8em; background-color: #ffffee; font-family: monospace;'>
|
||||
-o stratum+tcp://yaamp.com:PORT -u WALLET_ADDRESS -p xx</p>
|
||||
-o stratum+tcp://yiimp.ccminer.org:PORT -u WALLET_ADDRESS -p xx</p>
|
||||
</li>
|
||||
|
||||
<li>WALLET_ADDRESS can be of any currency we mine or a BTC address.</li>
|
||||
|
@ -76,9 +76,9 @@ echo <<<END
|
|||
<li><b>BitcoinTalk</b> - <a href='https://bitcointalk.org/index.php?topic=508786.0' target=_blank >https://bitcointalk.org/index.php?topic=508786.0</a></li>
|
||||
<!--li><b>IRC</b> - <a href='http://webchat.freenode.net/?channels=#yaamp' target=_blank >http://webchat.freenode.net/?channels=#yaamp</a></li-->
|
||||
|
||||
<li><b>API</b> - <a href='/site/api'>http://yaamp.com/site/api</a></li>
|
||||
<li><b>Difficulty</b> - <a href='/site/diff'>http://yaamp.com/site/diff</a></li>
|
||||
<li><b>Algo Switching</b> - <a href='/site/multialgo'>http://yaamp.com/site/multialgo</a></li>
|
||||
<li><b>API</b> - <a href='/site/api'>http://yiimp.ccminer.org/site/api</a></li>
|
||||
<li><b>Difficulty</b> - <a href='/site/diff'>http://yiimp.ccminer.org/site/diff</a></li>
|
||||
<li><b>Algo Switching</b> - <a href='/site/multialgo'>http://yiimp.ccminer.org/site/multialgo</a></li>
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
@ -39,11 +39,11 @@ connection will close (and move to your next configured algo) if the algo is not
|
|||
|
||||
:start
|
||||
|
||||
ccminer.exe -r 0 -a x11 -o stratum+tcp://yaamp.com:3533 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer.exe -r 0 -a x13 -o stratum+tcp://yaamp.com:3633 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer.exe -r 0 -a x15 -o stratum+tcp://yaamp.com:3733 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer.exe -r 0 -a lyra2 -o stratum+tcp://yaamp.com:4433 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer.exe -r 0 -a quark -o stratum+tcp://yaamp.com:4033 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer -r 0 -a x11 -o stratum+tcp://yaamp.com:3533 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer -r 0 -a x13 -o stratum+tcp://yaamp.com:3633 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer -r 0 -a x15 -o stratum+tcp://yaamp.com:3733 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer -r 0 -a lyra2 -o stratum+tcp://yaamp.com:4433 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
ccminer -r 0 -a quark -o stratum+tcp://yaamp.com:4033 -u joe -p x11,x13,x14,x15,quark,lyra2
|
||||
|
||||
sleep 5000
|
||||
goto start
|
||||
|
@ -56,6 +56,7 @@ is the reference with a factor of 1.</p>
|
|||
<pre class="main-left-box" style='padding: 3px; font-size: .9em; background-color: #ffffee; font-family: monospace;'>
|
||||
'scrypt' => 1,
|
||||
'scryptn' => 0.5,
|
||||
'c11' => 5.5,
|
||||
'x11' => 5.5,
|
||||
'x13' => 3.9,
|
||||
'x14' => 3.7,
|
||||
|
|
|
@ -5,7 +5,7 @@ require dirname(__FILE__).'/../../ui/lib/pageheader.php';
|
|||
$user = getuserparam(getparam('address'));
|
||||
if(!$user) return;
|
||||
|
||||
$this->pageTitle = "$user->username | yaamp.com";
|
||||
$this->pageTitle = "$user->username | yiimp";
|
||||
|
||||
$bitcoin = getdbosql('db_coins', "symbol='BTC'");
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
$algo = user()->getState('yaamp-algo');
|
||||
|
||||
JavascriptFile("/extensions/jqplot/jquery.jqplot.js");
|
||||
|
|
0
web/yaamp/runtime/.gitkeep
Normal file
0
web/yaamp/runtime/.gitkeep
Normal file
|
@ -19,12 +19,12 @@ function auto_page_resume()
|
|||
function auto_page_refresh()
|
||||
{
|
||||
page_refresh();
|
||||
|
||||
|
||||
var now_time = new Date().getTime();
|
||||
if(now_time > auto_start_time + auto_max_time)
|
||||
{
|
||||
$('#resume_update_button').show();
|
||||
document.title = 'yaamp.com';
|
||||
document.title = 'yiimp';
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<!doctype html>
|
||||
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
|
||||
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
|
||||
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
|
||||
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
<meta name="description" content="yet another anonymous mining pool for bitcoin and altcoin with auto profit switch and auto exchange">
|
||||
<meta name="keywords" content="anonymous,mining,pool,maxcoin,bitcoin,altcoin,auto,switch,exchange,profit">
|
||||
|
||||
<title>yaamp.com</title>
|
||||
|
||||
<?php
|
||||
|
||||
echo CHtml::cssFile("/extensions/jquery/themes/ui-lightness/jquery-ui.css");
|
||||
echo CHtml::cssFile('/yaamp/ui/css/main.css');
|
||||
echo CHtml::cssFile('/yaamp/ui/css/table.css');
|
||||
//echo CHtml::scriptFile('/yaamp/ui/js/jquery.tablesorter.js');
|
||||
|
||||
echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js');
|
||||
echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js');
|
||||
|
||||
echo "</head>";
|
||||
<!doctype html>
|
||||
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
|
||||
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
|
||||
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
|
||||
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
<meta name="description" content="yiimp mining pool for bitcoin and altcoin with auto profit switch and auto exchange">
|
||||
<meta name="keywords" content="yiimp,anonymous,mining,pool,maxcoin,bitcoin,altcoin,auto,switch,exchange,profit">
|
||||
|
||||
<title>YiiMP</title>
|
||||
|
||||
<?php
|
||||
|
||||
echo CHtml::cssFile("/extensions/jquery/themes/ui-lightness/jquery-ui.css");
|
||||
echo CHtml::cssFile('/yaamp/ui/css/main.css');
|
||||
echo CHtml::cssFile('/yaamp/ui/css/table.css');
|
||||
//echo CHtml::scriptFile('/yaamp/ui/js/jquery.tablesorter.js');
|
||||
|
||||
echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js');
|
||||
echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js');
|
||||
|
||||
echo "</head>";
|
||||
|
|
|
@ -18,7 +18,7 @@ echo <<<END
|
|||
<meta name="description" content="yet another anonymous mining pool for bitcoin and altcoin with auto profit switch and auto exchange">
|
||||
<meta name="keywords" content="anonymous,mining,pool,maxcoin,bitcoin,altcoin,auto,switch,exchange,profit,scrypt,x11,x13,x14,x15,lyra2,lyra2re,neoscrypt,sha256,quark">
|
||||
|
||||
<title>yaamp.com</title>
|
||||
<title>yiimp</title>
|
||||
|
||||
END;
|
||||
|
||||
|
@ -110,8 +110,8 @@ function showPageHeader()
|
|||
$mining = getdbosql('db_mining');
|
||||
$nextpayment = date('H:i', $mining->last_payout+YAAMP_PAYMENTS_FREQ);
|
||||
|
||||
echo "<span style='font-size: .8em;'>Next Payout: $nextpayment EST</span>";
|
||||
echo " © yaamp.com</span>";
|
||||
echo "<span style='font-size: .8em;'>Next Payout: $nextpayment EUST</span>";
|
||||
echo " © yiimp.ccminer.org</span>";
|
||||
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
|
@ -122,7 +122,7 @@ function showPageFooter()
|
|||
echo "<div class='footer'>";
|
||||
$year = date("Y", time());
|
||||
|
||||
echo "<p>© $year. All Rights Reserved. yaamp.com -
|
||||
echo "<p>© $year. All Rights Reserved. yiimp -
|
||||
<a href='/site/terms'>Terms and conditions</a></p>";
|
||||
|
||||
echo "</div><!-- footer -->";
|
||||
|
|
Loading…
Add table
Reference in a new issue