Skip to content

k0dejunky/bitBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

geekerV2

Geeker By k0dejunkyDotCom

CHANGE ALL FLOAT columns in the database to DECIMAL and use 16,8 for the size. This fixes rounding issues with the code.

To donate

1Apzahst2nUq226CyQJUHcHQKvy9nWoPvB
(FEEDS DIRECTLY TO BOT)

What Is GeekerV2?

A cleaned up version of the Crypto Trading Automatron Currently Running k0dejunky.com/bitcoin

Better Instructions:

  • Install a L.inux A.pache M.ySQL P.HP box (I like Linode.com shells for this)
  • Install PERL
  • Clone the git repo
  • Create a Mysql database it must be called 'geekerV2'
  • 'CREATE DATABASE geekerV2'
  • Make a user for mysql called geeker and choose a password for him. MUST be user called 'geeker'
  • CREATE USER 'geeker'@'localhost' IDENTIFIED BY 'yourpassword';
  • GRANT ALL PRIVILEGES ON geekerV2.* TO 'geeker'@'localhost';
  • Thats all, remember that password.
  • Dont put any of this in the apache web folders, this part stays offweb, even the php file (the perl file runs it)
  • RUN IT FROM the folder it is inside (it needs to be in there with sign.php)
  • Run the bot ONCE. It will create accounts table in database and quit.
  • "perl geekerV2.pl yourDatabasePasswordForGeeker"
  • Use CPAN to fetch anything the bot fails to launch for (perl packages)
  • Go get a bittrex account with API key and API secret.
  • Put some bitcoin in it (I started mine with about 0.082 BTC (roughly $30-$40 USD)
  • INSERT into the accounts table a single row, with apiKey and apiSecret
  • On the first run the bot will put the coins you've traded in the past from your balance list on bittrex into the currency table
  • Using a database editor set tradeMe to 1 and priceCheck to 1 in the currency table for the ones you want to trade (if you want the bot to do anything)
  • Beware that USDT cannot be traded by this bot at this time, due to the way the pair has to look, so do not mark it for trade me or price check
  • Now, run the bot again and leave it alone (I use a detached screen session and an output redirect for logging)
  • Keep track of your BTC balance on Bittrex and it may increase over time (once all sells complete)
  • Sometimes theres a selloff in the alt coin when the bot has a sell order on a alt coin. if you don't wish to wait, for it to come back up (possibly days, if ever) you will have to manually sell it on bittrex and take the loss.

How to start the bot

Pass the Database Password for Database 'geekerV2' to ./geekerV2.pl
Example: ./geekerV2.pl dbPassword

Database

Database Name: geekerV2 (on localhost)
Type: MySql

Hows that work?

It starts with BITCOIN, sells it for ALT coins like DASH and LTC when their prices (in bitcoins) are LOW.
It determines the LOW by the lowest price of 4 hours of monitoring the prices (note: works best after 4 hours of running)
When it places buy orders at the LOWest price of the timeRange, it also finds the HIGHest price of same timeRange.
It notes this, and IF that BUY is filled, it will IMMEDIATELY place the same amount bought for LOW amount BTC up for sale
for HIGH amount BTC. (ie: Buying LTC @ 0.00063000 BTC and selling it for 0.00064000 BTC)
It will only place the BUY order in the first place, IF the sale of same at high will CLEAR THE COMMISSION charged for
the transaction by the exchange (bittrex charges 0.0025% on all).

Once it BUYs it places for sale on HIGHest price of the timeRange it bought in.
But what if it goes out of range? what if thats TOO high or a fluke or even MISdirection from others?
Good question! Thats why there is a DRAGdown Sell function, after 15 minutes, any sell not sold, will have its PROFIT lowered by 5%.
It figures out the current PROFIT then calcs 5% of that, subtracts it, then funkymathTown to get the new UNIT price,
cancel the original sell order, and places a NEW sell order at the new price. The trick is, it WONT do this if
the NEW PROFIT is too low! So in essence, it buys as low as possible, TRIES to sell it super high, then gradually reduces
it until it pops. Very rarely does anything get stuck high anymore(it was an issue in the beginning of development,
this is the solution)

What about the buys? What if they never pop?
Good Question!
Thats why trimOldBuys(15) exists, just like dragdown but way simpler.
For a buy that doesnt sell in the 15 minutes, it gets CANCELLED (unless its partially filled, then it stays)
Its cancelled and forgotten if it doesnt get a bite.
This works because in 10 seconds, it will see it has enough bitcoin (freed by the cancel) to make a buy and
it will, replacing the previous investment with a more time accurate offer.

This isnt everything, some of it might not even be correct. So far the experiment was profitible if guided.

Database Tables

  • accounts
    exchange (which exchange are we using)
    apiKey (the api key)
    apiSecret (the api secret)

  • currencies
    coin (The Coin)
    balance (The Fun Part, sometimes...)
    pending
    reserve
    available
    lastUpdated
    tradeMe (Boolean, Should we BUY this coin, then sell what we buy)
    tradeToZero (Boolean, Should we SELL IT ALL, even if we didnt buy it first (harvestAllCoins) )
    priceCheck (should we store price History for this Coin?)

  • orderHistory
    uuid
    type (LIMIT_BUY or LIMIT_SELL)
    coin
    perUnitBuyPrice
    perUnitSellPrice
    amount
    remaining
    totalBuyPrice
    totalSellPrice
    profitBeforeCommission
    profitAfterCommission
    buyCommission
    sellCommission
    placed (timestamp)
    closed (timestamp)

  • autoTrades
    uuid
    type (LIMIT_BUY or LIMIT_SELL)
    coin
    perUnitBuyPrice
    perUnitSellPrice
    amount
    remaining
    totalBuyPrice
    totalSellPrice
    profitBeforeCommission
    profitAfterCommission
    buyCommission
    sellCommission
    placed (timestamp)
    closed (timestamp)
    resolved (boolean)
    sold (boolean)

  • openOrders
    uuid
    type (LIMIT_BUY or LIMIT_SELL)
    coin
    perUnitBuyPrice
    perUnitSellPrice
    amount
    remaining
    totalBuyPrice
    totalSellPrice
    profitBeforeCommission
    profitAfterCommission
    buyCommission
    sellCommission
    placed (timestamp)
    closed (timestamp)
    resolved (boolean)
    sold (boolean)

  • coinMetrics
    coin
    lowestPrice
    highestPrice
    averagePrice
    bid
    ask
    last
    gap
    volume
    range

  • btcPriceHistory
    date price

  • altCoinPriceHistory
    date price bid ask coin

Important Functions

The ones in the code, those are the important ones. Need those.

About

bitcoin trading bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages