# About This page is a complete guide for [phBot Crypto](https://phbot.org/crypto). --- # General ### Social Media * ##### [Twitter](https://twitter.com/projecthax) * ##### [Facebook](https://facebook.com/projecthax) * ##### [GitHub](https://github.com/projecthax) * ##### [Discord](https://discord.com/invite/e97chmQ) ### [Purchasing](#purchasing) ### [Download](#download) ### [Supported Operating Systems](#os) * #### [Wine](#wine) ### [Wallets](#wallets) ### [Tax](#tax) # Exchanges * #### [Supported Exchanges](#supported-exchange) * #### [Setup](#setup) * #### [Date / Time](#date) * #### [Binance](#binance) * #### [Coinbase Pro](#coinbase) * #### [Alpaca (stocks)](#alpaca) # Pairs * #### [Configuration](#pairs-config) * #### [Crypto Profit](#pairs-crypto-profit) * #### [Margin](#margin) * #### [Example](#pairs-example) * #### [Use cases](#pairs-usage) # [FAQ](#faq) # [DCA Calculator](#dca) --- # phBot Crypto ProjectHax Bot for Crypto phBot Crypto is a simple Dollar Cost Averaging (DCA) bot. As price moves down the bot will continue placing buy orders below your last fill until the coin goes back up to hit your profit target. This means you could be trapped in a position forever if it never recovers and/or you run out of money. <img src="screenshots/main.png" width="75%"> <blockquote>Dollar-cost averaging (DCA) is an investment strategy in which an investor divides up the total amount to be invested across periodic purchases of a target asset in an effort to reduce the impact of volatility on the overall purchase. The purchases occur regardless of the asset's price and at regular intervals. In effect, this strategy removes much of the detailed work of attempting to time the market in order to make purchases of equities at the best prices. Dollar-cost averaging is also known as the constant dollar plan.</blockquote> - https://www.investopedia.com/terms/d/dollarcostaveraging.asp --- # <div id="purchasing">Purchasing</div> phBot Crypto is a separate standalone application from the original phBot. It can be purchased at [phBot.org](https://phbot.org/crypto) for $10 per month. If you have an existing phBot subscription it will be unaffected as these are separate subscriptions. --- # <div id="download">Download</div> This link will always have the latest version. By downloading this application you agree to the [terms and conditions](https://phbot.org/legal/). It is on you to understand how the bot works and accept the risks associated with it. - [phBot Crypto](https://cdn.projecthax.com/crypto/phBot-crypto.exe) - [vc_redist.x86.exe](https://aka.ms/vs/16/release/vc_redist.x86.exe) --- # <div id="os">Supported Operating Systems</div> Windows 7 and onward is supported. **Paid** - [DigitalOcean](https://m.do.co/c/7116139f5003) - [Linode](https://www.linode.com/?r=18f42bca02213da70dd79826fd2ff1af171e152a) **Free** - [AWS](https://aws.amazon.com/free/) - [Oracle (recommended)](https://www.oracle.com/cloud/free/) - [IBM](https://www.ibm.com/cloud/free) The bot does need to write some data to disk so AWS free tier is not recommended as it is too slow. ## <div id="wine">Wine</div> Ubuntu 20.04 x86-64 is recommended. If you want to run it completely headless you should learn about [screen](https://www.howtogeek.com/662422/how-to-use-linuxs-screen-command/). ``` sudo dpkg --add-architecture i386 wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' sudo apt install --install-recommends winehq-stable ``` Running ``` wine cmd phBot-crypto.exe ``` --- # <div id="wallets">Wallets</div> You only need a wallet if you wish to take profit as crypto then transfer it off exchange. - [Exodus](https://www.exodus.com/) - [Coinbase Wallet](https://wallet.coinbase.com/) - [Crypto.com](https://crypto.com/defi-wallet) --- # <div id="tax">Tax</div> - [Koinly.io](https://koinly.io/?via=6BCBDC5B) --- # <div id="exchanges">Exchanges</div> ## <div id="supported-exchange">Supported Exchanges</div> More exchanges may be added in the future depending on demand. - Binance.com / Binance.us - Coinbase Pro - Alpaca (stocks) ## <div id="setup">Setup</div> On first start it will ask you to save the configuration. You should do this then run it again and follow the on screen instructions. ## <div id="date">Date / Time Warning</div> **Your computer timezone and time must be correct otherwise you will have issues authenticating.** ## Configuration All settings are stored inside the `phBot.ini` file where the executable lives. You only need one exchange for phBot to function. Binance currently has the lowest fees and is available almost everywhere. Coinbase Pro has much higher fees until you start doing lots of volume. The `db3` files are where order and fill information is stored (per exchange). They can be deleted if needed only when `Switched` is disabled and you are not taking profit as crypto. See <a href="#switched">Switched</a> for more info. ## API Key Creation First you will need to create an API key so that the bot is able to make trades. _Do not ever_ share the API keys you create with someone else. ### <div id="binance">Binance</div> --- The bot supports Binance.com and Binance.us by changing the `URL` field in the config file. <img src="screenshots/binance_1.png" width="20%"> <img src="screenshots/binance_2.png" width="35%"> <img src="screenshots/binance_3.png" width="50%"> Your API keys will be twice as long as what you see here. 1. Copy the _API Key_ and _Secret Key_ fields and place them in the `phBot.ini` file under the `Key` and `Secret` fields for `Binance`. 1. Set `Enabled` to `true` <img src="screenshots/binance_4.png" width="25%"> ### URL This only needs to be changed if you are using it with Binance._com_ instead of Binance._us_. For Binance._com_ change this field to: `https://api.binance.com` ### <div id="coinbase">Coinbase Pro (formerly GDAX)</div> --- It is recommended that you create a second portfolio specifically for the bot. <img src="screenshots/coinbase_1.png" height="10%" width="10%"> <img src="screenshots/coinbase_2.png" width="35%"> <img src="screenshots/coinbase_3.png" width="35%"> <img src="screenshots/coinbase_4.png" width="35%"> Your API keys will be twice as long as what you see here. 1. Copy the _Passphrase_, _API Secret_, and _API Key_ into the `phBot.ini` file under `Coinbase`. 1. Set `Enabled` to `true` ### <div id="alpaca">Alpaca (stocks)</div> --- **This feature is coming soon!** Stock trading is supported through the [alpaca.markets](https://alpaca.markets) brokerage. Crypto trading through Alpaca should work once it is available to the public. - Taking profit as crypto (or stock shares in this case) is not supported. - Fractional shares are not supported so your size must be more than the cost of 1 share. - Live data is required from Alpaca for accurate size calculations which currently costs $9/mo or $99/yr. <img src="screenshots/alpaca_1.png" width="35%"> 1. Copy the _API Key ID_ and _Secret Key_ into the `phBot.ini` file under `Alpaca`. 1. Set `Enabled` to `true` If you do not have more than $25,000 in your account you should block trade entries and exits to prevent becoming a pattern day trader. <img src="screenshots/alpaca_2.png" width="35%"> --- # Pairs ## <div id="pairs-config">Configuration</div> Once you have created a pair you must then add it to the `Pairs` list for the exchange. Each pair must be separated by a comma. - `Enabled` - Enables or disables the pair. `true` or `false` - `Size` - Initial dollar amount. - `Initial` - Percentage away from the current price to place the initial buy order. If this is set to `0` it will use a market order and immediately enter - this also means it will always be in a trade assuming volume/price conditions are met. - `Target` - Profit target percentage (based on the average). - `Scale` - Percentage away from the last fill to place another buy order. - `Scale Factor` - Percentage to increase the dollar amount by for each scale in. The value it uses is the last fill dollar amount. This means each new scale in order will be more than the previous dollar amount. - `Scale Multiplier` - Percentage to increase the `Scale` by for each subsequent fill. This defaults to `0`. - `Fills` - Maximum number of scale ins. - `Profit` - Currency to take profit in. `crypto` or `base` with `base` being the default. - `Target Type` - Sets which price to use for the profit target. `avg` targets the average of all the fills and `base` will use the first entry. - `Flush` - Enable to continuously move the initial buy order based on the last trade. This can be used to catch huge down moves when there are liquidity issues. - `Switched` - Enable if you switched from crypto profit back to base. This will force it to only track the average based on the orders that it creates. - `Volume` - Minimum amount of 24 hour volume to begin the initial buy. If a position already exists it will continue scaling. `0` will always trade. - `Percent Change` - Minimum % change (up or down) to start a sequence of trades. This value must be a positive number as we do not care if it is up or down - only moving. Can be set to `0` to always trade. - `Max Price` - Max price to start buying at. If this is set to `0` it will be ignored. ### <div id="pairs-crypto-profit">Crypto Profit</div> The bot allows you to take profit as either dollars (base) or crypto. If you decide to take profit as crypto then go back to base you must first get out of the current trades and enable `Switched`. If you do not, it will either sell the entire position instantly, or if you withdrew profits, not be able to sell because the coin is no longer in your portfolio. It is not recommended to take profit as crypto with a small dollar balance. **Do not** delete the `db3` database file when taking profit as crypto or if `Switched` is on unless you know what you are doing. If you do, you must wait for your target to hit then cancel any open orders. You essentially must completely reset then let the bot start over. ### <div id="switched">Switched</div> Enabling the `Switched` option forces the bot to only track trades that it makes. Changing orders on the exchange with `Switched` enabled is not recommended. You can still edit the target and scale and restart the bot to make it update the orders. If you manually exited a position, you will need to delete the database file so that it knows to start placing buy orders. This essentially wipes the memory of any trades the bot made. It will also wipe all information about other pairs so it is important to only delete it if you want to start over on all pairs. If you only ever take profit as the base currency you should never need to use this option unless you are manually buying/selling as well. In that case you should have a separate portfolio just for the bot. ### <div id="margin">Margin</div> Margin trading is supported on Binance and Alpaca. Margin is only recommended for sophisticated investors that know what they are doing. The bot will continue buying based on your fill count. It is on you to determine how much risk you are willing to take with margin. ### <div id="pairs-example">Example</div> Any coins/stocks listed below are purely used as example and are not a recommendation to buy or sell. ``` [phBot] Agree=false Username= Password= [Coinbase] Enabled=true Key= Secret= Passphrase= Pairs=BTC-USD URL=https://api.pro.coinbase.com [Binance] Enabled=false Key= Secret= Pairs=BTCUSDT URL=https://api.binance.us Margin=false [Alpaca] Enabled=false Key= Secret= Pairs=SPY URL=https://api.alpaca.markets [BTC-USD] Enabled=true Size=20 Initial=1 Target=1.5 Scale=2 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=false Switched=false [BTCUSDT] Enabled=true Size=20 Initial=1 Target=1.5 Scale=2 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=false Switched=false [SPY] Enabled=true Size=500 Initial=1 Target=1.5 Scale=1 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=false Switched=false ``` ### <div id="pairs-usage">Use cases</div> There are several ways to use the bot. 1. Buying continuously after each sell. - This works best if you want to take profit as crypto. 1. Buying slightly lower with a small initial percent (1% or so) - A little less risk as it has already dropped a small amount. 1. Buying crashes (15% or more) and high scale percentages (10% or more). - Does not happen as frequently but will generate the most amount of profit if several orders are filled. This works best after the coin has gone parabolic. #### Continuous ``` [BTC-USD] Enabled=true Size=20 Initial=0 Target=1.5 Scale=2 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=false Switched=false ``` #### Small initial ``` [BTC-USD] Enabled=true Size=20 Initial=1 Target=1.5 Scale=2 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=false Switched=false ``` #### Crashes The `Flush` option allows the bot to replace the buy order every 5 minutes to lower it with the price of the coin. ``` [BTC-USD] Enabled=true Size=20 Initial=15 Target=1.5 Scale=10 Scale Factor=1.05 Scale Multiplier=0 Fills=20 Profit=base Volume=0 Target Type=avg Percent Change=0 Max Price=0 Flush=true Switched=false ``` --- # <div id="faq">Frequently Asked Questions</div> - Q: Can I run Coinbase and Binance at the same time? - A: Yes. - Q: Can I run multiple Coinbase profiles at the same time? - A: Yes, copy the application to another folder and use different API keys in the config file. - Q: How much money do I need to use this? - A: That is up to you, but with some quick math you will need apporximately $250 for 10 fills with a size of 20 and scale factor 1.05 &ndash; per pair. - Q: What is the minimum size I can trade with? - A: On Binance the minimum is $10 however you really should use $12 due to fees and to avoid rounding problems. - Q: Can I trade coin pairs such as BTCETH? - A: It should work but has never been tested so it is not recommended that you try it. BTCUSDT or BTCUSDC is supported. - Q: Can it trade on margin or futures? - A: Margin is supported only on Binance otherwise spot only. If you choose to enable margin, you will not be able to trade spot as well at Binance with the same configuration. - Q: Will this make me rich? - A: No. <iframe src="https://giphy.com/embed/j6uK36y32LxQs" width="480" height="192" frameBorder="0" class="giphy-embed" allowFullScreen></iframe> --- # <div id="dca">DCA Calculator</div> #### All values are hypothetical. <div class="mb-3"> <label for="cSize" class="form-label">Size (dollar amount to start with)</label> <input type="text" class="form-control" id="cSize" placeholder="15" value="15"> </div> <div class="mb-3"> <label for="cInitial" class="form-label">Initial (% from the current price to start buying)</label> <input type="text" class="form-control" id="cInitial" placeholder="0" value="0"> </div> <div class="mb-3"> <label for="cPrice" class="form-label">Price (starting price of the coin)</label> <input type="text" class="form-control" id="cPrice" placeholder="1.00" value="1.00"> </div> <div class="mb-3"> <label for="cScale" class="form-label">Scale (% lower from the previous buy to add)</label> <input type="text" class="form-control" id="cScale" placeholder="2" value="2"> </div> <div class="mb-3"> <label for="cScaleFactor" class="form-label">Scale Factor (amount to increase the coins by from the previous buy)</label> <input type="text" class="form-control" id="cScaleFactor" placeholder="1.05" value="1.05"> </div> <div class="mb-3"> <label for="cScaleMult" class="form-label">Scale Multiplier (amount to increase the scale % by for each subsequent fill)</label> <input type="text" class="form-control" id="cScaleMult" placeholder="10" value="0"> </div> <div class="mb-3"> <label for="cFills" class="form-label">Fills (total number of buys)</label> <input type="text" class="form-control" id="cFills" placeholder="20" value="20"> </div> <div class="mb-3"> <label for="cTarget" class="form-label">Target (profit target %)</label> <input type="text" class="form-control" id="cTarget" placeholder="1.5" value="1.5"> </div> <div class="col-auto"> <button type="submit" class="btn btn-primary mb-3" onclick="calculate();">Calculate</button> </div> <br> <div id="scale-table"></div> <p id="scale-summary"></p>