Pages:
Author

Topic: [ANN] MarginBot - A Bitfinex Margin Lending Management Bot - page 3. (Read 45937 times)

newbie
Activity: 17
Merit: 0
Just updated github to 1.07c.  Fixed the above update.php issue (i used decimal(18,8), which should cover even the largest of investors), and made a quick fix to balances updating after loans are canceled ( Thanks jbhuang ! ).

The only 3 files that changed from v1.07b are:
/update.php
/inc/version_info.php
/inc/ExchangeAPIs/bitfinex.php

if updating from that version, you should only need to copy over those three files.  If updating from an older version, or doing a new install, follow the standard procedures.
newbie
Activity: 17
Merit: 0
Ok, its ready!  MarginBot v0.1.07 is now live on github!  Full Crypto Margin lending!  Currently it supports all currencies that Bitfinex supports for margin.
For a few weeks now, my marginbot setup has not been picking up account history, nor unused funding, but the cron job runs were being added to the BFXLendBot_CronRuns table.

I spent some time on it yesterday, and didn't get any ideas as to what might be wrong. Not least because my php binary will not execute a .php file.

But the problem shows up as a lack of history on http://.../marginbot/index.php

and a lack of entries in the table BFXLendBot_Tracking. The last entry was 2017-08-19.

So I noticed this morning 1.07b was available on the master branch.

I followed the update instructions, and the following occurred:

A new table BFXLendBot_CurPairs is created, and the 4 existing tables are backed up to copies with the suffix _BACKUP_v17

But I get this error on the screen http://.../marginbot/update.php?doUpdate=2

Quote
THERE HAS BEEN A DATABASE ERROR
Please Contact Support If this error persists.
1264 - Out of range value for column 'dep_balance' at row 7

I am using

5.7.16
MySQL Community Server (GPL)


Poking around the MySQL tables, it seems the table definitions are still the same: decimal(12,2). But I can see some ALTER TABLE statements in update.php, that switch to decimal(12,8).
When I paste the ALTER TABLE for the Tracking table into MySQLWorkbench it thinks there is a syntax error in both MODIFY COLUMN parts of the SQL statement.


I am also wondering it it makes more sense to use decimal(16,8), as that way you can still support numbers up to 999,999,999. decimal(12,8) only goes up to 9,999.

Aye, good catch, that should definitely be at least decimal(16,8).   I was building the updater on a relatively new install that didn't have much data in it, and 12,8 worked for me (only a few thousand $ in the test account), but it will fail for anyone with > $9,999 in their account.  I will update this in github.
newbie
Activity: 7
Merit: 0
Ok, its ready!  MarginBot v0.1.07 is now live on github!  Full Crypto Margin lending!  Currently it supports all currencies that Bitfinex supports for margin.
For a few weeks now, my marginbot setup has not been picking up account history, nor unused funding, but the cron job runs were being added to the BFXLendBot_CronRuns table.

I spent some time on it yesterday, and didn't get any ideas as to what might be wrong. Not least because my php binary will not execute a .php file.

But the problem shows up as a lack of history on http://.../marginbot/index.php

and a lack of entries in the table BFXLendBot_Tracking. The last entry was 2017-08-19.

So I noticed this morning 1.07b was available on the master branch.

I followed the update instructions, and the following occurred:

A new table BFXLendBot_CurPairs is created, and the 4 existing tables are backed up to copies with the suffix _BACKUP_v17

But I get this error on the screen http://.../marginbot/update.php?doUpdate=2

Quote
THERE HAS BEEN A DATABASE ERROR
Please Contact Support If this error persists.
1264 - Out of range value for column 'dep_balance' at row 7

I am using

5.7.16
MySQL Community Server (GPL)


Poking around the MySQL tables, it seems the table definitions are still the same: decimal(12,2). But I can see some ALTER TABLE statements in update.php, that switch to decimal(12,8).
When I paste the ALTER TABLE for the Tracking table into MySQLWorkbench it thinks there is a syntax error in both MODIFY COLUMN parts of the SQL statement.

Code:
ALTER TABLE `BFXLendBot_Tracking`
ADD COLUMN `trans_cur`  varchar(10) NULL AFTER `user_id`,
MODIFY COLUMN `dep_balance`  decimal(12,8) NULL DEFAULT NULL AFTER `date`,
MODIFY COLUMN `swap_payment`  decimal(12,8) NULL DEFAULT NULL AFTER `dep_balance`,
DROP INDEX `uniquieKeys` ,
ADD UNIQUE INDEX `uniquieKeys` (`user_id`, `trans_id`, `trans_cur`) USING BTREE;

Code:
CREATE TABLE `BFXLendBot_Tracking` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `user_id` smallint(4) DEFAULT NULL,
  `trans_id` int(12) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `dep_balance` decimal(12,2) DEFAULT NULL,
  `swap_payment` decimal(12,2) DEFAULT NULL,
  `average_return` decimal(8,6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniquieKeys` (`user_id`,`trans_id`)
) ENGINE=MyISAM AUTO_INCREMENT=171 DEFAULT CHARSET=latin1;

CREATE TABLE `BFXLendBot_Tracking_BACKUP_v17` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `user_id` smallint(4) DEFAULT NULL,
  `trans_id` int(12) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `dep_balance` decimal(12,2) DEFAULT NULL,
  `swap_payment` decimal(12,2) DEFAULT NULL,
  `average_return` decimal(8,6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniquieKeys` (`user_id`,`trans_id`)
) ENGINE=MyISAM AUTO_INCREMENT=171 DEFAULT CHARSET=latin1;

I am also wondering it it makes more sense to use decimal(16,8), as that way you can still support numbers up to 999,999,999. decimal(12,8) only goes up to 9,999.
newbie
Activity: 17
Merit: 0
Right, when I try to run from the browser the page appears messy like the previous screenshot, i am not sure if you can see that?

http://imgur.com/a/umbny

Hmm.  something is seriously not right with your server setup.  From that screenshot it looks like its dumping raw code rather than executing it, which shouldn't even be possible, unless its not actually being parsed by PHP.  have you been able to correctly run any other PHP code on the server?
newbie
Activity: 32
Merit: 0
Right, when I try to run from the browser the page appears messy like the previous screenshot, i am not sure if you can see that?

newbie
Activity: 17
Merit: 0
Tired the quickfix, here is the output


@bot:/var/www/html/MarginBot-master$ php -f install.php
error_reporting(E_ALL&~E_NOTICE);
PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/MarginBot-master/install.php:1) in /var/www/html/MarginBot-master/inc/config.php on line 4
PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/MarginBot-master/install.php:1) in /var/www/html/MarginBot-master/inc/config.php on line 4
PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 10
PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 168

You have been trying to run this from a web browser, not just the terminal, right?  It is a form you'll need to put information into.  Running it from a browser, it should ignore those warnings and notices and show the page without a problem.
newbie
Activity: 32
Merit: 0
Tired the quickfix, here is the output


@bot:/var/www/html/MarginBot-master$ php -f install.php
error_reporting(E_ALL&~E_NOTICE);
PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/MarginBot-master/install.php:1) in /var/www/html/MarginBot-master/inc/config.php on line 4
PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/MarginBot-master/install.php:1) in /var/www/html/MarginBot-master/inc/config.php on line 4
PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 10
PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 168


newbie
Activity: 32
Merit: 0
I am not sure, is there anything I can run to check that? could it be related to permission? 

I will be able to test the quick fix in 2 hours also I will create another VM on the side to document the steps of the build and post here for reference


 
newbie
Activity: 17
Merit: 0
Downloaded the fix but this time the installer.php prints the script and some error to the console

/var/www/html/MarginBot-master$ php -f install.php

PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 9

PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 167


http://www.w3.org/1999/xhtml">



PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 541






PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 334

PHP Notice:  Undefined index: installDBHost in /var/www/html/MarginBot-master/install.php on line 336

PHP Notice:  Undefined index: installDBPrefix in /var/www/html/MarginBot-master/install.php on line 337

PHP Notice:  Undefined index: installDBName in /var/www/html/MarginBot-master/install.php on line 395

PHP Notice:  Undefined index: installDBUser in /var/www/html/MarginBot-master/install.php on line 398

PHP Notice:  Undefined index: installDBPassword in /var/www/html/MarginBot-master/install.php on line 401

PHP Notice:  Undefined index: installEmail in /var/www/html/MarginBot-master/install.php on line 427

Background on my setup, it is a new VM with Ubuntu 16.04 LAMP stack



Do you have error settings particularly high on your php setup?  These are all notices, and shouldn't cause the script to stop executing.  There's no actual errors in this list.

A quick fix would be to add this to the top line of install.php:

error_reporting(E_ALL & ~E_NOTICE);

newbie
Activity: 32
Merit: 0
Downloaded the fix but this time the installer.php prints the script and some error to the console

/var/www/html/MarginBot-master$ php -f install.php

PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 9

PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 167


http://www.w3.org/1999/xhtml">



PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 536

PHP Notice:  Undefined variable: config in /var/www/html/MarginBot-master/inc/General.php on line 541






PHP Notice:  Undefined index: doInstall in /var/www/html/MarginBot-master/install.php on line 334

PHP Notice:  Undefined index: installDBHost in /var/www/html/MarginBot-master/install.php on line 336

PHP Notice:  Undefined index: installDBPrefix in /var/www/html/MarginBot-master/install.php on line 337

PHP Notice:  Undefined index: installDBName in /var/www/html/MarginBot-master/install.php on line 395

PHP Notice:  Undefined index: installDBUser in /var/www/html/MarginBot-master/install.php on line 398

PHP Notice:  Undefined index: installDBPassword in /var/www/html/MarginBot-master/install.php on line 401

PHP Notice:  Undefined index: installEmail in /var/www/html/MarginBot-master/install.php on line 427

Background on my setup, it is a new VM with Ubuntu 16.04 LAMP stack

newbie
Activity: 17
Merit: 0
Thanks for replying but I must be doing something wrong

http://imgur.com/a/Eq4IQ

from console

/var/www/html$ php -f install.php
PHP Notice:  Undefined index: doInstall in /var/www/html/install.php on line 9
PHP Notice:  Undefined index: doInstall in /var/www/html/install.php on line 151
PHP Notice:  Undefined index: SCRIPT_URL in /var/www/html/inc/General.php on line 14
PHP Notice:  Undefined index: SCRIPT_URL in /var/www/html/inc/General.php on line 14
PHP Fatal error:  Uncaught Error: Call to a member function query() on null in /var/www/html/inc/General.php:15
Stack trace:
#0 /var/www/html/install.php(246): General->__construct()
#1 {main}
  thrown in /var/www/html/inc/General.php on line 15

2 things:
1. I just uploaded another quick hotfix because I forgot to add something to the installer for the new version.  The hotfix isn't your issue though (but you will want to download it). 

2.  For some reason your server isn't correctly loading $_SERVER['SCRIPT_URL'] (PHP Notice:  Undefined index: SCRIPT_URL in /var/www/html/inc/General.php on line 14).
This is strange.  Never run into that issue before, but I changed it to $_SERVER['PHP_SELF'] which is a little more universal in the latest update.  If that still isn't working for you, I'll need to figure out another way to trap for what script is running.
newbie
Activity: 32
Merit: 0
Thanks for replying but I must be doing something wrong



from console

/var/www/html$ php -f install.php
PHP Notice:  Undefined index: doInstall in /var/www/html/install.php on line 9
PHP Notice:  Undefined index: doInstall in /var/www/html/install.php on line 151
PHP Notice:  Undefined index: SCRIPT_URL in /var/www/html/inc/General.php on line 14
PHP Notice:  Undefined index: SCRIPT_URL in /var/www/html/inc/General.php on line 14
PHP Fatal error:  Uncaught Error: Call to a member function query() on null in /var/www/html/inc/General.php:15
Stack trace:
#0 /var/www/html/install.php(246): General->__construct()
#1 {main}
  thrown in /var/www/html/inc/General.php on line 15

