Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit ece3e0e

Browse files
committed
changed rocketchat/slack output and trader ID
1 parent 7afe08a commit ece3e0e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

trader.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function __construct()
102102

103103

104104
$this->transactions = array();
105-
$this->traderID = substr(md5(time().microtime()."hello".rand(1,19999)),-3);
105+
$this->traderID = CURRENCY.' - '.CRYPTO;//substr(md5(time().microtime()."hello".rand(1,19999)),-3);
106106

107107
//setup Redis connection if user has configured it
108108
if(defined('REDIS_SERVER') && REDIS_SERVER != '')
@@ -280,7 +280,7 @@ function buyBTC($amount,$sellat,$btc=false)
280280

281281
echo "[B #$id] Buying $eur\t=\t$btc ".CRYPTO."\n";
282282

283-
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Buying *$btc ".CRYPTO."* for *$eur ".CURRENCY."*",':moneybag:','Bot #'.$this->traderID);
283+
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Buying *$btc ".CRYPTO."* for *$eur ".CURRENCY."*",':moneybag:');
284284

285285
$this->saveTransactions();
286286

@@ -297,7 +297,7 @@ function sellBTCID($id)
297297

298298
$profit = round(($data['btc']*$this->sellPrice)-($data['btc']*$data['buyprice']),2);
299299

300-
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Selling *".$data['btc']." ".CRYPTO."* for *".$data['eur']." ".CURRENCY."*. Profit: *$profit ".CURRENCY."*",':money_with_wings:','Bot #'.$this->traderID);
300+
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Selling *".$data['btc']." ".CRYPTO."* for *".$data['eur']." ".CURRENCY."*. Profit: *$profit ".CURRENCY."*",':money_with_wings:');
301301
}
302302

303303
function sellBTC($amount,$btc=false)
@@ -317,7 +317,8 @@ function sellBTC($amount,$btc=false)
317317
}
318318

319319
function watchdog()
320-
{
320+
{
321+
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Starting watchdog",':wave:');
321322
while(1)
322323
{
323324

@@ -351,7 +352,7 @@ function watchdog()
351352
$btc = (1/$this->sellPrice) * $eur;
352353
$this->deleteTransaction($id);
353354
$this->sellBTC($btc,true);
354-
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Selling *".$btc." ".CRYPTO."* for *".$eur." ".CURRENCY."*. Forefilling and deleting this sell order.",':money_with_wings:','Bot #'.$this->traderID);
355+
if(ROCKETCHAT_REPORTING===true) sendToRocketchat("Selling *".$btc." ".CRYPTO."* for *".$eur." ".CURRENCY."*. Forefilling and deleting this sell order.",':money_with_wings:');
355356
}
356357
else
357358
echo " [#$id] Watching SELL order for \t$eur ".CURRENCY.". Will sell when ".CRYPTO." price reaches ".$td['sellat']." ".CRYPTO.".\n";
@@ -393,8 +394,9 @@ function watchdog()
393394

394395

395396
//rocketchat
396-
function sendToRocketchat($message,$icon=':ghost:',$username='Traderbot')
397+
function sendToRocketchat($message,$icon=':ghost:')
397398
{
399+
$username = CURRENCY.' - '.CRYPTO.' trader'.(SIMULATE===true?' (simulation)':'');
398400
$data = array("icon_emoji"=>$icon,
399401
"username"=>$username,
400402
"text"=>$message);

0 commit comments

Comments
 (0)