diff --git a/.gitignore b/.gitignore
index 1368941..2a3a956 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-crons/DailyCron.php
\ No newline at end of file
+crons/DailyCron.php
+inc/config.json
\ No newline at end of file
diff --git a/inc/Accounts.php b/inc/Accounts.php
index 093b86e..59c11b0 100644
--- a/inc/Accounts.php
+++ b/inc/Accounts.php
@@ -151,9 +151,9 @@ function doAddAccount(){
if($newUser['id']!=0){
// Set default settings for the account //
- $sql = "INSERT into `".$config['db']['prefix']."Vars` (`id`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`highholdlimit`,`highholdamt` )
+ $sql = "INSERT into `".$config['db']['prefix']."Vars` (`id`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`hundredDayMin`,`highholdlimit`,`highholdamt` )
VALUES
- ( '".$newUser['id']."', '0.0650', '3', '25000', '100000', '0.1500', '0.3500', '0' )";
+ ( '".$newUser['id']."', '0.0650', '3', '25000', '100000', '0.1500', '0.2500', '0.3500', '0' )";
$newActSettings = $this->db->iquery($sql);
$ret['page']=2;
$ret['newaccount']=$newUser['id'];
@@ -276,6 +276,12 @@ function displayDetailsTableRow(){
Minimum
for 30 Day
+
+
+
+
+ Minimum for 120 Day
+ |
@@ -304,6 +310,12 @@ function displayDetailsTableRow(){
%
+ |
+
+
+ %
+
+ |
'.$thisCurrency.'
@@ -331,6 +343,7 @@ function displayDetailsTableRow(){
Gap Top
| |
+ |
|
@@ -346,6 +359,7 @@ function displayDetailsTableRow(){
|
|
+ |
@@ -526,6 +540,7 @@ function updateSettings(){
$USDgapBottom = preg_replace('/[^0-9.]/', '', $_REQUEST['USDgapBottom']);
$USDgapTop = preg_replace('/[^0-9.]/', '', $_REQUEST['USDgapTop']);
$thirtyDayMin = preg_replace('/[^0-9.]/', '', $_REQUEST['thirtyDayMin']);
+ $hundredDayMin = preg_replace('/[^0-9.]/', '', $_REQUEST['hundredDayMin']);
$highholdlimit = preg_replace('/[^0-9.]/', '', $_REQUEST['highholdlimit']);
$highholdamt = preg_replace('/[^0-9.]/', '', $_REQUEST['highholdamt']);
@@ -535,6 +550,7 @@ function updateSettings(){
$sql = "UPDATE `".$config['db']['prefix']."Vars` SET minlendrate = '".$this->db->escapeStr($minlendrate)."', spreadlend = '".$this->db->escapeStr($spreadlend)."',
USDgapBottom = '".$this->db->escapeStr($USDgapBottom)."', USDgapTop = '".$this->db->escapeStr($USDgapTop)."',
thirtyDayMin = '".$this->db->escapeStr($thirtyDayMin)."',
+ hundredDayMin = '".$this->db->escapeStr($hundredDayMin)."',
highholdlimit = '".$this->db->escapeStr($highholdlimit)."',
highholdamt = '".$this->db->escapeStr($highholdamt)."'
WHERE userid = '".$this->db->escapeStr($this->userid)."' AND curType = '".$this->db->escapeStr($_REQUEST['curType'])."' LIMIT 1";
@@ -546,6 +562,7 @@ function updateSettings(){
`USDgapBottom`,
`USDgapTop`,
`thirtyDayMin`,
+ `hundredDayMin`,
`highholdlimit`,
`highholdamt`,
`userid`,
@@ -558,6 +575,7 @@ function updateSettings(){
'".$this->db->escapeStr($USDgapBottom)."',
'".$this->db->escapeStr($USDgapTop)."',
'".$this->db->escapeStr($thirtyDayMin)."',
+ '".$this->db->escapeStr($hundredDayMin)."',
'".$this->db->escapeStr($highholdlimit)."',
'".$this->db->escapeStr($highholdamt)."',
'".$this->db->escapeStr($this->userid)."',
diff --git a/inc/ExchangeAPIs/bitfinex.php b/inc/ExchangeAPIs/bitfinex.php
index c49e15c..d0ceb19 100644
--- a/inc/ExchangeAPIs/bitfinex.php
+++ b/inc/ExchangeAPIs/bitfinex.php
@@ -363,8 +363,8 @@ function bitfinex_getMyLendRates($cur='USD', $minForLend = 50){
//checking to make sure the highhold isn't more than total available too...
$loans[$cur][0]['amt'] = ($this->actSettings['highholdamt'][$cur] > $ca ? $ca : $this->actSettings['highholdamt'][$cur]);
$loans[$cur][0]['rate'] = ($this->actSettings['highholdlimit'][$cur]*365);
- // always loan out highholds for 30 days... bascially we're pretty sure this is a high rate loan
- $loans[$cur][0]['time'] = 30;
+ // always loan out highholds for 120 days... bascially we're pretty sure this is a high rate loan
+ $loans[$cur][0]['time'] = 120;
}
// is there anything left after the highhold? if so, lets split it up //
if( $splitAvailable >= $minForLend ){
@@ -405,7 +405,15 @@ function bitfinex_getMyLendRates($cur='USD', $minForLend = 50){
// unless its above the threshold $this->actSettings['thirtyDayMin'], in which case we should lend it for the max 30 days
// (basically, the rate is higher than normal, lets keep this loan out as long as possible)
// if $this->actSettings['thirtyDayMin'] = 0, always loan for 2 days, no matter what
- $loans[$cur][$a]['time'] = (($this->actSettings['thirtyDayMin'][$cur]>0)&&($lrate >= ($this->actSettings['thirtyDayMin'][$cur] * 365)) ? 30 : 2);
+ if ($this->actSettings['hundredDayMin'][$cur] > 0 && $lrate >= $this->actSettings['hundredDayMin'][$cur] * 365){
+ $loans[$cur][$a]['time'] = 120;
+ }
+ else if ($this->actSettings['thirtyDayMin'][$cur] > 0 && $lrate >= $this->actSettings['thirtyDayMin'][$cur] * 365){
+ $loans[$cur][$a]['time'] = 30;
+ }
+ else {
+ $loans[$cur][$a]['time'] = 2;
+ }
$nextlend += $gapClimb;
$a++;
}
@@ -511,6 +519,7 @@ function bitfinex_getAccountSettings(){
$this->actSettings['USDgapBottom'][strtoupper($u['curType'])] = $u['USDgapBottom'];
$this->actSettings['USDgapTop'][strtoupper($u['curType'])] = $u['USDgapTop'];
$this->actSettings['thirtyDayMin'][strtoupper($u['curType'])] = $u['thirtyDayMin'];
+ $this->actSettings['hundredDayMin'][strtoupper($u['curType'])] = $u['hundredDayMin'];
$this->actSettings['highholdlimit'][strtoupper($u['curType'])] = $u['highholdlimit'];
$this->actSettings['highholdamt'][strtoupper($u['curType'])] = $u['highholdamt'];
$this->actSettings['extractAmt'][strtoupper($u['curType'])] = $u['extractAmt'];
diff --git a/inc/config.php b/inc/config.php
index 36248b6..9e044ff 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -5,22 +5,19 @@
require_once('version_info.php');
// Local Database Connection Info //
-$config['db']['host'] = '';
-$config['db']['dbname'] = '';
-$config['db']['dbuser'] = '';
-$config['db']['dbpass'] = '';
+$fileContent = file_exists('inc/config.json') ? file_get_contents('inc/config.json') : file_get_contents('../inc/config.json');
+$privateInfo = json_decode($fileContent , true);
+$config['db']['host'] = $privateInfo['database']['host'];
+$config['db']['dbname'] = $privateInfo['database']['dbname'];
+$config['db']['dbuser'] = $privateInfo['database']['dbuser'];
+$config['db']['dbpass'] = $privateInfo['database']['dbpass'];
// this is included in front of each database table name
-$config['db']['prefix'] = '';
+$config['db']['prefix'] = $privateInfo['database']['prefix'];
//Local Admin Email //
-$config['admin_email'] = 'marginbot@therovegroup.com';
+$config['admin_email'] = $privateInfo['email'];
// Current Fees Charged by BFX for Margin Swaps (15% as of Nov. 2014)
-$config['curFeesBFX'] = 15;
-
-
-
-
-
+$config['curFeesBFX'] = $privateInfo['fee'];
?>
\ No newline at end of file
diff --git a/install.php b/install.php
index bc218f5..4736326 100644
--- a/install.php
+++ b/install.php
@@ -5,6 +5,7 @@
$warning = array();
$configFile = getcwd().'/inc/config.php';
+$configJsonPath = getcwd().'/inc/config.json';
// This is a submit, lets do some stuff //
if($_REQUEST['doInstall']==1){
//Install Step 1
@@ -62,6 +63,7 @@
`USDgapBottom` varchar(12) DEFAULT NULL,
`USDgapTop` varchar(12) DEFAULT NULL,
`thirtyDayMin` varchar(12) DEFAULT NULL,
+ `hundredDayMin` varchar(12) DEFAULT NULL,
`highholdlimit` varchar(12) DEFAULT NULL,
`highholdamt` varchar(12) DEFAULT NULL,
`extractAmt` varchar(12) DEFAULT NULL,
@@ -114,37 +116,27 @@
if(count($warning)==0){
// tables seemed to create ok, lets write the config file //
-
-$configData = '';
-
+ $configJsonData = array(
+ "database" => array(
+ "host" => $_REQUEST['installDBHost'],
+ "dbname" => $_REQUEST['installDBName'],
+ "dbuser" => $_REQUEST['installDBUser'],
+ "dbpass" => $_REQUEST['installDBPassword'],
+ "prefix" => $_REQUEST['installDBPrefix']
+ ),
+ "email" => $_REQUEST['installEmail'],
+ "fee" => $_REQUEST['installBFXFees']
+ );
if (!$handle = fopen($configFile, 'w')) {
$warning[] = "Could Not open file ($configFile)";
//exit;
}
// Write to the config file //
- if (fwrite($handle, $configData) === FALSE) {
- $warning[] = "Cannot write to file ($configFile)";
+
+ if (file_put_contents($configJsonPath, json_encode($configJsonData)) === FALSE) {
+ $warning[] = "Cannot write to file ($configJsonPath)";
//exit;
}
else{
@@ -223,13 +215,13 @@
if($newUser['id']!=0){
// Set default settings for the account //
- $sql = "INSERT into `".$config['db']['prefix']."Vars` (`userid`,`curType`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`highholdlimit`,`highholdamt` )
+ $sql = "INSERT into `".$config['db']['prefix']."Vars` (`userid`,`curType`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`hundredDayMin`,`highholdlimit`,`highholdamt` )
VALUES
- ( '".$newUser['id']."', 'USD', '0.0650', '3', '25000', '100000', '0.1500', '0.3500', '0' )";
+ ( '".$newUser['id']."', 'USD', '0.0650', '3', '25000', '100000', '0.1500', '0.2500', '0.3500', '0' )";
$newActSettings = $db->iquery($sql);
- $sql = "INSERT into `".$config['db']['prefix']."Vars` (`userid`,`curType`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`highholdlimit`,`highholdamt` )
+ $sql = "INSERT into `".$config['db']['prefix']."Vars` (`userid`,`curType`,`minlendrate`,`spreadlend`,`USDgapBottom`,`USDgapTop`,`thirtyDayMin`,`hundredDayMin`,`highholdlimit`,`highholdamt` )
VALUES
- ( '".$newUser['id']."', 'BTC', '0.0150', '2', '2', '10', '0.1500', '0.3500', '0' )";
+ ( '".$newUser['id']."', 'BTC', '0.0150', '2', '2', '10', '0.1500', '0.2500', '0.3500', '0' )";
$newActSettings = $db->iquery($sql);
// Success, tell them they need to login now //