newbie
Activity: 17
Merit: 0
Hi,

First time trying to set up this, is it possible to create how to for beginners?

I am stuck at "failed to connect to MYSQL"

Any help would be much appreciated.


Oops, actually it looks like 1.07 broke the installer.  I just uploaded a quick fix that should address the issue.  Just download the newest version, 1.07a and try running it again.  It should correctly redirect you to the installer and allow you to set up the mysql database this time.  Sorry about that.  

*EDIT* If you have any more issues installing just post here and I'll be happy to help however I can.
newbie
Activity: 32
Merit: 0
Hi,

First time trying to set up this, is it possible to create how to for beginners?

I am stuck at "failed to connect to MYSQL"

Any help would be much appreciated.




newbie
Activity: 17
Merit: 0
Ok, its ready!  MarginBot v0.1.07 is now live on github!  Full Crypto Margin lending!  Currently it supports all currencies that Bitfinex supports for margin.

You can get it here:
https://github.com/HFenter/MarginBot


Full install instructions are there, but here's a quick Update instruction:


Update from an older Version

Important - Make sure to backup your existing inc/config.php file FIRST

To update, make a backup of your inc/config.php file, then download the most current version. Unzip the files and overwrite your existing install.

Then overwrite the default config.php file with your backed up version.
Visit the site, and you'll be redirected to an update system.
If you are not correctly redirected, just visit /MarginBot/update.php

If there are any issues feel free to contact me here or via the built in contact email.

(I'm wondering if I should start a new thread on this, since I can't update the original post anymore....  What do you guys think?)

newbie
Activity: 17
Merit: 0
1. First, let me get this out of the way.  I am HowardF, the original creator of MarginBot.  While I was away from this forum, it apparently got hacked, and they locked down all the accounts and sent out a change password thing.  Well, that change password thing isn't working, I can't request a new password from my old account, and I can't figure out any way around it.  So, I created this new account to use from now on.  If there's any concern whether its really me or not, I'm happy to prove it by changing either the old website at fuckedgox.com or I can make a little change in the Github repo or whatever (just tell me what you guys want, and I'll do it).  Also, if anyone has a better contact for an admin here that could reset the HowardF account for me so I can get back in, that would be awesome as well.  I'd love to get access back to that account, would save some trouble.

Just checking that account, it had made 2 posts in a thread in May of this year. Doesn't seem characteristic. I'd look into that.

Yeah, I'd noticed.  Already reported it.  Those 2 posts were not me.  At this point I'm pretty much considering that account gone.
newbie
Activity: 3
Merit: 0
1. First, let me get this out of the way.  I am HowardF, the original creator of MarginBot.  While I was away from this forum, it apparently got hacked, and they locked down all the accounts and sent out a change password thing.  Well, that change password thing isn't working, I can't request a new password from my old account, and I can't figure out any way around it.  So, I created this new account to use from now on.  If there's any concern whether its really me or not, I'm happy to prove it by changing either the old website at fuckedgox.com or I can make a little change in the Github repo or whatever (just tell me what you guys want, and I'll do it).  Also, if anyone has a better contact for an admin here that could reset the HowardF account for me so I can get back in, that would be awesome as well.  I'd love to get access back to that account, would save some trouble.

Just checking that account, it had made 2 posts in a thread in May of this year. Doesn't seem characteristic. I'd look into that.
newbie
Activity: 17
Merit: 0
Hi,

Since Bitfinex now supports Bitcoin Cash Lending

Can or will your bot support it?

I am currently working on adding back in Crypto Margin Lending.  I hope to have a new build up in the next day or so with this built in.  It should allow all types of crypto bitfinx supports for margin.
sr. member
Activity: 443
Merit: 260
Hi,

Since Bitfinex now supports Bitcoin Cash Lending

Can or will your bot support it?
newbie
Activity: 9
Merit: 0
Very happy to see you back HowardF! As a MarginBot user since 2015 I'm extremely excited to see what you have in store for us!

Welcome back!
Pages:
Jump to: