Bitcoin Forum
May 07, 2024, 04:35:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: #-POLONIEX LENDING BOT-#  (Read 1050 times)
R00TC0IN (OP)
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
January 08, 2017, 11:14:23 PM
 #1

R00TC0IN's
Advanced poloniex lending bot is coded in Python!

The bot features automatic lending on the exchange at Poloniex.

It will automatically lend all crypto currencies found in your lending account.

It uses an advanced lending strategy which will spread offers across the lend book to take advantage of possible spikes in lending rates.

I also have a trading guide full of trading information and how to guides for new and advanced traders.


Features

    Automatically lend your coins on Poloniex at the highest possible rates, 24 hours a day.

    Configure your own lending strategy!

    Be aggressive and hold out for a great rate or be conservative and lend often but at a lower rate, your choice!

    The ability to spread your offers out to take advantage of spikes in the lending rate.

    Withhold lending a percentage of your coins until the going rate reaches a certain threshold to maximize your profits.

    Lock in a high daily rate for a longer period of time period of up to sixty days, all configurable!

    Automatically transfer any funds you deposit (configurable on a coin-by-coin basis) to your lending account instantly after deposit.

    View a summary of your bot's activities, status, and reports via an easy-to-set-up webpage that you can access from anywhere!

    Choose any currency to see your profits in, even show how much you are making in USD!

    Select different lending strategies on a coin-by-coin basis.

    Run multiple instances of the bot for multiple accounts easily using multiple config files.

    Configure a date you would like your coins back, and watch the bot make sure all your coins are available to be traded or withdrawn.


Simple configuration file

Code:

[API]
apikey = API Key Here
secret =  Secret Here

[BOT]
#Sleeps between active iterations, time in seconds (1-3600)
sleeptimeactive = 5

#Sleeps between inactive iterations, time in seconds (1-3600)
#Set to the same value as sleeptimeactive to disable
sleeptimeinactive = 20

#Minimum daily lend rate in percent (0.0031-5)
#Setting to 0.0031 is about 1% a year, not worth it.
mindailyrate = 0.003

#Maximum lending rate. 2% is good choice because it's default at margin trader interface.
#5% is the maximum rate accepted by the exchange (0.003-5)
maxdailyrate = 5

#The number of offers to split the available balance across the [gaptop, gapbottom] range. (1-20)
spreadlend = 3

#The depth of lendbook (in percent of lendable balance) to move through
#before placing the first (gapbottom) and last (gaptop) offer.
#If gapbottom is set to 0, the first offer will be at the lowest possible rate.
#However some low value is recommended (say 10%) to skip dust offers.
gapbottom = 10
gaptop = 200

#Daily lend rate threshold after which we offer lends for x days as opposed to 2.
#If set to 0 all offers will be placed for a 2 day period (0.003-5)
xdaythreshold = 0.2
xdays = 60

#Auto-transfer of funds from exchange to lending balance.
#Enter ALL to transfer all coins, enter ACTIVE to transfer any coins you have in your lending account when the bot starts, these can be mixed.
#The currencies you enter below (comment it out to disable entirely, just leaving empty will result in an error) will be automatically transferred from your exchange balance to your lending balance whenever you deposit them.
#transferableCurrencies = STR,BTC,BTS,CLAM,DOGE,DASH,LTC,MAID,XMR,XRP,ETH,FCT

#Minimum loan size, the minimum size of offers to make, bigger values prevent the bot from loaning small available amounts but reduce loan fragmentation.
minloansize = 0.001

#Keep Stuck Orders - Sometimes an order gets partially filled. When this happens it may leave the remainder of your coin under the set minloansize.
#If this happens, KeepStuckOrders will keep your order where it is so maybe it can be filled. Otherwise it will be canceled and held until orders expire.
keepstuckorders = True

#Hide coins - Instead of keeping your coins lent out at minlendrate when it is not met, the bot will hold them and wait for the rate to surpass it.
hideCoins = True

#End date for lending, bot will try to make sure all your loans are done by this date so you can withdraw or do whatever you need.
#Uncomment to enable.
#Format: YEAR,MONTH,DAY
#endDate = 2016,12,25

#Raw maximum amount to lend if under maxtolendrate.
#If set to 0 or commented: the bot will check for maxpercenttolend.(0+)
#maxtolend = 0

#Maximum percent to lend if under maxtolendrate.
#If set to 0 or commented: the bot will lend 100% of your balance regardless of rate. (0-100)
#maxpercenttolend = 0

#Max to lend conditional rate.
#If set to more than 0: the maxtolend or maxpercenttolend will be used when the rate is less than or equal to the maxtolendrate.
#If set to 0 or commented: the bot will use the maxtolend or maxpercenttolend all the time. (0.0031-5)
#maxtolendrate = 0

# Local Market Analysis: Choose which coins to record the market of in order to analyse them and compute a recommended lending rate.
# Enter ALL to analyse all coins, enter ACTIVE to analyse the markets of any coins you have in your lending account when the bot starts, these can be mixed.
#analyseCurrencies = STR,BTC,BTS,CLAM,DOGE,DASH,LTC,MAID,XMR,XRP,ETH,FCT
# Choose how long to keep market data. (In days) (1-365)
#analyseMaxAge = 20
# Choose how often to record a market's rate. (In seconds.) (10-3600)
#analyseUpdateInterval = 20
# Choose how aggressive to lend at based on a market's performance. (As a percentile of the market's rate.) (1-99)
# Recommendations: Conservative = 50, Moderate = 75, Aggressive = 90, Very Aggressive = 99
#lendingStyle = 75

#Syntax: ["COIN:mindailyrate:maxactiveamount:maxtolend:maxpercenttolend:maxtolendrate",...]
#If maxactive amount is 0: stop lending this coin. in the future you'll be able to limit amount to be lent.
#If maxtolend is 0: check for maxpercenttolend.
#If maxpercenttolend is 0: 100% is going to be lent.
#If maxtolendrate is set to more than 0: the maxtolend or maxpercenttolend will be used when then rate is less or equal to the maxtolendrate. if set to 0 the bot will use the maxtolend or maxpercenttolend all the time.
#coinconfig = ["BTC:0.18:1:0:0:0","CLAM:0.6:1:0:0:0"]

#This option creates a json log file instead of console output which includes the most recent status.
#Uncomment both jsonfile and jsonlogsize to enable.
#Keep this in the default location if you want to use the webserver.
#jsonfile = www/botlog.json

#Limits the amount of log lines to save.
#jsonlogsize = 200

#Enables a webserver for the www folder, in order to easily use the lendingbot.html with the .json log.
#startWebServer = true

#Customize the IP and port that the webserver is hosted on. Defaults to 0.0.0.0:8000
#0.0.0.0 will point to your default IP (Local IP on LAN as well as localhost), set to 127.0.0.1 if you want it to be only accessible by host computer.
#Do not set to a reserved port
#Advanced users only.
#customWebServerAddress = 127.0.0.1

#The currency that the HTML Overview will present the earnings summary in.
#Options are BTC, USDT, ETH or anything as long as it has a direct BTC market. The default is BTC.
#outputCurrency = BTC


AUTOMATED MARKET DATA ANALYSYS & PERCENTILE LENDING


Code:
currencies_to_analyse = []
open_files = {}
max_age = 0
update_interval = 0
api = None
Data = None
lending_style = 0


def init(config, api1, data1):
    global currencies_to_analyse, open_files, max_age, update_interval, api, Data, lending_style
    currencies_to_analyse = config.get_currencies_list('analyseCurrencies')
    max_age = int(config.get('BOT', 'analyseMaxAge', 30, 1, 365))
    update_interval = int(config.get('BOT', 'analyseUpdateInterval', 60, 10, 3600))
    lending_style = int(config.get('BOT', 'lendingStyle', 50, 1, 99))
    api = api1
    Data = data1
    if len(currencies_to_analyse) != 0:
        for currency in currencies_to_analyse:

            try:
                api.api_query("returnLoanOrders", {'currency': currency, 'limit': '5'})
            except Exception as cur_ex:
                print "Error: You entered an incorrect currency: '" + currency + \
                      "' to analyse the market of, please check your settings. Error message: " + str(cur_ex)
                exit(1)

            else:
                path = "market_data/" + currency + "_market_data.csv"
                open_files[currency] = path

        thread = threading.Thread(target=update_market_loop)
        thread.deamon = True
        thread.start()


def update_market_loop():
    while True:
        update_markets()
        delete_old_data()
        time.sleep(update_interval)


def update_markets():
    for cur in open_files:
        with open(open_files[cur], 'a') as f:
            writer = csv.writer(f, lineterminator='\n')
            raw_data = api.return_loan_orders(cur, 5)['offers'][0]
            market_data = [Data.timestamp(), raw_data['rate']]
            writer.writerow(market_data)


def delete_old_data():
    for cur in open_files:
        with open(open_files[cur], 'rb') as file_a:
            new_a_buf = StringIO()
            writer = csv.writer(new_a_buf)
            reader2 = csv.reader(file_a)
            for row in reader2:
                if get_day_difference(row[0]) < max_age:
                    writer.writerow(row)

        # At this point, the contents (new_a_buf) exist in memory
        with open(open_files[cur], 'wb') as file_b:
            file_b.write(new_a_buf.getvalue())


def get_day_difference(date_time):  # Will be in format '%Y-%m-%d %H:%M:%S'
    date1 = datetime.datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S')
    now = datetime.datetime.now()
    diff_days = (now - date1).days
    return diff_days


def get_rate_list(cur='all'):
    if cur == 'all':
        all_rates = {}
        for cur in open_files:
            with open(open_files[cur], 'r') as f:
                reader = csv.reader(f)
                rates = []
                for row in reader:
                    rates.append(row[1])
                rates = map(float, rates)
                all_rates[cur] = rates
        return all_rates

    else:
        if cur not in open_files:
            return []
        with open(open_files[cur], 'r') as f:
            reader = csv.reader(f)
            rates = []
            for row in reader:
                rates.append(row[1])
            rates = map(float, rates)
        return rates


def get_rate_suggestion(cur, percentile=lending_style):
    if cur not in open_files:
        return 0
    rates = get_rate_list(cur)
    if use_numpy:
        result = numpy.percentile(rates, int(percentile), interpolation='linear')
    else:
        rates.sort()
        index = int(percentile * len(rates))
        result = rates[index]
    result = float(int(result * 1000000) / 1000000.0)
    return result




I accept almost any crypto currency as payment for this trading bot
Price is $5 for the Python trading bot.
Price is $1 for the trading guide.

AMP    Synereo AMP    
ARDR Ardor    
BBR    Boolberry    
BCN    Bytecoin    
BCY    BitCrystals
BELA    BellaCoin
BITS    Bitstar    
BLK    BlackCoin    
BTC    Bitcoin    
BTCD BitcoinDark    
BTM    Bitmark    
BTS    BitShares    
BURST Burst    
CLAM CLAMS    
CURE Curecoin    
DASH Dash    
DCR    Decred    
DGB    DigiByte    
DOGE Dogecoin    
EMC2 Einsteinium    
ETC    Ethereum Classic    
ETH    Ethereum
EXP    Expanse    
FLDC    FoldingCoin    
FLO    Florincoin    
GAME GameCredits    
GRC    Gridcoin Research    
HUC    Huntercoin
HZ    Horizon    
IOC    IO Digital Currency    
LBC    LBRY Credits    
LSK    Lisk    
LTC    Litecoin    
MAID MaidSafeCoin    
MYR    Myriadcoin
NAUT Nautiluscoin    
NAV    NAVCoin    
NEOS Neoscoin    
NMC    Namecoin    
NOBL NobleCoin    
NOTE DNotes    
NSR    NuShares    
NXC    Nexium    
NXT    NXT
OMNI Omni    
PINK    Pinkcoin    
POT    PotCoin    
PPC    Peercoin    
QBK    Qibuck    
QORA Qora    
QTL    Quatloo    
RADS Radium    
RBY    Rubycoin    
REP    Augur    
RIC    Riecoin    
SBD    Steem Dollars    
SC    Siacoin    
SDC    Shadow    
SJCX    Storjcoin X    
STEEM STEEM    
STR    Stellar    
STRAT Stratis    
SYS    Syscoin    
UNITY SuperNET    
USDT Tether USD    
VIA    Viacoin    
VOX    Voxels    
VRC    VeriCoin    
VTC    Vertcoin    
XCP    Counterparty    
XEM    NEM    
XMG    Magi    
XMR    Monero    
XPM    Primecoin
XRP    Ripple    
XVC    Vcash    
ZEC    Zcash


1715056538
Hero Member
*
Offline Offline

Posts: 1715056538

View Profile Personal Message (Offline)

Ignore
1715056538
Reply with quote  #2

1715056538
Report to moderator
1715056538
Hero Member
*
Offline Offline

Posts: 1715056538

View Profile Personal Message (Offline)

Ignore
1715056538
Reply with quote  #2

1715056538
Report to moderator
1715056538
Hero Member
*
Offline Offline

Posts: 1715056538

View Profile Personal Message (Offline)

Ignore
1715056538
Reply with quote  #2

1715056538
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715056538
Hero Member
*
Offline Offline

Posts: 1715056538

View Profile Personal Message (Offline)

Ignore
1715056538
Reply with quote  #2

1715056538
Report to moderator
1715056538
Hero Member
*
Offline Offline

Posts: 1715056538

View Profile Personal Message (Offline)

Ignore
1715056538
Reply with quote  #2

1715056538
Report to moderator
LieXurui
Hero Member
*****
Offline Offline

Activity: 547
Merit: 500



View Profile
January 09, 2017, 12:36:37 AM
 #2

you can see your bot is work
maybe you can see video how to work your bot
R00TC0IN (OP)
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
January 09, 2017, 12:43:00 AM
 #3

The bot comes with documentation on how to use its very simple to setup.

Here is a demo of the bot in action

https://i.imgur.com/cl6Jc8S.png
roy778
Full Member
***
Offline Offline

Activity: 239
Merit: 100


View Profile WWW
January 09, 2017, 01:52:40 AM
 #4

please share a video with your bot, becAUSE your account still newbie, we don't trust you
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!