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.
1Apzahst2nUq226CyQJUHcHQKvy9nWoPvB (FEEDS DIRECTLY TO BOT)
A cleaned up version of the Crypto Trading Automatron Currently Running k0dejunky.com/bitcoin
Pass the Database Password for Database 'geekerV2' to ./geekerV2.pl Example: ./geekerV2.pl dbPassword
Database Name: geekerV2 (on localhost) Type: MySql
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.
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
The ones in the code, those are the important ones. Need those.